www.mooseframework.org
CavityPressureUOAction.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
3 /* */
4 /* All contents are licensed under LGPL V2.1 */
5 /* See LICENSE for full restrictions */
6 /****************************************************************/
8 #include "Factory.h"
9 #include "FEProblem.h"
10 
11 template <>
12 InputParameters
14 {
15  InputParameters params = validParams<Action>();
16  params.addParam<Real>("initial_pressure", 0, "The initial pressure in the cavity");
17  params.addParam<std::vector<PostprocessorName>>("material_input",
18  "The name of the postprocessor(s) that holds the "
19  "amount of material injected into the cavity");
20  params.addRequiredParam<Real>("R", "The universal gas constant for the units used");
21  params.addRequiredParam<PostprocessorName>(
22  "temperature", "The name of the average temperature postprocessor value");
23  params.addParam<Real>("initial_temperature", "Initial temperature (optional)");
24  params.addRequiredParam<PostprocessorName>("volume",
25  "The name of the internal volume postprocessor value");
26  params.addParam<Real>(
27  "startup_time",
28  0,
29  "The amount of time during which the pressure will ramp from zero to its true value");
30  params.addParam<std::string>("output", "The name to use for the cavity pressure value");
31  params += validParams<SetupInterface>();
32  params.set<MultiMooseEnum>("execute_on") = "linear";
33  return params;
34 }
35 
36 CavityPressureUOAction::CavityPressureUOAction(const InputParameters & params)
37  : Action(params),
38  _initial_pressure(getParam<Real>("initial_pressure")),
39  _material_input(getParam<std::vector<PostprocessorName>>("material_input")),
40  _R(getParam<Real>("R")),
41  _temperature(getParam<PostprocessorName>("temperature")),
42  _volume(getParam<PostprocessorName>("volume")),
43  _startup_time(getParam<Real>("startup_time"))
44 {
45 }
46 
47 void
49 {
50  std::string name = _name + "UserObject";
51 
52  InputParameters params = _factory.getValidParams("CavityPressureUserObject");
53  params.set<MultiMooseEnum>("execute_on") = getParam<MultiMooseEnum>("execute_on");
54  params.set<Real>("initial_pressure") = _initial_pressure;
55  params.set<std::vector<PostprocessorName>>("material_input") = _material_input;
56  params.set<Real>("R") = _R;
57  params.set<PostprocessorName>("temperature") = _temperature;
58 
59  if (isParamValid("initial_temperature"))
60  params.set<Real>("initial_temperature") = getParam<Real>("initial_temperature");
61 
62  params.set<PostprocessorName>("volume") = _volume;
63  params.set<Real>("startup_time") = _startup_time;
64 
65  _problem->addUserObject("CavityPressureUserObject", name, params);
66 }
InputParameters validParams< CavityPressureUOAction >()
const std::vector< PostprocessorName > _material_input
CavityPressureUOAction(const InputParameters &params)
const PostprocessorName _volume
const PostprocessorName _temperature