www.mooseframework.org
Public Member Functions | Protected Member Functions | List of all members
AddFluidPropertiesInterrogatorAction Class Reference

Action that sets up the fluid properties interrogator. More...

#include <AddFluidPropertiesInterrogatorAction.h>

Inheritance diagram for AddFluidPropertiesInterrogatorAction:
[legend]

Public Member Functions

 AddFluidPropertiesInterrogatorAction (InputParameters parameters)
 
virtual void act () override
 

Protected Member Functions

void addFluidPropertiesInterrogatorObject () const
 Adds the FluidPropertiesInterrogator user object. More...
 

Detailed Description

Action that sets up the fluid properties interrogator.

Definition at line 23 of file AddFluidPropertiesInterrogatorAction.h.

Constructor & Destructor Documentation

◆ AddFluidPropertiesInterrogatorAction()

AddFluidPropertiesInterrogatorAction::AddFluidPropertiesInterrogatorAction ( InputParameters  parameters)

Definition at line 49 of file AddFluidPropertiesInterrogatorAction.C.

50  : Action(params)
51 {
52  // Currently these parameters are required by the constructor of Console, which
53  // assumes that the action satisfying task "add_output" has these parameters.
54  // However, these parameters are not meant to be seen by the user, so they
55  // are added here, instead of in validParams(), with the help of const_cast.
56  InputParameters & pars = const_cast<InputParameters &>(parameters());
57  ExecFlagEnum exec_enum = Output::getDefaultExecFlagEnum();
58  exec_enum = {EXEC_INITIAL, EXEC_TIMESTEP_END};
59  pars.addParam<ExecFlagEnum>("execute_on", exec_enum, "(Does not need to be set)");
60  pars.addParam<bool>("print_perf_log", false, "(Does not need to be set)");
61 }

Member Function Documentation

◆ act()

void AddFluidPropertiesInterrogatorAction::act ( )
overridevirtual

Definition at line 64 of file AddFluidPropertiesInterrogatorAction.C.

65 {
66  // Set up an arbitrary mesh
67  if (_current_task == "setup_mesh")
68  {
69  const std::string class_name = "GeneratedMesh";
70  InputParameters params = _factory.getValidParams(class_name);
71  params.set<MooseEnum>("dim") = "1";
72  _mesh = _factory.create<MooseMesh>(class_name, "mesh", params);
73  }
74  // Initialize the arbitrary mesh
75  else if (_current_task == "init_mesh")
76  {
77  _mesh->init();
78  }
79  // Create a "solve=false" FEProblem
80  else if (_current_task == "create_problem")
81  {
82  const std::string class_name = "FEProblem";
83  InputParameters params = _factory.getValidParams(class_name);
84  params.set<MooseMesh *>("mesh") = _mesh.get();
85  params.set<bool>("use_nonlinear") = true;
86  params.set<bool>("solve") = false;
87  _problem = _factory.create<FEProblemBase>(class_name, "Problem", params);
88  _problem->setKernelCoverageCheck(false);
89  }
90  // Add the fluid properties interrogator user object
91  else if (_current_task == "add_user_object")
92  {
94  }
95  // Set up an arbitrary steady executioner
96  else if (_current_task == "setup_executioner")
97  {
98  const std::string class_name = "Steady";
99  InputParameters params = _factory.getValidParams(class_name);
100  params.set<FEProblemBase *>("_fe_problem_base") = _problem.get();
101  params.set<FEProblem *>("_fe_problem") = (std::dynamic_pointer_cast<FEProblem>(_problem)).get();
102  std::shared_ptr<Executioner> executioner =
103  _factory.create<Executioner>(class_name, "Executioner", params);
104  _app.setExecutioner(std::move(executioner));
105  }
106  // Create a console that executes only on FINAL and does not print system info
107  else if (_current_task == "add_output")
108  {
109  const std::string class_name = "Console";
110  InputParameters params = _factory.getValidParams(class_name);
111  params.addPrivateParam<FEProblemBase *>("_fe_problem_base", _problem.get());
112  params.set<ExecFlagEnum>("execute_on") = EXEC_FINAL;
113  params.set<MultiMooseEnum>("system_info") = "";
114  std::shared_ptr<Output> output = _factory.create<Output>(class_name, "Console", params);
115  OutputWarehouse & output_warehouse = _app.getOutputWarehouse();
116  output_warehouse.addOutput(output);
117  }
118  else if (_current_task == "common_output")
119  {
120  // This action must satisfy this task to prevent CommonOutputAction from
121  // acting, which performs a static cast that assumes that the action
122  // satisfying the task "add_output" is derived from MooseObjectAction,
123  // which is now false.
124  }
125  else if (_current_task == "add_output_aux_variables")
126  {
127  // This action must satisfy this task to prevent MaterialOutputAction from
128  // acting, which assumes that the action satisfying "add_output" can be
129  // dynamic_cast-ed to type "AddOutputAction", which is now false.
130  }
131 }
void addFluidPropertiesInterrogatorObject() const
Adds the FluidPropertiesInterrogator user object.

◆ addFluidPropertiesInterrogatorObject()

void AddFluidPropertiesInterrogatorAction::addFluidPropertiesInterrogatorObject ( ) const
protected

Adds the FluidPropertiesInterrogator user object.

Definition at line 134 of file AddFluidPropertiesInterrogatorAction.C.

Referenced by act().

135 {
136  const std::string class_name = "FluidPropertiesInterrogator";
137  InputParameters params = _factory.getValidParams(class_name);
138  params.set<UserObjectName>("fp") = getParam<UserObjectName>("fp");
139  // Only pass parameters that were supplied to this action
140  if (isParamValid("rho"))
141  params.set<Real>("rho") = getParam<Real>("rho");
142  if (isParamValid("rhou"))
143  params.set<Real>("rhou") = getParam<Real>("rhou");
144  if (isParamValid("rhoE"))
145  params.set<Real>("rhoE") = getParam<Real>("rhoE");
146  if (isParamValid("e"))
147  params.set<Real>("e") = getParam<Real>("e");
148  if (isParamValid("p"))
149  params.set<Real>("p") = getParam<Real>("p");
150  if (isParamValid("T"))
151  params.set<Real>("T") = getParam<Real>("T");
152  if (isParamValid("vel"))
153  params.set<Real>("vel") = getParam<Real>("vel");
154  if (isParamValid("x_ncg"))
155  params.set<std::vector<Real>>("x_ncg") = getParam<std::vector<Real>>("x_ncg");
156  params.set<unsigned int>("precision") = getParam<unsigned int>("precision");
157  _problem->addUserObject(class_name, "fp_interrogator", params);
158 }

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