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 22 of file AddFluidPropertiesInterrogatorAction.h.

Constructor & Destructor Documentation

◆ AddFluidPropertiesInterrogatorAction()

AddFluidPropertiesInterrogatorAction::AddFluidPropertiesInterrogatorAction ( InputParameters  parameters)

Definition at line 50 of file AddFluidPropertiesInterrogatorAction.C.

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

Member Function Documentation

◆ act()

void AddFluidPropertiesInterrogatorAction::act ( )
overridevirtual

Definition at line 65 of file AddFluidPropertiesInterrogatorAction.C.

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

◆ addFluidPropertiesInterrogatorObject()

void AddFluidPropertiesInterrogatorAction::addFluidPropertiesInterrogatorObject ( ) const
protected

Adds the FluidPropertiesInterrogator user object.

Definition at line 136 of file AddFluidPropertiesInterrogatorAction.C.

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

Referenced by act().


The documentation for this class was generated from the following files:
AddFluidPropertiesInterrogatorAction::addFluidPropertiesInterrogatorObject
void addFluidPropertiesInterrogatorObject() const
Adds the FluidPropertiesInterrogator user object.
Definition: AddFluidPropertiesInterrogatorAction.C:136