www.mooseframework.org
PorousFlowFullySaturated.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 
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.addClassDescription("Adds Kernels and fluid-property Materials necessary to simulate a "
19  "single-phase fully-saturated flow problem. No upwinding of fluid "
20  "flow is used, so the results may differ slightly from the "
21  "Unsaturated Action. No Kernels for diffusion and dispersion of "
22  "fluid components are added. To run a simulation you will also "
23  "need to provide various other Materials for each mesh "
24  "block, depending on your simulation type, viz: permeability, "
25  "porosity, elasticity tensor, strain calculator, stress calculator, "
26  "matrix internal energy, thermal conductivity, diffusivity");
27  return params;
28 }
29 
32 {
33  _objects_to_add.push_back("PorousFlowFullySaturatedDarcyFlow");
35  _objects_to_add.push_back("PorousFlowMassTimeDerivative");
39  _objects_to_add.push_back("PorousFlowMassVolumetricExpansion");
42  _objects_to_add.push_back("PorousFlowFullySaturatedHeatAdvection");
43 }
44 
45 void
47 {
49 
50  // add the kernels
51  if (_current_task == "add_kernel")
52  {
53  std::string kernel_name = "PorousFlowFullySaturated_DarcyFlow";
54  std::string kernel_type = "PorousFlowFullySaturatedDarcyFlow";
55  InputParameters params = _factory.getValidParams(kernel_type);
56  params.set<UserObjectName>("PorousFlowDictator") = _dictator_name;
57  params.set<RealVectorValue>("gravity") = _gravity;
58 
59  for (unsigned i = 0; i < _num_mass_fraction_vars; ++i)
60  {
61  kernel_name = "PorousFlowFullySaturated_DarcyFlow" + Moose::stringify(i);
62  params.set<unsigned int>("fluid_component") = i;
63  params.set<NonlinearVariableName>("variable") = _mass_fraction_vars[i];
64  _problem->addKernel(kernel_type, kernel_name, params);
65  }
66  kernel_name = "PorousFlowFullySaturated_DarcyFlow" + Moose::stringify(_num_mass_fraction_vars);
67  params.set<unsigned int>("fluid_component") = _num_mass_fraction_vars;
68  params.set<NonlinearVariableName>("variable") = _pp_var;
69  _problem->addKernel(kernel_type, kernel_name, params);
70  }
71  if (_current_task == "add_kernel" && _simulation_type == SimulationTypeChoiceEnum::TRANSIENT)
72  {
73  std::string kernel_name = "PorousFlowFullySaturated_MassTimeDerivative";
74  std::string kernel_type = "PorousFlowMassTimeDerivative";
75  InputParameters params = _factory.getValidParams(kernel_type);
76  params.set<UserObjectName>("PorousFlowDictator") = _dictator_name;
77 
78  for (unsigned i = 0; i < _num_mass_fraction_vars; ++i)
79  {
80  kernel_name = "PorousFlowFullySaturated_MassTimeDerivative" + Moose::stringify(i);
81  params.set<unsigned int>("fluid_component") = i;
82  params.set<NonlinearVariableName>("variable") = _mass_fraction_vars[i];
83  _problem->addKernel(kernel_type, kernel_name, params);
84  }
85  kernel_name =
86  "PorousFlowFullySaturated_MassTimeDerivative" + Moose::stringify(_num_mass_fraction_vars);
87  params.set<unsigned int>("fluid_component") = _num_mass_fraction_vars;
88  params.set<NonlinearVariableName>("variable") = _pp_var;
89  _problem->addKernel(kernel_type, kernel_name, params);
90  }
91 
94  _current_task == "add_kernel" && _simulation_type == SimulationTypeChoiceEnum::TRANSIENT)
95  {
96  std::string kernel_name = "PorousFlowFullySaturated_MassVolumetricExpansion";
97  std::string kernel_type = "PorousFlowMassVolumetricExpansion";
98  InputParameters params = _factory.getValidParams(kernel_type);
99  params.set<UserObjectName>("PorousFlowDictator") = _dictator_name;
100  for (unsigned i = 0; i < _num_mass_fraction_vars; ++i)
101  {
102  kernel_name = "PorousFlowFullySaturated_MassVolumetricExpansion" + Moose::stringify(i);
103  params.set<unsigned>("fluid_component") = i;
104  params.set<NonlinearVariableName>("variable") = _mass_fraction_vars[i];
105  _problem->addKernel(kernel_type, kernel_name, params);
106  }
107  kernel_name = "PorousFlowFullySaturated_MassVolumetricExpansion" +
108  Moose::stringify(_num_mass_fraction_vars);
109  params.set<unsigned>("fluid_component") = _num_mass_fraction_vars;
110  params.set<NonlinearVariableName>("variable") = _pp_var;
111  _problem->addKernel(kernel_type, kernel_name, params);
112  }
113 
116  _current_task == "add_kernel")
117  {
118  std::string kernel_name = "PorousFlowFullySaturated_HeatAdvection";
119  std::string kernel_type = "PorousFlowFullySaturatedHeatAdvection";
120  InputParameters params = _factory.getValidParams(kernel_type);
121  params.set<NonlinearVariableName>("variable") = _temperature_var[0];
122  params.set<UserObjectName>("PorousFlowDictator") = _dictator_name;
123  params.set<RealVectorValue>("gravity") = _gravity;
124  _problem->addKernel(kernel_type, kernel_name, params);
125  }
126 
127  // add Materials
128  if (_deps.dependsOn(_objects_to_add, "PorousFlowPS_qp") && _current_task == "add_material")
129  {
130  // saturation is always unity, so is trivially calculated using PorousFlow1PhaseFullySaturated
131  std::string material_type = "PorousFlow1PhaseFullySaturated";
132  InputParameters params = _factory.getValidParams(material_type);
133  std::string material_name = "PorousFlowFullySaturated_1PhaseP_qp";
134  params.set<UserObjectName>("PorousFlowDictator") = _dictator_name;
135  params.set<std::vector<VariableName>>("porepressure") = {_pp_var};
136  _problem->addMaterial(material_type, material_name, params);
137  }
138  if (_deps.dependsOn(_objects_to_add, "PorousFlowPS_nodal") && _current_task == "add_material")
139  {
140  std::string material_type = "PorousFlow1PhaseFullySaturated";
141  InputParameters params = _factory.getValidParams(material_type);
142  std::string material_name = "PorousFlowFullySaturated_1PhaseP";
143  params.set<UserObjectName>("PorousFlowDictator") = _dictator_name;
144  params.set<std::vector<VariableName>>("porepressure") = {_pp_var};
145  params.set<bool>("at_nodes") = true;
146  _problem->addMaterial(material_type, material_name, params);
147  }
148 
149  if (_deps.dependsOn(_objects_to_add, "PorousFlowVolumetricStrain_qp") ||
150  _deps.dependsOn(_objects_to_add, "PorousFlowVolumetricStrain_nodal"))
152 
153  if (_deps.dependsOn(_objects_to_add, "PorousFlowRelativePermeability_qp"))
154  addRelativePermeabilityCorey(false, 0, 0.0, 0.0, 0.0);
155  if (_deps.dependsOn(_objects_to_add, "PorousFlowRelativePermeability_nodal"))
156  addRelativePermeabilityCorey(true, 0, 0.0, 0.0, 0.0);
157 }
const std::vector< VariableName > & _mass_fraction_vars
Name of the mass-fraction variables (if any)
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.
std::vector< VariableName > _coupled_displacements
displacement Variable names
virtual void act() override
InputParameters validParams< PorousFlowSinglePhaseBase >()
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
PorousFlowFullySaturated(const InputParameters &params)
const RealVectorValue _gravity
gravity
const std::vector< VariableName > & _temperature_var
Name of the temperature variable (if any)
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.
InputParameters validParams< PorousFlowFullySaturated >()
enum PorousFlowSinglePhaseBase::CouplingTypeEnum _coupling_type
DependencyResolver< std::string > _deps
All dependencies of kernels, auxkernels, materials, etc, are stored in _dependencies.