12 #include "FEProblem.h"
13 #include "Conversion.h"
14 #include "libmesh/string_to_enum.h"
21 params.addParam<
bool>(
"add_darcy_aux",
true,
"Add AuxVariables that record Darcy velocity");
22 params.addParam<
bool>(
"add_stress_aux",
true,
"Add AuxVariables that record effective stress");
23 params.addParam<
bool>(
"use_brine",
false,
"Use PorousFlowBrine material for the fluid phase");
24 params.addRequiredParam<VariableName>(
"porepressure",
"The name of the porepressure variable");
25 MooseEnum coupling_type(
"Hydro ThermoHydro HydroMechanical ThermoHydroMechanical",
"Hydro");
26 params.addParam<MooseEnum>(
"coupling_type",
28 "The type of simulation. For simulations involving Mechanical "
29 "deformations, you will need to supply the correct Biot coefficient. "
30 "For simulations involving Thermal flows, you will need an associated "
31 "ConstantThermalExpansionCoefficient Material");
32 MooseEnum simulation_type_choice(
"steady transient",
"transient");
33 params.addDeprecatedParam<MooseEnum>(
35 simulation_type_choice,
36 "Whether a transient or steady-state simulation is being performed",
37 "The execution type is now determined automatically. This parameter should no longer be "
39 params.addParam<UserObjectName>(
"fp",
41 "The name of the user object for fluid "
42 "properties. Not required if use_brine is true.");
43 params.addCoupledVar(
"mass_fraction_vars",
44 "List of variables that represent the mass fractions. With only one fluid "
45 "component, this may be left empty. With N fluid components, the format is "
46 "'f_0 f_1 f_2 ... f_(N-1)'. That is, the N^th component need not be "
47 "specified because f_N = 1 - (f_0 + f_1 + ... + f_(N-1)). It is best "
48 "numerically to choose the N-1 mass fraction variables so that they "
49 "represent the fluid components with small concentrations. This Action "
50 "will associated the i^th mass fraction variable to the equation for the "
51 "i^th fluid component, and the pressure variable to the N^th fluid "
53 params.addParam<
unsigned>(
"nacl_index",
55 "Index of NaCl variable in mass_fraction_vars, for "
56 "calculating brine properties. Only required if use_brine is true.");
57 params.addParam<Real>(
60 "The Biot coefficient (relevant only for mechanically-coupled simulations)");
61 params.addClassDescription(
"Base class for single-phase simulations");
67 _pp_var(getParam<VariableName>(
"porepressure")),
68 _coupling_type(getParam<MooseEnum>(
"coupling_type").getEnum<
CouplingTypeEnum>()),
73 _fp(getParam<UserObjectName>(
"fp")),
74 _biot_coefficient(getParam<Real>(
"biot_coefficient")),
75 _add_darcy_aux(getParam<bool>(
"add_darcy_aux")),
76 _add_stress_aux(getParam<bool>(
"add_stress_aux")),
77 _use_brine(getParam<bool>(
"use_brine")),
78 _nacl_index(getParam<unsigned>(
"nacl_index"))
81 mooseError(
"PorousFlowSinglePhaseBase: You need to specify a temperature variable to perform "
82 "non-isothermal simulations");
84 if (
_use_brine && !params.isParamValid(
"mass_fraction_vars"))
85 mooseError(
"PorousFlowSinglePhaseBase: You need to specify at least one component in "
86 "mass_fraction_vars if use_brine is true");
90 "PorousFlowSinglePhaseBase: nacl_index must be less than length of mass_fraction_vars");
93 mooseError(
"PorousFlowSinglePhaseBase: You need to specify fp if use_brine is false");
133 for (
unsigned i = 0; i <
_ndisp; ++i)
135 std::string kernel_name =
"PorousFlowUnsaturated_grad_stress" + Moose::stringify(i);
136 std::string kernel_type =
"StressDivergenceTensors";
138 kernel_type =
"StressDivergenceRZTensors";
139 InputParameters params = _factory.getValidParams(kernel_type);
140 params.set<NonlinearVariableName>(
"variable") =
_displacements[i];
145 params.set<std::string>(
"thermal_eigenstrain_name") =
146 getParam<std::string>(
"thermal_eigenstrain_name");
148 params.set<
unsigned>(
"component") = i;
149 params.set<
bool>(
"use_displaced_mesh") = getParam<bool>(
"use_displaced_mesh");
150 _problem->addKernel(kernel_type, kernel_name, params);
154 kernel_name =
"PorousFlowUnsaturated_gravity" + Moose::stringify(i);
155 kernel_type =
"Gravity";
156 params = _factory.getValidParams(kernel_type);
157 params.set<NonlinearVariableName>(
"variable") =
_displacements[i];
158 params.set<Real>(
"value") =
_gravity(i);
159 params.set<
bool>(
"use_displaced_mesh") = getParam<bool>(
"use_displaced_mesh");
160 _problem->addKernel(kernel_type, kernel_name, params);
163 kernel_name =
"PorousFlowUnsaturated_EffStressCoupling" + Moose::stringify(i);
164 kernel_type =
"PorousFlowEffectiveStressCoupling";
165 params = _factory.getValidParams(kernel_type);
166 params.set<UserObjectName>(
"PorousFlowDictator") =
_dictator_name;
167 params.set<NonlinearVariableName>(
"variable") =
_displacements[i];
169 params.set<
unsigned>(
"component") = i;
170 params.set<
bool>(
"use_displaced_mesh") = getParam<bool>(
"use_displaced_mesh");
171 _problem->addKernel(kernel_type, kernel_name, params);
177 std::string kernel_name =
"PorousFlowUnsaturated_HeatConduction";
178 std::string kernel_type =
"PorousFlowHeatConduction";
179 InputParameters params = _factory.getValidParams(kernel_type);
181 params.set<UserObjectName>(
"PorousFlowDictator") =
_dictator_name;
182 _problem->addKernel(kernel_type, kernel_name, params);
186 kernel_name =
"PorousFlowUnsaturated_EnergyTimeDerivative";
187 kernel_type =
"PorousFlowEnergyTimeDerivative";
188 params = _factory.getValidParams(kernel_type);
190 params.set<UserObjectName>(
"PorousFlowDictator") =
_dictator_name;
191 _problem->addKernel(kernel_type, kernel_name, params);
197 std::string kernel_name =
"PorousFlowUnsaturated_HeatVolumetricExpansion";
198 std::string kernel_type =
"PorousFlowHeatVolumetricExpansion";
199 InputParameters params = _factory.getValidParams(kernel_type);
200 params.set<UserObjectName>(
"PorousFlowDictator") =
_dictator_name;
202 _problem->addKernel(kernel_type, kernel_name, params);
241 if (compute_rho_mu_qp || compute_e_qp || compute_h_qp)
246 addBrineMaterial(nacl_name,
false, 0, compute_rho_mu_qp, compute_e_qp, compute_h_qp);
257 if (compute_rho_mu_nodal || compute_e_nodal || compute_h_nodal)
262 addBrineMaterial(nacl_name,
true, 0, compute_rho_mu_nodal, compute_e_nodal, compute_h_nodal);
266 true, 0, compute_rho_mu_nodal, compute_e_nodal, compute_h_nodal,
_fp);
280 const std::string uo_type =
"PorousFlowDictator";
281 InputParameters params = _factory.getValidParams(uo_type);
288 params.set<std::vector<VariableName>>(
"porous_flow_vars") = pf_vars;
289 params.set<
unsigned int>(
"number_fluid_phases") = 1;
293 _problem->addUserObject(uo_type, uo_name, params);