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 27871 : PorousFlowFluidPropertiesBaseTempl<is_ad>::validParams()
15 : {
16 27871 : InputParameters params = PorousFlowMaterialBase::validParams();
17 55742 : MooseEnum unit_choice("Kelvin=0 Celsius=1", "Kelvin");
18 55742 : params.addParam<MooseEnum>(
19 : "temperature_unit", unit_choice, "The unit of the temperature variable");
20 55742 : MooseEnum p_unit_choice("Pa MPa", "Pa");
21 55742 : 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 55742 : MooseEnum time_unit_choice("seconds hours days years", "seconds");
26 55742 : 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 55742 : params.addParam<bool>(
31 55742 : "compute_density_and_viscosity", true, "Compute the fluid density and viscosity");
32 55742 : params.addParam<bool>("compute_internal_energy", true, "Compute the fluid internal energy");
33 55742 : params.addParam<bool>("compute_enthalpy", true, "Compute the fluid enthalpy");
34 55742 : params.addPrivateParam<std::string>("pf_material_type", "fluid_properties");
35 27871 : params.addPrivateParam<bool>("is_ad", is_ad);
36 27871 : params.addClassDescription("Base class for PorousFlow fluid materials");
37 27871 : return params;
38 27871 : }
39 :
40 : template <bool is_ad>
41 21609 : PorousFlowFluidPropertiesBaseTempl<is_ad>::PorousFlowFluidPropertiesBaseTempl(
42 : const InputParameters & parameters)
43 : : PorousFlowMaterialBase(parameters),
44 21609 : _porepressure(
45 21609 : _nodal_material
46 11088 : ? getGenericMaterialProperty<std::vector<Real>, is_ad>("PorousFlow_porepressure_nodal")
47 32130 : : getGenericMaterialProperty<std::vector<Real>, is_ad>("PorousFlow_porepressure_qp")),
48 43218 : _temperature(_nodal_material
49 21609 : ? getGenericMaterialProperty<Real, is_ad>("PorousFlow_temperature_nodal")
50 32130 : : getGenericMaterialProperty<Real, is_ad>("PorousFlow_temperature_qp")),
51 43962 : _t_c2k(getParam<MooseEnum>("temperature_unit") == 0 ? 0.0 : 273.15),
52 21609 : _R(8.3144598),
53 21609 : _p_unit(
54 21609 : this->template getParam<MooseEnum>("pressure_unit").template getEnum<PressureUnitEnum>()),
55 21609 : _pressure_to_Pascals(_p_unit == PressureUnitEnum::Pa ? 1.0 : 1.0E6),
56 43218 : _time_unit(this->template getParam<MooseEnum>("time_unit").template getEnum<TimeUnitEnum>()),
57 21609 : _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 43218 : _compute_rho_mu(this->template getParam<bool>("compute_density_and_viscosity")),
62 43218 : _compute_internal_energy(this->template getParam<bool>("compute_internal_energy")),
63 43218 : _compute_enthalpy(this->template getParam<bool>("compute_enthalpy")),
64 43218 : _density(_compute_rho_mu
65 21609 : ? (_nodal_material ? &this->template declareGenericProperty<Real, is_ad>(
66 10998 : "PorousFlow_fluid_phase_density_nodal" + _phase)
67 32130 : : &this->template declareGenericProperty<Real, is_ad>(
68 10521 : "PorousFlow_fluid_phase_density_qp" + _phase))
69 : : nullptr),
70 21609 : _ddensity_dp(
71 20568 : (_compute_rho_mu && !is_ad)
72 20568 : ? (_nodal_material
73 62748 : ? &this->template declarePropertyDerivative<Real>(
74 10851 : "PorousFlow_fluid_phase_density_nodal" + _phase, _pressure_variable_name)
75 59076 : : &this->template declarePropertyDerivative<Real>(
76 9627 : "PorousFlow_fluid_phase_density_qp" + _phase, _pressure_variable_name))
77 : : nullptr),
78 42177 : _ddensity_dT((_compute_rho_mu && !is_ad)
79 62838 : ? (_nodal_material ? &this->template declarePropertyDerivative<Real>(
80 10851 : "PorousFlow_fluid_phase_density_nodal" + _phase,
81 : _temperature_variable_name)
82 59076 : : &this->template declarePropertyDerivative<Real>(
83 9627 : "PorousFlow_fluid_phase_density_qp" + _phase,
84 : _temperature_variable_name))
85 : : nullptr),
86 :
87 43218 : _viscosity(_compute_rho_mu
88 21609 : ? (_nodal_material ? &this->template declareGenericProperty<Real, is_ad>(
89 10998 : "PorousFlow_viscosity_nodal" + _phase)
90 32130 : : &this->template declareGenericProperty<Real, is_ad>(
91 10521 : "PorousFlow_viscosity_qp" + _phase))
92 : : nullptr),
93 42177 : _dviscosity_dp((_compute_rho_mu && !is_ad)
94 20568 : ? (_nodal_material
95 62748 : ? &this->template declarePropertyDerivative<Real>(
96 10851 : "PorousFlow_viscosity_nodal" + _phase, _pressure_variable_name)
97 59076 : : &this->template declarePropertyDerivative<Real>(
98 9627 : "PorousFlow_viscosity_qp" + _phase, _pressure_variable_name))
99 : : nullptr),
100 21609 : _dviscosity_dT(
101 20568 : (_compute_rho_mu && !is_ad)
102 20568 : ? (_nodal_material
103 62748 : ? &this->template declarePropertyDerivative<Real>(
104 10851 : "PorousFlow_viscosity_nodal" + _phase, _temperature_variable_name)
105 59076 : : &this->template declarePropertyDerivative<Real>(
106 9627 : "PorousFlow_viscosity_qp" + _phase, _temperature_variable_name))
107 : : nullptr),
108 :
109 43218 : _internal_energy(_compute_internal_energy
110 21609 : ? (_nodal_material
111 17781 : ? &this->template declareGenericProperty<Real, is_ad>(
112 9816 : "PorousFlow_fluid_phase_internal_energy_nodal" + _phase)
113 29574 : : &this->template declareGenericProperty<Real, is_ad>(
114 7965 : "PorousFlow_fluid_phase_internal_energy_qp" + _phase))
115 : : nullptr),
116 42177 : _dinternal_energy_dp((_compute_internal_energy && !is_ad)
117 20568 : ? (_nodal_material
118 56646 : ? &this->template declarePropertyDerivative<Real>(
119 9669 : "PorousFlow_fluid_phase_internal_energy_nodal" + _phase,
120 : _pressure_variable_name)
121 48852 : : &this->template declarePropertyDerivative<Real>(
122 7071 : "PorousFlow_fluid_phase_internal_energy_qp" + _phase,
123 : _pressure_variable_name))
124 : : nullptr),
125 42177 : _dinternal_energy_dT((_compute_internal_energy && !is_ad)
126 20568 : ? (_nodal_material
127 56646 : ? &this->template declarePropertyDerivative<Real>(
128 9669 : "PorousFlow_fluid_phase_internal_energy_nodal" + _phase,
129 : _temperature_variable_name)
130 48852 : : &this->template declarePropertyDerivative<Real>(
131 7071 : "PorousFlow_fluid_phase_internal_energy_qp" + _phase,
132 : _temperature_variable_name))
133 : : nullptr),
134 :
135 43218 : _enthalpy(_compute_enthalpy
136 21609 : ? (_nodal_material ? &this->template declareGenericProperty<Real, is_ad>(
137 9876 : "PorousFlow_fluid_phase_enthalpy_nodal" + _phase)
138 29859 : : &this->template declareGenericProperty<Real, is_ad>(
139 8250 : "PorousFlow_fluid_phase_enthalpy_qp" + _phase))
140 : : nullptr),
141 21609 : _denthalpy_dp(
142 20568 : (_compute_enthalpy && !is_ad)
143 20568 : ? (_nodal_material
144 57111 : ? &this->template declarePropertyDerivative<Real>(
145 9729 : "PorousFlow_fluid_phase_enthalpy_nodal" + _phase, _pressure_variable_name)
146 49992 : : &this->template declarePropertyDerivative<Real>(
147 7356 : "PorousFlow_fluid_phase_enthalpy_qp" + _phase, _pressure_variable_name))
148 : : nullptr),
149 42177 : _denthalpy_dT((_compute_enthalpy && !is_ad)
150 60594 : ? (_nodal_material ? &this->template declarePropertyDerivative<Real>(
151 9729 : "PorousFlow_fluid_phase_enthalpy_nodal" + _phase,
152 : _temperature_variable_name)
153 49992 : : &this->template declarePropertyDerivative<Real>(
154 7356 : "PorousFlow_fluid_phase_enthalpy_qp" + _phase,
155 : _temperature_variable_name))
156 21609 : : nullptr)
157 : {
158 21609 : }
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>;
|