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 54421 : PorousFlowFluidPropertiesBaseTempl<is_ad>::validParams()
15 : {
16 54421 : InputParameters params = PorousFlowMaterialBase::validParams();
17 108842 : MooseEnum unit_choice("Kelvin=0 Celsius=1", "Kelvin");
18 108842 : params.addParam<MooseEnum>(
19 : "temperature_unit", unit_choice, "The unit of the temperature variable");
20 108842 : MooseEnum p_unit_choice("Pa MPa", "Pa");
21 108842 : 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 108842 : MooseEnum time_unit_choice("seconds hours days years", "seconds");
26 108842 : 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 108842 : params.addParam<bool>(
31 108842 : "compute_density_and_viscosity", true, "Compute the fluid density and viscosity");
32 108842 : params.addParam<bool>("compute_internal_energy", true, "Compute the fluid internal energy");
33 108842 : params.addParam<bool>("compute_enthalpy", true, "Compute the fluid enthalpy");
34 108842 : params.addPrivateParam<std::string>("pf_material_type", "fluid_properties");
35 54421 : params.addPrivateParam<bool>("is_ad", is_ad);
36 54421 : params.addClassDescription("Base class for PorousFlow fluid materials");
37 54421 : return params;
38 54421 : }
39 :
40 : template <bool is_ad>
41 42600 : PorousFlowFluidPropertiesBaseTempl<is_ad>::PorousFlowFluidPropertiesBaseTempl(
42 : const InputParameters & parameters)
43 : : PorousFlowMaterialBase(parameters),
44 42600 : _porepressure(
45 42600 : _nodal_material
46 21639 : ? getGenericMaterialProperty<std::vector<Real>, is_ad>("PorousFlow_porepressure_nodal")
47 63561 : : getGenericMaterialProperty<std::vector<Real>, is_ad>("PorousFlow_porepressure_qp")),
48 85200 : _temperature(_nodal_material
49 42600 : ? getGenericMaterialProperty<Real, is_ad>("PorousFlow_temperature_nodal")
50 63561 : : getGenericMaterialProperty<Real, is_ad>("PorousFlow_temperature_qp")),
51 86736 : _t_c2k(getParam<MooseEnum>("temperature_unit") == 0 ? 0.0 : 273.15),
52 42600 : _R(8.3144598),
53 42600 : _p_unit(
54 42600 : this->template getParam<MooseEnum>("pressure_unit").template getEnum<PressureUnitEnum>()),
55 42600 : _pressure_to_Pascals(_p_unit == PressureUnitEnum::Pa ? 1.0 : 1.0E6),
56 85200 : _time_unit(this->template getParam<MooseEnum>("time_unit").template getEnum<TimeUnitEnum>()),
57 42600 : _time_to_seconds(_time_unit == TimeUnitEnum::seconds ? 1.0
58 792 : : _time_unit == TimeUnitEnum::hours ? 3600.0
59 726 : : _time_unit == TimeUnitEnum::days ? 3600.0 * 24
60 : : 3600 * 24 * 365.25),
61 85200 : _compute_rho_mu(this->template getParam<bool>("compute_density_and_viscosity")),
62 85200 : _compute_internal_energy(this->template getParam<bool>("compute_internal_energy")),
63 85200 : _compute_enthalpy(this->template getParam<bool>("compute_enthalpy")),
64 85200 : _density(_compute_rho_mu
65 42600 : ? (_nodal_material ? &this->template declareGenericProperty<Real, is_ad>(
66 21441 : "PorousFlow_fluid_phase_density_nodal" + _phase)
67 63561 : : &this->template declareGenericProperty<Real, is_ad>(
68 20961 : "PorousFlow_fluid_phase_density_qp" + _phase))
69 : : nullptr),
70 42600 : _ddensity_dp(
71 41202 : (_compute_rho_mu && !is_ad)
72 41202 : ? (_nodal_material
73 125088 : ? &this->template declarePropertyDerivative<Real>(
74 21441 : "PorousFlow_fluid_phase_density_nodal" + _phase, _pressure_variable_name)
75 119454 : : &this->template declarePropertyDerivative<Real>(
76 19563 : "PorousFlow_fluid_phase_density_qp" + _phase, _pressure_variable_name))
77 : : nullptr),
78 83802 : _ddensity_dT((_compute_rho_mu && !is_ad)
79 125286 : ? (_nodal_material ? &this->template declarePropertyDerivative<Real>(
80 21441 : "PorousFlow_fluid_phase_density_nodal" + _phase,
81 : _temperature_variable_name)
82 119454 : : &this->template declarePropertyDerivative<Real>(
83 19563 : "PorousFlow_fluid_phase_density_qp" + _phase,
84 : _temperature_variable_name))
85 : : nullptr),
86 :
87 85200 : _viscosity(_compute_rho_mu
88 42600 : ? (_nodal_material ? &this->template declareGenericProperty<Real, is_ad>(
89 21441 : "PorousFlow_viscosity_nodal" + _phase)
90 63561 : : &this->template declareGenericProperty<Real, is_ad>(
91 20961 : "PorousFlow_viscosity_qp" + _phase))
92 : : nullptr),
93 83802 : _dviscosity_dp((_compute_rho_mu && !is_ad)
94 41202 : ? (_nodal_material
95 125088 : ? &this->template declarePropertyDerivative<Real>(
96 21441 : "PorousFlow_viscosity_nodal" + _phase, _pressure_variable_name)
97 119454 : : &this->template declarePropertyDerivative<Real>(
98 19563 : "PorousFlow_viscosity_qp" + _phase, _pressure_variable_name))
99 : : nullptr),
100 42600 : _dviscosity_dT(
101 41202 : (_compute_rho_mu && !is_ad)
102 41202 : ? (_nodal_material
103 125088 : ? &this->template declarePropertyDerivative<Real>(
104 21441 : "PorousFlow_viscosity_nodal" + _phase, _temperature_variable_name)
105 119454 : : &this->template declarePropertyDerivative<Real>(
106 19563 : "PorousFlow_viscosity_qp" + _phase, _temperature_variable_name))
107 : : nullptr),
108 :
109 85200 : _internal_energy(_compute_internal_energy
110 42600 : ? (_nodal_material
111 34662 : ? &this->template declareGenericProperty<Real, is_ad>(
112 18987 : "PorousFlow_fluid_phase_internal_energy_nodal" + _phase)
113 58275 : : &this->template declareGenericProperty<Real, is_ad>(
114 15675 : "PorousFlow_fluid_phase_internal_energy_qp" + _phase))
115 : : nullptr),
116 83802 : _dinternal_energy_dp((_compute_internal_energy && !is_ad)
117 41202 : ? (_nodal_material
118 112440 : ? &this->template declarePropertyDerivative<Real>(
119 18987 : "PorousFlow_fluid_phase_internal_energy_nodal" + _phase,
120 : _pressure_variable_name)
121 98310 : : &this->template declarePropertyDerivative<Real>(
122 14277 : "PorousFlow_fluid_phase_internal_energy_qp" + _phase,
123 : _pressure_variable_name))
124 : : nullptr),
125 83802 : _dinternal_energy_dT((_compute_internal_energy && !is_ad)
126 41202 : ? (_nodal_material
127 112440 : ? &this->template declarePropertyDerivative<Real>(
128 18987 : "PorousFlow_fluid_phase_internal_energy_nodal" + _phase,
129 : _temperature_variable_name)
130 98310 : : &this->template declarePropertyDerivative<Real>(
131 14277 : "PorousFlow_fluid_phase_internal_energy_qp" + _phase,
132 : _temperature_variable_name))
133 : : nullptr),
134 :
135 85200 : _enthalpy(_compute_enthalpy
136 42600 : ? (_nodal_material ? &this->template declareGenericProperty<Real, is_ad>(
137 19119 : "PorousFlow_fluid_phase_enthalpy_nodal" + _phase)
138 58896 : : &this->template declareGenericProperty<Real, is_ad>(
139 16296 : "PorousFlow_fluid_phase_enthalpy_qp" + _phase))
140 : : nullptr),
141 42600 : _denthalpy_dp(
142 41202 : (_compute_enthalpy && !is_ad)
143 41202 : ? (_nodal_material
144 113457 : ? &this->template declarePropertyDerivative<Real>(
145 19119 : "PorousFlow_fluid_phase_enthalpy_nodal" + _phase, _pressure_variable_name)
146 100794 : : &this->template declarePropertyDerivative<Real>(
147 14898 : "PorousFlow_fluid_phase_enthalpy_qp" + _phase, _pressure_variable_name))
148 : : nullptr),
149 83802 : _denthalpy_dT((_compute_enthalpy && !is_ad)
150 120642 : ? (_nodal_material ? &this->template declarePropertyDerivative<Real>(
151 19119 : "PorousFlow_fluid_phase_enthalpy_nodal" + _phase,
152 : _temperature_variable_name)
153 100794 : : &this->template declarePropertyDerivative<Real>(
154 14898 : "PorousFlow_fluid_phase_enthalpy_qp" + _phase,
155 : _temperature_variable_name))
156 42600 : : nullptr)
157 : {
158 42600 : }
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>;
|