Line data Source code
1 : //* This file is part of the MOOSE framework
2 : //* https://mooseframework.inl.gov
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 "PorousFlowFluidPropertiesBase.h"
11 :
12 : template <bool is_ad>
13 : InputParameters
14 27184 : PorousFlowFluidPropertiesBaseTempl<is_ad>::validParams()
15 : {
16 27184 : InputParameters params = PorousFlowMaterialBase::validParams();
17 54368 : MooseEnum unit_choice("Kelvin=0 Celsius=1", "Kelvin");
18 54368 : params.addParam<MooseEnum>(
19 : "temperature_unit", unit_choice, "The unit of the temperature variable");
20 54368 : MooseEnum p_unit_choice("Pa MPa", "Pa");
21 54368 : params.addParam<MooseEnum>("pressure_unit",
22 : p_unit_choice,
23 : "The unit of the pressure variable used everywhere in the input file "
24 : "except for in the FluidProperties-module objects");
25 54368 : MooseEnum time_unit_choice("seconds hours days years", "seconds");
26 54368 : params.addParam<MooseEnum>("time_unit",
27 : time_unit_choice,
28 : "The unit of time used everywhere in the input file except for in the "
29 : "FluidProperties-module objects");
30 54368 : params.addParam<bool>(
31 54368 : "compute_density_and_viscosity", true, "Compute the fluid density and viscosity");
32 54368 : params.addParam<bool>("compute_internal_energy", true, "Compute the fluid internal energy");
33 54368 : params.addParam<bool>("compute_enthalpy", true, "Compute the fluid enthalpy");
34 54368 : params.addPrivateParam<std::string>("pf_material_type", "fluid_properties");
35 27184 : params.addPrivateParam<bool>("is_ad", is_ad);
36 27184 : params.addClassDescription("Base class for PorousFlow fluid materials");
37 27184 : return params;
38 27184 : }
39 :
40 : template <bool is_ad>
41 21075 : PorousFlowFluidPropertiesBaseTempl<is_ad>::PorousFlowFluidPropertiesBaseTempl(
42 : const InputParameters & parameters)
43 : : PorousFlowMaterialBase(parameters),
44 21075 : _porepressure(
45 21075 : _nodal_material
46 10863 : ? getGenericMaterialProperty<std::vector<Real>, is_ad>("PorousFlow_porepressure_nodal")
47 31287 : : getGenericMaterialProperty<std::vector<Real>, is_ad>("PorousFlow_porepressure_qp")),
48 42150 : _temperature(_nodal_material
49 21075 : ? getGenericMaterialProperty<Real, is_ad>("PorousFlow_temperature_nodal")
50 31287 : : getGenericMaterialProperty<Real, is_ad>("PorousFlow_temperature_qp")),
51 42894 : _t_c2k(getParam<MooseEnum>("temperature_unit") == 0 ? 0.0 : 273.15),
52 21075 : _R(8.3144598),
53 21075 : _p_unit(
54 21075 : this->template getParam<MooseEnum>("pressure_unit").template getEnum<PressureUnitEnum>()),
55 21075 : _pressure_to_Pascals(_p_unit == PressureUnitEnum::Pa ? 1.0 : 1.0E6),
56 42150 : _time_unit(this->template getParam<MooseEnum>("time_unit").template getEnum<TimeUnitEnum>()),
57 21075 : _time_to_seconds(_time_unit == TimeUnitEnum::seconds ? 1.0
58 360 : : _time_unit == TimeUnitEnum::hours ? 3600.0
59 330 : : _time_unit == TimeUnitEnum::days ? 3600.0 * 24
60 : : 3600 * 24 * 365.25),
61 42150 : _compute_rho_mu(this->template getParam<bool>("compute_density_and_viscosity")),
62 42150 : _compute_internal_energy(this->template getParam<bool>("compute_internal_energy")),
63 42150 : _compute_enthalpy(this->template getParam<bool>("compute_enthalpy")),
64 42150 : _density(_compute_rho_mu
65 21075 : ? (_nodal_material ? &this->template declareGenericProperty<Real, is_ad>(
66 10773 : "PorousFlow_fluid_phase_density_nodal" + _phase)
67 31287 : : &this->template declareGenericProperty<Real, is_ad>(
68 10212 : "PorousFlow_fluid_phase_density_qp" + _phase))
69 : : nullptr),
70 21075 : _ddensity_dp(
71 20421 : (_compute_rho_mu && !is_ad)
72 20421 : ? (_nodal_material
73 62298 : ? &this->template declarePropertyDerivative<Real>(
74 10773 : "PorousFlow_fluid_phase_density_nodal" + _phase, _pressure_variable_name)
75 58653 : : &this->template declarePropertyDerivative<Real>(
76 9558 : "PorousFlow_fluid_phase_density_qp" + _phase, _pressure_variable_name))
77 : : nullptr),
78 41496 : _ddensity_dT((_compute_rho_mu && !is_ad)
79 62388 : ? (_nodal_material ? &this->template declarePropertyDerivative<Real>(
80 10773 : "PorousFlow_fluid_phase_density_nodal" + _phase,
81 : _temperature_variable_name)
82 58653 : : &this->template declarePropertyDerivative<Real>(
83 9558 : "PorousFlow_fluid_phase_density_qp" + _phase,
84 : _temperature_variable_name))
85 : : nullptr),
86 :
87 42150 : _viscosity(_compute_rho_mu
88 21075 : ? (_nodal_material ? &this->template declareGenericProperty<Real, is_ad>(
89 10773 : "PorousFlow_viscosity_nodal" + _phase)
90 31287 : : &this->template declareGenericProperty<Real, is_ad>(
91 10212 : "PorousFlow_viscosity_qp" + _phase))
92 : : nullptr),
93 41496 : _dviscosity_dp((_compute_rho_mu && !is_ad)
94 20421 : ? (_nodal_material
95 62298 : ? &this->template declarePropertyDerivative<Real>(
96 10773 : "PorousFlow_viscosity_nodal" + _phase, _pressure_variable_name)
97 58653 : : &this->template declarePropertyDerivative<Real>(
98 9558 : "PorousFlow_viscosity_qp" + _phase, _pressure_variable_name))
99 : : nullptr),
100 21075 : _dviscosity_dT(
101 20421 : (_compute_rho_mu && !is_ad)
102 20421 : ? (_nodal_material
103 62298 : ? &this->template declarePropertyDerivative<Real>(
104 10773 : "PorousFlow_viscosity_nodal" + _phase, _temperature_variable_name)
105 58653 : : &this->template declarePropertyDerivative<Real>(
106 9558 : "PorousFlow_viscosity_qp" + _phase, _temperature_variable_name))
107 : : nullptr),
108 :
109 42150 : _internal_energy(_compute_internal_energy
110 21075 : ? (_nodal_material
111 17247 : ? &this->template declareGenericProperty<Real, is_ad>(
112 9591 : "PorousFlow_fluid_phase_internal_energy_nodal" + _phase)
113 28731 : : &this->template declareGenericProperty<Real, is_ad>(
114 7656 : "PorousFlow_fluid_phase_internal_energy_qp" + _phase))
115 : : nullptr),
116 41496 : _dinternal_energy_dp((_compute_internal_energy && !is_ad)
117 20421 : ? (_nodal_material
118 56196 : ? &this->template declarePropertyDerivative<Real>(
119 9591 : "PorousFlow_fluid_phase_internal_energy_nodal" + _phase,
120 : _pressure_variable_name)
121 48429 : : &this->template declarePropertyDerivative<Real>(
122 7002 : "PorousFlow_fluid_phase_internal_energy_qp" + _phase,
123 : _pressure_variable_name))
124 : : nullptr),
125 41496 : _dinternal_energy_dT((_compute_internal_energy && !is_ad)
126 20421 : ? (_nodal_material
127 56196 : ? &this->template declarePropertyDerivative<Real>(
128 9591 : "PorousFlow_fluid_phase_internal_energy_nodal" + _phase,
129 : _temperature_variable_name)
130 48429 : : &this->template declarePropertyDerivative<Real>(
131 7002 : "PorousFlow_fluid_phase_internal_energy_qp" + _phase,
132 : _temperature_variable_name))
133 : : nullptr),
134 :
135 42150 : _enthalpy(_compute_enthalpy
136 21075 : ? (_nodal_material ? &this->template declareGenericProperty<Real, is_ad>(
137 9651 : "PorousFlow_fluid_phase_enthalpy_nodal" + _phase)
138 29016 : : &this->template declareGenericProperty<Real, is_ad>(
139 7941 : "PorousFlow_fluid_phase_enthalpy_qp" + _phase))
140 : : nullptr),
141 21075 : _denthalpy_dp(
142 20421 : (_compute_enthalpy && !is_ad)
143 20421 : ? (_nodal_material
144 56661 : ? &this->template declarePropertyDerivative<Real>(
145 9651 : "PorousFlow_fluid_phase_enthalpy_nodal" + _phase, _pressure_variable_name)
146 49569 : : &this->template declarePropertyDerivative<Real>(
147 7287 : "PorousFlow_fluid_phase_enthalpy_qp" + _phase, _pressure_variable_name))
148 : : nullptr),
149 41496 : _denthalpy_dT((_compute_enthalpy && !is_ad)
150 60144 : ? (_nodal_material ? &this->template declarePropertyDerivative<Real>(
151 9651 : "PorousFlow_fluid_phase_enthalpy_nodal" + _phase,
152 : _temperature_variable_name)
153 49569 : : &this->template declarePropertyDerivative<Real>(
154 7287 : "PorousFlow_fluid_phase_enthalpy_qp" + _phase,
155 : _temperature_variable_name))
156 21075 : : nullptr)
157 : {
158 21075 : }
159 :
160 : template <bool is_ad>
161 : void
162 0 : PorousFlowFluidPropertiesBaseTempl<is_ad>::computeQpProperties()
163 : {
164 0 : mooseError("computeQpProperties() must be overriden in materials derived from "
165 : "PorousFlowFluidPropertiesBase");
166 : }
167 :
168 : template class PorousFlowFluidPropertiesBaseTempl<false>;
169 : template class PorousFlowFluidPropertiesBaseTempl<true>;
|