www.mooseframework.org
Public Member Functions | Private Attributes | List of all members
Q2PAction Class Reference

#include <Q2PAction.h>

Inheritance diagram for Q2PAction:
[legend]

Public Member Functions

 Q2PAction (const InputParameters &params)
 
virtual void act ()
 

Private Attributes

VariableName _pp_var
 
VariableName _sat_var
 
UserObjectName _water_density
 
UserObjectName _water_relperm
 
UserObjectName _water_relperm_for_diffusivity
 
Real _water_viscosity
 
UserObjectName _gas_density
 
UserObjectName _gas_relperm
 
Real _gas_viscosity
 
Real _diffusivity
 
std::vector< OutputName > _output_nodal_masses_to
 
std::vector< OutputName > _output_total_masses_to
 
bool _save_gas_flux_in_Q2PGasFluxResidual
 
bool _save_water_flux_in_Q2PWaterFluxResidual
 
bool _save_gas_Jacobian_in_Q2PGasJacobian
 
bool _save_water_Jacobian_in_Q2PWaterJacobian
 
bool _nodal_masses_not_outputted
 
bool _total_masses_not_outputted
 
bool _no_mass_calculations
 

Detailed Description

Definition at line 17 of file Q2PAction.h.

Constructor & Destructor Documentation

Q2PAction::Q2PAction ( const InputParameters &  params)

Definition at line 78 of file Q2PAction.C.

79  : Action(params),
80  _pp_var(getParam<NonlinearVariableName>("porepressure")),
81  _sat_var(getParam<NonlinearVariableName>("saturation")),
82  _water_density(getParam<UserObjectName>("water_density")),
83  _water_relperm(getParam<UserObjectName>("water_relperm")),
84  _water_relperm_for_diffusivity(isParamValid("water_relperm_for_diffusivity")
85  ? getParam<UserObjectName>("water_relperm_for_diffusivity")
86  : getParam<UserObjectName>("water_relperm")),
87  _water_viscosity(getParam<Real>("water_viscosity")),
88  _gas_density(getParam<UserObjectName>("gas_density")),
89  _gas_relperm(getParam<UserObjectName>("gas_relperm")),
90  _gas_viscosity(getParam<Real>("gas_viscosity")),
91  _diffusivity(getParam<Real>("diffusivity")),
92  _output_nodal_masses_to(getParam<std::vector<OutputName>>("output_nodal_masses_to")),
93  _output_total_masses_to(getParam<std::vector<OutputName>>("output_total_masses_to")),
94  _save_gas_flux_in_Q2PGasFluxResidual(getParam<bool>("save_gas_flux_in_Q2PGasFluxResidual")),
96  getParam<bool>("save_water_flux_in_Q2PWaterFluxResidual")),
97  _save_gas_Jacobian_in_Q2PGasJacobian(getParam<bool>("save_gas_Jacobian_in_Q2PGasJacobian")),
99  getParam<bool>("save_water_Jacobian_in_Q2PWaterJacobian"))
100 {
102  if (_output_nodal_masses_to.size() == 0)
104 
106  if (_output_total_masses_to.size() == 0)
108 
110 }
Real _diffusivity
Definition: Q2PAction.h:34
Real _gas_viscosity
Definition: Q2PAction.h:33
UserObjectName _water_density
Definition: Q2PAction.h:27
bool _total_masses_not_outputted
Definition: Q2PAction.h:42
std::vector< OutputName > _output_total_masses_to
Definition: Q2PAction.h:36
UserObjectName _water_relperm
Definition: Q2PAction.h:28
std::vector< OutputName > _output_nodal_masses_to
Definition: Q2PAction.h:35
bool _save_gas_Jacobian_in_Q2PGasJacobian
Definition: Q2PAction.h:39
UserObjectName _water_relperm_for_diffusivity
Definition: Q2PAction.h:29
bool _save_water_Jacobian_in_Q2PWaterJacobian
Definition: Q2PAction.h:40
bool _save_water_flux_in_Q2PWaterFluxResidual
Definition: Q2PAction.h:38
Real _water_viscosity
Definition: Q2PAction.h:30
bool _save_gas_flux_in_Q2PGasFluxResidual
Definition: Q2PAction.h:37
UserObjectName _gas_density
Definition: Q2PAction.h:31
VariableName _pp_var
Definition: Q2PAction.h:25
VariableName _sat_var
Definition: Q2PAction.h:26
bool _nodal_masses_not_outputted
Definition: Q2PAction.h:41
bool _no_mass_calculations
Definition: Q2PAction.h:43
UserObjectName _gas_relperm
Definition: Q2PAction.h:32

Member Function Documentation

void Q2PAction::act ( )
virtual

Definition at line 113 of file Q2PAction.C.

114 {
115  // add the kernels
116  if (_current_task == "add_kernel")
117  {
118  std::string kernel_name;
119  std::string kernel_type;
120  InputParameters params = _factory.getValidParams("Q2PNodalMass");
121 
122  kernel_name = "Q2P_nodal_water_mass";
123  kernel_type = "Q2PNodalMass";
124  params = _factory.getValidParams(kernel_type);
125  params.set<NonlinearVariableName>("variable") = _sat_var;
126  params.set<std::vector<VariableName>>("other_var") = {_pp_var};
127  params.set<bool>("var_is_porepressure") = false;
129  params.set<std::vector<AuxVariableName>>("save_in") = {"Q2P_nodal_water_mass_divided_by_dt"};
130  params.set<UserObjectName>("fluid_density") = _water_density;
131  _problem->addKernel(kernel_type, kernel_name, params);
132 
133  kernel_name = "Q2P_nodal_gas_mass";
134  kernel_type = "Q2PNodalMass";
135  params = _factory.getValidParams(kernel_type);
136  params.set<NonlinearVariableName>("variable") = _pp_var;
137  params.set<std::vector<VariableName>>("other_var") = {_sat_var};
138  params.set<bool>("var_is_porepressure") = true;
140  params.set<std::vector<AuxVariableName>>("save_in") = {"Q2P_nodal_gas_mass_divided_by_dt"};
141  params.set<UserObjectName>("fluid_density") = _gas_density;
142  _problem->addKernel(kernel_type, kernel_name, params);
143 
144  kernel_name = "Q2P_nodal_water_mass_old";
145  kernel_type = "Q2PNegativeNodalMassOld";
146  params = _factory.getValidParams(kernel_type);
147  params.set<NonlinearVariableName>("variable") = _sat_var;
148  params.set<std::vector<VariableName>>("other_var") = {_pp_var};
149  params.set<bool>("var_is_porepressure") = false;
150  params.set<UserObjectName>("fluid_density") = _water_density;
151  _problem->addKernel(kernel_type, kernel_name, params);
152 
153  kernel_name = "Q2P_nodal_gas_mass_old";
154  kernel_type = "Q2PNegativeNodalMassOld";
155  params = _factory.getValidParams(kernel_type);
156  params.set<NonlinearVariableName>("variable") = _pp_var;
157  params.set<std::vector<VariableName>>("other_var") = {_sat_var};
158  params.set<bool>("var_is_porepressure") = true;
159  params.set<UserObjectName>("fluid_density") = _gas_density;
160  _problem->addKernel(kernel_type, kernel_name, params);
161 
162  kernel_name = "Q2P_water_flux";
163  kernel_type = "Q2PSaturationFlux";
164  params = _factory.getValidParams(kernel_type);
165  params.set<NonlinearVariableName>("variable") = _sat_var;
166  params.set<std::vector<VariableName>>("porepressure_variable") = {_pp_var};
167  params.set<UserObjectName>("fluid_density") = _water_density;
168  params.set<UserObjectName>("fluid_relperm") = _water_relperm;
169  params.set<Real>("fluid_viscosity") = _water_viscosity;
171  params.set<std::vector<AuxVariableName>>("save_in") = {"Q2PWaterFluxResidual"};
173  params.set<std::vector<AuxVariableName>>("diag_save_in") = {"Q2PWaterJacobian"};
174  _problem->addKernel(kernel_type, kernel_name, params);
175 
176  kernel_name = "Q2P_gas_flux";
177  kernel_type = "Q2PPorepressureFlux";
178  params = _factory.getValidParams(kernel_type);
179  params.set<NonlinearVariableName>("variable") = _pp_var;
180  params.set<std::vector<VariableName>>("saturation_variable") = {_sat_var};
181  params.set<UserObjectName>("fluid_density") = _gas_density;
182  params.set<UserObjectName>("fluid_relperm") = _gas_relperm;
183  params.set<Real>("fluid_viscosity") = _gas_viscosity;
185  params.set<std::vector<AuxVariableName>>("save_in") = {"Q2PGasFluxResidual"};
187  params.set<std::vector<AuxVariableName>>("diag_save_in") = {"Q2PGasJacobian"};
188  _problem->addKernel(kernel_type, kernel_name, params);
189 
190  kernel_name = "Q2P_liquid_diffusion";
191  kernel_type = "Q2PSaturationDiffusion";
192  params = _factory.getValidParams(kernel_type);
193  params.set<NonlinearVariableName>("variable") = _sat_var;
194  params.set<std::vector<VariableName>>("porepressure_variable") = {_pp_var};
195  params.set<UserObjectName>("fluid_density") = _water_density;
196  params.set<UserObjectName>("fluid_relperm") = _water_relperm_for_diffusivity;
197  params.set<Real>("fluid_viscosity") = _water_viscosity;
198  params.set<Real>("diffusivity") = _diffusivity;
199  _problem->addKernel(kernel_type, kernel_name, params);
200  }
201 
202  if (_current_task == "add_aux_variable")
203  {
205  {
206  // user wants nodal masses or total masses
207  _problem->addAuxVariable("Q2P_nodal_water_mass_divided_by_dt",
208  FEType(Utility::string_to_enum<Order>(getParam<MooseEnum>("ORDER")),
209  Utility::string_to_enum<FEFamily>("LAGRANGE")));
210  _problem->addAuxVariable("Q2P_nodal_gas_mass_divided_by_dt",
211  FEType(Utility::string_to_enum<Order>(getParam<MooseEnum>("ORDER")),
212  Utility::string_to_enum<FEFamily>("LAGRANGE")));
213  }
215  _problem->addAuxVariable("Q2PGasFluxResidual",
216  FEType(Utility::string_to_enum<Order>(getParam<MooseEnum>("ORDER")),
217  Utility::string_to_enum<FEFamily>("LAGRANGE")));
219  _problem->addAuxVariable("Q2PWaterFluxResidual",
220  FEType(Utility::string_to_enum<Order>(getParam<MooseEnum>("ORDER")),
221  Utility::string_to_enum<FEFamily>("LAGRANGE")));
223  _problem->addAuxVariable("Q2PGasJacobian",
224  FEType(Utility::string_to_enum<Order>(getParam<MooseEnum>("ORDER")),
225  Utility::string_to_enum<FEFamily>("LAGRANGE")));
227  _problem->addAuxVariable("Q2PWaterJacobian",
228  FEType(Utility::string_to_enum<Order>(getParam<MooseEnum>("ORDER")),
229  Utility::string_to_enum<FEFamily>("LAGRANGE")));
230  }
231 
232  if (_current_task == "add_function" && _output_total_masses_to.size() > 0)
233  {
234  // user wants total masses, so need to build Functions to do this
235  InputParameters params = _factory.getValidParams("ParsedFunction");
236 
237  params.set<std::string>("value") = "a*b";
238 
239  std::vector<std::string> vars;
240  vars.push_back("a");
241  vars.push_back("b");
242  params.set<std::vector<std::string>>("vars") = vars;
243 
244  std::vector<std::string> vals_water;
245  vals_water.push_back("Q2P_mass_water_divided_by_dt");
246  vals_water.push_back("Q2P_dt");
247  params.set<std::vector<std::string>>("vals") = vals_water;
248  _problem->addFunction("ParsedFunction", "Q2P_water_mass_fcn", params);
249 
250  std::vector<std::string> vals_gas;
251  vals_gas.push_back("Q2P_mass_gas_divided_by_dt");
252  vals_gas.push_back("Q2P_dt");
253  params.set<std::vector<std::string>>("vals") = vals_gas;
254  _problem->addFunction("ParsedFunction", "Q2P_gas_mass_fcn", params);
255  }
256 
257  if (_current_task == "add_postprocessor" && _output_total_masses_to.size() > 0)
258  {
259  // user wants total masses, so need to build Postprocessors to do this
260 
261  InputParameters params = _factory.getValidParams("TimestepSize");
262 
263  params.set<MultiMooseEnum>("execute_on") = "timestep_begin";
264  params.set<std::vector<OutputName>>("outputs") = {"none"};
265  _problem->addPostprocessor("TimestepSize", "Q2P_dt", params);
266 
267  params = _factory.getValidParams("NodalSum");
268  params.set<std::vector<OutputName>>("outputs") = {"none"};
269  params.set<std::vector<VariableName>>("variable") = {"Q2P_nodal_water_mass_divided_by_dt"};
270  _problem->addPostprocessor("NodalSum", "Q2P_mass_water_divided_by_dt", params);
271 
272  params = _factory.getValidParams("FunctionValuePostprocessor");
273  params.set<FunctionName>("function") = "Q2P_water_mass_fcn";
274  params.set<std::vector<OutputName>>("outputs") = _output_total_masses_to;
275  _problem->addPostprocessor("FunctionValuePostprocessor", "mass_water", params);
276 
277  params = _factory.getValidParams("NodalSum");
278  params.set<std::vector<OutputName>>("outputs") = {"none"};
279  params.set<std::vector<VariableName>>("variable") = {"Q2P_nodal_gas_mass_divided_by_dt"};
280  _problem->addPostprocessor("NodalSum", "Q2P_mass_gas_divided_by_dt", params);
281 
282  params = _factory.getValidParams("FunctionValuePostprocessor");
283  params.set<FunctionName>("function") = "Q2P_gas_mass_fcn";
284  params.set<std::vector<OutputName>>("outputs") = _output_total_masses_to;
285  _problem->addPostprocessor("FunctionValuePostprocessor", "mass_gas", params);
286  }
287 }
Real _diffusivity
Definition: Q2PAction.h:34
Real _gas_viscosity
Definition: Q2PAction.h:33
UserObjectName _water_density
Definition: Q2PAction.h:27
std::vector< OutputName > _output_total_masses_to
Definition: Q2PAction.h:36
UserObjectName _water_relperm
Definition: Q2PAction.h:28
bool _save_gas_Jacobian_in_Q2PGasJacobian
Definition: Q2PAction.h:39
UserObjectName _water_relperm_for_diffusivity
Definition: Q2PAction.h:29
bool _save_water_Jacobian_in_Q2PWaterJacobian
Definition: Q2PAction.h:40
bool _save_water_flux_in_Q2PWaterFluxResidual
Definition: Q2PAction.h:38
Real _water_viscosity
Definition: Q2PAction.h:30
bool _save_gas_flux_in_Q2PGasFluxResidual
Definition: Q2PAction.h:37
UserObjectName _gas_density
Definition: Q2PAction.h:31
VariableName _pp_var
Definition: Q2PAction.h:25
VariableName _sat_var
Definition: Q2PAction.h:26
bool _no_mass_calculations
Definition: Q2PAction.h:43
UserObjectName _gas_relperm
Definition: Q2PAction.h:32

Member Data Documentation

Real Q2PAction::_diffusivity
private

Definition at line 34 of file Q2PAction.h.

Referenced by act().

UserObjectName Q2PAction::_gas_density
private

Definition at line 31 of file Q2PAction.h.

Referenced by act().

UserObjectName Q2PAction::_gas_relperm
private

Definition at line 32 of file Q2PAction.h.

Referenced by act().

Real Q2PAction::_gas_viscosity
private

Definition at line 33 of file Q2PAction.h.

Referenced by act().

bool Q2PAction::_no_mass_calculations
private

Definition at line 43 of file Q2PAction.h.

Referenced by act(), and Q2PAction().

bool Q2PAction::_nodal_masses_not_outputted
private

Definition at line 41 of file Q2PAction.h.

Referenced by Q2PAction().

std::vector<OutputName> Q2PAction::_output_nodal_masses_to
private

Definition at line 35 of file Q2PAction.h.

Referenced by Q2PAction().

std::vector<OutputName> Q2PAction::_output_total_masses_to
private

Definition at line 36 of file Q2PAction.h.

Referenced by act(), and Q2PAction().

VariableName Q2PAction::_pp_var
private

Definition at line 25 of file Q2PAction.h.

Referenced by act().

VariableName Q2PAction::_sat_var
private

Definition at line 26 of file Q2PAction.h.

Referenced by act().

bool Q2PAction::_save_gas_flux_in_Q2PGasFluxResidual
private

Definition at line 37 of file Q2PAction.h.

Referenced by act().

bool Q2PAction::_save_gas_Jacobian_in_Q2PGasJacobian
private

Definition at line 39 of file Q2PAction.h.

Referenced by act().

bool Q2PAction::_save_water_flux_in_Q2PWaterFluxResidual
private

Definition at line 38 of file Q2PAction.h.

Referenced by act().

bool Q2PAction::_save_water_Jacobian_in_Q2PWaterJacobian
private

Definition at line 40 of file Q2PAction.h.

Referenced by act().

bool Q2PAction::_total_masses_not_outputted
private

Definition at line 42 of file Q2PAction.h.

Referenced by Q2PAction().

UserObjectName Q2PAction::_water_density
private

Definition at line 27 of file Q2PAction.h.

Referenced by act().

UserObjectName Q2PAction::_water_relperm
private

Definition at line 28 of file Q2PAction.h.

Referenced by act().

UserObjectName Q2PAction::_water_relperm_for_diffusivity
private

Definition at line 29 of file Q2PAction.h.

Referenced by act().

Real Q2PAction::_water_viscosity
private

Definition at line 30 of file Q2PAction.h.

Referenced by act().


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