https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
14namespace Moose::MFEM
15{
16void
23
24void
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
36void
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
59void
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
73void
79
80} // namespace Moose::MFEM
81
82#endif
virtual Real & dt() const
virtual Real & time() const
void setTime(const mfem::real_t time)
const std::vector< std::string > & GetTrialVarNames() const
const std::vector< std::string > & GetTestVarNames() const
void FormSystem(mfem::BlockVector &trueX, mfem::BlockVector &trueRHS)
Build all weak-form components via BuildEquationSystem(), form the constrained linear part of the sys...
void SolveWithOperator(mfem::Operator &system_operator, mfem::Operator &linear_operator, const mfem::Vector &rhs, mfem::Vector &x)
Solve the current system operator using the configured nonlinear and linear solvers.
virtual void Init(mfem::BlockVector &X)
MFEMProblem & _problem
Reference to the current problem.
std::vector< std::string > _trial_var_names
Vector of names of state gridfunctions used in formulation, ordered by appearance in block vector dur...
std::vector< std::string > _test_var_names
virtual Moose::MFEM::TimeDependentEquationSystem * GetEquationSystem() const override
Returns a pointer to the operator's equation system.
virtual void ImplicitSolve(const mfem::real_t, const mfem::Vector &, mfem::Vector &) override
void FormEquationSystemOperator(mfem::real_t dt)
Form equation-system state for the current implicit time step.
Utilities for converting between vector(s) of libMesh Points and MFEM Vector(s).
Moose::MFEM::TimeDerivativeMap time_derivative_map
Moose::MFEM::CoefficientManager coefficients
std::unique_ptr< mfem::ODESolver > ode_solver
Moose::MFEM::GridFunctions gridfunctions