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