14 #include "libmesh/string_to_enum.h" 28 "The name of the dictator user object that is created by this Action");
29 params.
addClassDescription(
"Adds the PorousFlowDictator UserObject. This class also contains " 30 "many utility functions for adding other pieces of an input file, " 31 "which may be used by derived classes.");
34 "Gravitational acceleration vector downwards (m/s^2)");
37 "For isothermal simulations, this is the temperature " 38 "at which fluid properties (and stress-free strains) " 39 "are evaluated at. Otherwise, this is the name of " 40 "the temperature variable. Units = Kelvin");
42 "List of variables that represent the mass fractions. Format is 'f_ph0^c0 " 43 "f_ph0^c1 f_ph0^c2 ... f_ph0^c(N-1) f_ph1^c0 f_ph1^c1 fph1^c2 ... " 44 "fph1^c(N-1) ... fphP^c0 f_phP^c1 fphP^c2 ... fphP^c(N-1)' where " 45 "N=num_components and P=num_phases, and it is assumed that " 46 "f_ph^cN=1-sum(f_ph^c,{c,0,N-1}) so that f_ph^cN need not be given. If no " 47 "variables are provided then num_phases=1=num_components.");
48 params.
addParam<
unsigned int>(
"number_aqueous_equilibrium",
50 "The number of secondary species in the aqueous-equilibrium " 51 "reaction system. (Leave as zero if the simulation does not " 52 "involve chemistry)");
53 params.
addParam<
unsigned int>(
"number_aqueous_kinetic",
55 "The number of secondary species in the aqueous-kinetic reaction " 56 "system involved in precipitation and dissolution. (Leave as zero " 57 "if the simulation does not involve chemistry)");
58 params.
addParam<std::vector<VariableName>>(
61 "The name of the displacement variables (relevant only for " 62 "mechanically-coupled simulations)");
63 params.
addParam<std::vector<MaterialPropertyName>>(
66 "List of all eigenstrain models used in mechanics calculations. " 67 "Typically the eigenstrain_name used in " 68 "ComputeThermalExpansionEigenstrain. Only needed for " 69 "thermally-coupled simulations with thermal expansion.");
71 "use_displaced_mesh",
false,
"Use displaced mesh computations in mechanical kernels");
72 MooseEnum flux_limiter_type(
"MinMod VanLeer MC superbee None",
"VanLeer");
76 "Type of flux limiter to use if stabilization=KT. 'None' means that no antidiffusion " 77 "will be added in the Kuzmin-Turek scheme");
78 MooseEnum stabilization(
"None Full KT",
"Full");
81 "Numerical stabilization used. 'Full' means full upwinding. 'KT' " 82 "means FEM-TVD stabilization of Kuzmin-Turek");
84 "strain_at_nearest_qp",
86 "Only relevant for models in which porosity depends on strain. If true, then when " 87 "calculating nodal porosity that depends on strain, the strain at the nearest quadpoint will " 88 "be used. This adds a small extra computational burden, and is only necessary for " 89 "simulations involving: (1) elements that are not linear lagrange or (2) certain PorousFlow " 90 "Dirac Kernels (as specified in their documentation). If you set this to true, you will " 91 "also want to set the same parameter to true for related Kernels and Materials (which is " 92 "probably easiest to do in the GlobalParams block)");
100 _dictator_name(getParam<
std::string>(
"dictator_name")),
101 _num_aqueous_equilibrium(getParam<unsigned
int>(
"number_aqueous_equilibrium")),
102 _num_aqueous_kinetic(getParam<unsigned
int>(
"number_aqueous_kinetic")),
104 _mass_fraction_vars(isParamValid(
"mass_fraction_vars")
105 ? getParam<
std::vector<VariableName>>(
"mass_fraction_vars")
106 :
std::vector<VariableName>{}),
107 _num_mass_fraction_vars(_mass_fraction_vars.size()),
108 _temperature_var(isParamValid(
"temperature")
109 ? getParam<std::vector<VariableName>>(
"temperature")
110 : std::vector<VariableName>{}),
111 _displacements(getParam<std::vector<VariableName>>(
"displacements")),
112 _ndisp(_displacements.size()),
113 _coupled_displacements(_ndisp),
114 _flux_limiter_type(getParam<MooseEnum>(
"flux_limiter_type")),
115 _stabilization(getParam<MooseEnum>(
"stabilization").getEnum<StabilizationEnum>()),
116 _strain_at_nearest_qp(getParam<bool>(
"strain_at_nearest_qp"))
119 for (
unsigned int i = 0; i < _ndisp; ++i)
120 _coupled_displacements[i] = _displacements[i];
139 const auto & all_subdomains =
_problem->mesh().meshSubdomains();
140 if (all_subdomains.empty())
143 for (
const auto & subdomain : all_subdomains)
146 "The PorousFlow Actions require all subdomains to have the same coordinate system.");
180 for (
auto & auxkernel : auxkernels)
185 for (
auto & postprocessor : postprocessors)
190 for (
auto & bc : bcs)
195 for (
auto & dirac : diracs)
230 _problem->addAuxVariable(
"MooseVariableConstMonomial",
"saturation" + phase_str, var_params);
235 std::string aux_kernel_type =
"MaterialStdVectorAux";
238 std::string aux_kernel_name =
"PorousFlowActionBase_SaturationAux" + phase_str;
239 params.
set<MaterialPropertyName>(
"property") =
"PorousFlow_saturation_qp";
240 params.
set<
unsigned>(
"index") = phase;
241 params.
set<AuxVariableName>(
"variable") =
"saturation" + phase_str;
243 _problem->addAuxKernel(aux_kernel_type, aux_kernel_name, params);
254 _problem->addAuxVariable(
"MooseVariableConstMonomial",
"darcy_vel_x", var_params);
255 _problem->addAuxVariable(
"MooseVariableConstMonomial",
"darcy_vel_y", var_params);
256 _problem->addAuxVariable(
"MooseVariableConstMonomial",
"darcy_vel_z", var_params);
261 std::string aux_kernel_type =
"PorousFlowDarcyVelocityComponent";
268 std::string aux_kernel_name =
"PorousFlowActionBase_Darcy_x_Aux";
270 params.
set<AuxVariableName>(
"variable") =
"darcy_vel_x";
271 _problem->addAuxKernel(aux_kernel_type, aux_kernel_name, params);
273 aux_kernel_name =
"PorousFlowActionBase_Darcy_y_Aux";
275 params.
set<AuxVariableName>(
"variable") =
"darcy_vel_y";
276 _problem->addAuxKernel(aux_kernel_type, aux_kernel_name, params);
278 aux_kernel_name =
"PorousFlowActionBase_Darcy_z_Aux";
280 params.
set<AuxVariableName>(
"variable") =
"darcy_vel_z";
281 _problem->addAuxKernel(aux_kernel_type, aux_kernel_name, params);
291 _problem->addAuxVariable(
"MooseVariableConstMonomial",
"stress_xx", var_params);
292 _problem->addAuxVariable(
"MooseVariableConstMonomial",
"stress_xy", var_params);
293 _problem->addAuxVariable(
"MooseVariableConstMonomial",
"stress_xz", var_params);
294 _problem->addAuxVariable(
"MooseVariableConstMonomial",
"stress_yx", var_params);
295 _problem->addAuxVariable(
"MooseVariableConstMonomial",
"stress_yy", var_params);
296 _problem->addAuxVariable(
"MooseVariableConstMonomial",
"stress_yz", var_params);
297 _problem->addAuxVariable(
"MooseVariableConstMonomial",
"stress_zx", var_params);
298 _problem->addAuxVariable(
"MooseVariableConstMonomial",
"stress_zy", var_params);
299 _problem->addAuxVariable(
"MooseVariableConstMonomial",
"stress_zz", var_params);
304 std::string aux_kernel_type =
"RankTwoAux";
307 params.
set<MaterialPropertyName>(
"rank_two_tensor") =
"stress";
310 std::string aux_kernel_name =
"PorousFlowAction_stress_xx";
311 params.
set<AuxVariableName>(
"variable") =
"stress_xx";
312 params.
set<
unsigned>(
"index_i") = 0;
313 params.
set<
unsigned>(
"index_j") = 0;
314 _problem->addAuxKernel(aux_kernel_type, aux_kernel_name, params);
316 aux_kernel_name =
"PorousFlowAction_stress_xy";
317 params.
set<AuxVariableName>(
"variable") =
"stress_xy";
318 params.
set<
unsigned>(
"index_i") = 0;
319 params.
set<
unsigned>(
"index_j") = 1;
320 _problem->addAuxKernel(aux_kernel_type, aux_kernel_name, params);
322 aux_kernel_name =
"PorousFlowAction_stress_xz";
323 params.
set<AuxVariableName>(
"variable") =
"stress_xz";
324 params.
set<
unsigned>(
"index_i") = 0;
325 params.
set<
unsigned>(
"index_j") = 2;
326 _problem->addAuxKernel(aux_kernel_type, aux_kernel_name, params);
328 aux_kernel_name =
"PorousFlowAction_stress_yx";
329 params.
set<AuxVariableName>(
"variable") =
"stress_yx";
330 params.
set<
unsigned>(
"index_i") = 1;
331 params.
set<
unsigned>(
"index_j") = 0;
332 _problem->addAuxKernel(aux_kernel_type, aux_kernel_name, params);
334 aux_kernel_name =
"PorousFlowAction_stress_yy";
335 params.
set<AuxVariableName>(
"variable") =
"stress_yy";
336 params.
set<
unsigned>(
"index_i") = 1;
337 params.
set<
unsigned>(
"index_j") = 1;
338 _problem->addAuxKernel(aux_kernel_type, aux_kernel_name, params);
340 aux_kernel_name =
"PorousFlowAction_stress_yz";
341 params.
set<AuxVariableName>(
"variable") =
"stress_yz";
342 params.
set<
unsigned>(
"index_i") = 1;
343 params.
set<
unsigned>(
"index_j") = 2;
344 _problem->addAuxKernel(aux_kernel_type, aux_kernel_name, params);
346 aux_kernel_name =
"PorousFlowAction_stress_zx";
347 params.
set<AuxVariableName>(
"variable") =
"stress_zx";
348 params.
set<
unsigned>(
"index_i") = 2;
349 params.
set<
unsigned>(
"index_j") = 0;
350 _problem->addAuxKernel(aux_kernel_type, aux_kernel_name, params);
352 aux_kernel_name =
"PorousFlowAction_stress_zy";
353 params.
set<AuxVariableName>(
"variable") =
"stress_zy";
354 params.
set<
unsigned>(
"index_i") = 2;
355 params.
set<
unsigned>(
"index_j") = 1;
356 _problem->addAuxKernel(aux_kernel_type, aux_kernel_name, params);
358 aux_kernel_name =
"PorousFlowAction_stress_zz";
359 params.
set<AuxVariableName>(
"variable") =
"stress_zz";
360 params.
set<
unsigned>(
"index_i") = 2;
361 params.
set<
unsigned>(
"index_j") = 2;
362 _problem->addAuxKernel(aux_kernel_type, aux_kernel_name, params);
371 if (!
parameters().hasDefaultCoupledValue(
"temperature"))
372 mooseError(
"Attempt to add a PorousFlowTemperature material without setting a temperature " 375 std::string material_type =
"PorousFlowTemperature";
381 std::string material_name =
"PorousFlowActionBase_Temperature_qp";
383 material_name =
"PorousFlowActionBase_Temperature";
385 params.
set<
bool>(
"at_nodes") = at_nodes;
386 _problem->addMaterial(material_type, material_name, params);
395 if (!(
parameters().hasDefaultCoupledValue(
"mass_fraction_vars") ||
396 parameters().hasCoupledValue(
"mass_fraction_vars")))
397 mooseError(
"Attempt to add a PorousFlowMassFraction material without setting the " 398 "mass_fraction_vars");
400 std::string material_type =
"PorousFlowMassFraction";
406 std::string material_name =
"PorousFlowActionBase_MassFraction_qp";
408 material_name =
"PorousFlowActionBase_MassFraction";
410 params.
set<
bool>(
"at_nodes") = at_nodes;
411 _problem->addMaterial(material_type, material_name, params);
420 std::string material_type =
"PorousFlowEffectiveFluidPressure";
425 std::string material_name =
"PorousFlowUnsaturated_EffectiveFluidPressure_qp";
427 material_name =
"PorousFlowUnsaturated_EffectiveFluidPressure";
429 params.
set<
bool>(
"at_nodes") = at_nodes;
430 _problem->addMaterial(material_type, material_name, params);
439 std::string material_type =
"PorousFlowNearestQp";
443 params.
set<
bool>(
"nodal_material") =
true;
445 std::string material_name =
"PorousFlowActionBase_NearestQp";
446 _problem->addMaterial(material_type, material_name, params);
452 const std::string & base_name)
456 std::string material_type =
"PorousFlowVolumetricStrain";
459 std::string material_name =
"PorousFlowActionBase_VolumetricStrain";
461 params.
set<std::vector<VariableName>>(
"displacements") = displacements;
462 if (!base_name.empty())
463 params.
set<std::string>(
"base_name") = base_name;
464 _problem->addMaterial(material_type, material_name, params);
471 bool compute_density_and_viscosity,
472 bool compute_internal_energy,
473 bool compute_enthalpy,
474 const UserObjectName &
fp,
481 std::string material_type =
"PorousFlowSingleComponentFluid";
485 params.
set<
unsigned int>(
"phase") = phase;
486 params.
set<
bool>(
"compute_density_and_viscosity") = compute_density_and_viscosity;
487 params.
set<
bool>(
"compute_internal_energy") = compute_internal_energy;
488 params.
set<
bool>(
"compute_enthalpy") = compute_enthalpy;
489 params.
set<UserObjectName>(
"fp") =
fp;
490 params.
set<
MooseEnum>(
"temperature_unit") = temperature_unit;
494 std::string material_name =
"PorousFlowActionBase_FluidProperties_qp";
496 material_name =
"PorousFlowActionBase_FluidProperties";
498 params.
set<
bool>(
"at_nodes") = at_nodes;
499 _problem->addMaterial(material_type, material_name, params);
507 bool compute_density_and_viscosity,
508 bool compute_internal_energy,
509 bool compute_enthalpy,
514 std::string material_type =
"PorousFlowBrine";
517 params.
set<std::vector<VariableName>>(
"xnacl") = {nacl_brine};
519 params.
set<
unsigned int>(
"phase") = phase;
520 params.
set<
bool>(
"compute_density_and_viscosity") = compute_density_and_viscosity;
521 params.
set<
bool>(
"compute_internal_energy") = compute_internal_energy;
522 params.
set<
bool>(
"compute_enthalpy") = compute_enthalpy;
523 params.
set<
MooseEnum>(
"temperature_unit") = temperature_unit;
525 std::string material_name =
"PorousFlowActionBase_FluidProperties_qp";
527 material_name =
"PorousFlowActionBase_FluidProperties";
529 params.
set<
bool>(
"at_nodes") = at_nodes;
530 _problem->addMaterial(material_type, material_name, params);
539 std::string material_type =
"PorousFlowRelativePermeabilityConst";
543 params.
set<
unsigned int>(
"phase") = phase;
545 std::string material_name =
"PorousFlowActionBase_RelativePermeability_qp";
547 material_name =
"PorousFlowActionBase_RelativePermeability_nodal";
549 params.
set<
bool>(
"at_nodes") = at_nodes;
550 _problem->addMaterial(material_type, material_name, params);
556 bool at_nodes,
unsigned phase, Real n, Real s_res, Real sum_s_res)
560 std::string material_type =
"PorousFlowRelativePermeabilityCorey";
565 params.
set<
unsigned int>(
"phase") = phase;
566 params.
set<
Real>(
"s_res") = s_res;
567 params.
set<
Real>(
"sum_s_res") = sum_s_res;
569 std::string material_name =
"PorousFlowActionBase_RelativePermeability_qp";
571 material_name =
"PorousFlowActionBase_RelativePermeability_nodal";
573 params.
set<
bool>(
"at_nodes") = at_nodes;
574 _problem->addMaterial(material_type, material_name, params);
580 bool at_nodes,
unsigned phase, Real m, Real s_res, Real sum_s_res)
584 std::string material_type =
"PorousFlowRelativePermeabilityFLAC";
589 params.
set<
unsigned int>(
"phase") = phase;
590 params.
set<
Real>(
"s_res") = s_res;
591 params.
set<
Real>(
"sum_s_res") = sum_s_res;
593 std::string material_name =
"PorousFlowActionBase_RelativePermeability_qp";
595 material_name =
"PorousFlowActionBase_RelativePermeability_nodal";
597 params.
set<
bool>(
"at_nodes") = at_nodes;
598 _problem->addMaterial(material_type, material_name, params);
607 std::string userobject_type =
"PorousFlowCapillaryPressureVG";
611 _problem->addUserObject(userobject_type, userobject_name, params);
617 bool multiply_by_density,
618 std::string userobject_name)
622 const std::string userobject_type =
"PorousFlowAdvectiveFluxCalculatorSaturated";
627 params.
set<
unsigned>(
"phase") = phase;
628 params.
set<
bool>(
"multiply_by_density") = multiply_by_density;
629 _problem->addUserObject(userobject_type, userobject_name, params);
635 bool multiply_by_density,
636 std::string userobject_name)
640 const std::string userobject_type =
"PorousFlowAdvectiveFluxCalculatorUnsaturated";
645 params.
set<
unsigned>(
"phase") = phase;
646 params.
set<
bool>(
"multiply_by_density") = multiply_by_density;
647 _problem->addUserObject(userobject_type, userobject_name, params);
653 bool multiply_by_density,
654 std::string userobject_name)
658 const std::string userobject_type =
"PorousFlowAdvectiveFluxCalculatorSaturatedHeat";
663 params.
set<
unsigned>(
"phase") = phase;
664 params.
set<
bool>(
"multiply_by_density") = multiply_by_density;
665 _problem->addUserObject(userobject_type, userobject_name, params);
671 bool multiply_by_density,
672 std::string userobject_name)
676 const std::string userobject_type =
"PorousFlowAdvectiveFluxCalculatorUnsaturatedHeat";
681 params.
set<
unsigned>(
"phase") = phase;
682 params.
set<
bool>(
"multiply_by_density") = multiply_by_density;
683 _problem->addUserObject(userobject_type, userobject_name, params);
689 unsigned fluid_component,
690 bool multiply_by_density,
691 std::string userobject_name)
695 const std::string userobject_type =
"PorousFlowAdvectiveFluxCalculatorSaturatedMultiComponent";
700 params.
set<
unsigned>(
"phase") = phase;
701 params.
set<
bool>(
"multiply_by_density") = multiply_by_density;
702 params.
set<
unsigned>(
"fluid_component") = fluid_component;
703 _problem->addUserObject(userobject_type, userobject_name, params);
709 unsigned phase,
unsigned fluid_component,
bool multiply_by_density, std::string userobject_name)
713 const std::string userobject_type =
714 "PorousFlowAdvectiveFluxCalculatorUnsaturatedMultiComponent";
719 params.
set<
unsigned>(
"phase") = phase;
720 params.
set<
bool>(
"multiply_by_density") = multiply_by_density;
721 params.
set<
unsigned>(
"fluid_component") = fluid_component;
722 _problem->addUserObject(userobject_type, userobject_name, params);
Moose::CoordinateSystemType _coord_system
Coordinate system of the simulation (eg RZ, XYZ, etc)
virtual void addKernels()
Add all Kernels.
void addStressAux()
Add AuxVariables and AuxKernels to compute effective stress.
void addSaturationAux(unsigned phase)
Add an AuxVariable and AuxKernel to calculate saturation.
void addRelativePermeabilityCorey(bool at_nodes, unsigned phase, Real n, Real s_res, Real sum_s_res)
Adds a relative-permeability Material of the Corey variety.
PorousFlowActionBase(const InputParameters ¶ms)
void addEffectiveFluidPressureMaterial(bool at_nodes)
Adds a nodal and a quadpoint effective fluid pressure material.
InputParameters getValidParams(const std::string &name) const
bool dependsOn(const std::string &key, const std::string &value)
void addRelativePermeabilityConst(bool at_nodes, unsigned phase, Real kr)
Adds a relative-permeability Material of the constant variety (primarily to add kr = 1 in actions tha...
void addNearestQpMaterial()
Adds a PorousFlowNearestQp material.
std::vector< std::string > _included_objects
List of Kernels, AuxKernels, Materials, etc, that are added in this input file.
const ExecFlagType EXEC_TIMESTEP_END
virtual void addMaterials()
Add all Materials.
void addSingleComponentFluidMaterial(bool at_nodes, unsigned phase, bool compute_density_and_viscosity, bool compute_internal_energy, bool compute_enthalpy, const UserObjectName &fp, const MooseEnum &temperature_unit, const MooseEnum &pressure_unit, const MooseEnum &time_unit)
Adds a single-component fluid Material.
void addAdvectiveFluxCalculatorSaturated(unsigned phase, bool multiply_by_density, std::string userobject_name)
void addCapillaryPressureVG(Real m, Real alpha, std::string userobject_name)
Adds a van Genuchten capillary pressure UserObject.
virtual void addDictator()=0
Add the PorousFlowDictator object.
static InputParameters validParams()
virtual void act() override
void addBrineMaterial(const VariableName xnacl, bool at_nodes, unsigned phase, bool compute_density_and_viscosity, bool compute_internal_energy, bool compute_enthalpy, const MooseEnum &temperature_unit)
Adds a brine fluid Material.
void addAdvectiveFluxCalculatorSaturatedMultiComponent(unsigned phase, unsigned fluid_component, bool multiply_by_density, std::string userobject_name)
static InputParameters validParams()
void addDarcyAux(const RealVectorValue &gravity)
Add AuxVariables and AuxKernels to calculate Darcy velocity.
const std::string & _current_task
void addAdvectiveFluxCalculatorUnsaturated(unsigned phase, bool multiply_by_density, std::string userobject_name)
std::string stringify(const T &t)
void addTemperatureMaterial(bool at_nodes)
Adds a nodal and a quadpoint Temperature material.
const RealVectorValue _gravity
Gravity.
void addMassFractionMaterial(bool at_nodes)
Adds a nodal and a quadpoint MassFraction material.
bool _transient
Flag to denote if the simulation is transient.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual void addRelationshipManagers(Moose::RelationshipManagerType when_type) override
static const std::string alpha
Holds the PorousFlow dependencies of kernels, auxkernels, materials, etc.
const std::string _dictator_name
The name of the PorousFlowDictator object to be added.
const bool _strain_at_nearest_qp
Evaluate strain at the nearest quadpoint for porosity that depends on strain.
virtual void addAuxObjects()
Add all AuxVariables and AuxKernels.
void addVolumetricStrainMaterial(const std::vector< VariableName > &displacements, const std::string &base_name)
Adds a quadpoint volumetric strain material.
void addRelativePermeabilityFLAC(bool at_nodes, unsigned phase, Real m, Real s_res, Real sum_s_res)
Adds a relative-permeability Material of the FLAC variety.
void mooseError(Args &&... args) const
std::shared_ptr< FEProblemBase > & _problem
const InputParameters & parameters() const
virtual void addUserObjects()
Add all other UserObjects.
std::vector< const T *> getActions()
void addAdvectiveFluxCalculatorUnsaturatedMultiComponent(unsigned phase, unsigned fluid_component, bool multiply_by_density, std::string userobject_name)
void addAdvectiveFluxCalculatorSaturatedHeat(unsigned phase, bool multiply_by_density, std::string userobject_name)
virtual void addMaterialDependencies()
Add all material dependencies so that the correct version of each material can be added...
void ErrorVector unsigned int
const MooseEnum _flux_limiter_type
Flux limiter type in the Kuzmin-Turek FEM-TVD stabilization scheme.
enum PorousFlowActionBase::StabilizationEnum _stabilization
DependencyResolver< std::string > _deps
All dependencies of kernels, auxkernels, materials, etc, are stored in _dependencies.
void addAdvectiveFluxCalculatorUnsaturatedHeat(unsigned phase, bool multiply_by_density, std::string userobject_name)