Loading [MathJax]/extensions/tex2jax.js
https://mooseframework.inl.gov
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
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 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 }
38 
39 void
41 {
44 }
45 
46 void
48 {
49  auto pmesh = mesh().getMFEMParMeshPtr();
50  getProblemData().pmesh = pmesh;
51  getProblemData().comm = pmesh->GetComm();
52  MPI_Comm_size(pmesh->GetComm(), &(getProblemData().num_procs));
53  MPI_Comm_rank(pmesh->GetComm(), &(getProblemData().myid));
54 }
55 
56 void
58 {
59  setMesh();
60  auto mfem_exec_ptr = dynamic_cast<MFEMExecutioner *>(_app.getExecutioner());
61  if (mfem_exec_ptr != nullptr)
62  {
63  mfem_exec_ptr->constructProblemOperator();
64  }
65  else
66  {
67  mooseError("Executioner used that is not currently supported by MFEMProblem");
68  }
69 }
70 
71 void
72 MFEMProblem::addMFEMPreconditioner(const std::string & user_object_name,
73  const std::string & name,
74  InputParameters & parameters)
75 {
76  FEProblemBase::addUserObject(user_object_name, name, parameters);
77 }
78 
79 void
80 MFEMProblem::addMFEMSolver(const std::string & user_object_name,
81  const std::string & name,
82  InputParameters & parameters)
83 {
84  FEProblemBase::addUserObject(user_object_name, name, parameters);
85  auto object_ptr = getUserObject<MFEMSolverBase>(name).getSharedPtr();
86 
88 }
89 
90 void
92 {
93  auto nl_solver = std::make_shared<mfem::NewtonSolver>(getProblemData().comm);
94 
95  // Defaults to one iteration, without further nonlinear iterations
96  nl_solver->SetRelTol(0.0);
97  nl_solver->SetAbsTol(0.0);
98  nl_solver->SetMaxIter(1);
99 
100  getProblemData().nonlinear_solver = nl_solver;
101 }
102 
103 void
104 MFEMProblem::addBoundaryCondition(const std::string & bc_name,
105  const std::string & name,
106  InputParameters & parameters)
107 {
109  const UserObject * mfem_bc_uo = &(getUserObjectBase(name));
110  if (dynamic_cast<const MFEMIntegratedBC *>(mfem_bc_uo) != nullptr)
111  {
112  auto object_ptr = getUserObject<MFEMIntegratedBC>(name).getSharedPtr();
113  auto bc = std::dynamic_pointer_cast<MFEMIntegratedBC>(object_ptr);
115  {
116  getProblemData().eqn_system->AddIntegratedBC(std::move(bc));
117  }
118  else
119  {
120  mooseError("Cannot add integrated BC with name '" + name +
121  "' because there is no corresponding equation system.");
122  }
123  }
124  else if (dynamic_cast<const MFEMEssentialBC *>(mfem_bc_uo) != nullptr)
125  {
126  auto object_ptr = getUserObject<MFEMEssentialBC>(name).getSharedPtr();
127  auto mfem_bc = std::dynamic_pointer_cast<MFEMEssentialBC>(object_ptr);
129  {
130  getProblemData().eqn_system->AddEssentialBC(std::move(mfem_bc));
131  }
132  else
133  {
134  mooseError("Cannot add boundary condition with name '" + name +
135  "' because there is no corresponding equation system.");
136  }
137  }
138  else
139  {
140  mooseError("Unsupported bc of type '", bc_name, "' and name '", name, "' detected.");
141  }
142 }
143 
144 void
145 MFEMProblem::addMaterial(const std::string &, const std::string &, InputParameters &)
146 {
147  mooseError(
148  "MFEM materials must be added through the 'FunctorMaterials' block and not 'Materials'");
149 }
150 
151 void
152 MFEMProblem::addFunctorMaterial(const std::string & material_name,
153  const std::string & name,
154  InputParameters & parameters)
155 {
157  getUserObject<MFEMFunctorMaterial>(name);
158 }
159 
160 void
161 MFEMProblem::addFESpace(const std::string & user_object_name,
162  const std::string & name,
163  InputParameters & parameters)
164 {
165  FEProblemBase::addUserObject(user_object_name, name, parameters);
166  MFEMFESpace & mfem_fespace(getUserObject<MFEMFESpace>(name));
167 
168  // Register fespace and associated fe collection.
169  getProblemData().fecs.Register(name, mfem_fespace.getFEC());
170  getProblemData().fespaces.Register(name, mfem_fespace.getFESpace());
171 }
172 
173 void
174 MFEMProblem::addVariable(const std::string & var_type,
175  const std::string & var_name,
176  InputParameters & parameters)
177 {
178  addGridFunction(var_type, var_name, parameters);
179  // MOOSE variables store DoFs for the trial variable and its time derivatives up to second order;
180  // MFEM GridFunctions store data for only one set of DoFs each, so we must add additional
181  // GridFunctions for time derivatives.
182  if (isTransient())
183  {
185  }
186 }
187 
188 void
189 MFEMProblem::addGridFunction(const std::string & var_type,
190  const std::string & var_name,
191  InputParameters & parameters)
192 {
193  if (var_type == "MFEMVariable")
194  {
195  // Add MFEM variable directly.
196  FEProblemBase::addUserObject(var_type, var_name, parameters);
197  }
198  else
199  {
200  // Add MOOSE variable.
201  FEProblemBase::addVariable(var_type, var_name, parameters);
202 
203  // Add MFEM variable indirectly ("gridfunction").
205  FEProblemBase::addUserObject("MFEMVariable", var_name, mfem_variable_params);
206  }
207 
208  // Register gridfunction.
209  MFEMVariable & mfem_variable = getUserObject<MFEMVariable>(var_name);
210  getProblemData().gridfunctions.Register(var_name, mfem_variable.getGridFunction());
211  if (mfem_variable.getFESpace().isScalar())
212  getCoefficients().declareScalar<mfem::GridFunctionCoefficient>(
213  var_name, mfem_variable.getGridFunction().get());
214  else
215  getCoefficients().declareVector<mfem::VectorGridFunctionCoefficient>(
216  var_name, mfem_variable.getGridFunction().get());
217 }
218 
219 void
220 MFEMProblem::addAuxVariable(const std::string & var_type,
221  const std::string & var_name,
222  InputParameters & parameters)
223 {
224  // We do not handle MFEM AuxVariables separately from variables currently
225  addVariable(var_type, var_name, parameters);
226 }
227 
228 void
229 MFEMProblem::addAuxKernel(const std::string & kernel_name,
230  const std::string & name,
231  InputParameters & parameters)
232 {
234 }
235 
236 void
237 MFEMProblem::addKernel(const std::string & kernel_name,
238  const std::string & name,
239  InputParameters & parameters)
240 {
242  const UserObject * kernel_uo = &(getUserObjectBase(name));
243 
244  if (dynamic_cast<const MFEMKernel *>(kernel_uo) != nullptr)
245  {
246  auto object_ptr = getUserObject<MFEMKernel>(name).getSharedPtr();
247  auto kernel = std::dynamic_pointer_cast<MFEMKernel>(object_ptr);
249  {
250  getProblemData().eqn_system->AddKernel(std::move(kernel));
251  }
252  else
253  {
254  mooseError("Cannot add kernel with name '" + name +
255  "' because there is no corresponding equation system.");
256  }
257  }
258  else
259  {
260  mooseError("Unsupported kernel of type '", kernel_name, "' and name '", name, "' detected.");
261  }
262 }
263 
265 pointFromMFEMVector(const mfem::Vector & vec)
266 {
267  return libMesh::Point(
268  vec.Elem(0), vec.Size() > 1 ? vec.Elem(1) : 0., vec.Size() > 2 ? vec.Elem(2) : 0.);
269 }
270 
271 int
272 vectorFunctionDim(const std::string & type, const InputParameters & parameters)
273 {
274  if (type == "LevelSetOlssonVortex")
275  {
276  return 2;
277  }
278  else if (type == "ParsedVectorFunction")
279  {
280  if (parameters.isParamSetByUser("expression_z") || parameters.isParamSetByUser("value_z"))
281  {
282  return 3;
283  }
284  else if (parameters.isParamSetByUser("expression_y") || parameters.isParamSetByUser("value_y"))
285  {
286  return 2;
287  }
288  else
289  {
290  return 1;
291  }
292  }
293  else
294  {
295  return 3;
296  }
297 }
298 
299 const std::vector<std::string> SCALAR_FUNCS = {"Axisymmetric2D3DSolutionFunction",
300  "BicubicSplineFunction",
301  "CoarsenedPiecewiseLinear",
302  "CompositeFunction",
303  "ConstantFunction",
304  "ImageFunction",
305  "ParsedFunction",
306  "ParsedGradFunction",
307  "PeriodicFunction",
308  "PiecewiseBilinear",
309  "PiecewiseConstant",
310  "PiecewiseConstantFromCSV",
311  "PiecewiseLinear",
312  "PiecewiseLinearFromVectorPostprocessor",
313  "PiecewiseMultiInterpolation",
314  "PiecewiseMulticonstant",
315  "SolutionFunction",
316  "SplineFunction",
317  "FunctionSeries",
318  "LevelSetOlssonBubble",
319  "LevelSetOlssonPlane",
320  "NearestReporterCoordinatesFunction",
321  "ParameterMeshFunction",
322  "ParsedOptimizationFunction",
323  "FourierNoise",
324  "MovingPlanarFront",
325  "MultiControlDrumFunction",
326  "Grad2ParsedFunction",
327  "GradParsedFunction",
328  "RichardsExcavGeom",
329  "ScaledAbsDifferenceDRLRewardFunction",
330  "CircularAreaHydraulicDiameterFunction",
331  "CosineHumpFunction",
332  "CosineTransitionFunction",
333  "CubicTransitionFunction",
334  "GeneralizedCircumference",
335  "PiecewiseFunction",
336  "TimeRampFunction"},
337  VECTOR_FUNCS = {"ParsedVectorFunction", "LevelSetOlssonVortex"};
338 
339 void
340 MFEMProblem::addFunction(const std::string & type,
341  const std::string & name,
342  InputParameters & parameters)
343 {
345  auto & func = getFunction(name);
346  // FIXME: Do we want to have optimised versions for when functions
347  // are only of space or only of time.
348  if (std::find(SCALAR_FUNCS.begin(), SCALAR_FUNCS.end(), type) != SCALAR_FUNCS.end())
349  {
350  getCoefficients().declareScalar<mfem::FunctionCoefficient>(
351  name,
352  [&func](const mfem::Vector & p, double t) -> mfem::real_t
353  { return func.value(t, pointFromMFEMVector(p)); });
354  }
355  else if (std::find(VECTOR_FUNCS.begin(), VECTOR_FUNCS.end(), type) != VECTOR_FUNCS.end())
356  {
358  getCoefficients().declareVector<mfem::VectorFunctionCoefficient>(
359  name,
360  dim,
361  [&func, dim](const mfem::Vector & p, double t, mfem::Vector & u)
362  {
363  libMesh::RealVectorValue vector_value = func.vectorValue(t, pointFromMFEMVector(p));
364  for (int i = 0; i < dim; i++)
365  {
366  u[i] = vector_value(i);
367  }
368  });
369  }
370  else
371  {
372  mooseWarning("Could not identify whether function ",
373  type,
374  " is scalar or vector; no MFEM coefficient object created.");
375  }
376 }
377 
378 void
379 MFEMProblem::addPostprocessor(const std::string & type,
380  const std::string & name,
381  InputParameters & parameters)
382 {
383  // For some reason this isn't getting called
386  getCoefficients().declareScalar<mfem::FunctionCoefficient>(
387  name, [&val](const mfem::Vector &, double) -> mfem::real_t { return val; });
388 }
389 
392 {
393 
394  InputParameters fespace_params = _factory.getValidParams("MFEMGenericFESpace");
395  InputParameters mfem_variable_params = _factory.getValidParams("MFEMVariable");
396 
397  auto moose_fe_type =
398  FEType(Utility::string_to_enum<Order>(parameters.get<MooseEnum>("order")),
399  Utility::string_to_enum<FEFamily>(parameters.get<MooseEnum>("family")));
400 
401  std::string mfem_family;
402  int mfem_vdim = 1;
403 
404  switch (moose_fe_type.family)
405  {
406  case FEFamily::LAGRANGE:
407  mfem_family = "H1";
408  mfem_vdim = 1;
409  break;
410  case FEFamily::LAGRANGE_VEC:
411  mfem_family = "H1";
412  mfem_vdim = 3;
413  break;
414  case FEFamily::MONOMIAL:
415  mfem_family = "L2";
416  mfem_vdim = 1;
417  break;
418  case FEFamily::MONOMIAL_VEC:
419  mfem_family = "L2";
420  mfem_vdim = 3;
421  break;
422  default:
423  mooseError("Unable to set MFEM FESpace for MOOSE variable");
424  break;
425  }
426 
427  // Create fespace name. If this already exists, we will reuse this for
428  // the mfem variable ("gridfunction").
429  const std::string fespace_name = mfem_family + "_" +
430  std::to_string(mesh().getMFEMParMesh().Dimension()) + "D_P" +
431  std::to_string(moose_fe_type.order.get_order());
432 
433  // Set all fespace parameters.
434  fespace_params.set<std::string>("fec_name") = fespace_name;
435  fespace_params.set<int>("vdim") = mfem_vdim;
436 
437  if (!hasUserObject(fespace_name)) // Create the fespace (implicit).
438  {
439  addFESpace("MFEMGenericFESpace", fespace_name, fespace_params);
440  }
441 
442  mfem_variable_params.set<UserObjectName>("fespace") = fespace_name;
443 
444  return mfem_variable_params;
445 }
446 
447 void
449 {
450  // Displace mesh
451  if (mesh().shouldDisplace())
452  {
453  mesh().displace(static_cast<mfem::GridFunction const &>(*getMeshDisplacementGridFunction()));
454  // TODO: update FESpaces GridFunctions etc for transient solves
455  }
456 }
457 
458 std::optional<std::reference_wrapper<mfem::ParGridFunction const>>
460 {
461  // If C++23 transform were available this would be easier
462  auto const displacement_variable = mesh().getMeshDisplacementVariable();
463  if (displacement_variable)
464  {
465  return *_problem_data.gridfunctions.Get(displacement_variable.value());
466  }
467  else
468  {
469  return std::nullopt;
470  }
471 }
472 
473 std::vector<VariableName>
475 {
477 }
478 
479 MFEMMesh &
481 {
482  mooseAssert(ExternalProblem::mesh().type() == "MFEMMesh",
483  "Please choose the MFEMMesh mesh type for an MFEMProblem\n");
484  return static_cast<MFEMMesh &>(_mesh);
485 }
486 
487 const MFEMMesh &
489 {
490  return const_cast<MFEMProblem *>(this)->mesh();
491 }
492 
493 void
494 MFEMProblem::addSubMesh(const std::string & var_type,
495  const std::string & var_name,
496  InputParameters & parameters)
497 {
498  // Add MFEM SubMesh.
499  FEProblemBase::addUserObject(var_type, var_name, parameters);
500  // Register submesh.
501  MFEMSubMesh & mfem_submesh = getUserObject<MFEMSubMesh>(var_name);
502  getProblemData().submeshes.Register(var_name, mfem_submesh.getSubMesh());
503 }
504 
505 void
506 MFEMProblem::addTransfer(const std::string & transfer_name,
507  const std::string & name,
508  InputParameters & parameters)
509 {
510  if (parameters.get<std::string>("_moose_base") == "MFEMSubMeshTransfer")
512  else
513  FEProblemBase::addTransfer(transfer_name, name, parameters);
514 }
515 
516 std::shared_ptr<mfem::ParGridFunction>
517 MFEMProblem::getGridFunction(const std::string & name)
518 {
519  return getUserObject<MFEMVariable>(name).getGridFunction();
520 }
521 
522 void
523 MFEMProblem::addInitialCondition(const std::string & ic_name,
524  const std::string & name,
525  InputParameters & parameters)
526 {
528  getUserObject<MFEMInitialCondition>(name); // error check
529 }
530 
531 std::string
532 MFEMProblem::solverTypeString(const unsigned int libmesh_dbg_var(solver_sys_num))
533 {
534  mooseAssert(solver_sys_num == 0, "No support for multi-system with MFEM right now");
535  return MooseUtils::prettyCppType(getProblemData().jacobian_solver.get());
536 }
537 
538 #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:189
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:72
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
virtual void constructProblemOperator()=0
Virtual method to construct the ProblemOperator. Call for default problems.
MFEMProblemData & getProblemData()
Method to get the current MFEMProblemData object storing the current data specifying the FE problem...
Definition: MFEMProblem.h:190
const std::vector< std::string > SCALAR_FUNCS
Definition: MFEMProblem.C:299
std::shared_ptr< mfem::ParGridFunction > getGridFunction(const std::string &name)
Definition: MFEMProblem.C:517
void addPostprocessor(const std::string &type, const std::string &name, InputParameters &parameters) override
Override of ExternalProblem::addPostprocessor.
Definition: MFEMProblem.C:379
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:73
void addFunction(const std::string &type, const std::string &name, InputParameters &parameters) override
Override of ExternalProblem::addFunction.
Definition: MFEMProblem.C:340
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:391
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:480
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:174
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:153
std::string solverTypeString(unsigned int solver_sys_num) override
Return solver type as a human readable string.
Definition: MFEMProblem.C:532
void initProblemOperator()
Initialise the required ProblemOperator used in the Executioner to solve the problem.
Definition: MFEMProblem.C:57
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:68
int vectorFunctionDim(const std::string &type, const InputParameters &parameters)
Definition: MFEMProblem.C:272
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:448
MFEMProblemData _problem_data
Definition: MFEMProblem.h:213
virtual const std::string & name() const
Get the name of the class.
Definition: MooseBase.h:57
Moose::MFEM::FESpaces fespaces
Moose::MFEM::SubMeshes submeshes
void addSubMesh(const std::string &user_object_name, const std::string &name, InputParameters &parameters)
Definition: MFEMProblem.C:494
void mooseWarning(Args &&... args) const
Emits a warning prefixed with object name and type.
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:91
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
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:184
MooseMesh & _mesh
void addMaterial(const std::string &material_name, const std::string &name, InputParameters &parameters) override
Definition: MFEMProblem.C:145
virtual void initialSetup() override
Definition: MFEMProblem.C:40
const std::string & type() const
Get the type of this class.
Definition: MooseBase.h:51
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:47
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:80
void addAuxKernel(const std::string &kernel_name, const std::string &name, InputParameters &parameters) override
Override of ExternalProblem::addAuxKernel.
Definition: MFEMProblem.C:229
MooseApp & _app
The MOOSE application this is associated with.
Definition: MooseBase.h:84
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:53
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
Executioner * getExecutioner() const
Retrieve the Executioner for this App.
Definition: MooseApp.C:2085
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:161
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:85
void addFunctorMaterial(const std::string &material_name, const std::string &name, InputParameters &parameters) override
Definition: MFEMProblem.C:152
libMesh::Point pointFromMFEMVector(const mfem::Vector &vec)
Definition: MFEMProblem.C:265
MFEMMesh.
Definition: MFEMMesh.h:33
virtual std::vector< VariableName > getAuxVariableNames()
Returns all the variable names from the auxiliary system base.
Definition: MFEMProblem.C:474
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:104
const std::vector< std::string > VECTOR_FUNCS
Definition: MFEMProblem.C:337
Base class for wrapping mfem::Solver-derived classes.
virtual MooseMesh & mesh() override
const std::vector< VariableName > & getVariableNames() const
Definition: SystemBase.h:861
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type.
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...
const InputParameters & parameters() const
Get the parameters of the object.
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:237
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
std::optional< std::reference_wrapper< mfem::ParGridFunction const > > getMeshDisplacementGridFunction()
Returns optional reference to the displacement GridFunction to apply to nodes.
Definition: MFEMProblem.C:459
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:220
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:506
void addInitialCondition(const std::string &ic_name, const std::string &name, InputParameters &parameters) override
Definition: MFEMProblem.C:523