include/meltpooldg/phase_change/evaporative_cooling.templates.hpp Source File

Developer Documentation: include/meltpooldg/phase_change/evaporative_cooling.templates.hpp Source File
Developer Documentation
evaporative_cooling.templates.hpp
Go to the documentation of this file.
1#pragma once
2
5//
6#include <deal.II/base/exceptions.h>
7
12
14{
15 template <typename number>
16 EvaporativeCooling<number>::EvaporativeCooling(const EvaporationData<number> &evapor_data,
17 const MaterialData<number> &material_data,
18 const bool setup_internal_mass_flux_operator)
19 : do_phenomenological_recoil_pressure(
20 evapor_data.evaporative_cooling.consider_enthalpy_transport_vapor_mass_flux == "true")
21 , latent_heat_of_evaporation(material_data.latent_heat_of_evaporation)
22 , specific_heat_capacity(material_data.liquid.specific_heat_capacity)
23 , specific_enthalpy_reference_temperature(material_data.specific_enthalpy_reference_temperature)
24 , boiling_temperature(material_data.boiling_temperature)
25 , ramp_enabled(evapor_data.evaporative_cooling.enable_linear_activation_ramp)
26 {
29 dealii::ExcMessage(
30 "For the phenomenological recoil pressure model, the reference temperature "
31 "for computing the specific enthalpy must be specified. Abort..."));
32
33 if (setup_internal_mass_flux_operator)
34 {
35 if (evapor_data.evaporative_mass_flux_model == EvaporationModelType::recoil_pressure)
36 {
37 mass_flux_operator = std::make_unique<EvaporationModelRecoilPressure<number>>(
38 evapor_data.recoil,
39 material_data.boiling_temperature,
40 material_data.molar_mass,
41 material_data.latent_heat_of_evaporation);
42 }
43 else if (evapor_data.evaporative_mass_flux_model ==
44 EvaporationModelType::saturated_vapor_pressure)
45 {
46 mass_flux_operator = std::make_unique<EvaporationModelSaturatedVaporPressure<number>>(
47 evapor_data.recoil,
48 material_data.boiling_temperature,
49 material_data.molar_mass,
50 material_data.latent_heat_of_evaporation);
51 }
52 else if (evapor_data.evaporative_mass_flux_model == EvaporationModelType::pressure_aware)
53 {
54 mass_flux_operator = std::make_unique<EvaporationModelPressureAware<number>>(
55 evapor_data.pressure_aware,
56 material_data.boiling_temperature,
57 material_data.latent_heat_of_evaporation);
58 }
59 else
60 {
61 AssertThrow(false, dealii::ExcNotImplemented());
62 }
63
64
65 if (numbers::is_invalid(evapor_data.evaporative_cooling.activation_temperature))
66 {
67 // Set the activation temperature so that the transition from the linear activation ramp
68 // is kink-free.
70 material_data.boiling_temperature -
73 material_data.boiling_temperature);
74 }
75
76 if (ramp_enabled)
77 {
81 }
82 }
83 }
84
85
86 template <typename number>
87 template <typename ValueType>
88 inline ValueType
90 const ValueType &mass_flux,
91 [[maybe_unused]] const ValueType &temperature) const
92 {
93 ValueType specific_enthalpy(0.0);
94 if (do_phenomenological_recoil_pressure)
95 specific_enthalpy = compute_phenomenological_specific_enthalpy(temperature);
96
97 return -(latent_heat_of_evaporation + specific_enthalpy) * mass_flux;
98 }
99
100
101 template <typename number>
102 inline number
104 {
105 Assert(mass_flux_operator,
106 dealii::ExcMessage("To use this function, the class must be constructed with "
107 "setup_internal_mass_flux_operator = true."));
108
109 if (temperature < activation_temperature)
110 return 0.0;
111 else if (temperature >= boiling_temperature or not ramp_enabled)
112 return compute_evaporative_cooling(
113 mass_flux_operator->local_compute_evaporative_mass_flux(temperature), temperature);
114 else
115 // linear activation ramp
116 return activation_ramp_derivative * (temperature - activation_temperature);
117 }
118
119
120 template <typename number>
121 dealii::VectorizedArray<number>
123 const dealii::VectorizedArray<number> &temperature) const
124 {
125 Assert(mass_flux_operator,
126 dealii::ExcMessage("To use this function, the class must be constructed with "
127 "setup_internal_mass_flux_operator = true."));
128
129 return dealii::compare_and_apply_mask<dealii::SIMDComparison::less_than>(
130 temperature,
131 activation_temperature,
132 0,
133 dealii::compare_and_apply_mask<dealii::SIMDComparison::greater_than_or_equal>(
134 temperature,
135 ramp_enabled ? boiling_temperature : activation_temperature,
136 compute_evaporative_cooling(
137 mass_flux_operator->local_compute_evaporative_mass_flux_vec(temperature), temperature),
138 activation_ramp_derivative * (temperature - activation_temperature)));
139 }
140
141
142 template <typename number>
143 template <typename ValueType>
144 inline ValueType
146 [[maybe_unused]] const ValueType &mass_flux) const
147 {
148 if (do_phenomenological_recoil_pressure)
149 return -specific_heat_capacity * mass_flux;
150 else
151 return 0.0;
152 }
153
154
155 template <typename number>
156 inline number
159 const number temperature) const
160 {
161 Assert(mass_flux_operator,
162 dealii::ExcMessage("To use this function, the class must be constructed with "
163 "setup_internal_mass_flux_operator = true."));
164
165 if (temperature < activation_temperature)
166 return 0.0;
167 else if (temperature >= boiling_temperature or not ramp_enabled)
168 {
169 const auto mass_flux_derivative =
170 mass_flux_operator->local_compute_evaporative_mass_flux_derivative(temperature);
171 if (do_phenomenological_recoil_pressure)
172 return -specific_heat_capacity *
173 mass_flux_operator->local_compute_evaporative_mass_flux(temperature) -
174 (latent_heat_of_evaporation +
175 compute_phenomenological_specific_enthalpy(temperature)) *
176 mass_flux_derivative;
177 else
178 return -specific_heat_capacity * mass_flux_derivative;
179 }
180 else
181 return activation_ramp_derivative;
182 }
183
184
185 template <typename number>
186 dealii::VectorizedArray<number>
189 const dealii::VectorizedArray<number> &temperature) const
190 {
191 Assert(mass_flux_operator,
192 dealii::ExcMessage("To use this function, the class must be constructed with "
193 "setup_internal_mass_flux_operator = true."));
194
195 return dealii::compare_and_apply_mask<dealii::SIMDComparison::less_than>(
196 temperature,
197 activation_temperature,
198 0,
199 dealii::compare_and_apply_mask<dealii::SIMDComparison::greater_than_or_equal>(
200 temperature,
201 ramp_enabled ? boiling_temperature : activation_temperature,
202 (do_phenomenological_recoil_pressure) ?
203 -specific_heat_capacity *
204 mass_flux_operator->local_compute_evaporative_mass_flux_vec(temperature) -
205 (latent_heat_of_evaporation + compute_phenomenological_specific_enthalpy(temperature)) *
206 mass_flux_operator->local_compute_evaporative_mass_flux_vec_derivative(temperature) :
207 -specific_heat_capacity *
208 mass_flux_operator->local_compute_evaporative_mass_flux_vec_derivative(temperature),
209 activation_ramp_derivative));
210 }
211
212 template <typename number>
213 template <typename ValueType>
214 inline ValueType
216 const ValueType &temperature) const
217 {
218 return specific_heat_capacity * (temperature - specific_enthalpy_reference_temperature);
219 }
220
221} // namespace MeltPoolDG::Evaporation
const bool do_phenomenological_recoil_pressure
Definition evaporative_cooling.hpp:132
number activation_temperature
Definition evaporative_cooling.hpp:137
EvaporativeCooling(const EvaporationData< number > &evapor_data, const MaterialData< number > &material_data, const bool setup_internal_mass_flux_operator=false)
Definition evaporative_cooling.templates.hpp:16
number compute_evaporative_cooling_derivative_with_temperature_dependent_mass_flux(const number temperature) const
Definition evaporative_cooling.templates.hpp:158
ValueType compute_phenomenological_specific_enthalpy(const ValueType &temperature) const
Definition evaporative_cooling.templates.hpp:215
number activation_ramp_derivative
Definition evaporative_cooling.hpp:139
std::unique_ptr< EvaporationModelBase< number > > mass_flux_operator
Definition evaporative_cooling.hpp:140
ValueType compute_evaporative_cooling_derivative_constant_mass_flux(const ValueType &mass_flux) const
Definition evaporative_cooling.templates.hpp:145
ValueType compute_evaporative_cooling(const ValueType &mass_flux, const ValueType &temperature) const
Definition evaporative_cooling.templates.hpp:89
const number specific_enthalpy_reference_temperature
Definition evaporative_cooling.hpp:135
bool ramp_enabled
Definition evaporative_cooling.hpp:138
Definition evaporation_data.hpp:15
bool is_invalid(const double &number)
Definition numbers.hpp:16
Definition material_data.hpp:84
number molar_mass
Definition material_data.hpp:109
number boiling_temperature
Definition material_data.hpp:107
number latent_heat_of_evaporation
Definition material_data.hpp:108