TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Flux_2groupes_PolyMAC_MPFA.cpp
1/****************************************************************************
2* Copyright (c) 2024, CEA
3* All rights reserved.
4*
5* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8* 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
9*
10* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
11* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
12* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
13*
14*****************************************************************************/
15////////////////////////////////////////////////////////////////////////////////
16
17///Joseph L. Bottini, Taiyang Zhang, Caleb S. Brooks, Validation of two-group interfacial area transport equation in boiling flow,
18/// International Journal of Heat and Mass Transfer, 2024, https://doi.org/10.1016/j.ijheatmasstransfer.2024.125515
19
20////////////////////////////////////////////////////////////////////////////////
21
22#include <Op_Diff_Turbulent_PolyMAC_MPFA_Face.h>
23#include <Domaine_Cl_PolyMAC_family.h>
24#include <Neumann_paroi.h>
25#include <Flux_2groupes_PolyMAC_MPFA.h>
26#include <Viscosite_turbulente_base.h>
27#include <Aire_interfaciale.h>
28#include <Flux_2groupes_base.h>
29#include <Milieu_composite.h>
30#include <Pb_Multiphase.h>
31#include <Array_tools.h>
32#include <Matrix_tools.h>
33#include <math.h>
34#include <Changement_phase_base.h>
35#include <Sources.h>
36#include <Flux_parietal_base.h>
37#include <Flux_interfacial_PolyMAC_HFV.h>
38#include <Champ_Elem_PolyMAC_MPFA.h>
39#include <Champ_Face_PolyMAC_MPFA.h>
40#include <Champ_Face_base.h>
41#include <Domaine_PolyMAC_MPFA.h>
42
43Implemente_instanciable(Flux_2groupes_PolyMAC_MPFA,"Flux_2groupes_elem_PolyMAC_MPFA", Source_base);
44
45Sortie& Flux_2groupes_PolyMAC_MPFA::printOn(Sortie& os) const { return os; }
46
48{
49
50 Param param(que_suis_je());
51 param.ajouter("Dh", &dh_);
52 param.lire_avec_accolades_depuis(is);
53
54 const Pb_Multiphase *pbm = sub_type(Pb_Multiphase, equation().probleme()) ? &ref_cast(Pb_Multiphase, equation().probleme()) : nullptr;
55
56 for (int n = 0; n < pbm->nb_phases(); n++) //recherche de n_l, n_g : phase {liquide,gaz}_continu en priorite
57 {
58 if (pbm->nom_phase(n).debute_par("liquide") && (n_l < 0 || pbm->nom_phase(n).finit_par("continu"))) n_l = n;
59 if (( pbm->nom_phase(n).finit_par("group1"))) n_g1 = n;
60 if (( pbm->nom_phase(n).finit_par("group2"))) n_g2 = n;
61 }
62 if (n_l < 0) Process::exit(que_suis_je() + " : liquid phase not found!");
63 if (n_g1 < 0) Process::exit(que_suis_je() + " : group 1 not found!");
64 if (n_g2 < 0) Process::exit(que_suis_je() + " : group 2 not found!");
65
66 if (pbm->has_correlation("flux_2groupes")) correlation_ = pbm->get_correlation("flux_2groupes"); //correlation fournie par le bloc correlation
67 else Correlation_base::typer_lire_correlation(correlation_, *pbm, "flux_2groupes", is); //sinon -> on la lit
68
69 const Sources& les_sources_loc = pbm->equation(2).sources();
70 for (int j = 0 ; j<les_sources_loc.size(); j++)
71 {
72 if sub_type(Flux_interfacial_PolyMAC_HFV, les_sources_loc(j).valeur()) src_flux_interfacial_ = les_sources_loc(j).valeur();
73 }
74
75 return is;
76}
77
78void Flux_2groupes_PolyMAC_MPFA::dimensionner_blocs(matrices_t matrices, const tabs_t& semi_impl) const
79{
80 const Domaine_PolyMAC_MPFA& domaine = ref_cast(Domaine_PolyMAC_MPFA, equation().domaine_dis());
81 const int ne = domaine.nb_elem(), ne_tot = domaine.nb_elem_tot(), N = equation().inconnue().valeurs().line_size();
82
83 for (auto &&n_m : matrices)
84 if (n_m.first == "temperature" || n_m.first == "pression" || n_m.first == "alpha" || n_m.first == "interfacial_area" )
85 {
86 Matrice_Morse& mat = *n_m.second, mat2;
87 const DoubleTab& dep = equation().probleme().get_champ(n_m.first.c_str()).valeurs();
88 int nc = dep.dimension_tot(0),
89 M = dep.line_size();
90 Stencil sten(0, 2);
91 if (n_m.first == "alpha")
92 for (int e = 0; e < ne; e++)
93 for (int n = 0; n < N; n++) sten.append_line(N * e + n, N * e + n);
94 if (n_m.first == "interfacial_area" || n_m.first == "temperature") // N <= M
95 for (int e = 0; e < ne; e++)
96 for (int n = 0; n < N; n++) sten.append_line(N * e + n, M * e + n);
97 if (n_m.first == "pression" )
98 for (int e = 0; e < ne; e++)
99 for (int n = 0, m = 0; n < N; n++, m+=(M>1)) sten.append_line(N * e + n, M * e + m);
100
101 Matrix_tools::allocate_morse_matrix(N * ne_tot, M * nc, sten, mat2);
102 mat.nb_colonnes() ? mat += mat2 : mat = mat2;
103 }
104
105}
106
107
108void Flux_2groupes_PolyMAC_MPFA::ajouter_blocs(matrices_t matrices, DoubleTab& secmem, const tabs_t& semi_impl) const
109{
110 const Pb_Multiphase& pbm = ref_cast(Pb_Multiphase, equation().probleme());
111 const Milieu_composite& milc = ref_cast(Milieu_composite, equation().milieu());
112 const Domaine_PolyMAC_MPFA& domaine = ref_cast(Domaine_PolyMAC_MPFA, equation().domaine_dis());
113 const DoubleVect& pe = milc.porosite_elem(), &ve = domaine.volumes();
114 const Champ_base& ch_rho = milc.masse_volumique();
116 const Champ_Inc_base *pch_rho = sub_type(Champ_Inc_base, ch_rho) ? &ref_cast(Champ_Inc_base, ch_rho) : nullptr;
117 const IntTab& el_f = domaine.elem_faces(), &fcl = ch.fcl(), &f_e = domaine.face_voisins();
119
120 const DoubleTab& inco = equation().inconnue().valeurs(),
121 &alpha = pbm.equation_masse().inconnue().valeurs(),
122 &alpha_p = pbm.equation_masse().inconnue().passe(),
123 &ai = equation().probleme().get_champ("interfacial_area").passe(),
124 &press = ref_cast(QDM_Multiphase,pbm.equation_qdm()).pression().valeurs(),
125 &press_p = ref_cast(QDM_Multiphase,pbm.equation_qdm()).pression().passe(),
126 &temp_p = pbm.equation_energie().inconnue().passe(),
127 &rho = equation().milieu().masse_volumique().valeurs(),
128 &rho_p = equation().milieu().masse_volumique().passe(),
129 &d_b_p = equation().probleme().get_champ("diametre_bulles").passe(),
130 *k_turb = (equation().probleme().has_champ("k")) ? &equation().probleme().get_champ("k").passe() : nullptr ,
131 &lambda = milc.conductivite().passe(),
132 &Cp = milc.capacite_calorifique().passe(),
133 &mu_p = milc.viscosite_dynamique().passe();
134
135
136 Matrice_Morse *Mp = matrices.count("pression") ? matrices.at("pression") : nullptr,
137 *Mt = matrices.count("temperature") ? matrices.at("temperature") : nullptr,
138 *Ma = matrices.count("alpha") ? matrices.at("alpha") : nullptr,
139 *Mai = matrices.count("interfacial_area") ? matrices.at("interfacial_area") : nullptr;
140
141
142 const int N = inco.line_size(), Np = press.line_size(), Nk = (k_turb) ? (*k_turb).line_size() : -1, D = dimension;
143 int n, k, e, d;
144 const int cR = (rho_p.dimension_tot(0) == 1), cM = (mu_p.dimension_tot(0) == 1), cL = (lambda.dimension_tot(0) == 1), cCp = (Cp.dimension_tot(0) == 1) ;
145
146 const Flux_2groupes_base& correlation_flux = ref_cast(Flux_2groupes_base, correlation_.valeur());
147
148 double pas_tps = equation().probleme().schema_temps().pas_de_temps();
149
150
151 DoubleTrav epsilon(alpha);
152 const Op_Diff_Turbulent_PolyMAC_MPFA_Face& op_diff = ref_cast(Op_Diff_Turbulent_PolyMAC_MPFA_Face, equation().probleme().equation(0).operateur(0).l_op_base());
153 const Viscosite_turbulente_base& visc_turb = ref_cast(Viscosite_turbulente_base, op_diff.correlation());
154 visc_turb.eps(epsilon);
155
160
161 in_coeffs.n_g1 = n_g1, in_therms.n_g1 = n_g1;
162 in_coeffs.n_g2=n_g2, in_therms.n_g2=n_g2;
163 in_coeffs.n_l=n_l, in_therms.n_l=n_l;
164
165 in_coeffs.alpha.resize(N), in_coeffs.p.resize(N) , in_coeffs.rho.resize(N) , in_coeffs.mu.resize(N) , in_coeffs.d_bulles.resize(N) , in_coeffs.sigma.resize(N, N) , in_coeffs.epsilon.resize(Nk) , in_coeffs.k_turb.resize(Nk) , in_coeffs.nv.resize(N, N), in_coeffs.a_i.resize(N) ;
166 in_therms.alpha.resize(N), in_therms.T.resize(N), in_therms.p.resize(N) , in_therms.d_bulles.resize(N), in_therms.lambda.resize(N), in_therms.mu.resize(N), in_therms.rho.resize(N), in_therms.Cp.resize(N), in_therms.sigma.resize(N, N);
167
168 out_coeffs.gamma.resize(N, N), out_coeffs.da_gamma.resize(N, N),out_coeffs.dai_gamma.resize(N, N);
169 out_therms.dT_G1.resize(N), out_therms.dT_G2.resize(N) , out_therms.da_G1.resize(N), out_therms.da_G2.resize(N) , out_therms.dT_etaph1.resize(N) , out_therms.dT_etaph2.resize(N) , out_therms.da_etaph1.resize(N), out_therms.da_etaph2.resize(N) ;
170
171
172
173 // fill velocity at elem tab
174 DoubleTab pvit_elem(0, N * D);
175 domaine.domaine().creer_tableau_elements(pvit_elem);
176 const Champ_Face_base& ch_vit = ref_cast(Champ_Face_base,ref_cast(Pb_Multiphase, equation().probleme()).equation_qdm().inconnue());
177 ch_vit.get_elem_vector_field(pvit_elem);
178
179 const double fac_sec = 1.e4; // numerical security factor
180
181
182 for (e = 0; e < domaine.nb_elem(); e++)
183 {
184 // Get field values for correlations-------------------------------------------------------------------------------------------------------------------------------------------------------
185
186 for (in_coeffs.nv =0, d = 0; d < D; d++)
187 for ( n = 0; n < N; n++)
188 for (k = 0 ; k<N ; k++) in_coeffs.nv(n, k) += (pvit_elem(e, N * d + n) - ((n!=k) ? pvit_elem(e, N * d + k) : 0)) * (pvit_elem(e, N * d + n) - ((n!=k) ? pvit_elem(e, N * d + k) : 0)); // nv(n,n) = ||v(n)||, nv(n, k!=n) = ||v(n)-v(k)||
189 for (n = 0; n < N; n++)
190 for ( k = 0 ; k<N ; k++) in_coeffs.nv(n, k) = sqrt(in_coeffs.nv(n, k)) ;
191 /* arguments de coeff */
192 for (n = 0; n < N; n++)
193 {
194 in_coeffs.alpha[n] = alpha_p(e, n), in_therms.alpha[n] = alpha_p(e, n) ;
195 in_coeffs.p[n] = press_p(e, n * (Np > 1)), in_therms.p[n] = press_p(e, n * (Np > 1));
196 in_therms.T[n] = temp_p(e, n);
197 in_therms.lambda[n] = lambda(!cL * e, n) ;
198 in_therms.Cp[n] = Cp(!cCp * e, n) ;
199 in_coeffs.rho[n] = rho_p(!cR * e, n), in_therms.rho[n] = rho_p(!cR * e, n) ;
200 in_coeffs.mu[n] = mu_p(!cM * e, n), in_therms.mu[n] = mu_p(!cM * e, n);
201 in_coeffs.d_bulles[n] = d_b_p(e,n), in_therms.d_bulles[n] = d_b_p(e,n) ;
202 in_coeffs.a_i[n] = std::max(ai(e,n),0.) ;
203 for (k = 0; k < N; k++)
204 {
205 if(milc.has_interface(n, k))
206 {
207 Interface_base& sat = milc.get_interface(n, k);
208 in_coeffs.sigma(n,k) = sat.sigma(temp_p(e,n), press_p(e,n * (Np > 1)));
209 }
210 else if (milc.has_saturation(n, k))
211 {
212 Saturation_base& z_sat = milc.get_saturation(n, k);
213
214 DoubleTab& sig = z_sat.get_sigma_tab();
215 in_coeffs.sigma(n,k) = sig(e);
216 in_therms.sigma(n,k) = sig(e);
217
218 }
219 }
220 }
221 for (n = 0; n < Nk; n++)
222 {
223 in_coeffs.epsilon[n] = epsilon(e, n) ;
224 in_coeffs.k_turb[n] = (k_turb) ? (*k_turb)(e,n) : 0;
225 }
226
227 // Initialisation-----------------------------------------------------------------------------------------------------
228
229 double bilaninterg1 = 0. ;
230 double bilaninterg2 = 0. ;
231 double dag1_bilaninterg1 = 0. ;
232 double dag2_bilaninterg2 = 0. ;
233
234
235 if (milc.has_saturation(n_l, n_g1)) // If eos exit we can compute thermal effects
236 {
237
238 Saturation_base& sat1 = milc.get_saturation(n_l, n_g1);
239 Saturation_base& sat2 = milc.get_saturation(n_l, n_g2);
240
241 in_therms.Lvap = sat1.Lvap(press_p(e,n_l * (Np > 1))) ;
242 in_therms.hlsat = sat1.Hls(press_p(e,n_l * (Np > 1)));
243 in_therms.Tsatg1= sat1.Tsat( press_p(e,n_l * (Np > 1))) ;
244 in_therms.Tsatg2 = sat2.Tsat(press_p(e,n_l * (Np > 1))) ;
245 in_therms.dp_Tsat1= sat1.dP_Tsat(press_p(e,n_l * (Np > 1))) ;
246 in_therms.dp_Tsat2 = sat2.dP_Tsat(press_p(e,n_l * (Np > 1))) ;
247 in_therms.qp = 0. ;
248 for (int j = 0; j < int( el_f.dimension(1) ); j++)
249 {
250 int fb = el_f(e, j);
251 if (fb < 0) continue;
252
253 int el = f_e(fb, 1);
254 if (el < 0)
255 {
256 if (fcl(fb,0) == 4)
257 {
258 in_therms.qp = ref_cast(Neumann_paroi, cls[fcl(fb, 1)].valeur()).flux_impose(fcl(fb, 2), 0); // Get wall heat
259 }
260 }
261 }
262
263 // Get correlations for thermal effects-----------------------------------------------------------------------------------------------------------------------------------------------------
264
265 correlation_flux.therm(in_therms, out_therms);
266
267 // Thermal exchange balance for each group-------------------------------------------------------------------------------------------------------------------------------------------------
268
269 bilaninterg1 = out_therms.G1/rho(e, n_g1) - out_therms.etaph1 - alpha(e, n_g1) * ( 1. - rho_p(e, n_g1)/rho(e, n_g1))/pas_tps; // for group 1
270 bilaninterg2 = out_therms.G2/rho(e, n_g1) - out_therms.etaph2 - alpha(e, n_g2) * ( 1. - rho_p(e, n_g2)/rho(e, n_g2))/pas_tps ; // for group 2
271 dag1_bilaninterg1 = (bilaninterg1> 0.) ? out_therms.da_G1(n_g1)/rho(e, n_g1) - out_therms.da_etaph1(n_g1) - ( 1. - rho_p(e, n_g1)/rho(e, n_g1))/pas_tps : 0. ; // void fraction variations
272 dag2_bilaninterg2 = (0.> bilaninterg2) ? out_therms.da_G2(n_g2)/rho(e, n_g1) - out_therms.da_etaph2(n_g2) - ( 1. - rho_p(e, n_g2)/rho(e, n_g2))/pas_tps : 0. ; // void fraction variations
273
274
275 }
276
277
278
279 const double vol = pe(e) * ve(e) ;
280
281 in_coeffs.dh = dh_, in_coeffs.e = e, in_therms.dh = dh_ ;
282
283 // Get correlations for non thermal effects-----------------------------------------------------------------------------------------------------------------------------------------------
284
285 correlation_flux.coeffs(in_coeffs, out_coeffs);
286
287
288// Mass balance equation-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
289 if (sub_type(Masse_Multiphase, equation()))
290 {
291
292 // Interphase transfer between group 1 and group 2 : G 1->2 = G 2->1
293 // For group1
294
295 const double gammag1 = - rho(e, n_g1) * (out_coeffs.gamma(n_g1,n_g1) + out_coeffs.inter3g1 * std::max(bilaninterg1,0.) + out_coeffs.inter3g2 * std::min(bilaninterg2,0.) ) ;
296
297 // Physical/Numerical security because correlations are not asymptotically valid : 1 is ok, 0 is cancelled
298
299 double limg1 = 1.;
300 if (alpha(e, n_g1) < 1./fac_sec) // if not enough group 1
301 {
302
303 limg1 = (gammag1 < 0.) ? 0. : 1.;
304 }
305
306 // For group2
307
308 const double gammag2 = -gammag1 ;
309
310 // Physical/Numerical security because correlations are not asymptotically valid : 1 is ok, 0 is cancelled
311
312 double limg2 = 1. ;
313
314 if (alpha(e, n_g2) < 1./fac_sec) // if not enough group 2
315 {
316
317 limg2 = (gammag2 < 0.) ? 0. : 1.;
318 }
319
320
321 // Fill matrix with mass transfer---------------------------------------------------------------------------------------------------------------------------------------------------------
322
323 // Non-thermal mass tranfers : only between groups----------------------------------------------------------------------------------------------------------------------------
324
325 secmem(e, n_g1) += limg1 * vol * gammag1 ;// (alpha1, ai1, T, P) implicit dependance
326
327 secmem(e, n_g2) += limg2 * vol * gammag2 ;// (alpha2, ai2, T, P) implicit dependance
328
329 if (milc.has_saturation(n_l, n_g1))// If eos exit we can compute thermal effects----------------------------------------------------------------------------------------------
330 {
331 // Thermal mass transfers between gas and liquid
332
333 secmem(e, n_g1) += limg1 * vol * out_therms.G1 ;// (alpha1, T, P) implicit dependance
334
335 secmem(e, n_g2) += limg2 * vol * out_therms.G2 ;// (alpha2, T, P) implicit dependance
336
337 secmem(e, n_l) += - limg1 * vol * out_therms.G1 - limg2 * vol * out_therms.G2 ;// (alpha_l, T, P) implicit dependance
338
339 }
340
341 if (Ma) // void fraction dependance-------------------------------------------------------------------------------------------------------------------------------------------------------
342 {
343 // Non-thermal mass tranfers : only between groups----------------------------------------------------------------------------------------------------------------------------
344
345 (*Ma)(N * e + n_g1, N * e + n_g1) -= -limg1 * vol * rho(e, n_g1) * ( out_coeffs.da_gamma(n_g1,n_g1) + out_coeffs.inter3g1 * dag1_bilaninterg1 + out_coeffs.da_inter3g1 * std::max(bilaninterg1,0.) );
346
347 (*Ma)(N * e + n_g2, N * e + n_g2) -= limg2 * vol * rho(e, n_g1) * ( out_coeffs.da_gamma(n_g2,n_g2) + out_coeffs.inter3g2 * dag2_bilaninterg2 + out_coeffs.da_inter3g2 * std::max(bilaninterg2,0.) );
348
349
350 if (milc.has_saturation(n_l, n_g1)) // If eos exit we can compute thermal effects----------------------------------------------------------------------------------------------
351 {
352
353 (*Ma)(N * e + n_g1, N * e + n_g1) -= limg1 * vol * out_therms.da_G1(n_g1) ;
354
355 (*Ma)(N * e + n_g2, N * e + n_g2) -= limg2 * vol * out_therms.da_G2(n_g2) ;
356
357 (*Ma)(N * e + n_l, N * e + n_l) -= - limg1 * vol * out_therms.da_G1(n_l) - limg2 * vol * out_therms.da_G2(n_l) ;
358
359 }
360 }
361
362 if (Mai) // interfacial area dependance only for non thermal effects--------------------------------------------------------------------------------------------------------------------
363 {
364 // Non-thermal mass tranfers : only between groups----------------------------------------------------------------------------------------------------------------------------
365
366 (*Mai)(N * e + n_g1, N * e + n_g1) -= - limg1 * vol * rho(e, n_g1) * out_coeffs.dai_gamma(n_g1,n_g1);
367
368 (*Mai)(N * e + n_g2, N * e + n_g2) -= limg2 * vol * rho(e, n_g1) * out_coeffs.dai_gamma(n_g2,n_g2);
369
370 }
371
372 // (T,P) dependance only for thermal effects---------------------------------------------------------------------------------------------------------------------------------------------
373
374 if (milc.has_saturation(n_l, n_g1)) // If eos exit we can compute thermal effects----------------------------------------------------------------------------------------------
375 {
376 // dT : Temperature variations, dp : Pressure variations
377
378 const double dT_bilaninterg1 = (bilaninterg1> 0.) ? out_therms.dT_G1(n_g1)/rho(e, n_g1)- out_therms.G1/rho(e, n_g1)/rho(e, n_g1) * pch_rho->derivees().at("temperature")(e, n_g1) - out_therms.dT_etaph1(n_g1) - alpha(e, n_g1) * ( rho_p(e, n_g1)/rho(e, n_g1)/rho(e, n_g1))* pch_rho->derivees().at("temperature")(e, n_g1)/pas_tps : 0.;
379
380 const double dp_bilaninterg1 = (bilaninterg1> 0.) ? out_therms.dp_G1/rho(e, n_g1)- out_therms.G1/rho(e, n_g1)/rho(e, n_g1) * pch_rho->derivees().at("pression")(e, n_g1) - out_therms.dp_etaph1 - alpha(e, n_g1) * ( rho_p(e, n_g1)/rho(e, n_g1)/rho(e, n_g1))* pch_rho->derivees().at("pression")(e, n_g1)/pas_tps : 0.;
381
382 const double dT_bilaninterg2 = (bilaninterg2> 0.) ? out_therms.dT_G2(n_g2)/rho(e, n_g1) - out_therms.G2/rho(e, n_g2)/rho(e, n_g2) * pch_rho->derivees().at("temperature")(e, n_g2) - out_therms.dT_etaph2(n_g2) - alpha(e, n_g2) * ( rho_p(e, n_g2)/rho(e, n_g2)/rho(e, n_g2))*pch_rho->derivees().at("temperature")(e, n_g2)/pas_tps : 0. ;
383
384 const double dp_bilaninterg2 = (bilaninterg2> 0.) ? out_therms.dp_G2/rho(e, n_g1) - out_therms.G2/rho(e, n_g2)/rho(e, n_g2) * pch_rho->derivees().at("temperature")(e, n_g2) - out_therms.dp_etaph2 - alpha(e, n_g2) * ( rho_p(e, n_g2)/rho(e, n_g2)/rho(e, n_g2))*pch_rho->derivees().at("pression")(e, n_g2)/pas_tps : 0.;
385
386 if (Mt)//--------------------------------------------------------------------------------------------------------------------------------------------------------
387 {
388
389 // Intergoup thermal effects-------------------------------------------------------------------------------------------
390
391 (*Mt)(N * e + n_g1, N * e + n_g1) -= -limg1 * vol * ( pch_rho->derivees().at("temperature")(e, n_g1) * ( out_coeffs.gamma(n_g1,n_g1) + out_coeffs.inter3g1 * std::max(bilaninterg1,0.) - out_coeffs.inter3g2 * std::min(bilaninterg2,0.) ) + rho(e, n_g1) * ( out_coeffs.inter3g1 * dT_bilaninterg1 + out_coeffs.inter3g2 * dT_bilaninterg2 ));
392
393 (*Mt)(N * e + n_g2, N * e + n_g2) -= limg2 * vol * ( pch_rho->derivees().at("temperature")(e, n_g1) * ( out_coeffs.gamma(n_g1,n_g1) + out_coeffs.inter3g1 * std::max(bilaninterg1,0.) + out_coeffs.inter3g2 * std::min(bilaninterg2,0.) ) + rho(e, n_g1) * ( out_coeffs.inter3g1 * dT_bilaninterg1 + out_coeffs.inter3g2 * dT_bilaninterg2 ) );
394
395 // Exchanges gas-liquid---------------------------------------------------------------------------------------------------
396
397 (*Mt)(N * e + n_g1, N * e + n_g1) -= limg1 * vol * out_therms.dT_G1(n_g1) ;
398
399 (*Mt)(N * e + n_g2, N * e + n_g2) -= limg2 * vol * out_therms.dT_G2(n_g2) ;
400
401 (*Mt)(N * e + n_l, N * e + n_l) -= - limg1 * vol * out_therms.dT_G1(n_l) - limg2 * vol * out_therms.dT_G2(n_l) ;
402
403 }
404 if (Mp)//--------------------------------------------------------------------------------------------------------------------------------------------------------------
405 {
406
407 // Intergoup thermal effects-------------------------------------------------------------------------------------------
408
409 (*Mp)(N * e + n_g1, e) -= -limg1 * vol * ( pch_rho->derivees().at("pression")(e, n_g1) * ( out_coeffs.gamma(n_g1,n_g1) + out_coeffs.inter3g1 * std::max(bilaninterg1,0.) - out_coeffs.inter3g2 * std::min(bilaninterg2,0.) ) + rho(e, n_g1) * ( out_coeffs.inter3g1 * dp_bilaninterg1 + out_coeffs.inter3g2 * dp_bilaninterg2 ) );
410
411 (*Mp)(N * e + n_g2, e) -= limg2 * vol * ( pch_rho->derivees().at("pression")(e, n_g1) * ( out_coeffs.gamma(n_g1,n_g1) + out_coeffs.inter3g1 * std::max(bilaninterg1,0.) + out_coeffs.inter3g2 * std::min(bilaninterg2,0.) ) + rho(e, n_g1) * ( out_coeffs.inter3g1 * dp_bilaninterg1 + out_coeffs.inter3g2 * dp_bilaninterg2 ) );
412
413 // Exchanges gas-liquid---------------------------------------------------------------------------------------------------
414
415 (*Mp)(N * e + n_g1, e) -= limg1 * vol * out_therms.dp_G1 ;
416
417 (*Mp)(N * e + n_g2, e) -= limg2 * vol * out_therms.dp_G2 ;
418
419 (*Mp)(N * e + n_l, e) -= - limg1 * vol * out_therms.dp_G1 - limg2 * vol * out_therms.dp_G2 ;
420
421 }
422 }
423 }
424
425// IATE -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
426 else if (sub_type(Aire_interfaciale, equation()))
427 {
428
429 const double ai1 = std::max(inco(e, n_g1), 0.) ; // security inco negative
430 const double ai2 = std::max(inco(e, n_g2), 0.) ; // security inco negative
431
432 // Recurring term with numerical issue when void fraction is 0 : ai/alpha
433
434 const double aisural_1 = (1./fac_sec < alpha(e, n_g1) ) ? ai1 / std::max(alpha(e, n_g1),1./fac_sec) : 0. ;
435 const double dal_aisural_1 = (0. < aisural_1 ) ? - ai1 / std::max(alpha(e, n_g1) /alpha(e, n_g1),1./fac_sec) : 0. ;
436 const double dai_aisural_1 = (0. < aisural_1 ) ? 1. / std::max(alpha(e, n_g1),1./fac_sec) : 0. ;
437 const double aisural_2 = (1./fac_sec < alpha(e, n_g2) ) ? ai2 / std::max(alpha(e, n_g2),1./fac_sec) : 0. ;
438 const double dal_aisural_2 = (0. < aisural_2 ) ? - ai2 / std::max(alpha(e, n_g2) /alpha(e, n_g2),1./fac_sec) : 0. ;
439 const double dai_aisural_2 = (0. < aisural_2 ) ? 1. / std::max(alpha(e, n_g2), 1./fac_sec) : 0. ;
440
441 // Fill matrix with transfers---------------------------------------------------------------------------------------------------------------------------------------------------------
442
443 secmem(e, n_g1) += vol * ( std::max(bilaninterg1,0.) * aisural_1 * (2./3. - out_coeffs.inter2g1) - std::min(bilaninterg2,0.) * aisural_2 * out_coeffs.inter2g2 + aisural_1 * out_therms.etaph1 ) ;
444
445 secmem(e, n_g2) += vol * (std::max(bilaninterg2,0.) * aisural_2 * (2./3. + out_coeffs.inter2g2) + std::min(bilaninterg1,0.) * aisural_1 * out_coeffs.inter2g1 + aisural_2 * out_therms.etaph2 ) ;
446
447
448 if (Ma)//-------------------------------------------------------------------------------------------------------------------------------------------------------------------
449 {
450
451 (*Ma)(N * e + n_g1 , N * e + n_g1) -= vol * ( std::max(bilaninterg1,0.) * dal_aisural_1 * (2./3. - out_coeffs.inter2g1) + dag1_bilaninterg1 * aisural_1 * (2./3. - out_coeffs.inter2g1) - std::max(bilaninterg1,0.) * aisural_1 * out_coeffs.da_inter2g1 + dal_aisural_1 * out_therms.etaph1 + aisural_1 * out_therms.da_etaph1(n_g1) ) ;
452
453 (*Ma)(N * e + n_g2 , N * e + n_g2) -= vol * ( std::max(bilaninterg2,0.) * dal_aisural_2 * (2./3. - out_coeffs.inter2g2) + dag2_bilaninterg2 * aisural_2 * (2./3. + out_coeffs.inter2g2) + std::max(bilaninterg2,0.) * aisural_2 * out_coeffs.da_inter2g2 + dal_aisural_2 * out_therms.etaph2 + aisural_2 * out_therms.da_etaph2(n_g2) ) ;
454
455 }
456
457 if (Mai)//-------------------------------------------------------------------------------------------------------------------------------------------------------------------
458 {
459
460 (*Mai)(N * e + n_g1 , N * e + n_g1) -= vol * ( std::max(bilaninterg1,0.) * dai_aisural_1 * (2./3. - out_coeffs.inter2g1) + dai_aisural_1 * out_therms.etaph1 ) ;
461
462 (*Mai)(N * e + n_g2 , N * e + n_g2) -= vol * ( std::max(bilaninterg2,0.) * dai_aisural_2 * (2./3. + out_coeffs.inter2g2) + dai_aisural_2 * out_therms.etaph2 ) ;
463 }
464
465 // (T,P) dependance only for thermal effects-----------------------------------------------------------------------------------------------------------------------------------
466
467 if (milc.has_saturation(n_l, n_g1))// If eos exit we can compute thermal effects
468 {
469 // dT : Temperature variations, dp : Pressure variations
470
471 const double dT_bilaninterg1 = (bilaninterg1> 0.) ? out_therms.dT_G1(n_g1)/rho(e, n_g1)- out_therms.G1/rho(e, n_g1)/rho(e, n_g1) * pch_rho->derivees().at("temperature")(e, n_g1) - out_therms.dT_etaph1(n_g1) - alpha(e, n_g1) * ( rho_p(e, n_g1)/rho(e, n_g1)/rho(e, n_g1))* pch_rho->derivees().at("temperature")(e, n_g1)/pas_tps : 0.;
472
473 const double dp_bilaninterg1 = (bilaninterg1> 0.) ? out_therms.dp_G1/rho(e, n_g1)- out_therms.G1/rho(e, n_g1)/rho(e, n_g1) * pch_rho->derivees().at("pression")(e, n_g1) - out_therms.dp_etaph1 - alpha(e, n_g1) * ( rho_p(e, n_g1)/rho(e, n_g1)/rho(e, n_g1))* pch_rho->derivees().at("pression")(e, n_g1)/pas_tps : 0.;
474 const double dT_bilaninterg2 = (bilaninterg2> 0.) ? out_therms.dT_G2(n_g2)/rho(e, n_g1) - out_therms.G2/rho(e, n_g2)/rho(e, n_g2) * pch_rho->derivees().at("temperature")(e, n_g2) - out_therms.dT_etaph2(n_g2) - alpha(e, n_g2) * ( rho_p(e, n_g2)/rho(e, n_g2)/rho(e, n_g2))*pch_rho->derivees().at("temperature")(e, n_g2)/pas_tps : 0. ;
475
476 const double dp_bilaninterg2 = (bilaninterg2> 0.) ? out_therms.dp_G2/rho(e, n_g1) - out_therms.G2/rho(e, n_g2)/rho(e, n_g2) * pch_rho->derivees().at("temperature")(e, n_g2) - out_therms.dp_etaph2 - alpha(e, n_g2) * ( rho_p(e, n_g2)/rho(e, n_g2)/rho(e, n_g2))*pch_rho->derivees().at("pression")(e, n_g2)/pas_tps : 0.;
477
478
479 if (Mt)//-------------------------------------------------------------------------------------------------------------------------------------------------------------------
480 {
481
482 (*Mt)(N * e + n_g1 , N * e + n_g1) -= vol * ( dT_bilaninterg1 * aisural_1 * (2./3. - out_coeffs.inter2g1) - dT_bilaninterg2 * aisural_2 * out_coeffs.inter2g2 + aisural_1 * out_therms.dT_etaph1(n_g1) ) ;
483
484 (*Mt)(N * e + n_g2 , N * e + n_g2) -= vol * ( dT_bilaninterg2 * aisural_2 * (2./3. + out_coeffs.inter2g2) + dT_bilaninterg1 * aisural_1 * out_coeffs.inter2g1 + aisural_2 * out_therms.dT_etaph1(n_g2) ) ;
485
486 }
487
488 if (Mp)//-------------------------------------------------------------------------------------------------------------------------------------------------------------------
489 {
490
491 (*Mp)(N * e + n_g1 , e ) -= vol * ( dp_bilaninterg1 * aisural_1 * (2./3. - out_coeffs.inter2g1) - dp_bilaninterg2 * aisural_2 * out_coeffs.inter2g2 + aisural_1 * out_therms.dp_etaph1 ) ;
492
493 (*Mp)(N * e + n_g2 , e ) -= vol * ( dp_bilaninterg2 * aisural_2 * (2./3. + out_coeffs.inter2g2) + dp_bilaninterg1 * aisural_1 * out_coeffs.inter2g1 + aisural_2 * out_therms.dp_etaph2 ) ;
494
495 }
496 }
497
498 }
499
500 }
501}
Transport equation for the interfacial area.
: class Champ_Elem_PolyMAC_MPFA
virtual DoubleTab & get_elem_vector_field(DoubleTab &, bool passe=false) const
const IntTab & fcl() const
Class Champ_Inc_base.
DoubleTab & passe(int i=1) override
Returns field values at instant t-i.
const Domaine_Cl_dis_base & domaine_Cl_dis() const
DoubleTab & valeurs() override
Returns the array of field values at the current time.
const tabs_t & derivees() const
virtual DoubleTab & valeurs()=0
virtual DoubleTab & passe(int i=1)
Definition Champ_Proto.h:50
class Champ_base This class is the base of the fields hierarchy.
Definition Champ_base.h:43
class Conds_lim This class represents a vector of boundary conditions.
Definition Conds_lim.h:32
static void typer_lire_correlation(OWN_PTR(Correlation_base)&, const Probleme_base &, const Nom &, Entree &)
const Cond_lim & les_conditions_limites(int) const
Returns the i-th boundary condition.
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
virtual const Milieu_base & milieu() const =0
Sources & sources()
Returns the source terms associated with the equation.
virtual const Champ_Inc_base & inconnue() const =0
Probleme_base & probleme()
Returns the problem associated with the equation.
const Champ_Don_base & viscosite_dynamique() const
Definition Fluide_base.h:58
Classe Source_Flux_2groupes_PolyMAC_MPFA.
void dimensionner_blocs(matrices_t matrices, const tabs_t &semi_impl={}) const override
void ajouter_blocs(matrices_t matrices, DoubleTab &secmem, const tabs_t &semi_impl={}) const override
classe Flux_2groupes_base correlations de flux entre 2 groupes
virtual void coeffs(const input_coeffs &input, output_coeffs &output) const =0
virtual void therm(const input_therms &input, output_therms &output) const =0
DoubleTab & get_sigma_tab()
double sigma(const double T, const double P) const
Specialisation of Convection_Diffusion_std for multiphase flows where the transported scalar is the v...
Matrice_Morse class - Represents a (sparse) matrix M, not necessarily square,.
int nb_colonnes() const override
Return local number of columns (=size on the current proc).
static void allocate_morse_matrix(const int nb_lines, const int nb_columns, const Stencil &stencil, Matrice_Morse &matrix, const bool &attach_stencil_to_matrix=false)
DoubleVect & porosite_elem()
Definition Milieu_base.h:58
virtual const Champ_Don_base & capacite_calorifique() const
Returns the heat capacity of the medium (const version).
virtual const Champ_Don_base & conductivite() const
Returns the conductivity of the medium (const version).
virtual const Champ_base & masse_volumique() const
Returns the mass density of the medium (const version).
Composite medium representing a multiphase fluid and its properties:
bool has_interface(int k, int l) const
bool has_saturation(int k, int l) const
Interface_base & get_interface(int k, int l) const
Saturation_base & get_saturation(int k, int l) const
const Equation_base & equation() const
Returns the reference to the equation pointed to by MorEqn::mon_equation.
Definition MorEqn.h:62
Classe Neumann_paroi This boundary condition corresponds to an imposed flux for the.
virtual int finit_par(const char *const n) const
Definition Nom.cpp:319
virtual int debute_par(const char *const n) const
Definition Nom.cpp:314
static int dimension
Definition Objet_U.h:94
const Nom & que_suis_je() const
Returns the string identifying the class.
Definition Objet_U.cpp:104
virtual Entree & readOn(Entree &)
Reads an Objet_U from an input stream. Virtual method to override.
Definition Objet_U.cpp:289
virtual Sortie & printOn(Sortie &) const
Writes the object to an output stream. Virtual method to override.
Definition Objet_U.cpp:278
: class Op_Diff_Turbulent_PolyMAC_MPFA_Face
const Correlation_base & correlation() const
Multiphase thermohydraulics problem of type "3*N equations":
virtual Equation_base & equation_qdm()
virtual Equation_base & equation_energie()
const Nom & nom_phase(int i) const
const Equation_base & equation(int) const override
Returns the equation at index i (const version).
int nb_phases() const
virtual Equation_base & equation_masse()
bool has_champ(const Motcle &nom, OBS_PTR(Champ_base) &ref_champ) const override
const Champ_base & get_champ(const Motcle &nom) const override
int has_correlation(std::string nom_correlation) const
const Correlation_base & get_correlation(std::string nom_correlation) const
const Schema_Temps_base & schema_temps() const
Returns the time scheme associated with the problem.
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
Definition Process.cpp:466
Carries the terms of the momentum equation for multiphase flow without turbulence modelling.
void Tsat(const SpanD P, SpanD res, int ncomp=1, int ind=0) const
void Hls(const SpanD P, SpanD res, int ncomp=1, int ind=0) const
void dP_Tsat(const SpanD P, SpanD res, int ncomp=1, int ind=0) const
void Lvap(const SpanD P, SpanD res, int ncomp=1, int ind=0) const
double pas_de_temps() const
Returns the current time step (delta_t).
Base class for output streams.
Definition Sortie.h:52
Source_base A Source_base object is a term appearing on the right-hand side of an.
Definition Source_base.h:42
void resize(_SIZE_ n, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)
Definition TRUSTTab.tpp:469
_SIZE_ dimension_tot(int) const override
Definition TRUSTTab.tpp:160
void append_line(_TYPE_)
Definition TRUSTTab.tpp:213
_SIZE_ dimension(int d) const
Definition TRUSTTab.tpp:133
int line_size() const
Definition TRUSTVect.tpp:67
Turbulent viscosity correlations describing the Reynolds stress tensor R_{ij} = - <u'_i u'_j>.
virtual void eps(DoubleTab &eps) const =0