https://mooseframework.inl.gov
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Private Attributes | List of all members
Moose::MFEM::TimeDomainEquationSystemProblemOperator Class Reference

Problem operator for time-dependent problems with an equation system. More...

#include <TimeDomainEquationSystemProblemOperator.h>

Inheritance diagram for Moose::MFEM::TimeDomainEquationSystemProblemOperator:
[legend]

Public Member Functions

 TimeDomainEquationSystemProblemOperator (MFEMProblem &problem)
 
void SetGridFunctions () override
 
void Init (mfem::BlockVector &X) override
 
void ImplicitSolve (const double dt, const mfem::Vector &X, mfem::Vector &dX_dt) override
 
void Solve () override
 
Moose::MFEM::TimeDependentEquationSystemGetEquationSystem () const override
 Returns a pointer to the operator's equation system. More...
 
virtual void SetTestVariablesFromTrueVectors ()
 
virtual void SetTrialVariablesFromTrueVectors ()
 

Public Attributes

mfem::Array< int_block_true_offsets
 
mfem::BlockVector _true_x
 
mfem::BlockVector _true_rhs
 
mfem::OperatorHandle _equation_system_operator
 

Protected Member Functions

void BuildEquationSystemOperator (double dt)
 

Protected Attributes

MFEMProblem_problem
 Reference to the current problem. More...
 
MFEMProblemData_problem_data
 
std::vector< std::string > _test_var_names
 Vector of names of state gridfunctions used in formulation, ordered by appearance in block vector during solve. More...
 
std::vector< mfem::ParGridFunction * > _test_variables
 
const mfem::Vector * _test_true_vector = nullptr
 
std::vector< std::string > _trial_var_names
 Vector of names of state gridfunctions used in formulation, ordered by appearance in block vector during solve. More...
 
std::vector< mfem::ParGridFunction * > _trial_variables
 

Private Attributes

std::shared_ptr< Moose::MFEM::TimeDependentEquationSystem_equation_system {nullptr}
 

Detailed Description

Problem operator for time-dependent problems with an equation system.

Definition at line 20 of file TimeDomainEquationSystemProblemOperator.h.

Constructor & Destructor Documentation

◆ TimeDomainEquationSystemProblemOperator()

Moose::MFEM::TimeDomainEquationSystemProblemOperator::TimeDomainEquationSystemProblemOperator ( MFEMProblem problem)
inline

Definition at line 24 of file TimeDomainEquationSystemProblemOperator.h.

25  : TimeDomainProblemOperator(problem),
27  std::dynamic_pointer_cast<TimeDependentEquationSystem>(_problem_data.eqn_system))
28  {
29  }
std::shared_ptr< Moose::MFEM::TimeDependentEquationSystem > _equation_system
std::shared_ptr< Moose::MFEM::EquationSystem > eqn_system

Member Function Documentation

◆ BuildEquationSystemOperator()

void Moose::MFEM::TimeDomainEquationSystemProblemOperator::BuildEquationSystemOperator ( double  dt)
protected

Definition at line 77 of file TimeDomainEquationSystemProblemOperator.C.

Referenced by ImplicitSolve().

78 {
82 }
Moose::MFEM::TimeDependentEquationSystem * GetEquationSystem() const override
Returns a pointer to the operator&#39;s equation system.
virtual void BuildJacobian(mfem::BlockVector &trueX, mfem::BlockVector &trueRHS)
Build linear system, with essential boundary conditions accounted for.

◆ GetEquationSystem()

Moose::MFEM::TimeDependentEquationSystem* Moose::MFEM::TimeDomainEquationSystemProblemOperator::GetEquationSystem ( ) const
inlineoverridevirtual

Returns a pointer to the operator's equation system.

Implements Moose::MFEM::EquationSystemInterface.

Definition at line 36 of file TimeDomainEquationSystemProblemOperator.h.

Referenced by BuildEquationSystemOperator(), ImplicitSolve(), Init(), and SetGridFunctions().

37  {
38  if (!_equation_system)
39  {
40  MFEM_ABORT("No equation system has been added.");
41  }
42 
43  return _equation_system.get();
44  }
std::shared_ptr< Moose::MFEM::TimeDependentEquationSystem > _equation_system

◆ ImplicitSolve()

void Moose::MFEM::TimeDomainEquationSystemProblemOperator::ImplicitSolve ( const double  dt,
const mfem::Vector &  X,
mfem::Vector &  dX_dt 
)
override

Definition at line 49 of file TimeDomainEquationSystemProblemOperator.C.

52 {
53  dX_dt = 0.0;
55  for (unsigned int ind = 0; ind < _trial_variables.size(); ++ind)
56  {
57  _trial_variables.at(ind)->MakeTRef(
58  _trial_variables.at(ind)->ParFESpace(), dX_dt, _block_true_offsets[ind]);
59  }
62 
63  if (_problem_data.jacobian_solver->isLOR() && _equation_system->_test_var_names.size() > 1)
64  mooseError("LOR solve is only supported for single-variable systems");
65 
66  _problem_data.jacobian_solver->updateSolver(
67  *_equation_system->_blfs.Get(_equation_system->_test_var_names.at(0)),
68  _equation_system->_ess_tdof_lists.at(0));
69 
74 }
std::shared_ptr< Moose::MFEM::TimeDependentEquationSystem > _equation_system
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:333
Moose::MFEM::TimeDependentEquationSystem * GetEquationSystem() const override
Returns a pointer to the operator&#39;s equation system.
void setTime(const double time)
Moose::MFEM::CoefficientManager coefficients
std::vector< mfem::ParGridFunction * > _trial_variables
std::shared_ptr< mfem::NewtonSolver > nonlinear_solver
std::shared_ptr< MFEMSolverBase > jacobian_solver

◆ Init()

void Moose::MFEM::TimeDomainEquationSystemProblemOperator::Init ( mfem::BlockVector &  X)
overridevirtual

Reimplemented from Moose::MFEM::ProblemOperatorBase.

Definition at line 26 of file TimeDomainEquationSystemProblemOperator.C.

27 {
30  // Set timestepper
31  auto & ode_solver = _problem_data.ode_solver;
32  ode_solver = std::make_unique<mfem::BackwardEulerSolver>();
33  ode_solver->Init(*(this));
34  SetTime(_problem.time());
35 }
virtual Real & time() const
Moose::MFEM::TimeDependentEquationSystem * GetEquationSystem() const override
Returns a pointer to the operator&#39;s equation system.
std::unique_ptr< mfem::ODESolver > ode_solver
virtual void BuildEquationSystem()
MFEMProblem & _problem
Reference to the current problem.
virtual void Init(mfem::BlockVector &X)

◆ SetGridFunctions()

void Moose::MFEM::TimeDomainEquationSystemProblemOperator::SetGridFunctions ( )
overridevirtual

Reimplemented from Moose::MFEM::ProblemOperatorBase.

Definition at line 17 of file TimeDomainEquationSystemProblemOperator.C.

18 {
21 
23 }
std::vector< std::string > _test_var_names
Vector of names of state gridfunctions used in formulation, ordered by appearance in block vector dur...
const std::vector< std::string > & TestVarNames() const
std::vector< std::string > _trial_var_names
Vector of names of state gridfunctions used in formulation, ordered by appearance in block vector dur...
Moose::MFEM::TimeDependentEquationSystem * GetEquationSystem() const override
Returns a pointer to the operator&#39;s equation system.
const std::vector< std::string > & TrialVarNames() const

◆ SetTestVariablesFromTrueVectors()

void Moose::MFEM::ProblemOperatorBase::SetTestVariablesFromTrueVectors ( )
virtualinherited

Definition at line 65 of file ProblemOperatorBase.C.

Referenced by ImplicitSolve(), Moose::MFEM::ProblemOperatorBase::Init(), and Solve().

66 {
67  for (unsigned int ind = 0; ind < _test_variables.size(); ++ind)
68  {
69  auto * const test_var = _test_variables.at(ind);
70 
71  // We must sync the memory flags from the true true vector to the grid function copy of the true
72  // vector
73  mooseAssert(_test_true_vector, "The true vector should already have been set");
74  test_var->GetTrueVector().SyncMemory(*_test_true_vector);
75  test_var->SetFromTrueVector();
76  }
77 }
std::vector< mfem::ParGridFunction * > _test_variables
const mfem::Vector * _test_true_vector

◆ SetTrialVariablesFromTrueVectors()

void Moose::MFEM::ProblemOperatorBase::SetTrialVariablesFromTrueVectors ( )
virtualinherited

Definition at line 80 of file ProblemOperatorBase.C.

Referenced by ImplicitSolve().

81 {
82  for (unsigned int ind = 0; ind < _trial_variables.size(); ++ind)
83  {
84  _trial_variables.at(ind)->SetFromTrueVector();
85  }
86 }
std::vector< mfem::ParGridFunction * > _trial_variables

◆ Solve()

void Moose::MFEM::TimeDomainEquationSystemProblemOperator::Solve ( )
overridevirtual

Implements Moose::MFEM::ProblemOperatorBase.

Definition at line 38 of file TimeDomainEquationSystemProblemOperator.C.

39 {
40  // Advance time step of the MFEM problem. Time is also updated here, and
41  // _problem_operator->SetTime is called inside the ode_solver->Step method to
42  // update the time used by time dependent (function) coefficients.
44  // Synchonise time dependent GridFunctions with updated DoF data.
46 }
virtual Real & time() const
std::unique_ptr< mfem::ODESolver > ode_solver
mfem::BlockVector f
MFEMProblem & _problem
Reference to the current problem.
virtual Real & dt() const

Member Data Documentation

◆ _block_true_offsets

mfem::Array<int> Moose::MFEM::ProblemOperatorBase::_block_true_offsets
inherited

◆ _equation_system

std::shared_ptr<Moose::MFEM::TimeDependentEquationSystem> Moose::MFEM::TimeDomainEquationSystemProblemOperator::_equation_system {nullptr}
private

Definition at line 50 of file TimeDomainEquationSystemProblemOperator.h.

Referenced by GetEquationSystem(), and ImplicitSolve().

◆ _equation_system_operator

mfem::OperatorHandle Moose::MFEM::ProblemOperatorBase::_equation_system_operator
inherited

Definition at line 33 of file ProblemOperatorBase.h.

◆ _problem

MFEMProblem& Moose::MFEM::ProblemOperatorBase::_problem
protectedinherited

Reference to the current problem.

Definition at line 37 of file ProblemOperatorBase.h.

Referenced by Init(), and Solve().

◆ _problem_data

MFEMProblemData& Moose::MFEM::ProblemOperatorBase::_problem_data
protectedinherited

◆ _test_true_vector

const mfem::Vector* Moose::MFEM::ProblemOperatorBase::_test_true_vector = nullptr
protectedinherited

◆ _test_var_names

std::vector<std::string> Moose::MFEM::ProblemOperatorBase::_test_var_names
protectedinherited

Vector of names of state gridfunctions used in formulation, ordered by appearance in block vector during solve.

Definition at line 42 of file ProblemOperatorBase.h.

Referenced by Moose::MFEM::ProblemOperatorBase::SetGridFunctions(), Moose::MFEM::EquationSystemProblemOperator::SetGridFunctions(), and SetGridFunctions().

◆ _test_variables

std::vector<mfem::ParGridFunction *> Moose::MFEM::ProblemOperatorBase::_test_variables
protectedinherited

◆ _trial_var_names

std::vector<std::string> Moose::MFEM::ProblemOperatorBase::_trial_var_names
protectedinherited

Vector of names of state gridfunctions used in formulation, ordered by appearance in block vector during solve.

Definition at line 48 of file ProblemOperatorBase.h.

Referenced by Moose::MFEM::ProblemOperatorBase::SetGridFunctions(), Moose::MFEM::EquationSystemProblemOperator::SetGridFunctions(), and SetGridFunctions().

◆ _trial_variables

std::vector<mfem::ParGridFunction *> Moose::MFEM::ProblemOperatorBase::_trial_variables
protectedinherited

◆ _true_rhs

mfem::BlockVector Moose::MFEM::ProblemOperatorBase::_true_rhs
inherited

◆ _true_x

mfem::BlockVector Moose::MFEM::ProblemOperatorBase::_true_x
inherited

The documentation for this class was generated from the following files: