https://mooseframework.inl.gov
MFEMProblem.h
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 #pragma once
13 #include "ExternalProblem.h"
14 #include "MFEMProblemData.h"
15 #include "MFEMMesh.h"
16 
18 {
19 public:
21 
22  MFEMProblem(const InputParameters & params);
23  virtual ~MFEMProblem() {}
24 
25  virtual void initialSetup() override;
26  virtual void externalSolve() override {}
27  virtual void syncSolutions(Direction) override {}
28 
33  virtual MFEMMesh & mesh() override;
34  virtual const MFEMMesh & mesh() const override;
36 
41  virtual std::vector<VariableName> getAuxVariableNames();
42 
43  void addBoundaryCondition(const std::string & bc_name,
44  const std::string & name,
45  InputParameters & parameters) override;
46 
47  void addMaterial(const std::string & material_name,
48  const std::string & name,
49  InputParameters & parameters) override;
50 
51  void addFunctorMaterial(const std::string & material_name,
52  const std::string & name,
53  InputParameters & parameters) override;
54 
58  void addFESpace(const std::string & user_object_name,
59  const std::string & name,
64  void setDevice();
65 
69  void setMesh();
70 
74  void addSubMesh(const std::string & user_object_name,
75  const std::string & name,
77 
81  void addTransfer(const std::string & transfer_name,
82  const std::string & name,
83  InputParameters & parameters) override;
88  void addVariable(const std::string & var_type,
89  const std::string & var_name,
90  InputParameters & parameters) override;
91 
95  void addGridFunction(const std::string & var_type,
96  const std::string & var_name,
98 
104  void addAuxVariable(const std::string & var_type,
105  const std::string & var_name,
106  InputParameters & parameters) override;
107 
113  void addKernel(const std::string & kernel_name,
114  const std::string & name,
115  InputParameters & parameters) override;
116 
122  void addAuxKernel(const std::string & kernel_name,
123  const std::string & name,
124  InputParameters & parameters) override;
125 
131  void addFunction(const std::string & type,
132  const std::string & name,
133  InputParameters & parameters) override;
134 
135  void addInitialCondition(const std::string & ic_name,
136  const std::string & name,
137  InputParameters & parameters) override;
138 
144  void addPostprocessor(const std::string & type,
145  const std::string & name,
146  InputParameters & parameters) override;
147 
151  void addMFEMPreconditioner(const std::string & user_object_name,
152  const std::string & name,
154 
158  void addMFEMSolver(const std::string & user_object_name,
159  const std::string & name,
161 
166  void addMFEMNonlinearSolver();
167 
174 
181 
187 
191  void displaceMesh();
192 
196  std::optional<std::reference_wrapper<mfem::ParGridFunction const>>
198 
199  Moose::FEBackend feBackend() const override { return Moose::FEBackend::MFEM; }
200 
201  std::string solverTypeString(unsigned int solver_sys_num) override;
202 
206  std::shared_ptr<mfem::ParGridFunction> getGridFunction(const std::string & name);
207 
208 protected:
210 };
211 
212 #endif
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 syncSolutions(Direction) override
Method to transfer data to/from the external application to the associated transfer mesh...
Definition: MFEMProblem.h:27
Base problem data struct.
MFEMProblemData & getProblemData()
Method to get the current MFEMProblemData object storing the current data specifying the FE problem...
Definition: MFEMProblem.h:186
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
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
void addVariable(const std::string &var_type, const std::string &var_name, InputParameters &parameters) override
Override of ExternalProblem::addVariable.
Definition: MFEMProblem.C:160
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
std::string solverTypeString(unsigned int solver_sys_num) override
Return solver type as a human readable string.
Definition: MFEMProblem.C:517
Front-end class for creating and storing MFEM coefficients.
void displaceMesh()
Displace the mesh, if mesh displacement is enabled.
Definition: MFEMProblem.C:433
virtual void addAuxVariable(const std::string &var_type, const std::string &var_name, InputParameters &params)
Canonical method for adding an auxiliary variable.
MFEMProblemData _problem_data
Definition: MFEMProblem.h:209
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
void addMFEMNonlinearSolver()
Add the nonlinear solver to the system.
Definition: MFEMProblem.C:77
Moose::MFEM::CoefficientManager coefficients
const std::string & name() const
Get the name of the class.
Definition: MooseBase.h:99
Moose::MFEM::CoefficientManager & getCoefficients()
Method to get the PropertyManager object for storing material properties and converting them to MFEM ...
Definition: MFEMProblem.h:180
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 setMesh()
Set the mesh used by MFEM.
Definition: MFEMProblem.C:48
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
Moose::FEBackend feBackend() const override
Definition: MFEMProblem.h:199
void addAuxKernel(const std::string &kernel_name, const std::string &name, InputParameters &parameters) override
Override of ExternalProblem::addAuxKernel.
Definition: MFEMProblem.C:214
virtual ~MFEMProblem()
Definition: MFEMProblem.h:23
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
MFEMProblem(const InputParameters &params)
Definition: MFEMProblem.C:33
void addFunctorMaterial(const std::string &material_name, const std::string &name, InputParameters &parameters) override
Definition: MFEMProblem.C:138
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
void setDevice()
Set the device to use to solve the FE problem.
void addBoundaryCondition(const std::string &bc_name, const std::string &name, InputParameters &parameters) override
Definition: MFEMProblem.C:90
virtual MooseMesh & mesh() override
virtual void externalSolve() override
New interface for solving an External problem.
Definition: MFEMProblem.h:26
void addKernel(const std::string &kernel_name, const std::string &name, InputParameters &parameters) override
Override of ExternalProblem::addKernel.
Definition: MFEMProblem.C:222
std::optional< std::reference_wrapper< mfem::ParGridFunction const > > getMeshDisplacementGridFunction()
Returns optional reference to the displacement GridFunction to apply to nodes.
Definition: MFEMProblem.C:444
void addAuxVariable(const std::string &var_type, const std::string &var_name, InputParameters &parameters) override
Override of ExternalProblem::addAuxVariable.
Definition: MFEMProblem.C:204
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