15#include <Convection_Diffusion_Temperature_FT_Disc.h>
16#include <Transport_Interfaces_FT_Disc.h>
17#include <Domaine_VF.h>
18#include <Discretisation_base.h>
19#include <Probleme_FT_Disc_gen.h>
20#include <Fluide_Diphasique.h>
21#include <Fluide_Incompressible.h>
23#include <Sous_Domaine.h>
25#include <Champ_Uniforme.h>
26#include <Echange_impose_base.h>
27#include <Echange_contact_VDF_FT_Disc.h>
28#include <Domaine_Cl_VDF.h>
29#include <Neumann_paroi.h>
30#include <Neumann_paroi_adiabatique.h>
34#include <Interprete_bloc.h>
35#include <Domaine_VDF.h>
36#include <Perf_counters.h>
38#include <Parametre_implicite.h>
39#include <Dirichlet_paroi_fixe.h>
40#include <Dirichlet_paroi_defilante.h>
42static const double TSAT_CONSTANTE = 0.;
76 solveur_masse->set_name_of_coefficient_temporel(
"rho_cp_comme_T");
78 num.
suffix(
"temperature_thermique");
79 Nom nom=
"Convection_chaleur";
82 terme_convectif.set_description((Nom)
"Convective heat transfer rate=Integral(-rho*cp*T*u*ndS) [W] if SI units used");
83 nom=
"Diffusion_chaleur";
86 terme_diffusif.set_description((Nom)
"Conduction heat transfer rate=Integral(lambda*grad(T)*ndS) [W] if SI units used");
91 Cerr <<
"We account for no energy correction!!" << finl;
110 param.
ajouter_condition(
"(value_of_phase_eq_0)_or_(value_of_phase_eq_1)",
"phase must be set to 0 or 1");
145 if (mot==
"equation_interface")
151 Cerr <<
" Interface equation for the temperature convection diffusion equation :"
156 else if (mot==
"solveur_pression_fictive")
159 Cerr <<
"Reading and typing of fictitious pressure solver (for velocity extension) : " << finl;
165 else if (mot==
"diffusion")
168 Cerr <<
" "<<
que_suis_je() <<
"::lire diffusivite" << finl;
173 Cerr <<
" Error: phase must be specified before diffusion" << finl;
179 else if (mot==
"convection")
182 Cerr <<
" "<<
que_suis_je() <<
"::lire convection" << finl;
186 Cerr <<
" Error: equation_navier_stokes must be specified before convection" << finl;
192 else if (mot==
"maintien_temperature")
195 Cerr <<
" Equation_Concentration_FT::lire maintien_temperature" << finl;
201 else if (mot==
"prescribed_mpoint")
204 Cerr <<
que_suis_je() <<
"::lire prescribed_mpoint" << finl;
209 else if (mot==
"equation_navier_stokes")
215 Cerr <<
" Navier_stokes equation for the temperature convection diffusion equation :"
231 return vitesse_convection_;
247static void extrapolate(
const Domaine_VF& domaine_vf,
248 const DoubleTab& interfacial_area,
249 const int stencil_width,
250 const DoubleTab& distance,
253 const double invalid_test = -1.e30;
254 const IntTab& elem_faces = domaine_vf.
elem_faces();
256 const int nb_faces_elem = elem_faces.
dimension(1);
257 const int nb_elem = elem_faces.
dimension(0);
261 const double n_iterations = 5*stencil_width;
262 for (
int iteration = 0; iteration < n_iterations; iteration++)
267 for (
int i_elem = 0; i_elem < nb_elem; i_elem++)
271 const double d = distance[i_elem];
272 if (( d > invalid_test) && (interfacial_area[i_elem]<DMINFLOAT))
276 for (
int i_face = 0; i_face < nb_faces_elem; i_face++)
278 const int face = elem_faces(i_elem, i_face);
279 const int voisin = faces_elem(face, 0) + faces_elem(face, 1) - i_elem;
283 double mp = field_old[voisin];
284 const double dvois = distance[voisin];
285 if (dvois > invalid_test)
288 if (fabs(dvois)<DMINFLOAT)
290 Cerr <<
"distance is very much at zero whereas interfacial_area is zero too... Pathological case to be looked into closely. " << finl;
291 Cerr <<
"Is it from a Break-up or coalescence? " << finl;
292 Cerr <<
"see Convection_Diffusion_Temperature_FT_Disc and static void extrapolate" << finl;
293 Cerr <<
"Contact TRUST support." << finl;
296 const double inv_d2 = 1./(dvois*dvois);
303 field[i_elem] = somme / coeff;
310static void extrapoler_dans_phase(DoubleTab& gradient,
311 const DoubleTab& indicatrice,
313 const double invalid_test,
314 const double indic_phase,
const int nb_iter)
316 DoubleTab gradient_old;
317 for (
int iteration = 0; iteration < nb_iter; iteration++)
321 gradient_old = gradient;
323 for (
int i_elem = 0; i_elem < domaine_vf.
elem_faces().dimension(0); i_elem++)
325 if (indicatrice[i_elem] != indic_phase)
331 for (
int i_face = 0; i_face < domaine_vf.
elem_faces().dimension(1); i_face++)
333 const int face = domaine_vf.
elem_faces(i_elem, i_face);
338 const double grad = gradient_old[voisin];
339 if (grad > invalid_test)
347 gradient[i_elem] = somme / coeff;
350 gradient.echange_espace_virtuel();
357static void extrapoler_champ_elem(
const Domaine_VF& domaine_vf,
358 const DoubleTab& indicatrice,
359 const DoubleTab& distance_interface,
360 const DoubleTab& normale_interface,
361 const DoubleTab& champ_div_n,
362 const int correction_gradt_ordre_,
364 const int stencil_width,
365 const double interfacial_value,
370 const IntTab& elem_faces = domaine_vf.
elem_faces();
372 const int nb_faces_elem = elem_faces.
dimension(1);
373 const int nb_elem = elem_faces.
dimension(0);
375 const DoubleTab& centre_gravite_elem = domaine_vf.
xp();
376 const DoubleTab& centre_gravite_face = domaine_vf.
xv();
377 const double invalid_test = -1.e30;
378 const double invalid_value = -2.e30;
381 assert(gradient.dimension(0) == distance_interface.
dimension(0));
382 gradient = invalid_value;
383 const double indic_phase = (phase == 0) ? 0. : 1.;
386 for (i_elem = 0; i_elem < nb_elem; i_elem++)
388 double d = distance_interface[i_elem];
389 if (indicatrice[i_elem] == indic_phase && d > invalid_test)
405 double dist_elem_face_min = 1e30;
406 for (
int face_loc=0; face_loc<nb_faces_elem; face_loc++)
408 double dist_elem_face = 0;
409 const int face_glob = elem_faces(i_elem,face_loc);
412 double centre_elem_i = centre_gravite_elem(i_elem,i_dim);
413 double centre_face_i = centre_gravite_face(face_glob,i_dim);
414 dist_elem_face += (centre_elem_i-centre_face_i)*(centre_elem_i-centre_face_i);
416 dist_elem_face = sqrt(dist_elem_face);
417 dist_elem_face_min = (dist_elem_face < dist_elem_face_min) ? dist_elem_face : dist_elem_face_min;
433 if (std::fabs(d) < dist_elem_face_min)
435 Cerr <<
"Time = " << temps <<
"; extrapoler_champ_elem: distance lower than dx/2" << finl;
436 Cerr <<
" Element position:" << finl;
439 Cerr <<
" x(" << i_dim <<
") = " << centre_gravite_elem(i_elem,i_dim) << finl;
442 d = (phase == 0) ? -dist_elem_face_min : dist_elem_face_min;
446 const double v = champ[i_elem];
449 const double grad = (v - interfacial_value) / d;
453 const double div_n = champ_div_n[i_elem];
455 switch (correction_gradt_ordre_)
459 gradient[i_elem] = grad;
463 gradient[i_elem] = grad * (1. - (-div_n) * d / 2.);
467 gradient[i_elem] = grad * (1. - (-div_n) * d / 2. + (-div_n) * (-div_n) * d * d / 6.);
470 Cerr <<
"Error for the method Convection_Diffusion_Temperature_FT_Disc::extrapoler_champ_elem correction_gradt_ordre_" << finl;
476 Cerr <<
"extrapoler_champ_elem: errcount=" << err_count << finl;
477 gradient.echange_espace_virtuel();
481 extrapoler_dans_phase(gradient, indicatrice, domaine_vf, invalid_test, indic_phase, stencil_width );
484 const double autre_phase = 1.-indic_phase;
485 extrapoler_dans_phase(gradient, indicatrice, domaine_vf, invalid_test, autre_phase, stencil_width );
488 for (i_elem = 0; i_elem < nb_elem; i_elem++)
490 const double d = distance_interface[i_elem];
491 const double grad = gradient[i_elem];
492 if (indicatrice[i_elem] != indic_phase
494 && grad > invalid_test)
497 const double div_n = champ_div_n[i_elem];
498 champ[i_elem] = d * grad * (1. - 0.5 * div_n * d) + interfacial_value;
504 champ.echange_espace_virtuel();
522 const double interfacial_value = TSAT_CONSTANTE;
535 extrapoler_champ_elem(domaine_vf, indicatrice, distance_interface, normale_interface, div_n,
537 phase_, stencil_width, interfacial_value,
550 const double invalid_test = -1.e25;
558 mpoint.
valeurs() = grad_t_->valeurs();
560 DoubleTab& val = mpoint.
valeurs();
561 const int n = val.
size();
562 for (
int i = 0; i < n; i++)
563 if (val[i] < invalid_test)
566 const double k = fluide_dipha_->fluide_phase(
phase_).conductivite().valeurs()(0,0);
567 const double L = fluide_dipha_->chaleur_latente();
595static void collect_into_unique_occurence(ArrOfInt& mixed_elems, ArrOfDouble& lost_fluxes)
597 const int nb_elem_with_duplicates = mixed_elems.
size_array();
601 for (
int i=0; i<nb_elem_with_duplicates; i++)
603 const int elemi = mixed_elems[i];
608 const int elemj = mixed_elems[j];
619 lost_fluxes[nb_elem] = lost_fluxes[i];
620 for (j=i+1; j<nb_elem_with_duplicates; j++)
622 const int elemj = mixed_elems[j];
625 lost_fluxes[nb_elem] += lost_fluxes[j];
628 mixed_elems[nb_elem] = elemi;
637 Cerr <<
"Work in progress and widly incorrect. " << finl;
638 Cerr <<
"Wait and see for further improvements. Exit" << finl;
640 if (
inconnue().nb_valeurs_temporelles() == 1)
642 Cerr <<
"You need at least 2 positions to the wheel... Contact TRUST support. " << finl;
649 const DoubleTab& indicatrice_passe = eq_interface_.
inconnue().
passe();
654 const double rhocp = fluide_dipha_->fluide_phase(
phase_).masse_volumique().valeurs()(0,0)
655 * fluide_dipha_->fluide_phase(
phase_).capacite_calorifique().valeurs()(0,0);
662 for(
int i=0; i<nb_elem; i++)
665 derivee_energy_[i] = (temperature[elemi] * indicatrice[elemi] - temperature_passe[elemi] * indicatrice_passe[elemi])* rhocp;
669 const double Lvap = fluide_dipha_->chaleur_latente();
671 DoubleTab& mp = mpoint_->valeurs();
675 double total_flux_lost = 0.;
676 double total_derivee_energy = 0.;
677 double mpai_tot = 0.;
678 double mp_sum_before = 0.;
679 double int_ai_before = 0.;
680 for (
int nd=0 ; nd<nb_elem ; nd++)
683 int_ai_before += ai[elembe];
688 mpai_tot += mp[elembe]*ai[elembe]*Lvap;
689 mp_sum_before += mp[elembe]*ai[elembe];
691 if (int_ai_before>DMINFLOAT)
693 const double mean_mp_before = mp_sum_before/int_ai_before;
694 Cerr <<
" mp_sum_before= " << mp_sum_before <<
" mean_mp_before= " << mean_mp_before <<
" time= " << temps << finl;
696 total_flux_lost =
mp_sum(total_flux_lost);
697 mpai_tot =
mp_sum(mpai_tot);
698 total_derivee_energy =
mp_sum(total_derivee_energy)/dt;
699 Cerr <<
"[Basic-Mixed-cells-Energy-Balance] Time= " << temps <<
" nb_elems= " << nb_elem
700 <<
" phi(positive if towards mixed cells)= " << total_flux_lost
701 <<
" mp*ai*Lvap= " << mpai_tot
702 <<
" dE/dt= " << total_derivee_energy
703 <<
" imbalance= " << total_derivee_energy-total_flux_lost+mpai_tot << finl;
712 double int_dmp_ai = 0.;
714 double int_mp_ai = 0.;
715 for(
int i=0; i<nb_elem; i++)
722 double phi_conv_lost_by_mixed_cell = 0.;
723 double phi_diffu_added_to_mixed_cell = 0.;
726 Cerr <<
"Search for a solution? What case is it? diffu, BC? " << finl;
736 phi_conv_lost_by_mixed_cell =0.;
748 Cerr <<
"conv. The end of the list is reached, "
749 <<
"mixed_elems_["<< i<<
"]= " << elem <<
" was not found in mixed_elem_conv_"<< finl;
752 Cerr <<
"WE ASSUME IT IS BECAUSE IT IS A BC? any solution? WE IGNORE IT"<< finl;
763 double VdrhocpT_dt = 0.;
764 if (account_for_mixed_cell_energy)
766 VdrhocpT_dt=(rhocp*volume[elem])*(temperature[elem] * indicatrice[elem] - temperature_passe[elem] * indicatrice_passe[elem])/dt;
773 const double value_before = temperature[elem];
774 temperature[elem] = 1/indicatrice[elem] * (temperature_passe[elem] * indicatrice_passe[elem] + dt/(rhocp*volume[elem])*(mp[elem]*ai[elem]*Lvap - phi_in_mixed_cell*rhocp));
776 Cerr <<
"[Delta-T-due-to-Energy-correction] elem "<< elem <<
" Tnew-Tuncorrected " << temperature[elem]-value_before << finl;
778 const double tmp = (temperature[elem] * indicatrice[elem] - temperature_passe[elem] * indicatrice_passe[elem])* rhocp;
781 Cerr <<
"New derivee_energy after correction (before/after) : ( "<<
derivee_energy_[i] <<
" / " << tmp <<
" )." << finl;
788 if (ai[elem]>DMINFLOAT)
790 const double old_mp = mp[elem];
792 double delta_mp = 0. ;
793 if (account_for_diff)
795 delta_mp += (1/(ai[elem]*Lvap))*((mp[elem]*ai[elem]*Lvap + phi_diffu_added_to_mixed_cell));
797 Cerr <<
" delta-mp-diff= " << delta_mp << finl;
799 if (account_for_conv)
808 delta_mp += (1/(ai[elem]*Lvap))*(-phi_conv_lost_by_mixed_cell);
810 Cerr <<
" delta-mp-conv= " << delta_mp << finl;
812 if (account_for_mixed_cell_energy)
813 delta_mp += (1/(ai[elem]*Lvap))*(VdrhocpT_dt);
816 Cerr <<
" delta_mp= " << delta_mp <<
" old_mp= " << old_mp <<
" new_mp= " << mp[elem] << finl;
817 if (fabs(old_mp)>DMINFLOAT)
818 Cerr <<
"relative correction of mp at time "<< temps <<
" elem= " << elem <<
" delta= " <<delta_mp/old_mp*100. <<
"%." <<finl;
824 if ((ai[elem]>DMINFLOAT) and (temps>DMINFLOAT))
827 int_mp_ai += mp[elem]*ai[elem];
831 double delta_mp = 0. ;
832 if (account_for_diff)
835 delta_mp += (-1/Lvap)*((mp[elem]*ai[elem]*Lvap - phi_diffu_added_to_mixed_cell));
842 if (account_for_conv)
855 delta_mp += (-1/Lvap)*(phi_conv_lost_by_mixed_cell);
859 if (account_for_mixed_cell_energy)
861 delta_mp += (1/Lvap)*(VdrhocpT_dt);
864 int_dmp_ai += delta_mp;
870 if ((
option==3) and (int_ai>DMINFLOAT))
873 const double mean_dmp = int_dmp_ai/int_ai;
874 const double mean_mp = int_mp_ai/int_ai;
876 if (fabs(mean_mp)>DMINFLOAT)
877 rel=mean_dmp/mean_mp*100.;
878 Cerr <<
"correction of mp at time "<< temps <<
" mean_mp= " << mean_mp <<
" relative= " << rel <<
"%." <<finl;
900 double total_flux_lost = 0.;
901 double total_derivee_energy = 0.;
902 double mpai_tot = 0.;
904 for (
int nd=0 ; nd<nb_elem ; nd++)
909 mpai_tot += mp[elem]*ai[elem]*Lvap;
912 if ((
option==3) and (int_ai>DMINFLOAT))
914 const double mean_mp_corr = mpai_tot/(int_ai*Lvap);
915 Cerr <<
" mean_mp_corr= " << mean_mp_corr <<
" time= " << temps << finl;
917 total_flux_lost =
mp_sum(total_flux_lost);
918 mpai_tot =
mp_sum(mpai_tot);
919 total_derivee_energy =
mp_sum(total_derivee_energy)/dt;
920 Cerr <<
"[Corrected-balance] Time= " << temps <<
" nb_elems= " << nb_elem
921 <<
" phi(positive if towards mixed cells)= " << total_flux_lost
922 <<
" mp*ai*Lvap= " << mpai_tot
923 <<
" dE/dt= " << total_derivee_energy
924 <<
" imbalance= " << total_derivee_energy-total_flux_lost+mpai_tot << finl;
933 for(
int i=0; i<n; i++)
935 if ((ai[i]>DMINFLOAT) && (fabs(mp[i])>mmax))
944 extrapolate(domaine_vf, ai,
stencil_width_, distance_interface, mp);
959 vitesse_convection_->valeurs() += val_vitesse_ns;
964 solveur_masse_fictitious->set_name_of_coefficient_temporel(
"no_coeff");
976 Cerr <<
"[Conv_diff_FT_Disc] div_tmp recieved the type " << div_tmp.
type() << finl;
977 Cerr <<
"[Conv_diff_FT_Disc] div_tmp que suis je " << div_tmp.que_suis_je() << finl;
986 Cerr <<
"[Conv_diff_FT_Disc] Velocity correction. Construction of the divergence operator type : " << nom_type << finl;
1010 DoubleTab& secmem = divergence_delta_U->valeurs();
1012 div_tmp->
calculer(vitesse_convection_->valeurs(),secmem);
1019 const IntTab& face_voisins = domaine_vf.
face_voisins();
1020 const IntTab& elem_faces = domaine_vf.
elem_faces();
1022 const int nb_faces_elem = elem_faces.
dimension(1);
1027 for (
int elem = 0; elem < nb_elem; elem++)
1029 const double dist = distance(elem);
1040 for (i_face = 0; i_face < nb_faces_elem; i_face++)
1042 const int face = elem_faces(elem, i_face);
1043 const int voisin = face_voisins(face, 0) + face_voisins(face, 1) - elem;
1046 const double d = distance(voisin);
1059 assembleur_pression_->modifier_secmem(secmem);
1061 la_pression->changer_temps(
schema_temps().temps_courant());
1066 la_pression->valeurs()
1068 assembleur_pression_->modifier_solution(la_pression->valeurs());
1071 DoubleTab& gradP = gradient_pression_->valeurs();
1075 gradient_tmp.
typer();
1081 gradient_tmp.
calculer(la_pression->valeurs(), gradP);
1083 solveur_masse_fictitious->appliquer(gradP);
1088 DoubleTab& vc = vitesse_convection_->valeurs();
1093 for (i = 0; i < n; i++)
1100 for (i = 0; i < n; i++)
1101 for (j = 0; j < m; j++)
1102 vc(i,j) += gradP(i,j);
1113 statistics().create_custom_counter(
"calculer_mpoint",3,
"FrontTracking");
1114 statistics().begin_count(
"calculer_mpoint",statistics().get_last_opened_counter_level()+1);
1116 statistics().end_count(
"calculer_mpoint");
1129 statistics().create_custom_counter(
"extend_ui",3,
"FrontTracking");
1130 statistics().begin_count(
"extend_ui", statistics().get_last_opened_counter_level()+1);
1140 vitesse_convection_->valeurs() += val_vitesse_ns;
1149 statistics().end_count(
"extend_ui");
1162 bool calcul_explicite =
false;
1169 if (
schema_temps().diffusion_implicite() && !calcul_explicite)
1182 double total_flux_lost = 0.;
1183 for (
int nd=0 ; nd<nb_diffu ; nd++)
1189 total_flux_lost =
mp_sum(total_flux_lost);
1197 DoubleTab derivee_tmp(derivee);
1200 derivee_tmp *= rhoCp;
1201 derivee += derivee_tmp;
1206 double total_flux_conv_lost = 0.;
1207 for (
int nd=0 ; nd<nb_conv ; nd++)
1210 const double flux =
lost_fluxes_(nb_diffu+nd)*rhoCp[elem];
1211 total_flux_conv_lost += flux;
1216 total_flux_conv_lost =
mp_sum(total_flux_conv_lost);
1222 solveur_masse->appliquer(derivee);
1223 if (
schema_temps().diffusion_implicite() && !calcul_explicite)
1242 double total_flux_lost = 0.;
1243 for (
int nd=0 ; nd<nb ; nd++)
1246 total_flux_lost =
mp_sum(total_flux_lost);
1255 mpoint_uncorrected_->valeurs() = mpoint_->valeurs();
1256 DoubleTab& mp = mpoint_->valeurs();
1260 double mp_sum_before_corr = 0.;
1261 double int_ai_before = 0.;
1262 for (
int nd=0 ; nd<nb_elemi ; nd++)
1265 int_ai_before += ai[elembi];
1270 mp_sum_before_corr += mp[elembi]*ai[elembi];
1272 if (int_ai_before>DMINFLOAT)
1274 const double mean_mp_before_corr = mp_sum_before_corr/int_ai_before;
1275 Cerr <<
" mp_sum_before_corr= " << mp_sum_before_corr <<
" mean_mp_before_corr= " << mean_mp_before_corr <<
" time= " << temps << finl;
1297 toto ce code n est pas lu
1325 vitesse_convection_->mettre_a_jour(temps);
1333 const Domaine& dom = domaine_vf.
domaine();
1334 const Sous_Domaine& ss_domaine = dom.
ss_domaine(nom_sous_domaine);
1342 double temp_moy_ss_domaine = 0.;
1343 double vol_liq = 0.;
1346 int index = ss_domaine[i];
1348 if (index < nb_elem)
1350 temp_moy_ss_domaine += temperature[index] * indicatrice[index] * volume[index];
1351 vol_liq += indicatrice[index] * volume[index];
1354 vol_liq =
mp_sum(vol_liq);
1355 temp_moy_ss_domaine =
mp_sum(temp_moy_ss_domaine);
1356 if (vol_liq == 0. || temp_moy_ss_domaine == 0.)
1362 temp_moy_ss_domaine /= vol_liq ;
1363 double fac = temp_moy_ini / temp_moy_ss_domaine;
1389 int nbwall_found = 0;
1393 const Nom& bc_name = la_cl-> frontiere_dis().le_nom();
1400 Cerr <<
"[Convection_Diffusion_Temperature_FT_Disc]: Reinjection bubble: Wall-type BC found at " << bc_name <<finl;
1402 nbwall_found = nbwall_found +1;
1405 if (nbwall_found != 1)
1406 Process::exit(
Nom(nbwall_found) +
" wall-type BC found!!!!! Check JDD, pls" );
1408 Process::exit(
"[Convection_Diffusion_Temperature_FT_Disc]: !!! NO WALL-TYPE BOUNDARY WAS FOUND IN THE DOMAINE, PLESEASE CHECK JDD" );
1411 const IntTab& face_voisins = domaine_vf.
face_voisins();
1413 const DoubleTab& centre_gravite_face = domaine_vf.
xv();
1424 for (
int ii = 0; ii < nb_face; ii++)
1426 const int num_face = ii + nb_first_face;
1427 const int elemi = face_voisins (num_face, 0)
1428 + face_voisins (num_face, 1) + 1;
1430 if (!est_egal (indica(elemi,0), 1.))
1438 if (BC_has_vap == 0)
1441 double sum_surface = 0;
1442 for (
int ii = 0; ii < nb_face; ii++)
1444 const int num_face = ii + nb_first_face;
1448 sum_surface += surface (num_face);
1455 sum_T = (sum_surface > DMINFLOAT) ? sum_T / sum_surface : 0;
1473 dis.
discretiser_champ(
"temperature", un_domaine_dis, nom,
"K", 1 , nb_valeurs_temps, temps, la_temperature);
1474 champs_compris.add(la_temperature.valeur());
1477 nom =
Nom(
"temperature_grad_") +
le_nom();
1478 dis.
discretiser_champ(
"temperature", un_domaine_dis, nom,
"K/m", 1 , temps, grad_t_);
1479 champs_compris.add(grad_t_.valeur());
1483 dis.
discretiser_champ(
"temperature", un_domaine_dis, nom,
"kg/(m2s)", 1 , temps, mpoint_);
1484 champs_compris.add(mpoint_.valeur());
1487 nom =
Nom(
"mpoint_uncorrected_") +
le_nom();
1488 dis.
discretiser_champ(
"temperature", un_domaine_dis, nom,
"kg/(m2s)", 1 , temps, mpoint_uncorrected_);
1489 champs_compris.add(mpoint_uncorrected_.valeur());
1493 dis.
discretiser_champ(
"vitesse", un_domaine_dis, nom,
"m/s", -1 , 1 , temps, vitesse_convection_);
1494 champs_compris.add(vitesse_convection_.valeur());
1500 Cerr <<
"Fake Pressure gradient discretization" << finl;
1501 nom =
Nom(
"gradient_pression_") +
le_nom();
1505 gradient_pression_);
1506 champs_compris.add(gradient_pression_.valeur());
1509 Cerr <<
"Fake Pressure discretization" << finl;
1511 dis.
discretiser_champ(
"pression",un_domaine_dis,nom,
"Pa.m3/kg",1,1,temps,la_pression);
1512 champs_compris.add(la_pression.valeur());
1515 Cerr <<
"Velocity (delta_u) divergence discretization" << finl;
1516 nom =
Nom(
"divergence_delta_U_") +
le_nom();
1517 dis.
discretiser_champ(
"divergence_vitesse" ,un_domaine_dis, nom,
"m3/s", 1,1,temps,divergence_delta_U);
1518 champs_compris.add(divergence_delta_U.valeur());
1528 Nom type =
"Assembleur_P_";
1531 Cerr <<
"Navier_Stokes_std::discretiser_assembleur_pression : type="<< type << finl;
1532 assembleur_pression_.typer(type);
1533 assembleur_pression_->associer_domaine_dis_base(
domaine_dis());
1543 Cerr <<
"The value of the stencil to compute mpoint should at least be strictly larger than "
1544 <<
"the width on which the distance is computed (given by n_iterations_distance in " << ft.
que_suis_je() <<
")" << finl;
1545 Cerr <<
"Current options : stencil= " <<
stencil_width_ <<
" and n_iterations_distance= " << ndist <<
" are invalid! Exiting." << finl;
1552 Cerr <<
"You are trying to make the extension of velocity divergence free. " << finl;
1553 Cerr <<
"A poisson solver is then required and should be defined in your equation by the addition of the optional keyword solveur_pression_fictive " << finl;
1554 Cerr <<
"as in e.g.: solveur_pression_fictive GCP { precond ssor { omega 1.5 } seuil 1e-15 impr } " << finl;
1564 instructions <<
"{" << finl;
1569 for (
int ifront=0; ifront<nfront; ifront++)
1573 instructions <<
" " <<nom_front <<
" sortie_libre_rho_variable champ_front_uniforme 1 0" << finl;
1575 instructions <<
" " <<nom_front <<
" symetrie" << finl;
1577 instructions <<
"}" << finl;
1578 Cerr <<
"Interpretation de la chaine suivante:" << finl << instructions.
get_str();
1582 Cerr <<
"Discretisation of fictitious CL ..." << finl;
1583 zcl_fictitious_.typer(
"Domaine_Cl_VDF");
1586 zcl_fictitious_vdf.
associer(domaine_vdf);
1587 zcl_fictitious_->associer_eqn(ns);
1591 Cerr <<
"Interpreting input string ..." << finl;
1592 is >> zcl_fictitious_vdf ;
1595 Cerr <<
"Completing fictitious CL ..." << finl;
1600 assembleur_pression_->associer_domaine_cl_dis_base(zcl_fictitious_.valeur());
1601 assembleur_pression_->completer(ns);
1611 Cerr <<
"Check your datafile. Rc_GridN and Rc_inject should not but used simultaneously." << finl;
1612 Cerr <<
"Rc_tcl_GridN = " <<
Rc_GridN_ << finl;
1636 Process::exit(
"[Convection_Diffusion_Temperature_FT_Disc]: !!! NO WALL-TYPE BOUNDARY WAS FOUND IN THE DOMAINE, PLESEASE CHECK JDD" );
1646 const double cell_height = 2.*std::fabs(zvdf.
dist_face_elem0(num_face,elem_voisin));
1650 Cerr <<
"[Convection_Diffusion_Temperature_FT_Disc] Rc_inject_ is set to " <<
Rc_inject_ <<
" according to provided Rc_GridN_ " <<
Rc_GridN_ << finl;
1661 Cerr <<
"You forgot to associate the diphasic fluid to the problem named " <<
probleme().
le_nom() << finl;
1671 Cerr <<
"You forgot to associate the diphasic fluid to the problem named " <<
probleme().
le_nom() << finl;
1674 return fluide_dipha_->fluide_phase(
phase_);
1681 Cerr <<
"Erreur dans Convection_Diffusion_Temperature_FT_Disc::associer_milieu_base\n"
1682 <<
" On attendait un fluide diphasique" << finl;
1683 Cerr <<
"Error for Convection_Diffusion_Temperature_FT_Disc::associer_milieu_base\n"
1684 <<
"A Fluide_Diphasique medium was expected." << finl;
1697 const ArrOfInt& flags_compo_a_supprimer,
1701 if (nouvelle_phase !=
phase_)
1705 assert(num_compo.
size() == n);
1711 for (
int t = 0; t < nb_valeurs_temporelles; t++)
1714 for (
int i = 0; i < n; i++)
1716 const int c = num_compo[i];
1717 if (c >= 0 && flags_compo_a_supprimer[c])
1718 temp[i] = TSAT_CONSTANTE;
1728 ref_eq_interface_.valeur().associate_temp_equation_post_processing(*
this);
1737 double interfacial_flux = 0.;
1741 Cerr <<
"Woops! Not VDF";
1747 const Nom& bc_name = la_cl->frontiere_dis().le_nom();
1753 Cerr <<
"paroi_adiabatique" << finl;
1754 return interfacial_flux;
1758 Cerr <<
"paroi_flux_impose" << finl;
1765 Cerr <<
"paroi_temperature_imposee (among other possibilities)" << finl;
1772 const double h = la_cl_typee.
h_imp(num_face-ndeb);
1773 const double T_imp = la_cl_typee.
T_ext(num_face-ndeb);
1776 interfacial_flux = h*(T_imp - TSAT_CONSTANTE);
1778 return interfacial_flux;
1790 Cerr <<
que_suis_je() <<
"::get_flux_to_face(). " ;
1791 Cerr <<
"The BC type " << la_cl.valeur() <<
" for boundary "<< bc_name
1792 <<
" is not supported yet."<< finl;
1795 return interfacial_flux;
1800 double flux=0., Twall=0.;
1810 const IntTab& elem_faces = domaine_vf.
elem_faces();
1812 const int nb_faces_voisins = elem_faces.
dimension(1);
1816 for (i=0; i<nb_faces_voisins; i++)
1818 num_face = elem_faces(elem,i);
1821 const int elemb = faces_elem(num_face, 0) + faces_elem(num_face, 1) +1;
1828 if (i==nb_faces_voisins)
1830 Cerr <<
"Error. No boundary face found in this element "<< elem << finl;
1833 double flux=0., Twall=0.;
1840 double& flux,
double& Twall)
const
1846 Cerr <<
"Woops! Not VDF";
1852 const Nom& bc_name = la_cl->frontiere_dis().le_nom();
1858 Cerr <<
"paroi_adiabatique" << finl;
1861 Cerr <<
"How can we set Twall when temperature(elem) is not valid? Or is it?" << finl;
1866 Cerr <<
"paroi_flux_impose" << finl;
1870 Cerr <<
"How can we set Twall when temperature(elem) is not valid? Or is it?" << finl;
1885 const double h = la_cl_typee.
h_imp(num_face-ndeb);
1886 const double T_imp = la_cl_typee.
Ti_wall(num_face-ndeb);
1895 Cerr <<
"paroi_temperature_imposee (among other possibilities)" << finl;
1902 const double h = la_cl_typee.
h_imp(num_face-ndeb);
1903 const double T_imp = la_cl_typee.
T_ext(num_face-ndeb);
1907 flux = h*(T_imp - TSAT_CONSTANTE);
1923 Cerr <<
que_suis_je() <<
"::get_flux_and_Twall(). " ;
1924 Cerr <<
"The BC type " << la_cl.valeur() <<
" for boundary "<< bc_name
1925 <<
" is not supported yet."<< finl;
1936 const int elem = faces_elem(num_face, 0) + faces_elem(num_face, 1) +1;
1939 double P[3] = {0.,0.,0.}, xyz_face[3] = {0.,0.,0.};
1940 xyz_face[0] = domaine_vf.
xv(num_face,0);
1941 xyz_face[1] = domaine_vf.
xv(num_face,1);
1942 P[0] = domaine_vf.
xp(elem, 0);
1943 P[1] = domaine_vf.
xp(elem, 1);
1946 xyz_face[2] = domaine_vf.
xv(num_face,2);
1947 P[2] = domaine_vf.
xp(elem, 2);
1951 for (
int i=0; i<3; i++)
1952 d += (xyz_face[i] - P[i])*(xyz_face[i] - P[i]);
1955 const double k = fluide_dipha_->fluide_phase(
phase_).conductivite().valeurs()(0,0);
1958 const double Twall = temperature(elem) - d/k*flux;
1965 return TSAT_CONSTANTE;
DoubleTab & futur(int i=1) override
Returns field values at instant t+i.
DoubleTab & passe(int i=1) override
Returns field values at instant t-i.
virtual int nb_valeurs_temporelles() const
Returns the number of temporal values currently kept.
DoubleTab & valeurs() override
Returns the array of field values at the current time.
virtual DoubleTab & valeurs()=0
class Champ_base This class is the base of the fields hierarchy.
virtual DoubleTab & valeurs() override
Returns the array of field values.
Champ_front_base & champ_front()
class Cond_lim Generic class used to represent any class
double get_Twall_at_face(const int num_face) const
const double & get_tempC() const
void compute_divergence_free_velocity_extension()
bool is_reinject_activated() const
int lire_motcle_non_standard(const Motcle &, Entree &) override
Reads non-simple-type parameters of an Objet_U from an input stream.
SolveurSys solveur_pression_
Matrice matrice_pression_
void set_param(Param &titi) const override
const double & get_tsat_constant() const
bool divergence_free_velocity_extension_
void associer_milieu_base(const Milieu_base &milieu) override
Associates a physical medium to the equation; the medium is cast to Fluide_base.
int preparer_calcul() override
Everything that does not depend on other possible problems.
virtual void corriger_pas_de_temps(double dt)
void completer() override
Completes the construction (initialization) of objects associated with the equation.
const double & get_Rc_inject() const
void get_flux_and_Twall(const int num_face, double &flux, double &Twall) const
int correction_courbure_ordre_
void discretiser_assembleur_pression()
Milieu_base & milieu() override
Convection_Diffusion_Temperature_FT_Disc()
ArrOfInt correction_mpoint_diff_conv_energy_
void set_is_solid_particle(const bool is_solid_particle)
double get_Twall_at_elem(const int elem) const
void calculer_grad_t()
met a jour le champ grad_t en fonction du champ inconnue.
virtual void preparer_pas_de_temps()
bool maintien_temperature_
double get_flux_to_face(const int num_face) const
DoubleTab & derivee_en_temps_inco(DoubleTab &) override
Returns the time derivative of the unknown I of the equation: dI/dt = M-1*(sum(operators(I) + sources...
ArrOfInt mixed_elems_conv_
ArrOfDouble lost_fluxes_conv_
Noms name_bc_opening_pressure_
OWN_PTR(Champ_Fonc_base) grad_t_
LIST(OBS_PTR(Champ_base)) liste_champs_compris_
ArrOfDouble derivee_energy_
void mettre_a_jour(double temps) override
The value of the unknown at the time step has been calculated.
int correction_gradt_ordre_
OBS_PTR(Fluide_Diphasique) fluide_dipha_
virtual void suppression_interfaces(const IntVect &num_compo, const ArrOfInt &flags_compo_a_supprimer, int nouvelle_phase)
Methode appelee par Transport_Interfaces_xxx::test_suppression_interfaces_sous_domaine() lorqu'une in...
void discretiser() override
Discretizes the equation.
const Champ_base & vitesse_pour_transport() const override
bool is_prescribed_mpoint_
ArrOfInt mixed_elems_diffu_
ArrOfDouble lost_fluxes_diffu_
double prescribed_mpoint_
double get_Twall(const int num_face) const
Convection_Diffusion_Temperature Special case of Convection_Diffusion_std.
const Champ_Inc_base & inconnue() const override
const Champ_base & get_champ(const Motcle &nom) const override
DoubleTab & derivee_en_temps_inco(DoubleTab &) override
Returns the time derivative of the unknown I of the equation: dI/dt = M-1*(sum(operators(I) + sources...
int lire_motcle_non_standard(const Motcle &, Entree &) override
Reads non-simple-type parameters of an Objet_U from an input stream.
void set_param(Param &titi) const override
Operateur_Diff terme_diffusif
int lire_motcle_non_standard(const Motcle &, Entree &) override
Reads non-simple-type parameters of an Objet_U from an input stream.
Operateur_Conv terme_convectif
Dirichlet_paroi_defilante Imposes the wall velocity in an equation of type Navier_Stokes.
Dirichlet_paroi_fixe Represents a fixed wall in a Navier-Stokes type equation.
class Discretisation_base This class represents a spatial discretization scheme, which
virtual Nom get_name_of_type_for(const Nom &class_operateur, const Nom &type_operteur, const Equation_base &eqn, const OBS_PTR(Champ_base)&champ_supp=OBS_PTR(Champ_base)()) const
Fills the Nom type depending on the class of operator, the type of operator and the equation.
void discretiser_champ(const Motcle &directive, const Domaine_dis_base &z, const Nom &nom, const Nom &unite, int nb_comp, int nb_pas_dt, double temps, OWN_PTR(Champ_Inc_base)&champ, const Nom &sous_type=NOM_VIDE) const
const Sous_Domaine_t & ss_domaine(int i) const
const Frontiere_t & frontiere(int i) const
void completer(const Domaine_dis_base &) override
const Cond_lim & la_cl_de_la_face(int numfa) const override
Given a boundary face index in the Domaine_VF, returns the boundary condition to which this face.
void associer(const Domaine_dis_base &) override
class Domaine_Cl_dis_base Domaine_Cl_dis_base objects represent discretized boundary conditions
int nb_cond_lim() const
Returns the number of boundary conditions.
const Cond_lim & les_conditions_limites(int) const
Returns the i-th boundary condition.
double dist_face_elem0(int, int) const override
Returns the distance between the center of a face and the center of face_voisins(face,...
virtual const DoubleVect & face_surfaces() const
double xv(int num_face, int k) const
int elem_faces(int i, int j) const
Returns the index of the i-th face of element num_elem; the face numbering convention is.
double xp(int num_elem, int k) const
int face_voisins(int num_face, int i) const
Returns the neighbouring element of num_face in direction i.
class Domaine_dis_base This class is the base of the hierarchy of discretized domains.
const Domaine & domaine() const
An input stream whose source is a character string.
virtual double flux_exterieur_impose(int i) const
Echange_impose_base: This boundary condition is used only for the energy equation.
virtual double h_imp(int num) const
Returns the value of the imposed heat exchange coefficient on the i-th component.
virtual double T_ext(int num) const
Returns the value of the imposed temperature on the i-th component of the boundary field.
Class defining operators and methods for all reading operation in an input flow (file,...
class Equation_base The role of an equation is the calculation of one or more fields....
const Nom & le_nom() const override
Returns the name of the equation.
const Discretisation_base & discretisation() const
Returns the discretization associated with the equation.
Solveur_Masse_base & solv_masse()
Returns the mass solver associated with the equation.
virtual void mettre_a_jour(double temps)
The value of the unknown at the time step has been calculated.
virtual void completer()
Completes the construction (initialization) of objects associated with the equation.
virtual int preparer_calcul()
Everything that does not depend on other possible problems.
virtual Domaine_Cl_dis_base & domaine_Cl_dis()
Returns the discretized boundary condition domain associated with the equation.
Probleme_base & probleme()
Returns the problem associated with the equation.
Schema_Temps_base & schema_temps()
Returns the time scheme associated with the equation.
virtual void discretiser()
Discretizes the equation.
Champs_compris champs_compris_
Domaine_dis_base & domaine_dis()
Returns the discretized domain associated with the equation.
const Nom & le_nom() const override
Returns the name of the field.
int num_premiere_face() const
int_t num_premiere_face() const
const Nom & le_nom() const override
Returns the name of the Objet_U. Virtual method to override: returns "neant" in this implementation.
int_t nb_faces() const
Returns the number of faces of the boundary.
: class Maillage_FT_Disc Cette classe decrit un maillage:
int get_mesh_tag() const
return mesh_state_tag_
Milieu_base This class is the base of the (physical) medium hierarchy.
void associer_eqn(const Equation_base &)
Associates an equation with the object.
A character string (Nom) in uppercase.
void calculer_delta_u_interface(Champ_base &u0, int phase_pilote, int ordre, const bool future_or_past=false)
Calcul du saut de vitesse a l'interface du au changement de phase.
const DoubleTab & get_interfacial_area() const
virtual const Champ_base & calculer_div_normale_interface()
Navier_Stokes_std This class carries the terms of the momentum equation.
const Champ_Inc_base & inconnue() const override
Returns the velocity (unknown field of the equation) (const version).
Classe Neumann_paroi_adiabatique This boundary condition corresponds to an adiabatic wall in a.
Classe Neumann_paroi This boundary condition corresponds to an imposed flux for the.
class Nom: a character string for naming TRUST objects.
Nom & suffix(const char *const)
Suffix extraction: Nom x("azerty");.
const Nom & que_suis_je() const
Returns the string identifying the class.
virtual Entree & readOn(Entree &)
Reads an Objet_U from an input stream. Virtual method to override.
virtual Sortie & printOn(Sortie &) const
Writes the object to an output stream. Virtual method to override.
Operateur_Div Generic class of the hierarchy of operators computing the divergence.
Operateur_base & l_op_base() override
Returns the underlying object upcast to Operateur_base.
void typer() override
Types the operator: types as "Op_div_"+discretisation()+.
DoubleTab & calculer(const DoubleTab &, DoubleTab &) const override
Initializes the array passed as parameter with the contribution of the operator.
Classe Operateur_Grad Generic class of the hierarchy of operators computing the gradient.
DoubleTab & calculer(const DoubleTab &, DoubleTab &) const override
Initializes the array passed as parameter with the contribution of the operator.
Operateur_base & l_op_base() override
Returns the underlying object upcast to Operateur_base.
void typer() override
Types the operator: types as "Op_Grad_"+discretisation()+.
virtual void associer(const Domaine_dis_base &, const Domaine_Cl_dis_base &, const Champ_Inc_base &inco)=0
void associer_eqn(const Equation_base &)
Associates an equation with the operator.
const Nom & type() const
Returns the (name of the) type of operator to create.
virtual void completer()
Updates the references of the objects associated with the operator.
Helper class to factorize the readOn method of Objet_U classes.
void ajouter_flag(const char *keyword, const bool *value)
Register a boolean flag whose mere presence switches it to true.
void ajouter_condition(const char *condition, const char *message, const char *name=0)
Declare a post-read logical condition that must hold on the parameter values.
void ajouter(const char *keyword, const int *value, Param::Nature nat=Param::OPTIONAL)
Register an integer parameter.
void ajouter_non_std(const char *keyword, const Objet_U *value, Param::Nature nat=Param::OPTIONAL)
Register a keyword handled by Objet_U::lire_motcle_non_standard.
class Parametre_implicite A Parametre_implicite object groups together the various
bool & calcul_explicite()
virtual const Transport_Interfaces_FT_Disc & equation_interfaces(const Motcle &nom) const
virtual const Navier_Stokes_FT_Disc & equation_hydraulique(const Motcle &nom) const
const Triple_Line_Model_FT_Disc & tcl() const
const Nom & le_nom() const override
Returns the name of the Objet_U. Virtual method to override: returns "neant" in this implementation.
static double mp_max(double)
static double mp_sum(double)
Computes the sum of x over all processors in the current group.
static void barrier()
Synchronizes all processors in the current group (waits until all processors have reached the barrier...
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
static int je_suis_maitre()
Returns 1 if on the master processor of the current group (i.e. me() == 0), 0 otherwise.
This class, derived from Sortie, accumulates what is sent to it into a character string.
const char * get_str() const
returns a copy of the string stored by the SChaine
double temps_courant() const
Returns the current time.
double pas_de_temps() const
Returns the current time step (delta_t).
virtual int nb_valeurs_temporelles() const =0
Solveur_Masse_base Represents the mass matrix of an equation.
Base class for output streams.
int_t nb_elem_tot() const
_SIZE_ size_array() const
void resize_array(_SIZE_ new_size, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)
_SIZE_ dimension(int d) const
virtual void echange_espace_virtuel(IsExchangeBlocking exchange_type=IsExchangeBlocking::DefaultBlocking, const std::string kernel_name="noname")
const Champ_Inc_base & inconnue() const override
const Champ_base & get_indicatrice() override
getter champ variables_internes_->indicatrice_cache a partir de la position des interfaces.
virtual const Champ_base & get_normale_interface() const
const Maillage_FT_Disc & maillage_interface() const
virtual const Champ_base & get_distance_interface() const
virtual const int & get_n_iterations_distance() const
bool is_activated() const
const int & tag_tcl() const
void corriger_mpoint(DoubleTab &mpoint) const