www.mooseframework.org
PorousFlowPropertyAux.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 
9 
10 template <>
11 InputParameters
13 {
14  InputParameters params = validParams<AuxKernel>();
15  params.addRequiredParam<UserObjectName>(
16  "PorousFlowDictator", "The UserObject that holds the list of PorousFlow variable names");
17  MooseEnum property_enum("pressure saturation temperature density viscosity mass_fraction relperm "
18  "enthalpy internal_energy");
19  params.addRequiredParam<MooseEnum>(
20  "property", property_enum, "The fluid property that this auxillary kernel is to calculate");
21  params.addParam<unsigned int>("phase", 0, "The index of the phase this auxillary kernel acts on");
22  params.addParam<unsigned int>(
23  "fluid_component", 0, "The index of the fluid component this auxillary kernel acts on");
24  params.addClassDescription("AuxKernel to provide access to properties evaluated at quadpoints. "
25  "Note that elemental AuxVariables must be used, so that these "
26  "properties are integrated over each element.");
27  return params;
28 }
29 
30 PorousFlowPropertyAux::PorousFlowPropertyAux(const InputParameters & parameters)
31  : AuxKernel(parameters),
32  _dictator(getUserObject<PorousFlowDictator>("PorousFlowDictator")),
33  _property_enum(getParam<MooseEnum>("property").getEnum<PropertyEnum>()),
34  _phase(getParam<unsigned int>("phase")),
35  _fluid_component(getParam<unsigned int>("fluid_component"))
36 {
37  // Check that the phase and fluid_component are valid
38  if (_phase >= _dictator.numPhases())
39  mooseError("Phase number in the AuxKernel ",
40  _name,
41  " is greater than the number of phases in the problem");
42 
44  mooseError("Fluid component number in the AuxKernel ",
45  _name,
46  " is greater than the number of phases in the problem");
47 
48  // Only get material properties required by this instance of the AuxKernel
49  switch (_property_enum)
50  {
52  _pressure = &getMaterialProperty<std::vector<Real>>("PorousFlow_porepressure_qp");
53  break;
54 
56  _saturation = &getMaterialProperty<std::vector<Real>>("PorousFlow_saturation_qp");
57  break;
58 
60  _temperature = &getMaterialProperty<Real>("PorousFlow_temperature_qp");
61  break;
62 
64  _fluid_density = &getMaterialProperty<std::vector<Real>>("PorousFlow_fluid_phase_density_qp");
65  break;
66 
68  _fluid_viscosity = &getMaterialProperty<std::vector<Real>>("PorousFlow_viscosity_qp");
69  break;
70 
73  &getMaterialProperty<std::vector<std::vector<Real>>>("PorousFlow_mass_frac_qp");
74  break;
75 
78  &getMaterialProperty<std::vector<Real>>("PorousFlow_relative_permeability_qp");
79  break;
80 
82  _enthalpy = &getMaterialProperty<std::vector<Real>>("PorousFlow_fluid_phase_enthalpy_qp");
83 
86  &getMaterialProperty<std::vector<Real>>("PorousFlow_fluid_phase_internal_energy_qp");
87  }
88 }
89 
90 Real
92 {
93  Real property = 0.0;
94 
95  switch (_property_enum)
96  {
98  property = (*_pressure)[_qp][_phase];
99  break;
100 
102  property = (*_saturation)[_qp][_phase];
103  break;
104 
106  property = (*_temperature)[_qp];
107  break;
108 
110  property = (*_fluid_density)[_qp][_phase];
111  break;
112 
114  property = (*_fluid_viscosity)[_qp][_phase];
115  break;
116 
118  property = (*_mass_fractions)[_qp][_phase][_fluid_component];
119  break;
120 
122  property = (*_relative_permeability)[_qp][_phase];
123  break;
124 
126  property = (*_enthalpy)[_qp][_phase];
127  break;
128 
130  property = (*_internal_energy)[_qp][_phase];
131  break;
132  }
133 
134  return property;
135 }
const MaterialProperty< std::vector< Real > > * _fluid_viscosity
Viscosity of each phase.
const MaterialProperty< std::vector< std::vector< Real > > > * _mass_fractions
Mass fraction of each component in each phase.
PropertyEnum
enum of properties
unsigned int _fluid_component
Fluid omponent index.
const PorousFlowDictator & _dictator
PorousFlow Dictator UserObject.
unsigned int numComponents() const
the number of fluid components
InputParameters validParams< PorousFlowPropertyAux >()
const MaterialProperty< std::vector< Real > > * _internal_energy
Internal energy of each phase.
const MaterialProperty< std::vector< Real > > * _enthalpy
Enthalpy of each phase.
PorousFlowPropertyAux(const InputParameters &parameters)
const MaterialProperty< std::vector< Real > > * _saturation
Saturation of each phase (at the qps)
const MaterialProperty< Real > * _temperature
Temperature of the fluid (at the qps)
const MaterialProperty< std::vector< Real > > * _fluid_density
Fluid density of each phase (at the qps)
unsigned int _phase
Phase index.
This holds maps between the nonlinear variables used in a PorousFlow simulation and the variable numb...
unsigned int numPhases() const
the number of fluid phases
enum PorousFlowPropertyAux::PropertyEnum _property_enum
const MaterialProperty< std::vector< Real > > * _relative_permeability
Relative permeability of each phase.
const MaterialProperty< std::vector< Real > > * _pressure
Pressure of each phase (at the qps)