OGS
EffectiveThermalConductivityPorosityMixing.cpp
Go to the documentation of this file.
1
11
16
17namespace MaterialPropertyLib
18{
19//
20// For 1D problems
21//
22template <>
25 std::string name,
26 ParameterLib::CoordinateSystem const* const local_coordinate_system)
27 : local_coordinate_system_(local_coordinate_system)
28{
29 name_ = std::move(name);
30}
31
32template <>
34{
35 if (!std::holds_alternative<Medium*>(scale_))
36 {
38 "The property 'EffectiveThermalConductivityPorosityMixing' is "
39 "implemented on the 'medium' scale only.");
40 }
41}
42
43template <>
45 VariableArray const& variable_array,
46 ParameterLib::SpatialPosition const& pos, double const t,
47 double const dt) const
48{
49 auto const& medium = std::get<Medium*>(scale_);
50
51 // Assuming there is either a gas phase or a liquid phase or both.
52 auto const gas_phase =
53 medium->hasPhase("Gas") ? &medium->phase("Gas") : nullptr;
54 auto const liquid_phase = medium->hasPhase("AqueousLiquid")
55 ? &medium->phase("AqueousLiquid")
56 : nullptr;
57 // Assuming there is always a solid phase.
58 auto const& solid_phase = medium->phase("Solid");
59
60 auto const gas_thermal_conductivity =
61 gas_phase
62 ? gas_phase
63 ->property(
65 .template value<double>(variable_array, pos, t, dt)
66 : 0.;
67
68 auto const liquid_thermal_conductivity =
69 liquid_phase
70 ? liquid_phase
71 ->property(
73 .template value<double>(variable_array, pos, t, dt)
74 : 0.;
75
76 auto const solid_thermal_conductivity =
77 solid_phase
79 .template value<double>(variable_array, pos, t, dt);
80
81 auto const porosity = variable_array.porosity;
82 auto const S_L = variable_array.liquid_saturation;
83 auto const S_G = 1. - S_L;
84
85 auto const phi_G = porosity * S_G;
86 auto const phi_L = porosity * S_L;
87 auto const phi_S = 1. - porosity;
88
89 double const effective_thermal_conductivity =
90 phi_G * gas_thermal_conductivity + phi_L * liquid_thermal_conductivity +
91 phi_S * solid_thermal_conductivity;
92
93 return effective_thermal_conductivity;
94}
95template <>
98 double const, double const) const
99{
100 OGS_FATAL(
101 "dValue is not implemented for "
102 "EffectiveThermalConductivityPorosityMixing");
103}
104//
105// For 2D and 3D problems
106//
107template <int GlobalDim>
110 std::string name,
111 ParameterLib::CoordinateSystem const* const local_coordinate_system)
112 : local_coordinate_system_(local_coordinate_system)
113{
114 name_ = std::move(name);
115}
116
117template <int GlobalDim>
119{
120 if (!std::holds_alternative<Medium*>(scale_))
121 {
122 OGS_FATAL(
123 "The property 'EffectiveThermalConductivityPorosityMixing' is "
124 "implemented on the 'medium' scale only.");
125 }
126}
127
128template <int GlobalDim>
130 VariableArray const& variable_array,
131 ParameterLib::SpatialPosition const& pos, double const t,
132 double const dt) const
133{
134 auto const& medium = std::get<Medium*>(scale_);
135 // Assuming there is either a gas phase or a liquid phase or both.
136 auto const gas_phase =
137 medium->hasPhase("Gas") ? &medium->phase("Gas") : nullptr;
138 auto const liquid_phase = medium->hasPhase("AqueousLiquid")
139 ? &medium->phase("AqueousLiquid")
140 : nullptr;
141 // Assuming there is always a solid phase.
142 auto const& solid_phase = medium->phase("Solid");
143
144 auto const gas_thermal_conductivity =
145 gas_phase
146 ? gas_phase
147 ->property(
149 .template value<double>(variable_array, pos, t, dt)
150 : 0.;
151
152 auto const liquid_thermal_conductivity =
153 liquid_phase
154 ? liquid_phase
155 ->property(
157 .template value<double>(variable_array, pos, t, dt)
158 : 0.;
159
160 auto solid_thermal_conductivity = formEigenTensor<GlobalDim>(
161 solid_phase
163 .value(variable_array, pos, t, dt));
164
165 auto const porosity = variable_array.porosity;
166
167 auto const S_L = variable_array.liquid_saturation;
168 auto const S_G = 1. - S_L;
169
170 auto const phi_G = porosity * S_G;
171 auto const phi_L = porosity * S_L;
172 auto const phi_S = 1. - porosity;
173
174 // Local coordinate transformation is only applied for the case that the
175 // initial solid thermal conductivity is given with orthotropic assumption.
176 if (local_coordinate_system_ &&
177 (solid_thermal_conductivity.cols() == GlobalDim))
178 {
179 solid_thermal_conductivity =
180 local_coordinate_system_->rotateTensor<GlobalDim>(
181 solid_thermal_conductivity, pos);
182 }
183 auto const I = Eigen::Matrix<double, GlobalDim, GlobalDim>::Identity();
184 Eigen::Matrix<double, GlobalDim, GlobalDim> const
185 effective_thermal_conductivity = (phi_G * gas_thermal_conductivity +
186 phi_L * liquid_thermal_conductivity) *
187 I +
188 phi_S * solid_thermal_conductivity;
189 return effective_thermal_conductivity;
190}
191
192template <int GlobalDim>
195 double const, double const) const
196{
197 OGS_FATAL(
198 "dValue is not implemented for "
199 "EffectiveThermalConductivityPorosityMixing");
200}
203} // namespace MaterialPropertyLib
#define OGS_FATAL(...)
Definition Error.h:26
EffectiveThermalConductivityPorosityMixing(std::string name, ParameterLib::CoordinateSystem const *const local_coordinate_system)
PropertyDataType dValue(VariableArray const &variable_array, Variable const variable, ParameterLib::SpatialPosition const &pos, double const t, double const dt) const override
virtual PropertyDataType value() const
Definition Property.cpp:76
Eigen::Matrix< double, GlobalDim, GlobalDim > formEigenTensor(MaterialPropertyLib::PropertyDataType const &values)
std::variant< double, Eigen::Matrix< double, 2, 1 >, Eigen::Matrix< double, 3, 1 >, Eigen::Matrix< double, 2, 2 >, Eigen::Matrix< double, 3, 3 >, Eigen::Matrix< double, 4, 1 >, Eigen::Matrix< double, 6, 1 >, Eigen::MatrixXd > PropertyDataType
Definition Property.h:31
A local coordinate system used for tensor transformations.