OGS
PhaseTransitionNone.cpp
Go to the documentation of this file.
1 
10 #include "PhaseTransitionNone.h"
11 
13 
14 namespace ProcessLib
15 {
16 namespace TH2M
17 {
19  std::map<int, std::shared_ptr<MaterialPropertyLib::Medium>> const& media)
20  : PhaseTransitionModel(media)
21 {
22  DBUG("Create PhaseTransitionNone constitutive model.");
23 
24  // check for minimum requirement definitions in media object
25  std::array const required_gas_properties = {
28  std::array const required_liquid_properties = {
30 
31  for (auto const& m : media)
32  {
33  checkRequiredProperties(m.second->phase("Gas"),
34  required_gas_properties);
35  checkRequiredProperties(m.second->phase("AqueousLiquid"),
36  required_liquid_properties);
37  }
38 }
39 
41  PhaseTransitionModelVariables const& phase_transition_model_variables,
42  const MaterialPropertyLib::Medium* medium,
44  ParameterLib::SpatialPosition pos, double const t, double const dt) const
45 {
46  // primary variables
47  auto const pGR = std::get<double>(variables[static_cast<int>(
49  auto const T = std::get<double>(variables[static_cast<int>(
51 
52  auto const& liquid_phase = medium->phase("AqueousLiquid");
53  auto const& gas_phase = medium->phase("Gas");
54 
55  // copy previous state before modification.
56  PhaseTransitionModelVariables cv = phase_transition_model_variables;
57 
58  // C-component is only component in the gas phase
59  cv.xnCG = 1.;
60  cv.xmCG = 1.;
61 
62  auto const M =
64  .template value<double>(variables, pos, t, dt);
65 
66  variables[static_cast<int>(MaterialPropertyLib::Variable::molar_mass)] = M;
67 
69  .template value<double>(variables, pos, t, dt);
71  .template value<double>(variables, pos, t, dt);
72  cv.lambdaGR =
73  gas_phase
75  .template value<double>(variables, pos, t, dt);
76 
77  cv.rhoCGR = cv.rhoGR;
78 
79  // W-component is only component in the liquid phase
80  cv.xmWL = 1.;
81 
82  cv.rhoLR = liquid_phase.property(MaterialPropertyLib::PropertyType::density)
83  .template value<double>(variables, pos, t, dt);
84 
85  cv.muLR =
87  .template value<double>(variables, pos, t, dt);
88 
89  cv.lambdaLR =
90  liquid_phase
92  .template value<double>(variables, pos, t, dt);
93 
94  cv.rhoWLR = cv.rhoLR;
95 
96  // specific heat capacities
97  auto const cpG =
98  gas_phase
100  .template value<double>(variables, pos, t, dt);
101 
102  auto const cpL =
103  liquid_phase
105  .template value<double>(variables, pos, t, dt);
106 
107  // specific phase enthalpies
108  cv.hG = cpG * T;
109  cv.hL = cpL * T;
110  cv.dh_G_dT = cpG;
111  cv.dh_L_dT = cpL;
112 
113  // specific inner energies
114  cv.uG = cv.hG - pGR / cv.rhoGR;
115  cv.uL = cv.hL;
116 
117  auto const drho_GR_dT =
119  .template dValue<double>(variables,
121  pos, t, dt);
122  cv.du_G_dT = cpG + pGR * drho_GR_dT / cv.rhoGR / cv.rhoGR;
123 
124  cv.du_L_dT = cpL;
125 
126  cv.drho_GR_dp_GR =
128  .template dValue<double>(
130  t, dt);
131  cv.drho_LR_dp_LR =
133  .template dValue<double>(
135  pos, t, dt);
137 
138  cv.du_G_dp_GR =
139  -1 / cv.rhoGR + pGR * cv.drho_GR_dp_GR / cv.rhoGR / cv.rhoGR;
140 
142  cv.drho_C_LR_dp_LR = 0;
143  cv.drho_C_LR_dp_GR = 0;
144  cv.drho_C_GR_dT = drho_GR_dT;
145 
146  auto const drho_LR_dT =
148  .template dValue<double>(variables,
150  pos, t, dt);
151  cv.drho_C_LR_dT = 0;
152 
153  cv.du_L_dp_GR = 0;
154  cv.du_L_dp_cap = 0;
155  /* TODO update to the following when uL has same structure as the uG:
156  +-1 / cv.rhoLR + pLR * cv.drho_LR_dp_cap / cv.rhoLR / cv.rhoLR;
157  */
158 
161  cv.drho_W_LR_dT = drho_LR_dT;
162  cv.drho_W_GR_dT = 0;
163  cv.drho_W_GR_dp_GR = 0;
164  cv.drho_W_GR_dp_cap = 0;
165  return cv;
166 }
167 } // namespace TH2M
168 } // namespace ProcessLib
void DBUG(char const *fmt, Args const &... args)
Definition: Logging.h:27
Phase const & phase(std::size_t index) const
Definition: Medium.cpp:30
std::array< VariableType, static_cast< int >(Variable::number_of_variables)> VariableArray
Definition: VariableType.h:108
void checkRequiredProperties(Component const &c, Container const &required_properties)
Definition: Component.h:96
PhaseTransitionNone(std::map< int, std::shared_ptr< MaterialPropertyLib::Medium >> const &media)
PhaseTransitionModelVariables updateConstitutiveVariables(PhaseTransitionModelVariables const &phase_transition_model_variables, const MaterialPropertyLib::Medium *medium, MaterialPropertyLib::VariableArray variables, ParameterLib::SpatialPosition pos, double const t, double const dt) const override