https://mooseframework.inl.gov
MFEMSteady.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 "MFEMSteady.h"
13 #include "MFEMProblem.h"
14 
15 registerMooseObject("MooseApp", MFEMSteady);
16 
19 {
21  params.addClassDescription("Executioner for steady state MFEM problems.");
22  params.addParam<Real>("time", 0.0, "System time");
23  return params;
24 }
25 
27  : MFEMExecutioner(params),
28  _system_time(getParam<Real>("time")),
29  _time_step(_mfem_problem.timeStep()),
30  _time(_mfem_problem.time()),
31  _output_iteration_number(0)
32 {
34 }
35 
36 void
38 {
39  _problem_data.eqn_system = std::make_shared<Moose::MFEM::EquationSystem>();
40  auto problem_operator =
41  std::make_unique<Moose::MFEM::EquationSystemProblemOperator>(_problem_data);
42 
43  _problem_operator.reset();
44  _problem_operator = std::move(problem_operator);
45 }
46 
47 void
49 {
52 
53  // Set up initial conditions
57  getParam<MooseEnum>("assembly_level").getEnum<mfem::AssemblyLevel>());
58 
59  _problem_operator->SetGridFunctions();
61 }
62 
63 void
65 {
66  if (_app.isRecovering())
67  {
68  _console << "\nCannot recover steady solves!\nExiting...\n" << std::endl;
69  return;
70  }
71 
72  _time_step = 0;
73  _time = _time_step;
76 
77  preExecute();
78 
80 
81  // first step in any steady state solve is always 1 (preserving backwards compatibility)
82  _time_step = 1;
84 
85  // Solve equation system.
88 
89  // Displace mesh, if required
91 
94 
95  // need to keep _time in sync with _time_step to get correct output
96  _time = _time_step;
97  // Execute user objects at timestep end
101 
102  {
103  TIME_SECTION("final", 1, "Executing Final Objects")
108  _time = _time_step;
111  }
112 
113  postExecute();
114 }
115 
116 #endif
static InputParameters validParams()
void finalizeMultiApps()
bool shouldSolve() const
virtual void preExecute()
Override this for actions that should take place before execution.
Definition: Executioner.h:73
void timestepSetup() override
Real _system_time
Definition: MFEMSteady.h:30
registerMooseObject("MooseApp", MFEMSteady)
int & _time_step
Definition: MFEMSteady.h:31
virtual void postExecute()
Method called at the end of the simulation.
virtual void computeMarkers()
MFEMSteady(const InputParameters &params)
Definition: MFEMSteady.C:26
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
const ExecFlagType EXEC_TIMESTEP_END
Definition: Moose.C:34
void displaceMesh()
Displace the mesh, if mesh displacement is enabled.
Definition: MFEMProblem.C:448
Real & _time
Definition: MFEMSteady.h:32
void constructProblemOperator() override
Virtual method to construct the ProblemOperator. Call for default problems.
Definition: MFEMSteady.C:37
Moose::MFEM::FESpaces fespaces
std::unique_ptr< Moose::MFEM::ProblemOperator > _problem_operator
Definition: MFEMSteady.h:38
virtual void advanceState()
Advance all of the state holding vectors / datastructures so that we can move to the next timestep...
virtual void execute(const ExecFlagType &exec_type)
Convenience function for performing execution of MOOSE systems.
mfem::BlockVector f
static InputParameters validParams()
Definition: MFEMSteady.C:18
const ExecFlagType EXEC_PRE_MULTIAPP_SETUP
Definition: Moose.C:52
virtual void computeIndicators()
virtual void postExecute()
Override this for actions that should take place after execution.
Definition: Executioner.h:78
virtual void initialSetup() override
Definition: MFEMProblem.C:40
MooseApp & _app
The MOOSE application this is associated with.
Definition: MooseBase.h:84
MFEMProblemData & _problem_data
std::shared_ptr< Moose::MFEM::EquationSystem > eqn_system
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual void init() override
Initialize the executioner.
Definition: MFEMSteady.C:48
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...
virtual void execute() override
Pure virtual execute function MUST be overridden by children classes.
Definition: MFEMSteady.C:64
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an optional parameter and a documentation string to the InputParameters object...
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.
Moose::MFEM::GridFunctions gridfunctions
MFEMProblem & _mfem_problem
bool isRecovering() const
Whether or not this is a "recover" calculation.
Definition: MooseApp.C:1802
const ExecFlagType EXEC_FINAL
Definition: Moose.C:44
virtual void outputStep(ExecFlagType type)
Output the current step.
const ExecFlagType EXEC_INITIAL
Definition: Moose.C:28