https://mooseframework.inl.gov
MFEMProblem.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #ifdef MOOSE_MFEM_ENABLED
11 
12 #include "MFEMProblem.h"
13 #include "MFEMInitialCondition.h"
14 #include "MFEMVariable.h"
15 #include "MFEMSubMesh.h"
16 #include "MFEMFunctorMaterial.h"
17 #include "libmesh/string_to_enum.h"
18 
19 #include <vector>
20 #include <algorithm>
21 
22 registerMooseObject("MooseApp", MFEMProblem);
23 
26 {
28  params.addClassDescription("Problem type for building and solving finite element problem using"
29  " the MFEM finite element library.");
30  return params;
31 }
32 
34 {
35  // Initialise Hypre for all MFEM problems.
36  mfem::Hypre::Init();
37  setMesh();
38 }
39 
40 void
42 {
45 }
46 
47 void
49 {
50  auto pmesh = mesh().getMFEMParMeshPtr();
51  getProblemData().pmesh = pmesh;
52  getProblemData().comm = pmesh->GetComm();
53  MPI_Comm_size(pmesh->GetComm(), &(getProblemData().num_procs));
54  MPI_Comm_rank(pmesh->GetComm(), &(getProblemData().myid));
55 }
56 
57 void
58 MFEMProblem::addMFEMPreconditioner(const std::string & user_object_name,
59  const std::string & name,
60  InputParameters & parameters)
61 {
62  FEProblemBase::addUserObject(user_object_name, name, parameters);
63 }
64 
65 void
66 MFEMProblem::addMFEMSolver(const std::string & user_object_name,
67  const std::string & name,
68  InputParameters & parameters)
69 {
70  FEProblemBase::addUserObject(user_object_name, name, parameters);
71  auto object_ptr = getUserObject<MFEMSolverBase>(name).getSharedPtr();
72 
74 }
75 
76 void
78 {
79  auto nl_solver = std::make_shared<mfem::NewtonSolver>(getProblemData().comm);
80 
81  // Defaults to one iteration, without further nonlinear iterations
82  nl_solver->SetRelTol(0.0);
83  nl_solver->SetAbsTol(0.0);
84  nl_solver->SetMaxIter(1);
85 
86  getProblemData().nonlinear_solver = nl_solver;
87 }
88 
89 void
90 MFEMProblem::addBoundaryCondition(const std::string & bc_name,
91  const std::string & name,
92  InputParameters & parameters)
93 {
95  const UserObject * mfem_bc_uo = &(getUserObjectBase(name));
96  if (dynamic_cast<const MFEMIntegratedBC *>(mfem_bc_uo) != nullptr)
97  {
98  auto object_ptr = getUserObject<MFEMIntegratedBC>(name).getSharedPtr();
99  auto bc = std::dynamic_pointer_cast<MFEMIntegratedBC>(object_ptr);
101  {
102  getProblemData().eqn_system->AddIntegratedBC(std::move(bc));
103  }
104  else
105  {
106  mooseError("Cannot add integrated BC with name '" + name +
107  "' because there is no corresponding equation system.");
108  }
109  }
110  else if (dynamic_cast<const MFEMEssentialBC *>(mfem_bc_uo) != nullptr)
111  {
112  auto object_ptr = getUserObject<MFEMEssentialBC>(name).getSharedPtr();
113  auto mfem_bc = std::dynamic_pointer_cast<MFEMEssentialBC>(object_ptr);
115  {
116  getProblemData().eqn_system->AddEssentialBC(std::move(mfem_bc));
117  }
118  else
119  {
120  mooseError("Cannot add boundary condition with name '" + name +
121  "' because there is no corresponding equation system.");
122  }
123  }
124  else
125  {
126  mooseError("Unsupported bc of type '", bc_name, "' and name '", name, "' detected.");
127  }
128 }
129 
130 void
131 MFEMProblem::addMaterial(const std::string &, const std::string &, InputParameters &)
132 {
133  mooseError(
134  "MFEM materials must be added through the 'FunctorMaterials' block and not 'Materials'");
135 }
136 
137 void
138 MFEMProblem::addFunctorMaterial(const std::string & material_name,
139  const std::string & name,
140  InputParameters & parameters)
141 {
143  getUserObject<MFEMFunctorMaterial>(name);
144 }
145 
146 void
147 MFEMProblem::addFESpace(const std::string & user_object_name,
148  const std::string & name,
149  InputParameters & parameters)
150 {
151  FEProblemBase::addUserObject(user_object_name, name, parameters);
152  MFEMFESpace & mfem_fespace(getUserObject<MFEMFESpace>(name));
153 
154  // Register fespace and associated fe collection.
155  getProblemData().fecs.Register(name, mfem_fespace.getFEC());
156  getProblemData().fespaces.Register(name, mfem_fespace.getFESpace());
157 }
158 
159 void
160 MFEMProblem::addVariable(const std::string & var_type,
161  const std::string & var_name,
162  InputParameters & parameters)
163 {
164  addGridFunction(var_type, var_name, parameters);
165  // MOOSE variables store DoFs for the trial variable and its time derivatives up to second order;
166  // MFEM GridFunctions store data for only one set of DoFs each, so we must add additional
167  // GridFunctions for time derivatives.
168  if (isTransient())
170 }
171 
172 void
173 MFEMProblem::addGridFunction(const std::string & var_type,
174  const std::string & var_name,
175  InputParameters & parameters)
176 {
177  if (var_type == "MFEMVariable")
178  {
179  // Add MFEM variable directly.
180  FEProblemBase::addUserObject(var_type, var_name, parameters);
181  }
182  else
183  {
184  // Add MOOSE variable.
185  FEProblemBase::addVariable(var_type, var_name, parameters);
186 
187  // Add MFEM variable indirectly ("gridfunction").
189  FEProblemBase::addUserObject("MFEMVariable", var_name, mfem_variable_params);
190  }
191 
192  // Register gridfunction.
193  MFEMVariable & mfem_variable = getUserObject<MFEMVariable>(var_name);
194  getProblemData().gridfunctions.Register(var_name, mfem_variable.getGridFunction());
195  if (mfem_variable.getFESpace().isScalar())
196  getCoefficients().declareScalar<mfem::GridFunctionCoefficient>(
197  var_name, mfem_variable.getGridFunction().get());
198  else
199  getCoefficients().declareVector<mfem::VectorGridFunctionCoefficient>(
200  var_name, mfem_variable.getGridFunction().get());
201 }
202 
203 void
204 MFEMProblem::addAuxVariable(const std::string & var_type,
205  const std::string & var_name,
206  InputParameters & parameters)
207 {
208  // We handle MFEM AuxVariables just like MFEM Variables, except
209  // we do not add additional GridFunctions for time derivatives.
210  addGridFunction(var_type, var_name, parameters);
211 }
212 
213 void
214 MFEMProblem::addAuxKernel(const std::string & kernel_name,
215  const std::string & name,
216  InputParameters & parameters)
217 {
219 }
220 
221 void
222 MFEMProblem::addKernel(const std::string & kernel_name,
223  const std::string & name,
224  InputParameters & parameters)
225 {
227  const UserObject * kernel_uo = &(getUserObjectBase(name));
228 
229  if (dynamic_cast<const MFEMKernel *>(kernel_uo) != nullptr)
230  {
231  auto object_ptr = getUserObject<MFEMKernel>(name).getSharedPtr();
232  auto kernel = std::dynamic_pointer_cast<MFEMKernel>(object_ptr);
234  {
235  getProblemData().eqn_system->AddKernel(std::move(kernel));
236  }
237  else
238  {
239  mooseError("Cannot add kernel with name '" + name +
240  "' because there is no corresponding equation system.");
241  }
242  }
243  else
244  {
245  mooseError("Unsupported kernel of type '", kernel_name, "' and name '", name, "' detected.");
246  }
247 }
248 
250 pointFromMFEMVector(const mfem::Vector & vec)
251 {
252  return libMesh::Point(
253  vec.Elem(0), vec.Size() > 1 ? vec.Elem(1) : 0., vec.Size() > 2 ? vec.Elem(2) : 0.);
254 }
255 
256 int
257 vectorFunctionDim(const std::string & type, const InputParameters & parameters)
258 {
259  if (type == "LevelSetOlssonVortex")
260  {
261  return 2;
262  }
263  else if (type == "ParsedVectorFunction")
264  {
265  if (parameters.isParamSetByUser("expression_z") || parameters.isParamSetByUser("value_z"))
266  {
267  return 3;
268  }
269  else if (parameters.isParamSetByUser("expression_y") || parameters.isParamSetByUser("value_y"))
270  {
271  return 2;
272  }
273  else
274  {
275  return 1;
276  }
277  }
278  else
279  {
280  return 3;
281  }
282 }
283 
284 const std::vector<std::string> SCALAR_FUNCS = {"Axisymmetric2D3DSolutionFunction",
285  "BicubicSplineFunction",
286  "CoarsenedPiecewiseLinear",
287  "CompositeFunction",
288  "ConstantFunction",
289  "ImageFunction",
290  "ParsedFunction",
291  "ParsedGradFunction",
292  "PeriodicFunction",
293  "PiecewiseBilinear",
294  "PiecewiseConstant",
295  "PiecewiseConstantFromCSV",
296  "PiecewiseLinear",
297  "PiecewiseLinearFromVectorPostprocessor",
298  "PiecewiseMultiInterpolation",
299  "PiecewiseMulticonstant",
300  "SolutionFunction",
301  "SplineFunction",
302  "FunctionSeries",
303  "LevelSetOlssonBubble",
304  "LevelSetOlssonPlane",
305  "NearestReporterCoordinatesFunction",
306  "ParameterMeshFunction",
307  "ParsedOptimizationFunction",
308  "FourierNoise",
309  "MovingPlanarFront",
310  "MultiControlDrumFunction",
311  "Grad2ParsedFunction",
312  "GradParsedFunction",
313  "RichardsExcavGeom",
314  "ScaledAbsDifferenceDRLRewardFunction",
315  "CircularAreaHydraulicDiameterFunction",
316  "CosineHumpFunction",
317  "CosineTransitionFunction",
318  "CubicTransitionFunction",
319  "GeneralizedCircumference",
320  "PiecewiseFunction",
321  "TimeRampFunction"},
322  VECTOR_FUNCS = {"ParsedVectorFunction", "LevelSetOlssonVortex"};
323 
324 void
325 MFEMProblem::addFunction(const std::string & type,
326  const std::string & name,
327  InputParameters & parameters)
328 {
330  auto & func = getFunction(name);
331  // FIXME: Do we want to have optimised versions for when functions
332  // are only of space or only of time.
333  if (std::find(SCALAR_FUNCS.begin(), SCALAR_FUNCS.end(), type) != SCALAR_FUNCS.end())
334  {
335  getCoefficients().declareScalar<mfem::FunctionCoefficient>(
336  name,
337  [&func](const mfem::Vector & p, double t) -> mfem::real_t
338  { return func.value(t, pointFromMFEMVector(p)); });
339  }
340  else if (std::find(VECTOR_FUNCS.begin(), VECTOR_FUNCS.end(), type) != VECTOR_FUNCS.end())
341  {
343  getCoefficients().declareVector<mfem::VectorFunctionCoefficient>(
344  name,
345  dim,
346  [&func, dim](const mfem::Vector & p, double t, mfem::Vector & u)
347  {
348  libMesh::RealVectorValue vector_value = func.vectorValue(t, pointFromMFEMVector(p));
349  for (int i = 0; i < dim; i++)
350  {
351  u[i] = vector_value(i);
352  }
353  });
354  }
355  else
356  {
357  mooseWarning("Could not identify whether function ",
358  type,
359  " is scalar or vector; no MFEM coefficient object created.");
360  }
361 }
362 
363 void
364 MFEMProblem::addPostprocessor(const std::string & type,
365  const std::string & name,
366  InputParameters & parameters)
367 {
368  // For some reason this isn't getting called
371  getCoefficients().declareScalar<mfem::FunctionCoefficient>(
372  name, [&val](const mfem::Vector &, double) -> mfem::real_t { return val; });
373 }
374 
377 {
378 
379  InputParameters fespace_params = _factory.getValidParams("MFEMGenericFESpace");
380  InputParameters mfem_variable_params = _factory.getValidParams("MFEMVariable");
381 
382  auto moose_fe_type =
383  FEType(Utility::string_to_enum<Order>(parameters.get<MooseEnum>("order")),
384  Utility::string_to_enum<FEFamily>(parameters.get<MooseEnum>("family")));
385 
386  std::string mfem_family;
387  int mfem_vdim = 1;
388 
389  switch (moose_fe_type.family)
390  {
391  case FEFamily::LAGRANGE:
392  mfem_family = "H1";
393  mfem_vdim = 1;
394  break;
395  case FEFamily::LAGRANGE_VEC:
396  mfem_family = "H1";
397  mfem_vdim = 3;
398  break;
399  case FEFamily::MONOMIAL:
400  mfem_family = "L2";
401  mfem_vdim = 1;
402  break;
403  case FEFamily::MONOMIAL_VEC:
404  mfem_family = "L2";
405  mfem_vdim = 3;
406  break;
407  default:
408  mooseError("Unable to set MFEM FESpace for MOOSE variable");
409  break;
410  }
411 
412  // Create fespace name. If this already exists, we will reuse this for
413  // the mfem variable ("gridfunction").
414  const std::string fespace_name = mfem_family + "_" +
415  std::to_string(mesh().getMFEMParMesh().Dimension()) + "D_P" +
416  std::to_string(moose_fe_type.order.get_order());
417 
418  // Set all fespace parameters.
419  fespace_params.set<std::string>("fec_name") = fespace_name;
420  fespace_params.set<int>("vdim") = mfem_vdim;
421 
422  if (!hasUserObject(fespace_name)) // Create the fespace (implicit).
423  {
424  addFESpace("MFEMGenericFESpace", fespace_name, fespace_params);
425  }
426 
427  mfem_variable_params.set<UserObjectName>("fespace") = fespace_name;
428 
429  return mfem_variable_params;
430 }
431 
432 void
434 {
435  // Displace mesh
436  if (mesh().shouldDisplace())
437  {
438  mesh().displace(static_cast<mfem::GridFunction const &>(*getMeshDisplacementGridFunction()));
439  // TODO: update FESpaces GridFunctions etc for transient solves
440  }
441 }
442 
443 std::optional<std::reference_wrapper<mfem::ParGridFunction const>>
445 {
446  // If C++23 transform were available this would be easier
447  auto const displacement_variable = mesh().getMeshDisplacementVariable();
448  if (displacement_variable)
449  {
450  return *_problem_data.gridfunctions.Get(displacement_variable.value());
451  }
452  else
453  {
454  return std::nullopt;
455  }
456 }
457 
458 std::vector<VariableName>
460 {
462 }
463 
464 MFEMMesh &
466 {
467  mooseAssert(ExternalProblem::mesh().type() == "MFEMMesh",
468  "Please choose the MFEMMesh mesh type for an MFEMProblem\n");
469  return static_cast<MFEMMesh &>(_mesh);
470 }
471 
472 const MFEMMesh &
474 {
475  return const_cast<MFEMProblem *>(this)->mesh();
476 }
477 
478 void
479 MFEMProblem::addSubMesh(const std::string & var_type,
480  const std::string & var_name,
481  InputParameters & parameters)
482 {
483  // Add MFEM SubMesh.
484  FEProblemBase::addUserObject(var_type, var_name, parameters);
485  // Register submesh.
486  MFEMSubMesh & mfem_submesh = getUserObject<MFEMSubMesh>(var_name);
487  getProblemData().submeshes.Register(var_name, mfem_submesh.getSubMesh());
488 }
489 
490 void
491 MFEMProblem::addTransfer(const std::string & transfer_name,
492  const std::string & name,
493  InputParameters & parameters)
494 {
495  if (parameters.getBase() == "MFEMSubMeshTransfer")
497  else
498  FEProblemBase::addTransfer(transfer_name, name, parameters);
499 }
500 
501 std::shared_ptr<mfem::ParGridFunction>
502 MFEMProblem::getGridFunction(const std::string & name)
503 {
504  return getUserObject<MFEMVariable>(name).getGridFunction();
505 }
506 
507 void
508 MFEMProblem::addInitialCondition(const std::string & ic_name,
509  const std::string & name,
510  InputParameters & parameters)
511 {
513  getUserObject<MFEMInitialCondition>(name); // error check
514 }
515 
516 std::string
517 MFEMProblem::solverTypeString(const unsigned int libmesh_dbg_var(solver_sys_num))
518 {
519  mooseAssert(solver_sys_num == 0, "No support for multi-system with MFEM right now");
520  return MooseUtils::prettyCppType(getProblemData().jacobian_solver.get());
521 }
522 
523 #endif
std::shared_ptr< mfem::ParMesh > pmesh
void addGridFunction(const std::string &var_type, const std::string &var_name, InputParameters &parameters)
Adds one MFEM GridFunction to be used in the MFEM solve.
Definition: MFEMProblem.C:173
void addMFEMPreconditioner(const std::string &user_object_name, const std::string &name, InputParameters &parameters)
Method called in AddMFEMPreconditionerAction which will create the solver.
Definition: MFEMProblem.C:58
virtual void addTransfer(const std::string &transfer_name, const std::string &name, InputParameters &parameters)
Add a Transfer to the problem.
Factory & _factory
The Factory for building objects.
Definition: SubProblem.h:1047
MFEMProblemData & getProblemData()
Method to get the current MFEMProblemData object storing the current data specifying the FE problem...
Definition: MFEMProblem.h:186
const std::vector< std::string > SCALAR_FUNCS
Definition: MFEMProblem.C:284
std::shared_ptr< mfem::ParGridFunction > getGridFunction(const std::string &name)
Definition: MFEMProblem.C:502
void addPostprocessor(const std::string &type, const std::string &name, InputParameters &parameters) override
Override of ExternalProblem::addPostprocessor.
Definition: MFEMProblem.C:364
std::vector< std::pair< R1, R2 > > get(const std::string &param1, const std::string &param2) const
Combine two vector parameters into a single vector of pairs.
std::optional< std::reference_wrapper< std::string const > > getMeshDisplacementVariable() const
Returns an optional reference to displacement variable name.
Definition: MFEMMesh.h:62
void addFunction(const std::string &type, const std::string &name, InputParameters &parameters) override
Override of ExternalProblem::addFunction.
Definition: MFEMProblem.C:325
InputParameters addMFEMFESpaceFromMOOSEVariable(InputParameters &moosevar_params)
Method used to get an mfem FEC depending on the variable family specified in the input file...
Definition: MFEMProblem.C:376
static InputParameters validParams()
Definition: MFEMProblem.C:25
virtual MFEMMesh & mesh() override
Overwritten mesh() method from base MooseMesh to retrieve the correct mesh type, in this case MFEMMes...
Definition: MFEMProblem.C:465
const InputParameters & parameters() const
Get the parameters of the object.
Definition: MooseBase.h:127
registerMooseObject("MooseApp", MFEMProblem)
void addVariable(const std::string &var_type, const std::string &var_name, InputParameters &parameters) override
Override of ExternalProblem::addVariable.
Definition: MFEMProblem.C:160
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
InputParameters getValidParams(const std::string &name) const
Get valid parameters for the object.
Definition: Factory.C:68
static InputParameters validParams()
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
static constexpr std::size_t dim
This is the dimension of all vector and tensor datastructures used in MOOSE.
Definition: Moose.h:159
std::string solverTypeString(unsigned int solver_sys_num) override
Return solver type as a human readable string.
Definition: MFEMProblem.C:517
std::unique_ptr< T_DEST, T_DELETER > dynamic_pointer_cast(std::unique_ptr< T_SRC, T_DELETER > &src)
These are reworked from https://stackoverflow.com/a/11003103.
std::shared_ptr< MooseObject > getSharedPtr()
Get another shared pointer to this object that has the same ownership group.
Definition: MooseObject.C:61
int vectorFunctionDim(const std::string &type, const InputParameters &parameters)
Definition: MFEMProblem.C:257
bool hasUserObject(const std::string &name) const
Check if there if a user object of given name.
void displaceMesh()
Displace the mesh, if mesh displacement is enabled.
Definition: MFEMProblem.C:433
MFEMProblemData _problem_data
Definition: MFEMProblem.h:209
const std::string & getBase() const
Moose::MFEM::FESpaces fespaces
Moose::MFEM::SubMeshes submeshes
void addSubMesh(const std::string &user_object_name, const std::string &name, InputParameters &parameters)
Add an MFEM SubMesh to the problem.
Definition: MFEMProblem.C:479
std::string GetTimeDerivativeName(std::string name)
Constructs and stores an mfem::ParGridFunction object.
Definition: MFEMVariable.h:20
void addMFEMNonlinearSolver()
Add the nonlinear solver to the system.
Definition: MFEMProblem.C:77
Moose::MFEM::FECollections fecs
virtual Function & getFunction(const std::string &name, const THREAD_ID tid=0)
virtual void addPostprocessor(const std::string &pp_name, const std::string &name, InputParameters &parameters)
std::shared_ptr< mfem::FiniteElementCollection > getFEC() const
Returns a shared pointer to the constructed fec.
Definition: MFEMFESpace.h:46
const std::string & name() const
Get the name of the class.
Definition: MooseBase.h:99
virtual bool isScalar() const =0
mfem::Coefficient & declareScalar(const std::string &name, const std::string &existing_or_literal)
Declare an alias to an existing scalar coefficient or, if it does not exist, try interpreting the nam...
T * Get(const std::string &field_name) const
Returns a non-owning pointer to the field. This is guaranteed to return a non-null pointer...
Base class for construction of a mfem::ParSubMesh object.
Definition: MFEMSubMesh.h:22
mfem::VectorCoefficient & declareVector(const std::string &name, const std::string &existing_or_literal)
Declare an alias to an existing vector coefficientor or, if it does not exist, try interpreting the n...
virtual void addFunction(const std::string &type, const std::string &name, InputParameters &parameters)
Real PostprocessorValue
various MOOSE typedefs
Definition: MooseTypes.h:202
Moose::MFEM::CoefficientManager & getCoefficients()
Method to get the PropertyManager object for storing material properties and converting them to MFEM ...
Definition: MFEMProblem.h:180
MooseMesh & _mesh
void addMaterial(const std::string &material_name, const std::string &name, InputParameters &parameters) override
Definition: MFEMProblem.C:131
virtual void initialSetup() override
Definition: MFEMProblem.C:41
const std::string & type() const
Get the type of this class.
Definition: MooseBase.h:89
void initialSetup() override
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition: MooseEnum.h:33
void setMesh()
Set the mesh used by MFEM.
Definition: MFEMProblem.C:48
virtual const SystemBase & systemBaseAuxiliary() const override
Return the auxiliary system object as a base class reference.
void addMFEMSolver(const std::string &user_object_name, const std::string &name, InputParameters &parameters)
Method called in AddMFEMSolverAction which will create the solver.
Definition: MFEMProblem.C:66
void addAuxKernel(const std::string &kernel_name, const std::string &name, InputParameters &parameters) override
Override of ExternalProblem::addAuxKernel.
Definition: MFEMProblem.C:214
const MFEMFESpace & getFESpace() const
Returns a reference to the fespace used by the gridfunction.
Definition: MFEMVariable.h:31
std::shared_ptr< mfem::ParSubMesh > getSubMesh()
Returns a shared pointer to the constructed fespace.
Definition: MFEMSubMesh.h:30
std::shared_ptr< mfem::ParMesh > getMFEMParMeshPtr()
Copy a shared_ptr to the mfem::ParMesh object.
Definition: MFEMMesh.h:42
std::shared_ptr< mfem::ParGridFunction > getGridFunction() const
Returns a shared pointer to the constructed gridfunction.
Definition: MFEMVariable.h:28
const PostprocessorValue & getPostprocessorValueByName(const PostprocessorName &name, std::size_t t_index=0) const
Get a read-only reference to the value associated with a Postprocessor that exists.
std::shared_ptr< Moose::MFEM::EquationSystem > eqn_system
Constructs and stores an mfem::ParFiniteElementSpace object.
Definition: MFEMFESpace.h:22
virtual void addVariable(const std::string &var_type, const std::string &var_name, InputParameters &params)
Canonical method for adding a non-linear variable.
std::shared_ptr< mfem::NewtonSolver > nonlinear_solver
bool isParamSetByUser(const std::string &name) const
Method returns true if the parameter was set by the user.
void addFESpace(const std::string &user_object_name, const std::string &name, InputParameters &parameters)
Add an MFEM FESpace to the problem.
Definition: MFEMProblem.C:147
void Register(const std::string &field_name, FieldArgs &&... args)
Construct new field with name field_name and register.
MFEMProblem(const InputParameters &params)
Definition: MFEMProblem.C:33
void displace(mfem::GridFunction const &displacement)
Displace the nodes of the mesh by the given displacement.
Definition: MFEMMesh.C:76
void addFunctorMaterial(const std::string &material_name, const std::string &name, InputParameters &parameters) override
Definition: MFEMProblem.C:138
libMesh::Point pointFromMFEMVector(const mfem::Vector &vec)
Definition: MFEMProblem.C:250
MFEMMesh inherits a MOOSE mesh class which allows us to work with other MOOSE objects.
Definition: MFEMMesh.h:22
virtual std::vector< VariableName > getAuxVariableNames()
Returns all the variable names from the auxiliary system base.
Definition: MFEMProblem.C:459
virtual std::vector< std::shared_ptr< UserObject > > addUserObject(const std::string &user_object_name, const std::string &name, InputParameters &parameters)
void addBoundaryCondition(const std::string &bc_name, const std::string &name, InputParameters &parameters) override
Definition: MFEMProblem.C:90
const std::vector< std::string > VECTOR_FUNCS
Definition: MFEMProblem.C:322
Base class for wrapping mfem::Solver-derived classes.
void mooseWarning(Args &&... args) const
Emits a warning prefixed with object name and type.
Definition: MooseBase.h:295
virtual MooseMesh & mesh() override
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type and optionally a file path to the top-level block p...
Definition: MooseBase.h:267
const std::vector< VariableName > & getVariableNames() const
Definition: SystemBase.h:860
void addClassDescription(const std::string &doc_string)
This method adds a description of the class that will be displayed in the input file syntax dump...
std::shared_ptr< mfem::ParFiniteElementSpace > getFESpace() const
Returns a shared pointer to the constructed fespace.
Definition: MFEMFESpace.h:38
void addKernel(const std::string &kernel_name, const std::string &name, InputParameters &parameters) override
Override of ExternalProblem::addKernel.
Definition: MFEMProblem.C:222
const UserObject & getUserObjectBase(const std::string &name, const THREAD_ID tid=0) const
Get the user object by its name.
virtual bool isTransient() const override
Class to construct an MFEM integrator to apply to the equation system.
Definition: MFEMKernel.h:21
std::optional< std::reference_wrapper< mfem::ParGridFunction const > > getMeshDisplacementGridFunction()
Returns optional reference to the displacement GridFunction to apply to nodes.
Definition: MFEMProblem.C:444
Moose::MFEM::GridFunctions gridfunctions
void addAuxVariable(const std::string &var_type, const std::string &var_name, InputParameters &parameters) override
Override of ExternalProblem::addAuxVariable.
Definition: MFEMProblem.C:204
Base class for user-specific data.
Definition: UserObject.h:40
std::shared_ptr< MFEMSolverBase > jacobian_solver
std::string prettyCppType(const std::string &cpp_type)
Definition: MooseUtils.C:1246
void addTransfer(const std::string &transfer_name, const std::string &name, InputParameters &parameters) override
Add transfers between MultiApps and/or MFEM SubMeshes.
Definition: MFEMProblem.C:491
void addInitialCondition(const std::string &ic_name, const std::string &name, InputParameters &parameters) override
Definition: MFEMProblem.C:508