www.mooseframework.org
PorousFlowPropertyAux.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #include "PorousFlowPropertyAux.h"
11 
13 
14 template <>
15 InputParameters
17 {
18  InputParameters params = validParams<AuxKernel>();
19  params.addRequiredParam<UserObjectName>(
20  "PorousFlowDictator", "The UserObject that holds the list of PorousFlow variable names");
21  MooseEnum property_enum("pressure saturation temperature density viscosity mass_fraction relperm "
22  "capillary_pressure enthalpy internal_energy secondary_concentration "
23  "mineral_concentration mineral_reaction_rate porosity permeability");
24  params.addRequiredParam<MooseEnum>(
25  "property", property_enum, "The fluid property that this auxillary kernel is to calculate");
26  params.addParam<unsigned int>("phase", 0, "The index of the phase this auxillary kernel acts on");
27  params.addParam<unsigned int>(
28  "liquid_phase", 0, "The index of the liquid phase (used for capillary pressure)");
29  params.addParam<unsigned int>(
30  "gas_phase", 1, "The index of the gas phase (used for capillary pressure)");
31  params.addParam<unsigned int>(
32  "fluid_component", 0, "The index of the fluid component this auxillary kernel acts on");
33  params.addParam<unsigned int>("secondary_species", 0, "The secondary chemical species number");
34  params.addParam<unsigned int>("mineral_species", 0, "The mineral chemical species number");
35  params.addRangeCheckedParam<unsigned int>(
36  "row", 0, "row>=0 & row<=2", "Row of permeability tensor to output");
37  params.addRangeCheckedParam<unsigned int>(
38  "column", 0, "column>=0 & column<=2", "Column of permeability tensor to output");
39  params.addClassDescription("AuxKernel to provide access to properties evaluated at quadpoints. "
40  "Note that elemental AuxVariables must be used, so that these "
41  "properties are integrated over each element.");
42  return params;
43 }
44 
45 PorousFlowPropertyAux::PorousFlowPropertyAux(const InputParameters & parameters)
46  : AuxKernel(parameters),
47  _dictator(getUserObject<PorousFlowDictator>("PorousFlowDictator")),
48  _property_enum(getParam<MooseEnum>("property").getEnum<PropertyEnum>()),
49  _phase(getParam<unsigned int>("phase")),
50  _liquid_phase(getParam<unsigned int>("liquid_phase")),
51  _gas_phase(getParam<unsigned int>("gas_phase")),
52  _fluid_component(getParam<unsigned int>("fluid_component")),
53  _secondary_species(getParam<unsigned int>("secondary_species")),
54  _mineral_species(getParam<unsigned int>("mineral_species")),
55  _k_row(getParam<unsigned int>("row")),
56  _k_col(getParam<unsigned int>("column"))
57 {
58  // Check that the phase and fluid_component are valid
59  if (_phase >= _dictator.numPhases())
60  paramError("phase",
61  "Phase number entered is greater than the number of phases specified in the "
62  "Dictator. Remember that indexing starts at 0");
63 
65  paramError("fluid_component",
66  "Fluid component number entered is greater than the number of fluid components "
67  "specified in the Dictator. Remember that indexing starts at 0");
68 
69  // Check the parameters used to calculate capillary pressure
71  {
73  paramError(
74  "liquid_phase",
75  "Liquid phase number entered is greater than the number of phases specified in the "
76  "Dictator. Remember that indexing starts at 0");
77 
79  paramError("gas_phase",
80  "Gas phase number entered is greater than the number of phases specified in the "
81  "Dictator. Remember that indexing starts at 0");
82 
84  paramError("liquid_phase", "Liquid phase number entered cannot be equal to gas_phase");
85  }
86 
89  paramError("secondary_species",
90  "Secondary species number entered is greater than the number of aqueous equilibrium "
91  "chemical reactions specified in the Dictator. Remember that indexing starts at 0");
92 
96  paramError("mineral_species",
97  "Mineral species number entered is greater than the number of aqueous "
98  "precipitation-dissolution chemical reactions specified in the Dictator. Remember "
99  "that indexing starts at 0");
100 
101  // Only get material properties required by this instance of the AuxKernel
102  switch (_property_enum)
103  {
105  _pressure = &getMaterialProperty<std::vector<Real>>("PorousFlow_porepressure_qp");
106  break;
107 
109  _saturation = &getMaterialProperty<std::vector<Real>>("PorousFlow_saturation_qp");
110  break;
111 
113  _temperature = &getMaterialProperty<Real>("PorousFlow_temperature_qp");
114  break;
115 
117  _fluid_density = &getMaterialProperty<std::vector<Real>>("PorousFlow_fluid_phase_density_qp");
118  break;
119 
121  _fluid_viscosity = &getMaterialProperty<std::vector<Real>>("PorousFlow_viscosity_qp");
122  break;
123 
126  &getMaterialProperty<std::vector<std::vector<Real>>>("PorousFlow_mass_frac_qp");
127  break;
128 
131  &getMaterialProperty<std::vector<Real>>("PorousFlow_relative_permeability_qp");
132  break;
133 
135  _pressure = &getMaterialProperty<std::vector<Real>>("PorousFlow_porepressure_qp");
136  break;
137 
139  _enthalpy = &getMaterialProperty<std::vector<Real>>("PorousFlow_fluid_phase_enthalpy_qp");
140  break;
141 
144  &getMaterialProperty<std::vector<Real>>("PorousFlow_fluid_phase_internal_energy_qp");
145  break;
146 
148  _sec_conc = &getMaterialProperty<std::vector<Real>>("PorousFlow_secondary_concentration_qp");
149  break;
150 
152  _mineral_conc =
153  &getMaterialProperty<std::vector<Real>>("PorousFlow_mineral_concentration_qp");
154  break;
155 
158  &getMaterialProperty<std::vector<Real>>("PorousFlow_mineral_reaction_rate_qp");
159  break;
160 
162  _porosity = &getMaterialProperty<Real>("PorousFlow_porosity_qp");
163  break;
164 
166  _permeability = &getMaterialProperty<RealTensorValue>("PorousFlow_permeability_qp");
167  break;
168  }
169 }
170 
171 Real
173 {
174  Real property = 0.0;
175 
176  switch (_property_enum)
177  {
179  property = (*_pressure)[_qp][_phase];
180  break;
181 
183  property = (*_saturation)[_qp][_phase];
184  break;
185 
187  property = (*_temperature)[_qp];
188  break;
189 
191  property = (*_fluid_density)[_qp][_phase];
192  break;
193 
195  property = (*_fluid_viscosity)[_qp][_phase];
196  break;
197 
199  property = (*_mass_fractions)[_qp][_phase][_fluid_component];
200  break;
201 
203  property = (*_relative_permeability)[_qp][_phase];
204  break;
205 
207  property = (*_pressure)[_qp][_gas_phase] - (*_pressure)[_qp][_liquid_phase];
208  break;
209 
211  property = (*_enthalpy)[_qp][_phase];
212  break;
213 
215  property = (*_internal_energy)[_qp][_phase];
216  break;
217 
219  property = (*_sec_conc)[_qp][_secondary_species];
220  break;
221 
223  property = (*_mineral_conc)[_qp][_mineral_species];
224  break;
225 
227  property = (*_mineral_reaction_rate)[_qp][_mineral_species];
228  break;
229 
231  property = (*_porosity)[_qp];
232  break;
233 
235  property = (*_permeability)[_qp](_k_row, _k_col);
236  break;
237  }
238 
239  return property;
240 }
PorousFlowPropertyAux::_secondary_species
const unsigned int _secondary_species
Secondary species number.
Definition: PorousFlowPropertyAux.h:112
PorousFlowPropertyAux.h
PorousFlowPropertyAux::_fluid_density
const MaterialProperty< std::vector< Real > > * _fluid_density
Fluid density of each phase.
Definition: PorousFlowPropertyAux.h:45
PorousFlowPropertyAux::_fluid_viscosity
const MaterialProperty< std::vector< Real > > * _fluid_viscosity
Viscosity of each phase.
Definition: PorousFlowPropertyAux.h:48
PorousFlowPropertyAux::PropertyEnum::SATURATION
PorousFlowPropertyAux::_permeability
const MaterialProperty< RealTensorValue > * _permeability
Permeability of the media.
Definition: PorousFlowPropertyAux.h:75
PorousFlowPropertyAux::_gas_phase
const unsigned int _gas_phase
Gas phase index.
Definition: PorousFlowPropertyAux.h:106
PorousFlowPropertyAux::_dictator
const PorousFlowDictator & _dictator
PorousFlowDictator UserObject.
Definition: PorousFlowPropertyAux.h:78
PorousFlowPropertyAux::_temperature
const MaterialProperty< Real > * _temperature
Temperature of the fluid.
Definition: PorousFlowPropertyAux.h:42
PorousFlowDictator::numAqueousKinetic
unsigned int numAqueousKinetic() const
The number of aqueous kinetic secondary species.
Definition: PorousFlowDictator.C:123
PorousFlowPropertyAux::PropertyEnum::DENSITY
PorousFlowPropertyAux::_mass_fractions
const MaterialProperty< std::vector< std::vector< Real > > > * _mass_fractions
Mass fraction of each component in each phase.
Definition: PorousFlowPropertyAux.h:51
PorousFlowPropertyAux::_property_enum
enum PorousFlowPropertyAux::PropertyEnum _property_enum
PorousFlowPropertyAux::_pressure
const MaterialProperty< std::vector< Real > > * _pressure
Pressure of each phase.
Definition: PorousFlowPropertyAux.h:36
PorousFlowPropertyAux::PropertyEnum::POROSITY
PorousFlowPropertyAux::PropertyEnum::PERMEABILITY
PorousFlowPropertyAux::PropertyEnum::TEMPERATURE
PorousFlowPropertyAux::_sec_conc
const MaterialProperty< std::vector< Real > > * _sec_conc
Secondary-species concentration.
Definition: PorousFlowPropertyAux.h:63
PorousFlowPropertyAux::PropertyEnum::MASS_FRACTION
PorousFlowPropertyAux::_saturation
const MaterialProperty< std::vector< Real > > * _saturation
Saturation of each phase.
Definition: PorousFlowPropertyAux.h:39
PorousFlowPropertyAux::PropertyEnum::SECONDARY_CONCENTRATION
PorousFlowPropertyAux::_fluid_component
const unsigned int _fluid_component
Fluid component index.
Definition: PorousFlowPropertyAux.h:109
PorousFlowDictator::numAqueousEquilibrium
unsigned int numAqueousEquilibrium() const
The number of aqueous equilibrium secondary species.
Definition: PorousFlowDictator.C:117
PorousFlowPropertyAux::_k_col
const unsigned int _k_col
Definition: PorousFlowPropertyAux.h:119
PorousFlowPropertyAux::PorousFlowPropertyAux
PorousFlowPropertyAux(const InputParameters &parameters)
Definition: PorousFlowPropertyAux.C:45
PorousFlowPropertyAux::_k_row
const unsigned int _k_row
Permeability tensor row and column.
Definition: PorousFlowPropertyAux.h:118
PorousFlowPropertyAux::PropertyEnum::VISCOSITY
PorousFlowPropertyAux::_mineral_species
const unsigned int _mineral_species
Mineral species number.
Definition: PorousFlowPropertyAux.h:115
PorousFlowDictator
This holds maps between the nonlinear variables used in a PorousFlow simulation and the variable numb...
Definition: PorousFlowDictator.h:71
PorousFlowDictator::numPhases
unsigned int numPhases() const
The number of fluid phases.
Definition: PorousFlowDictator.C:105
PorousFlowPropertyAux::PropertyEnum::ENTHALPY
PorousFlowPropertyAux::_relative_permeability
const MaterialProperty< std::vector< Real > > * _relative_permeability
Relative permeability of each phase.
Definition: PorousFlowPropertyAux.h:54
PorousFlowPropertyAux::_porosity
const MaterialProperty< Real > * _porosity
Porosity of the media.
Definition: PorousFlowPropertyAux.h:72
PorousFlowPropertyAux::_mineral_conc
const MaterialProperty< std::vector< Real > > * _mineral_conc
Mineral-species concentration.
Definition: PorousFlowPropertyAux.h:66
registerMooseObject
registerMooseObject("PorousFlowApp", PorousFlowPropertyAux)
PorousFlowPropertyAux::PropertyEnum::MINERAL_CONCENTRATION
validParams< PorousFlowPropertyAux >
InputParameters validParams< PorousFlowPropertyAux >()
Definition: PorousFlowPropertyAux.C:16
PorousFlowDictator::numComponents
unsigned int numComponents() const
The number of fluid components.
Definition: PorousFlowDictator.C:111
PorousFlowPropertyAux::PropertyEnum::INTERNAL_ENERGY
PorousFlowPropertyAux::PropertyEnum
PropertyEnum
Enum of properties.
Definition: PorousFlowPropertyAux.h:81
PorousFlowPropertyAux
Provides a simple interface to PorousFlow material properties.
Definition: PorousFlowPropertyAux.h:26
PorousFlowPropertyAux::_enthalpy
const MaterialProperty< std::vector< Real > > * _enthalpy
Enthalpy of each phase.
Definition: PorousFlowPropertyAux.h:57
PorousFlowPropertyAux::computeValue
virtual Real computeValue() override
Definition: PorousFlowPropertyAux.C:172
PorousFlowPropertyAux::PropertyEnum::PRESSURE
PorousFlowPropertyAux::PropertyEnum::MINERAL_REACTION_RATE
PorousFlowPropertyAux::PropertyEnum::RELPERM
PorousFlowPropertyAux::PropertyEnum::CAPILLARY_PRESSURE
PorousFlowPropertyAux::_phase
const unsigned int _phase
Phase index.
Definition: PorousFlowPropertyAux.h:100
PorousFlowPropertyAux::_mineral_reaction_rate
const MaterialProperty< std::vector< Real > > * _mineral_reaction_rate
Mineral-species reacion rate.
Definition: PorousFlowPropertyAux.h:69
PorousFlowPropertyAux::_internal_energy
const MaterialProperty< std::vector< Real > > * _internal_energy
Internal energy of each phase.
Definition: PorousFlowPropertyAux.h:60
PorousFlowPropertyAux::_liquid_phase
const unsigned int _liquid_phase
Liquid phase index.
Definition: PorousFlowPropertyAux.h:103