https://mooseframework.inl.gov
Loading...
Searching...
No Matches
MFEMTransient.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 "MFEMTransient.h"
13#include "MFEMProblem.h"
14#include "TimeStepper.h"
15
17
20{
23 params.addClassDescription("Executioner for transient MFEM problems.");
24 return params;
25}
26
28 : TransientBase(params),
29 _mfem_problem(dynamic_cast<MFEMProblem &>(feProblem())),
30 _mfem_problem_solve(*this, _mfem_problem.getProblemOperators())
31{
33 getParam<MooseEnum>("assembly_level").getEnum<mfem::AssemblyLevel>());
34}
35
36void
38{
40
41 // verify that the requested time integration scheme is actually supported by MFEM transient
43 paramError("scheme",
44 "Time Integration scheme \"" + stringify(getTimeScheme()) +
45 "\" is not supported by MFEMTransient Executioner.");
46}
47
48void
50{
51 _dt_old = _dt;
52
53 if (input_dt == -1.0)
55 else
56 _dt = input_dt;
57
59
60 // Unfortunately, time needs to be temporarily incremented so we get
61 // meaningful console output in timestepSetup(). We decrement it back
62 // immediately after so step() below behaves as expected.
63 _time += _dt;
65 _time -= _dt;
66
69 {
71 return;
72 }
74
75 // Advance time step of the MFEM problem. Time is also updated here, and
76 // _problem_operator->SetTime is called inside the ode_solver->Step method to
77 // update the time used by time dependent (function) coefficients.
79
80 // Continue with usual TransientBase::takeStep() finalisation
82
83 if (!lastSolveConverged())
84 {
85 _console << "Aborting as solve did not converge" << std::endl;
86 return;
87 }
88
91
94 else
96
97 // Set time to time old, since final time is updated in TransientBase::endStep()
99
101}
102
103#endif
registerMooseObject("MooseApp", MFEMTransient)
const ExecFlagType EXEC_TIMESTEP_END
Definition Moose.C:37
const ExecFlagType EXEC_TIMESTEP_BEGIN
Definition Moose.C:38
const ConsoleStream _console
An instance of helper class to write streams to the Console objects.
bool execMultiApps(ExecFlagType type, bool auto_advance=true)
Execute the MultiApps associated with the ExecFlagType.
void timestepSetup() override
virtual void onTimestepBegin() override
virtual void execute(const ExecFlagType &exec_type)
Convenience function for performing execution of MOOSE systems.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
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.
static InputParameters validParams()
void setAssemblyLevel(mfem::AssemblyLevel assembly_level)
Set the default assembly level to use for EquationSystem assembly.
static InputParameters validParams()
MFEMTransient(const InputParameters &params)
virtual void init() override
Initialize the executioner.
virtual void takeStep(Real input_dt=-1.0) override
Do whatever is necessary to advance one step.
MFEMProblem & _mfem_problem
void paramError(const std::string &param, Args... args) const
Emits an error prefixed with the file and line number of the given param (from the input file) along ...
Definition MooseBase.h:457
virtual void postSolve()
Definition TimeStepper.h:37
virtual bool converged() const
If the time step converged.
virtual void rejectStep()
This gets called when time step is rejected.
virtual void acceptStep()
This gets called when time step is accepted.
virtual void preSolve()
Definition TimeStepper.h:36
virtual void step()
Take a time step.
Base class for transient executioners that use a FixedPointSolve solve object for multiapp-main app i...
bool & _last_solve_converged
Whether or not the last solve converged.
FEProblemBase & _problem
Here for backward compatibility.
Moose::TimeIntegratorType getTimeScheme() const
Get the time scheme used.
Real & _time_old
Previous time.
virtual bool lastSolveConverged() const override
Whether or not the last solve converged.
Real & _time
Current time.
virtual Real computeConstrainedDT()
TimeStepper * _time_stepper
static InputParameters validParams()
virtual void init() override
Initialize the executioner.
Real & _dt
Current delta t... or timestep size.
@ TI_IMPLICIT_EULER
Definition MooseTypes.h:958