www.mooseframework.org
PorousFlowBasicTHM.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 /****************************************************************/
7 #include "PorousFlowBasicTHM.h"
8 
9 #include "FEProblem.h"
10 #include "Conversion.h"
11 #include "libmesh/string_to_enum.h"
12 
13 template <>
14 InputParameters
16 {
17  InputParameters params = validParams<PorousFlowSinglePhaseBase>();
18  params.addParam<bool>("multiply_by_density",
19  false,
20  "If true, then the Kernels for fluid flow are multiplied by "
21  "the fluid density. If false, this multiplication is not "
22  "performed, which means the problem linearises, but that care "
23  "must be taken when using other PorousFlow objects.");
24  params.addClassDescription("Adds Kernels and fluid-property Materials necessary to simulate a "
25  "single-phase, single-component fully-saturated flow problem. No "
26  "upwinding and no mass lumping of the fluid mass are used. The "
27  "fluid-mass time derivative is close to linear, and is perfectly "
28  "linear if multiply_by_density=false. These features mean the "
29  "results may differ slightly from the "
30  "Unsaturated Action case. To run a simulation "
31  "you will also need to provide various other Materials for each mesh "
32  "block, depending on your simulation type, viz: permeability, "
33  "constant Biot modulus, constant thermal expansion coefficient, "
34  "porosity, elasticity tensor, strain calculator, stress calculator, "
35  "matrix internal energy, thermal conductivity, diffusivity");
36  return params;
37 }
38 
39 PorousFlowBasicTHM::PorousFlowBasicTHM(const InputParameters & params)
40  : PorousFlowSinglePhaseBase(params), _multiply_by_density(getParam<bool>("multiply_by_density"))
41 {
42  if (_num_mass_fraction_vars != 0)
43  mooseError("PorousFlowBasicTHM can only be used for a single-component fluid, so that no "
44  "mass-fraction variables should be provided");
45  _objects_to_add.push_back("PorousFlowFullySaturatedDarcyBase");
47  _objects_to_add.push_back("PorousFlowFullySaturatedMassTimeDerivative");
50  _objects_to_add.push_back("PorousFlowFullySaturatedHeatAdvection");
51 }
52 
53 void
55 {
57 
58  // add the kernels
59  if (_current_task == "add_kernel")
60  {
61  std::string kernel_name = "PorousFlowBasicTHM_DarcyFlow";
62  std::string kernel_type = "PorousFlowFullySaturatedDarcyBase";
63  InputParameters params = _factory.getValidParams(kernel_type);
64  params.set<UserObjectName>("PorousFlowDictator") = _dictator_name;
65  params.set<RealVectorValue>("gravity") = _gravity;
66  params.set<bool>("multiply_by_density") = _multiply_by_density;
67  params.set<NonlinearVariableName>("variable") = _pp_var;
68  _problem->addKernel(kernel_type, kernel_name, params);
69  }
70  if (_current_task == "add_kernel" && _simulation_type == SimulationTypeChoiceEnum::TRANSIENT)
71  {
72  std::string kernel_name = "PorousFlowBasicTHM_MassTimeDerivative";
73  std::string kernel_type = "PorousFlowFullySaturatedMassTimeDerivative";
74  InputParameters params = _factory.getValidParams(kernel_type);
75  params.set<UserObjectName>("PorousFlowDictator") = _dictator_name;
76  params.set<NonlinearVariableName>("variable") = _pp_var;
77  params.set<Real>("biot_coefficient") = _biot_coefficient;
78  params.set<bool>("multiply_by_density") = _multiply_by_density;
79  params.set<MooseEnum>("coupling_type") = parameters().get<MooseEnum>("coupling_type");
80  _problem->addKernel(kernel_type, kernel_name, params);
81  }
82 
85  _current_task == "add_kernel")
86  {
87  std::string kernel_name = "PorousFlowBasicTHM_HeatAdvection";
88  std::string kernel_type = "PorousFlowFullySaturatedHeatAdvection";
89  InputParameters params = _factory.getValidParams(kernel_type);
90  params.set<NonlinearVariableName>("variable") = _temperature_var[0];
91  params.set<UserObjectName>("PorousFlowDictator") = _dictator_name;
92  params.set<RealVectorValue>("gravity") = _gravity;
93  _problem->addKernel(kernel_type, kernel_name, params);
94  }
95 
96  // add Materials
97  if (_deps.dependsOn(_objects_to_add, "PorousFlowPS_qp") && _current_task == "add_material")
98  {
99  std::string material_type = "PorousFlow1PhaseFullySaturated";
100  InputParameters params = _factory.getValidParams(material_type);
101  std::string material_name = "PorousFlowBasicTHM_1PhaseP_qp";
102  params.set<UserObjectName>("PorousFlowDictator") = _dictator_name;
103  params.set<std::vector<VariableName>>("porepressure") = {_pp_var};
104  _problem->addMaterial(material_type, material_name, params);
105  }
106  if (_deps.dependsOn(_objects_to_add, "PorousFlowPS_nodal") && _current_task == "add_material")
107  {
108  std::string material_type = "PorousFlow1PhaseFullySaturated";
109  InputParameters params = _factory.getValidParams(material_type);
110  std::string material_name = "PorousFlowBasicTHM_1PhaseP";
111  params.set<UserObjectName>("PorousFlowDictator") = _dictator_name;
112  params.set<std::vector<VariableName>>("porepressure") = {_pp_var};
113  params.set<bool>("at_nodes") = true;
114  _problem->addMaterial(material_type, material_name, params);
115  }
116 
117  if ((_deps.dependsOn(_objects_to_add, "PorousFlowVolumetricStrain_qp") ||
118  _deps.dependsOn(_objects_to_add, "PorousFlowVolumetricStrain_nodal")) &&
122 
123  if (_deps.dependsOn(_objects_to_add, "PorousFlowRelativePermeability_qp"))
124  addRelativePermeabilityCorey(false, 0, 0.0, 0.0, 0.0);
125  if (_deps.dependsOn(_objects_to_add, "PorousFlowRelativePermeability_nodal"))
126  addRelativePermeabilityCorey(true, 0, 0.0, 0.0, 0.0);
127 }
const Real _biot_coefficient
fluid specific heat capacity at constant volume
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.
virtual void act() override
std::vector< VariableName > _coupled_displacements
displacement Variable names
InputParameters validParams< PorousFlowSinglePhaseBase >()
const bool _multiply_by_density
std::vector< std::string > _objects_to_add
List of Kernels, AuxKernels, Materials, etc, to be added.
Base class for actions involving a single fluid phase.
const NonlinearVariableName _pp_var
porepressure NonlinearVariable name
const RealVectorValue _gravity
gravity
const std::vector< VariableName > & _temperature_var
Name of the temperature variable (if any)
InputParameters validParams< PorousFlowBasicTHM >()
PorousFlowBasicTHM(const InputParameters &params)
enum PorousFlowSinglePhaseBase::SimulationTypeChoiceEnum _simulation_type
const std::string _dictator_name
The name of the PorousFlowDictator object to be added.
const unsigned _num_mass_fraction_vars
Number of mass-fraction variables.
void addVolumetricStrainMaterial(const std::vector< VariableName > &displacements, bool consistent_with_displaced_mesh)
Adds a quadpoint volumetric strain material.
enum PorousFlowSinglePhaseBase::CouplingTypeEnum _coupling_type
DependencyResolver< std::string > _deps
All dependencies of kernels, auxkernels, materials, etc, are stored in _dependencies.