https://mooseframework.inl.gov
TimeDependentEquationSystemProblemOperator.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 
13 
14 namespace Moose::MFEM
15 {
16 void
18 {
22 }
23 
24 void
26 {
28  // Set timestepper
29  auto & ode_solver = _problem_data.ode_solver;
30  ode_solver = std::make_unique<mfem::BackwardEulerSolver>();
31  ode_solver->Init(*(this));
32  SetTime(_problem.time());
33  SetImplicitVariableType(STATE);
34 }
35 
36 void
38 {
39  auto & dt = _problem.dt();
40  auto & gfs = _problem_data.gridfunctions;
42 
43  // Initialise time derivative
44  for (const auto & trial_var_name : _trial_var_names)
45  gfs.GetRef(tdm.getTimeDerivativeName(trial_var_name)) = gfs.GetRef(trial_var_name);
46 
47  // Advance time step of the MFEM problem. Time is also updated here, and
48  // _problem_operator->SetTime is called inside the ode_solver->Step method to
49  // update the time used by time dependent (function) coefficients.
51  // Synchonise time dependent GridFunctions with updated DoF data.
53 
54  // Set time derivatives
55  for (const auto & trial_var_name : _trial_var_names)
56  (gfs.GetRef(tdm.getTimeDerivativeName(trial_var_name)) -= gfs.GetRef(trial_var_name)) /= -dt;
57 }
58 
59 void
61  const mfem::Vector &,
62  mfem::Vector & X_new)
63 {
66 
67  auto * const es = GetEquationSystem();
69 
70  X_new.MakeRef(_true_x, 0);
71 }
72 
73 void
75 {
79 }
80 
81 } // namespace Moose::MFEM
82 
83 #endif
std::vector< std::string > _test_var_names
virtual Real & time() const
std::vector< std::string > _trial_var_names
Vector of names of state gridfunctions used in formulation, ordered by appearance in block vector dur...
std::unique_ptr< mfem::ODESolver > ode_solver
void BuildEquationSystemOperator(mfem::real_t dt)
Add kernels/bcs and assemble the linear part of the equation system.
Moose::MFEM::CoefficientManager coefficients
void FormSystem(mfem::BlockVector &trueX, mfem::BlockVector &trueRHS)
Assemble the linear part of the operator, assemble the right-hand side, apply essential and eliminate...
void setTime(const mfem::real_t time)
virtual void BuildEquationSystem()
Build all forms comprising this EquationSystem.
virtual Moose::MFEM::TimeDependentEquationSystem * GetEquationSystem() const override
Returns a pointer to the operator&#39;s equation system.
MFEMProblem & _problem
Reference to the current problem.
virtual void Init(mfem::BlockVector &X)
const std::vector< std::string > & GetTrialVarNames() const
void SolveWithOperator(EquationSystem &equation_system, const mfem::Vector &rhs, mfem::Vector &x)
Solve the current equation system/operator using the configured nonlinear solver or linear solver for...
const std::vector< std::string > & GetTestVarNames() const
Utilities for converting between vector(s) of libMesh Points and MFEM Vector(s).
virtual void ImplicitSolve(const mfem::real_t, const mfem::Vector &, mfem::Vector &) override
Moose::MFEM::GridFunctions gridfunctions
virtual Real & dt() const
Moose::MFEM::TimeDerivativeMap time_derivative_map