OGS
ThermalConductivity.cpp
Go to the documentation of this file.
1
10#include "ThermalConductivity.h"
11
13
14namespace ProcessLib::TH2M
15{
16namespace ConstitutiveRelations
17{
18template <int DisplacementDim>
20 SpaceTimeData const& x_t, MediaData const& media_data,
21 TemperatureData const& T_data, PorosityData const& porosity_data,
22 SaturationData const& S_L_data,
23 ThermalConductivityData<DisplacementDim>& thermal_conductivity_data) const
24{
25 namespace MPL = MaterialPropertyLib;
26 MPL::VariableArray variables;
27 variables.temperature = T_data.T;
28 variables.porosity = porosity_data.phi;
29 variables.liquid_saturation = S_L_data.S_L;
30
31 auto const& mpl_thermal_conductivity =
32 media_data.medium[MPL::PropertyType::thermal_conductivity];
33
34 thermal_conductivity_data.lambda = MPL::formEigenTensor<DisplacementDim>(
35 mpl_thermal_conductivity.value(variables, x_t.x, x_t.t, x_t.dt));
36}
37
38template <int DisplacementDim>
40 SpaceTimeData const& x_t, MediaData const& media_data,
41 TemperatureData const& T_data, PorosityData const& porosity_data,
42 PorosityDerivativeData const& porosity_d_data,
43 SaturationData const& S_L_data,
45 thermal_conductivity_d_data) const
46{
47 namespace MPL = MaterialPropertyLib;
48 MPL::VariableArray variables;
49 variables.temperature = T_data.T;
50 variables.porosity = porosity_data.phi;
51 variables.liquid_saturation = S_L_data.S_L;
52
53 // Derivatives computed here and not in the MPL property because various
54 // derivatives are not available in the VariableArray.
55
56 auto const lambdaGR =
57 media_data.gas.hasProperty(MPL::PropertyType::thermal_conductivity)
59 media_data.gas[MPL::PropertyType::thermal_conductivity].value(
60 variables, x_t.x, x_t.t, x_t.dt))
62
63 auto const dlambda_GR_dT =
64 media_data.gas.hasProperty(MPL::PropertyType::thermal_conductivity)
66 media_data.gas[MPL::PropertyType::thermal_conductivity]
67 .dValue(variables, MPL::Variable::temperature, x_t.x,
68 x_t.t, x_t.dt))
70
71 auto const lambdaLR =
72 media_data.liquid.hasProperty(MPL::PropertyType::thermal_conductivity)
74 media_data.liquid[MPL::PropertyType::thermal_conductivity]
75 .value(variables, x_t.x, x_t.t, x_t.dt))
77
78 auto const dlambda_LR_dT =
79 media_data.liquid.hasProperty(MPL::PropertyType::thermal_conductivity)
81 media_data.liquid[MPL::PropertyType::thermal_conductivity]
82 .dValue(variables, MPL::Variable::temperature, x_t.x,
83 x_t.t, x_t.dt))
85
86 auto const lambdaSR =
87 media_data.solid.hasProperty(MPL::PropertyType::thermal_conductivity)
89 media_data.solid[MPL::PropertyType::thermal_conductivity]
90 .value(variables, x_t.x, x_t.t, x_t.dt))
92
93 auto const dlambda_SR_dT =
94 media_data.solid.hasProperty(MPL::PropertyType::thermal_conductivity)
96 media_data.solid[MPL::PropertyType::thermal_conductivity]
97 .dValue(variables, MPL::Variable::temperature, x_t.x,
98 x_t.t, x_t.dt))
100
101 thermal_conductivity_d_data.dlambda_dp_cap =
102 -porosity_d_data.dphi_L_dp_cap * lambdaGR +
103 porosity_d_data.dphi_L_dp_cap * lambdaLR;
104
105 double const phi_L = S_L_data.S_L * porosity_data.phi;
106 double const phi_G = (1. - S_L_data.S_L) * porosity_data.phi;
107 double const phi_S = 1. - porosity_data.phi;
108
109 // Assuming dS_L/dT = 0, then:
110 // dphi_G_dT = -dS_L/dT * phi + (1 - S_L) * dphi_dT = (1 - S_L) * dphi_dT
111 // dphi_L_dT = dS_L/dT * phi + S_L * dphi_dT S_L * dphi_dT
112 // dphi_S_dT = -dphi_dT -dphi_dT
113 thermal_conductivity_d_data.dlambda_dT =
114 (1 - S_L_data.S_L) * porosity_d_data.dphi_dT * lambdaGR +
115 phi_G * dlambda_GR_dT +
116 S_L_data.S_L * porosity_d_data.dphi_dT * lambdaLR +
117 +phi_L * dlambda_LR_dT - porosity_d_data.dphi_dT * lambdaSR +
118 phi_S * dlambda_SR_dT;
119}
120
121template struct ThermalConductivityModel<2>;
122template struct ThermalConductivityModel<3>;
123} // namespace ConstitutiveRelations
124} // namespace ProcessLib::TH2M
bool hasProperty(PropertyType const &p) const
Definition Phase.cpp:69
Eigen::Matrix< double, GlobalDim, GlobalDim > formEigenTensor(MaterialPropertyLib::PropertyDataType const &values)
ParameterLib::SpatialPosition x
Definition Base.h:74
MaterialPropertyLib::Medium const & medium
Definition Base.h:45
MaterialPropertyLib::Phase const & solid
Definition Base.h:46
MaterialPropertyLib::Phase const & liquid
Definition Base.h:47
MaterialPropertyLib::Phase const & gas
Definition Base.h:48
void dEval(SpaceTimeData const &x_t, MediaData const &media_data, TemperatureData const &T_data, PorosityData const &porosity_data, PorosityDerivativeData const &porosity_d_data, SaturationData const &S_L_data, ThermalConductivityDerivativeData< DisplacementDim > &thermal_conductivity_d_data) const
void eval(SpaceTimeData const &x_t, MediaData const &media_data, TemperatureData const &T_data, PorosityData const &porosity_data, SaturationData const &S_L_data, ThermalConductivityData< DisplacementDim > &thermal_conductivity_data) const