TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Rupture_bulles_2groupes_PolyMAC_MPFA.cpp
1/****************************************************************************
2* Copyright (c) 2021, 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#include <Rupture_bulles_2groupes_PolyMAC_MPFA.h>
17#include <Pb_Multiphase.h>
18#include <Milieu_composite.h>
19#include <Op_Diff_Turbulent_PolyMAC_MPFA_Face.h>
20#include <Viscosite_turbulente_base.h>
21#include <Matrix_tools.h>
22#include <Array_tools.h>
23#include <Rupture_bulles_2groupes_base.h>
24#include <math.h>
25#include <Champ_Elem_PolyMAC_MPFA.h>
26#include <Champ_Face_base.h>
27#include <Domaine_PolyMAC_MPFA.h>
28
29Implemente_instanciable(Rupture_bulles_2groupes_PolyMAC_MPFA, "Rupture_bulles_2groupes_elem_PolyMAC_MPFA", Source_base);
30
32{
33 return os;
34}
35
37{
38 Param param(que_suis_je());
39 param.ajouter("beta_k", &beta_k_);
40 param.ajouter("dh", &dh_);
41 param.lire_avec_accolades_depuis(is);
42
43
44 const Pb_Multiphase *pbm = sub_type(Pb_Multiphase, equation().probleme()) ? &ref_cast(Pb_Multiphase, equation().probleme()) : nullptr;
45
46 if (!pbm || pbm->nb_phases() == 1) Process::exit(que_suis_je() + " : not needed for single-phase flow!");
47 for (int n = 0; n < pbm->nb_phases(); n++) //recherche de n_l, n_g : phase {liquide,gaz}_continu en priorite
48 {
49 if (pbm->nom_phase(n).debute_par("liquide") && (n_l < 0 || pbm->nom_phase(n).finit_par("continu"))) n_l = n;
50 if ((pbm->nom_phase(n).finit_par("group1"))) n_g1 = n;
51 if ((pbm->nom_phase(n).finit_par("group2"))) n_g2 = n;
52 }
53 if (n_l < 0) Process::exit(que_suis_je() + " : liquid phase not found!");
54 if (n_g1 < 0) Process::exit(que_suis_je() + " : group 1 not found!");
55 if (n_g2 < 0) Process::exit(que_suis_je() + " : group 2 not found!");
56
57 if (pbm->has_correlation("Rupture_bulles_2groupes")) correlation_ = pbm->get_correlation("Rupture_bulles_2groupes"); //correlation fournie par le bloc correlation
58 else Correlation_base::typer_lire_correlation(correlation_, *pbm, "Rupture_bulles_2groupes", is); //sinon -> on la lit
59
60 return is;
61}
62
63void Rupture_bulles_2groupes_PolyMAC_MPFA::dimensionner_blocs(matrices_t matrices, const tabs_t& semi_impl) const
64{
65 const Domaine_PolyMAC_MPFA& domaine = ref_cast(Domaine_PolyMAC_MPFA, equation().domaine_dis());
66 const int ne = domaine.nb_elem(), ne_tot = domaine.nb_elem_tot(), N = equation().inconnue().valeurs().line_size();
67
68 for (auto &&n_m : matrices)
69 if (n_m.first == "alpha" || n_m.first == "k" || n_m.first == "tau" || n_m.first == "omega" || n_m.first == "interfacial_area")
70 {
71 Matrice_Morse& mat = *n_m.second, mat2;
72 const DoubleTab& dep = equation().probleme().get_champ(n_m.first.c_str()).valeurs();
73 int nc = dep.dimension_tot(0),
74 M = dep.line_size();
75 Stencil sten(0, 2);
76 if (n_m.first == "alpha")
77 for (int e = 0; e < ne; e++)
78 for (int n = 0; n < N; n++)
79 {
80 sten.append_line(N * e + n, N * e + n_l);
81 if (n != n_l) sten.append_line(N * e + n, N * e + n);
82 }
83 if (n_m.first == "k" || n_m.first == "tau" || n_m.first == "omega") // N <= M
84 for (int e = 0; e < ne; e++)
85 for (int n = 0; n < N; n++) sten.append_line(N * e + n, M * e +n_l);
86 //tableau_trier_retirer_doublons(sten);
87 Matrix_tools::allocate_morse_matrix(N * ne_tot, M * nc, sten, mat2);
88 mat.nb_colonnes() ? mat += mat2 : mat = mat2;
89 }
90}
91
92void Rupture_bulles_2groupes_PolyMAC_MPFA::ajouter_blocs(matrices_t matrices, DoubleTab& secmem, const tabs_t& semi_impl) const
93{
94
95 const Domaine_PolyMAC_MPFA& domaine = ref_cast(Domaine_PolyMAC_MPFA, equation().domaine_dis());
96 const DoubleVect& pe = equation().milieu().porosite_elem(), &ve = domaine.volumes();
97 const Pb_Multiphase& pbm = ref_cast(Pb_Multiphase, equation().probleme());
98 const DoubleTab& inco = equation().inconnue().valeurs(),
99 &inco_p = equation().inconnue().passe(),
100 &d_b = equation().probleme().get_champ("diametre_bulles").passe(),
101 &alpha = pbm.equation_masse().inconnue().valeurs(),
102 &alpha_p = pbm.equation_masse().inconnue().passe(),
103 &press_p = ref_cast(QDM_Multiphase, pbm.equation_qdm()).pression().passe(),
104 &temp_p = pbm.equation_energie().inconnue().passe(),
105 &rho_p = equation().milieu().masse_volumique().passe(),
106 &nu_p = equation().probleme().get_champ("viscosite_cinematique").passe(),
107 *tab_k_p = equation().probleme().has_champ("k") ? &equation().probleme().get_champ("k").passe() : nullptr,
108 *tab_k = equation().probleme().has_champ("k") ? &equation().probleme().get_champ("k").valeurs() : nullptr,
109 *tau = equation().probleme().has_champ("tau") ? &equation().probleme().get_champ("tau").valeurs() : nullptr,
110 *omega = equation().probleme().has_champ("omega") ? &equation().probleme().get_champ("omega").valeurs() : nullptr ;
111
112 const Milieu_composite& milc = ref_cast(Milieu_composite, equation().milieu());
113 int N = pbm.nb_phases(), Nk = (tab_k_p) ? (*tab_k_p).line_size() : -1, Np = equation().probleme().get_champ("pression").valeurs().line_size();
114
115 std::string Type_diss = "other"; // omega, tau or other dissipation
116 if (tau) Type_diss = "tau";
117 else if (omega) Type_diss = "omega";
118
119 DoubleTrav epsilon(alpha);
120 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());
121 const Viscosite_turbulente_base& visc_turb = ref_cast(Viscosite_turbulente_base, op_diff.correlation());
122 visc_turb.eps(epsilon); // Epsilon is in the past
123 double limiter = visc_turb.limiteur();
124 double dh = dh_;
125
126 Matrice_Morse *Ma = matrices.count("alpha") ? matrices.at("alpha") : nullptr,
127 *Mk = matrices.count("k") ? matrices.at("k") : nullptr,
128 *Mtau = matrices.count("tau") ? matrices.at("tau") : nullptr,
129 *Momega = matrices.count("omega") ? matrices.at("omega") : nullptr,
130 *Mai = matrices.count("interfacial_area") ? matrices.at("interfacial_area") : nullptr;
131
132 int cR = (rho_p.dimension_tot(0) == 1), cM = (nu_p.dimension_tot(0) == 1), n, k, e,d, D = dimension;
133 DoubleTrav alp_(N), p_l(N), T_l(N), rho_l(N), nu_l(N), sigma_l(N,N), dv(N, N), d_bulles(N), eps_l(Nk), k_l(Nk), coeff_TI(N, N),coeff_SI(N, N),coeff_SO(N, N); //arguments pour coeff
134 const Rupture_bulles_2groupes_base& correlation_rupt = ref_cast(Rupture_bulles_2groupes_base, correlation_.valeur());
135
136 // fill velocity at elem tab
137 DoubleTab pvit_elem(0, N * D);
138 domaine.domaine().creer_tableau_elements(pvit_elem);
139 const Champ_Face_base& ch_vit = ref_cast(Champ_Face_base,ref_cast(Pb_Multiphase, equation().probleme()).equation_qdm().inconnue());
140 ch_vit.get_elem_vector_field(pvit_elem);
141
142
143 const double fac_sec = 1.e4 ; // numerical security
144 const double alpha_min = 1.e-3 ; // to avoid numerical problems
145
146 /* elements */
147 for (e = 0; e < domaine.nb_elem(); e++)
148 {
149 // Get field values for correlations-------------------------------------------------------------------------------------------------------------------------------------------------------
150 for (n = 0; n < N; n++)
151 {
152 alp_(n) = alpha_p(e, n); // passe suffisant
153 p_l(n) = press_p(e, n * (Np > 1));
154 T_l(n) = temp_p(e, n);
155 rho_l(n) = rho_p(!cR * e, n);
156 nu_l(n) = nu_p(!cM * e, n);
157 for (k = 0; k < N; k++)
158 if(milc.has_interface(n, k))
159 {
160 Interface_base& sat = milc.get_interface(n, k);
161 sigma_l(n,k) = sat.sigma(temp_p(e,n), press_p(e,n * (Np > 1)));
162 }
163 else if (milc.has_saturation(n, k))
164 {
165 Saturation_base& z_sat = milc.get_saturation(n, k);
166
167 DoubleTab& sig = z_sat.get_sigma_tab();
168 sigma_l(n,k) = sig(e);
169
170 }
171 d_bulles(n) = d_b(e,n);
172
173 }
174 for (n = 0; n < Nk; n++)
175 {
176 eps_l(n) =epsilon(e, n) ;
177 k_l(n) = (tab_k_p) ? (*tab_k_p)(e,n) : 0;
178 }
179
180 for (dv =0, d = 0; d < D; d++)
181 for ( n = 0; n < N; n++)
182 for (k = 0 ; k<N ; k++) dv(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)||
183 for (n = 0; n < N; n++)
184 for ( k = 0 ; k<N ; k++) dv(n, k) = sqrt(dv(n, k)) ;
185
186 // Get correlations-------------------------------------------------------------------------------------------------------------------------------------------------------
187 correlation_rupt.coefficient_TI(alp_, p_l, T_l, rho_l, nu_l, sigma_l, dh, dv, d_bulles, eps_l, k_l, n_l, n_g1, n_g2, coeff_TI); // Explicit coeff for Turbulent impact
188 correlation_rupt.coefficient_SI(alp_, p_l, T_l, rho_l, nu_l, sigma_l, dh, dv, d_bulles, eps_l, k_l, n_l, n_g1, n_g2, coeff_SI); // Explicit coeff for Surface instability
189 correlation_rupt.coefficient_SO(alp_, p_l, T_l, rho_l, nu_l, sigma_l, dh, dv, d_bulles, eps_l, k_l, n_l, n_g1, n_g2, coeff_SO); // Explicit coeff for Shear off
190
191 // Get epsilon according to model
192 double eps_valeurs= epsilon(e, n_l) ;
193
194 if (Type_diss == "tau") eps_valeurs = beta_k_ * ((*tab_k)(e, n_l)>1.e-8 ? (*tab_k)(e, n_l)*(*tab_k)(e, n_l)/ std::max((*tab_k)(e, n_l) * (*tau)(e, n_l), limiter * nu_p(e, n_l)) : 0 );
195 else if (Type_diss == "omega") eps_valeurs = beta_k_ * ((*tab_k)(e, n_l)*(*omega)(e, n_l)) ;
196 else eps_valeurs = epsilon(e, n_l);
197
198 // Recuring functions for source terms-------------------------------------------------------------------------------------------------------------------------------------------------------
199 // fac = prefactor
200
201 const double fac_TI1 = (alpha(e, n_g1)>alpha_min) ? pe(e) * ve(e) * coeff_TI(n_g1, n_l): 0.;
202 const double fac_TI2 = (alpha(e, n_g2)>alpha_min) ? pe(e) * ve(e) * coeff_TI(n_g2, n_l): 0.;
203 const double fac_TI21 = (alpha(e, n_g2)>alpha_min) ? pe(e) * ve(e) * coeff_TI(n_g1, n_g2): 0.;
204 const double fac_SI = (alpha(e, n_g2)>alpha_min) ? pe(e) * ve(e) * coeff_SI(n_g2, n_l): 0.;
205 const double fac_SO1 = (alpha(e, n_g2)>alpha_min) ? pe(e) * ve(e) * coeff_SO(n_g1, n_l): 0.;
206 const double fac_SO2 = (alpha(e, n_g2)>alpha_min) ? pe(e) * ve(e) * coeff_SO(n_g2, n_l): 0.;
207
208 const double ai1 = std::max(inco(e, n_g1), 0.) ; // securite inco negative
209 const double ai2_p = std::max(inco_p(e, n_g2), 0.) ; // securite inco negative
210 const double ai2 = std::max(inco(e, n_g2), 0.) ; // securite inco negative
211 const double eps_1_over3 = std::cbrt(eps_valeurs) ;
212
213 const double alphag1_1_over3 = std::cbrt(alpha(e, n_g1)) ;
214 const double ai1_5_over3 = std::cbrt(ai1) * std::cbrt(ai1) * std::cbrt(ai1) * std::cbrt(ai1) * std::cbrt(ai1) ;
215 const double alphag2_1_over3 = std::cbrt(alpha(e, n_g2)) ;
216 const double alphag2p_1_over3 = std::cbrt(alpha_p(e, n_g2)) ;
217 const double ai2_5_over3 = std::cbrt(ai2) * std::cbrt(ai2) * std::cbrt(ai2) * std::cbrt(ai2) * std::cbrt(ai2) ;
218 const double ai2p_5_over3 = std::cbrt(ai2) * std::cbrt(ai2) * std::cbrt(ai2) * std::cbrt(ai2) * std::cbrt(ai2) ;
219
220 // Fill the matrix--------------------------------------------------------------------------------------------------------------------------------------------------
221
222 // TI (1)--------------------------------------------------------------------------------------------------------------------------------------------------
223
224 secmem(e , n_g1) += (fac_TI1 > 0. ) ? fac_TI1 / std::min(alphag1_1_over3 * alphag1_1_over3,fac_sec) * alpha_p(e, n_l) * ai1_5_over3 * eps_1_over3 : 0. ; //(alpha1, ai1, epsilon) implicit dependance
225
226 // TI (2)--------------------------------------------------------------------------------------------------------------------------------------------------
227
228 secmem(e , n_g2) += (fac_TI2 > 0. ) ? fac_TI2 / std::min(alphag2_1_over3 * alphag2_1_over3 ,fac_sec) * alpha_p(e, n_l) * ai2_5_over3 * eps_1_over3 : 0. ; //(alpha2, ai2, epsilon) implicit dependance
229
230 // TI (21)--------------------------------------------------------------------------------------------------------------------------------------------------------------
231
232 secmem(e , n_g1) += (fac_TI21 > 0. ) ? fac_TI21 / std::min(alphag2p_1_over3 * alphag2p_1_over3 ,fac_sec) * alpha_p(e, n_l) * ai2p_5_over3 * eps_1_over3: 0. ;//(epsilon) implicit dependance
233
234 // SI--------------------------------------------------------------------------------------------------------------------------------------------------
235
236 secmem(e , n_g2) += (fac_SI > 0. ) ? fac_SI * alpha(e, n_g2) * alpha(e, n_g2) : 0.;//(alpha2) implicit dependance
237
238 // SO (1)--------------------------------------------------------------------------------------------------------------------------------------------------
239
240 secmem(e , n_g1) += (fac_SO1 > 0. ) ? fac_SO1 * ai2_p * ai2_p / std::min(alpha_p(e, n_g2),fac_sec): 0.;// no implicit dependance
241
242 // SO (2)--------------------------------------------------------------------------------------------------------------------------------------------------
243
244 secmem(e , n_g2) += (fac_SO2 > 0. ) ? fac_SO2 * ai2 * ai2 * ai2 / std::min(alpha(e, n_g2) * alpha(e, n_g2) ,fac_sec): 0.;//(alpha1, ai1) implicit dependance
245
246 if (Ma)
247 {
248 // TI (1)--------------------------------------------------------------------------------------------------------------------------------------------------
249
250 (*Ma)(N * e + n_g1 , N * e + n_g1) -= (fac_TI1 > 0. ) ? fac_TI1 * -2./3. / std::min(alphag1_1_over3 * alphag1_1_over3 * alphag1_1_over3 * alphag1_1_over3 * alphag1_1_over3,fac_sec) * alpha_p(e, n_l) * std::min(alphag1_1_over3 * alphag1_1_over3,fac_sec) * eps_1_over3 : 0.;
251
252 // TI (2)--------------------------------------------------------------------------------------------------------------------------------------------------
253
254 (*Ma)(N * e + n_g2 , N * e + n_g2) -= (fac_TI2 > 0. ) ? fac_TI2 * -2./3. / std::min(alphag2_1_over3 * alphag2_1_over3 * alphag2_1_over3 * alphag2_1_over3 * alphag2_1_over3 ,fac_sec) * alpha_p(e, n_l) * ai2_5_over3 * eps_1_over3 : 0.;
255
256 // SI--------------------------------------------------------------------------------------------------------------------------------------------------
257
258 (*Ma)(N * e + n_g2 , N * e + n_g2) -= (fac_SI > 0. ) ? fac_SI * 2. * alpha(e, n_g2) : 0. ;
259
260 // SO (2)--------------------------------------------------------------------------------------------------------------------------------------------------
261 (*Ma)(N * e + n_g2 , N * e + n_g2) -= (fac_SO2 > 0. ) ? - 2. * fac_SO2 * ai2 * ai2 * ai2 / std::min(alpha(e, n_g2) * alpha(e, n_g2) * alpha(e, n_g2),fac_sec): 0.;
262
263 }
264
265 if (Mai)
266 {
267 // TI (1)--------------------------------------------------------------------------------------------------------------------------------------------------
268
269 (*Mai)(N * e + n_g1 , N * e + n_g1) -= (fac_TI1 > 0. ) ? fac_TI1 / std::min(alphag1_1_over3 * alphag1_1_over3,fac_sec) * alpha_p(e, n_l) * 5./3. * (std::cbrt(ai1) * std::cbrt(ai1)) * eps_1_over3 : 0.;
270
271 // TI (2)--------------------------------------------------------------------------------------------------------------------------------------------------
272
273 (*Mai)(N * e + n_g2 , N * e + n_g2) -= (fac_TI2 > 0. ) ? fac_TI2 / std::min(alphag2_1_over3 * alphag2_1_over3 ,fac_sec) * alpha_p(e, n_l) * 5./3. * (std::cbrt(ai2) * std::cbrt(ai2)) * eps_1_over3 : 0.;
274
275 // SO (2)--------------------------------------------------------------------------------------------------------------------------------------------------
276
277 (*Mai)(N * e + n_g2 , N * e + n_g2) -= (fac_SO2 > 0. ) ? 3. * fac_SO2 * (std::cbrt(ai2) * std::cbrt(ai2)) / std::min(alpha(e, n_g2) * alpha(e, n_g2),fac_sec): 0.;
278
279 }
280 if (Type_diss == "tau")
281 {
282 if ((*tab_k)(e, n_l) * (*tau)(e, n_l) > limiter * nu_p(e, n_l)) // derivee en k ; depend de l'activation ou non du limiteur
283 {
284 if (Mk)
285 {
286 const double deps = 1./3. * std::cbrt(beta_k_) / std::min(std::cbrt((*tab_k)(e, n_l)) * std::cbrt((*tab_k)(e, n_l)),fac_sec) / std::min(std::cbrt((*tau)(e, n_l)),fac_sec) ;
287
288 // TI (1)--------------------------------------------------------------------------------------------------------------------------------------------------
289
290 (*Mk)(N * e + n_g1, Nk * e + n_l) -= (fac_TI1 > 0. ) ? fac_TI1 / std::min(alphag1_1_over3 * alphag1_1_over3,fac_sec) * alpha_p(e, n_l) * std::min(alphag1_1_over3 * alphag1_1_over3,fac_sec) * deps : 0.;
291
292 // TI (2)--------------------------------------------------------------------------------------------------------------------------------------------------
293
294 (*Mk)(N * e + n_g2, Nk * e + n_l) -= (fac_TI2 > 0. ) ? fac_TI2 / std::min(alphag2_1_over3 * alphag2_1_over3 ,fac_sec) * alpha_p(e, n_l) * ai2_5_over3 * deps : 0.;
295
296 //TI (21)--------------------------------------------------------------------------------------------------------------------------------------------------
297
298 (*Mk)(N * e + n_g1, Nk * e + n_l) -= (fac_TI21 > 0. ) ? fac_TI21 / std::min(alphag2p_1_over3 * alphag2p_1_over3 ,fac_sec) * alpha_p(e, n_l) * ai2p_5_over3 * deps : 0.;
299
300 }
301 if (Mtau)
302 {
303 const double deps = -1./3. * std::cbrt(beta_k_) * std::cbrt((*tab_k)(e, n_l)) / std::min(std::cbrt((*tau)(e, n_l)) * std::cbrt((*tau)(e, n_l)) * std::cbrt((*tau)(e, n_l)) * std::cbrt((*tau)(e, n_l)),fac_sec) ;
304
305 // TI (1)--------------------------------------------------------------------------------------------------------------------------------------------------
306
307 (*Mtau)(N * e + n_g1, Nk * e + n_l)-= (fac_TI1 > 0. ) ? fac_TI1 / std::min(alphag1_1_over3 * alphag1_1_over3,fac_sec) * alpha_p(e, n_l) * std::min(alphag1_1_over3 * alphag1_1_over3,fac_sec) * deps : 0.;
308
309 // TI (2)--------------------------------------------------------------------------------------------------------------------------------------------------
310
311 (*Mtau)(N * e + n_g2, Nk * e + n_l)-= (fac_TI2 > 0. ) ? fac_TI2 / std::min(alphag2_1_over3 * alphag2_1_over3 ,fac_sec) * alpha_p(e, n_l) * ai2_5_over3 * deps : 0.;
312
313 //TI (21)--------------------------------------------------------------------------------------------------------------------------------------------------
314
315 (*Mtau)(N * e + n_g1, Nk * e + n_l)-= (fac_TI21 > 0. ) ? fac_TI21 / std::min(alphag2p_1_over3 * alphag2p_1_over3 ,fac_sec) * alpha_p(e, n_l) * ai2p_5_over3 * deps : 0.;
316
317 }
318 }
319 else if (Mk)
320 {
321 const double deps = 1./3. * std::cbrt(beta_k_) / std::min(std::cbrt((*tab_k)(e, n_l)),fac_sec) / std::min(std::cbrt(limiter * nu_p(e, n_l)),fac_sec) ;
322
323 // TI (1)--------------------------------------------------------------------------------------------------------------------------------------------------
324
325 (*Mk)(N * e + n_g1, Nk * e + n_l) -= (fac_TI1 > 0. ) ? fac_TI1 / std::min(alphag1_1_over3 * alphag1_1_over3,fac_sec) * alpha_p(e, n_l) * std::min(alphag1_1_over3 * alphag1_1_over3,fac_sec) * deps : 0.;
326
327 // TI (2)--------------------------------------------------------------------------------------------------------------------------------------------------
328
329 (*Mk)(N * e + n_g2, Nk * e + n_l) -= (fac_TI2 > 0. ) ? fac_TI2 / std::min(alphag2_1_over3 * alphag2_1_over3 ,fac_sec) * alpha_p(e, n_l) * ai2_5_over3 * deps : 0.;
330
331 //TI (21)--------------------------------------------------------------------------------------------------------------------------------------------------
332
333 (*Mk)(N * e + n_g1, Nk * e + n_l) -= (fac_TI21 > 0. ) ? fac_TI21 / std::min(alphag2p_1_over3 * alphag2p_1_over3 ,fac_sec) * alpha_p(e, n_l) * ai2p_5_over3 * deps : 0.;
334
335 }
336 }
337 if (Type_diss == "omega")
338 {
339 if (Momega)
340 {
341 const double deps = 1./3. * std::cbrt(beta_k_) * std::cbrt((*tab_k)(e, n_l)) / std::min(std::cbrt((*omega)(e, n_l)) * std::cbrt((*omega)(e, n_l)),fac_sec) ;
342
343 // TI (1)--------------------------------------------------------------------------------------------------------------------------------------------------
344
345 (*Momega)(N * e + n_g1 , Nk * e + n_l) -= (fac_TI1 > 0. ) ? fac_TI1 / std::min(alphag1_1_over3 * alphag1_1_over3,fac_sec) * alpha_p(e, n_l) * std::min(alphag1_1_over3 * alphag1_1_over3,fac_sec) * deps : 0.;
346
347 // TI (2)--------------------------------------------------------------------------------------------------------------------------------------------------
348
349 (*Momega)(N * e + n_g2 , Nk * e + n_l) -= (fac_TI2 > 0. ) ? fac_TI2 / std::min(alphag2_1_over3 * alphag2_1_over3 ,fac_sec) * alpha_p(e, n_l) * ai2_5_over3 * deps : 0.;
350
351 // TI (21)--------------------------------------------------------------------------------------------------------------------------------------------------
352
353 (*Momega)(N * e + n_g1 , Nk * e + n_l) -= (fac_TI21 > 0. ) ? fac_TI21 / std::min(alphag2p_1_over3 * alphag2p_1_over3 ,fac_sec) * alpha_p(e, n_l) * ai2p_5_over3 * deps : 0.;
354
355 }
356 if (Mk)
357 {
358 const double deps = 1./3. * std::cbrt(beta_k_) / std::min(std::cbrt((*tab_k)(e, n_l)) * std::cbrt((*tab_k)(e, n_l)) ,fac_sec) * std::cbrt((*omega)(e, n_l)) ;
359
360 // TI (1)--------------------------------------------------------------------------------------------------------------------------------------------------
361
362 (*Mk)(N * e + n_g1 , Nk * e + n_l) -= (fac_TI1 > 0. ) ? fac_TI1 / std::min(alphag1_1_over3 * alphag1_1_over3,fac_sec) * alpha_p(e, n_l) * std::min(alphag1_1_over3 * alphag1_1_over3,fac_sec) * deps : 0.;
363
364 // TI (2)--------------------------------------------------------------------------------------------------------------------------------------------------
365
366 (*Mk)(N * e + n_g2 , Nk * e + n_l) -= (fac_TI2 > 0. ) ? fac_TI2 / std::min(alphag2_1_over3 * alphag2_1_over3 ,fac_sec) * alpha_p(e, n_l) * ai2_5_over3 * deps : 0.;
367
368 // TI (21)--------------------------------------------------------------------------------------------------------------------------------------------------
369
370 (*Mk)(N * e + n_g1 , Nk * e + n_l) -= (fac_TI21 > 0. ) ? fac_TI21 / std::min(alphag2_1_over3 * alphag2_1_over3 ,fac_sec) * alpha_p(e, n_l) * ai2p_5_over3 * deps : 0.;
371 }
372 }
373 }
374}
virtual DoubleTab & get_elem_vector_field(DoubleTab &, bool passe=false) const
DoubleTab & passe(int i=1) override
Returns field values at instant t-i.
DoubleTab & valeurs() override
Returns the array of field values at the current time.
virtual DoubleTab & valeurs()=0
virtual DoubleTab & passe(int i=1)
Definition Champ_Proto.h:50
static void typer_lire_correlation(OWN_PTR(Correlation_base)&, const Probleme_base &, const Nom &, Entree &)
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
virtual const Champ_Inc_base & inconnue() const =0
Probleme_base & probleme()
Returns the problem associated with the equation.
DoubleTab & get_sigma_tab()
double sigma(const double T, const double P) const
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_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
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
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
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.
classe Rupture_bulles_2groupes_PolyMAC_MPFA
void ajouter_blocs(matrices_t matrices, DoubleTab &secmem, const tabs_t &semi_impl={}) const override
void dimensionner_blocs(matrices_t matrices, const tabs_t &semi_impl={}) const override
virtual void coefficient_SO(const DoubleTab &alpha, const DoubleTab &p, const DoubleTab &T, const DoubleTab &rho, const DoubleTab &nu, const DoubleTab &sigma, double Dh, const DoubleTab &ndv, const DoubleTab &d_bulles, const DoubleTab &eps, const DoubleTab &k_turb, const int n_l, const int n_g1, const int n_g2, DoubleTab &coeff) const =0
virtual void coefficient_TI(const DoubleTab &alpha, const DoubleTab &p, const DoubleTab &T, const DoubleTab &rho, const DoubleTab &nu, const DoubleTab &sigma, const double Dh, const DoubleTab &ndv, const DoubleTab &d_bulles, const DoubleTab &eps, const DoubleTab &k_turb, const int n_l, const int n_g1, const int n_g2, DoubleTab &coeff) const =0
virtual void coefficient_SI(const DoubleTab &alpha, const DoubleTab &p, const DoubleTab &T, const DoubleTab &rho, const DoubleTab &nu, const DoubleTab &sigma, const double Dh, const DoubleTab &ndv, const DoubleTab &d_bulles, const DoubleTab &eps, const DoubleTab &k_turb, const int n_l, const int n_g1, const int n_g2, DoubleTab &coeff) const =0
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
_SIZE_ dimension_tot(int) const override
Definition TRUSTTab.tpp:160
void append_line(_TYPE_)
Definition TRUSTTab.tpp:213
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