113 const DoubleVect& pe = milc.
porosite_elem(), &ve = domaine.volumes();
117 const IntTab& el_f = domaine.elem_faces(), &fcl = ch.
fcl(), &f_e = domaine.face_voisins();
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;
142 const int N = inco.
line_size(), Np = press.line_size(), Nk = (k_turb) ? (*k_turb).line_size() : -1, D =
dimension;
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) ;
151 DoubleTrav epsilon(alpha);
154 visc_turb.
eps(epsilon);
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) ;
174 DoubleTab pvit_elem(0, N * D);
175 domaine.domaine().creer_tableau_elements(pvit_elem);
179 const double fac_sec = 1.e4;
182 for (e = 0; e < domaine.nb_elem(); e++)
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));
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)) ;
192 for (n = 0; n < N; n++)
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);
202 in_coeffs.
a_i[n] = std::max(ai(e,n),0.) ;
203 for (k = 0; k < N; k++)
208 in_coeffs.
sigma(n,k) = sat.
sigma(temp_p(e,n), press_p(e,n * (Np > 1)));
215 in_coeffs.
sigma(n,k) = sig(e);
216 in_therms.
sigma(n,k) = sig(e);
221 for (n = 0; n < Nk; n++)
223 in_coeffs.
epsilon[n] = epsilon(e, n) ;
224 in_coeffs.
k_turb[n] = (k_turb) ? (*k_turb)(e,n) : 0;
229 double bilaninterg1 = 0. ;
230 double bilaninterg2 = 0. ;
231 double dag1_bilaninterg1 = 0. ;
232 double dag2_bilaninterg2 = 0. ;
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)));
248 for (
int j = 0; j < int( el_f.
dimension(1) ); j++)
251 if (fb < 0)
continue;
258 in_therms.
qp = ref_cast(
Neumann_paroi, cls[fcl(fb, 1)].valeur()).flux_impose(fcl(fb, 2), 0);
265 correlation_flux.
therm(in_therms, out_therms);
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;
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 ;
279 const double vol = pe(e) * ve(e) ;
281 in_coeffs.
dh =
dh_, in_coeffs.
e = e, in_therms.
dh =
dh_ ;
285 correlation_flux.
coeffs(in_coeffs, out_coeffs);
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.) ) ;
300 if (alpha(e,
n_g1) < 1./fac_sec)
303 limg1 = (gammag1 < 0.) ? 0. : 1.;
308 const double gammag2 = -gammag1 ;
314 if (alpha(e,
n_g2) < 1./fac_sec)
317 limg2 = (gammag2 < 0.) ? 0. : 1.;
325 secmem(e,
n_g1) += limg1 * vol * gammag1 ;
327 secmem(e,
n_g2) += limg2 * vol * gammag2 ;
333 secmem(e,
n_g1) += limg1 * vol * out_therms.
G1 ;
335 secmem(e,
n_g2) += limg2 * vol * out_therms.
G2 ;
337 secmem(e,
n_l) += - limg1 * vol * out_therms.
G1 - limg2 * vol * out_therms.
G2 ;
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) ;
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) ;
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 ) );
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 ) );
415 (*Mp)(N * e +
n_g1, e) -= limg1 * vol * out_therms.
dp_G1 ;
417 (*Mp)(N * e +
n_g2, e) -= limg2 * vol * out_therms.
dp_G2 ;
419 (*Mp)(N * e +
n_l, e) -= - limg1 * vol * out_therms.
dp_G1 - limg2 * vol * out_therms.
dp_G2 ;
429 const double ai1 = std::max(inco(e,
n_g1), 0.) ;
430 const double ai2 = std::max(inco(e,
n_g2), 0.) ;
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. ;
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 ) ;
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 ) ;
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) ) ;
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) ) ;
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 ) ;
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 ) ;
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) ) ;
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) ) ;
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 ) ;
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 ) ;