16#include <Check_espace_virtuel.h>
17#include <Postprocessing_IJK.h>
18#include <Schema_Euler_explicite_IJK.h>
19#include <IJK_Navier_Stokes_tools.h>
20#include <Probleme_FTD_IJK_base.h>
21#include <IJK_Thermal_cut_cell.h>
22#include <IJK_Field_vector.h>
23#include <IJK_Lata_writer.h>
24#include <Schema_RK3_IJK.h>
25#include <Domaine_IJK.h>
26#include <IJK_Interfaces.h>
27#include <Option_IJK.h>
38inline Entity str_to_entity(
const Motcle& loc)
40 if (loc ==
"ELEM")
return Entity::ELEMENT;
41 if (loc ==
"SOM")
return Entity::NODE;
42 if (loc ==
"FACES")
return Entity::FACE;
44 Cerr <<
"Invalid localisation for field postprocessing : '" << loc <<
"' !!" << finl;
46 return Entity::ELEMENT;
49inline Nom entity_to_str(
const Entity& e)
51 if (e == Entity::ELEMENT)
return "ELEM";
52 if (e == Entity::NODE)
return "SOM";
53 if (e == Entity::FACE)
return "FACES";
57inline int extract_component(
const Nom& fld_name)
59 const std::vector<std::string> compos = {
"_X",
"_Y",
"_Z"};
61 std::string end = s.substr(s.size()-2, 2);
62 auto it = std::find(compos.begin(), compos.end(), end);
63 if(it == compos.end())
65 Cerr <<
"ERROR: field name '" << fld_name <<
"' does not end with a component name (_X, _Y or _Z)!! Should not happend?" << finl;
68 return (
int)std::distance(compos.begin(), it);
73Postprocessing_IJK::Postprocessing_IJK()
75 groups_statistiques_FT_.dimensionner(0);
103 ref_ijk_ft_ = ijk_ft;
105 interfaces_ = ref_ijk_ft_->get_interface();
106 pressure_ = ref_ijk_ft_->eq_ns().pressure_;
107 velocity_ = ref_ijk_ft_->eq_ns().velocity_;
108 bk_tsi_ns_ = ref_ijk_ft_->eq_ns().backup_terme_source_interfaces_ns_;
109 d_velocity_ = ref_ijk_ft_->eq_ns().d_velocity_;
111 if (ref_ijk_ft_->has_thermals())
112 thermals_ = ref_ijk_ft_->get_ijk_thermals();
207 Cerr <<
"Post-processing for the interface of IJK_interfaces object named: '" << motlu <<
"'" << finl;
211 for (
int i=0; i < mon_probleme->nombre_d_equations(); i++)
218 if (motlu != interf_nam)
220 Cerr <<
"ERROR: the requested interface equation '" << motlu <<
"' is not available for post-processing!!!" << finl;
227 Cerr <<
"ERROR: Postprocessing_IJK::lire_entete_bloc_interface()\n";
228 Cerr <<
" { was expected after the keyword interfaces\n";
229 Cerr <<
" We found '" << motlu <<
"'" << finl;
236 Entity reqloc = str_to_entity(reqloc_s);
237 noms_champs_a_post_.add(fld_nam);
239 Motcle true_field_name = fld_nam;
243 const std::string& str = fld_nam.
getString();
244 std::string key (
"_");
245 std::size_t found = str.rfind(key);
246 if (found!=std::string::npos)
248 Nom var =
Nom(str.substr(0,found));
253 std::stoi(str.substr(found));
256 std::vector<FieldInfo_t> prefix_thermals;
258 for (
const auto& f : prefix_thermals)
260 Nom prefix = std::get<0>(f);
264 true_field_name=prefix;
265 Cerr <<
" For IJK_thermals: postpro field name '" << fld_nam <<
"' matched with prefix " << true_field_name <<
" defined in IJK_thermals::Fill_postprocessable_fields " << finl;
268 std::vector<FieldInfo_t> c = {{ fld_nam, std::get<1>(f), std::get<2>(f), std::get<3>(f)}};
273 catch (
const std::invalid_argument& )
288 Motcle nom2 = std::get<0>(f);
293 if((get<2>(f) == Nature_du_champ::vectoriel) && (!
vect_post_fields_.count(nom2)))
304 Motcle nom2 = std::get<0>(f);
305 Entity loc2 = std::get<1>(f);
307 bool want_interp = (reqloc == Entity::ELEMENT && loc2 == Entity::FACE);
309 && (reqloc == loc2 || want_interp))
315 Cerr <<
"ERROR: field '" << fld_nam <<
"' at localisation '"<< reqloc_s <<
"' duplicated in list of fields to be postprocessed!!" << finl;
328 Cerr <<
"ERROR: field '" << fld_nam <<
"' at localisation '"<< reqloc_s <<
"' is not available for postprocessing!!" << finl;
337 Entity e = str_to_entity(loc_lu);
340 std::vector<FieldInfo_t> flds;
343 for (
const auto& f : flds)
346 Entity loc2 = get<1>(f);
347 bool isOnInterface = get<3>(f);
348 if(isOnInterface && nom2 == nom_champ && e == loc2)
356 Cerr <<
"ERROR: on the interface, field '" << nom_champ <<
"' at localisation '"<< loc_lu <<
"' is not available for postprocessing!!" << finl;
361 interface_post_required_ =
true;
368 Motcle accolade_fermee(
"}"), motlu;
372 while (motlu != accolade_fermee)
410 const double current_time = ref_ijk_ft_->schema_temps_ijk().get_current_time();
411 dumplata_header(lata_name);
412 dumplata_add_geometry(lata_name, velocity_.valeur()[0]);
413 dumplata_add_geometry(lata_name, ref_ijk_ft_->eq_ns().velocity_ft_[0]);
420 velocity_.valeur()[0].echange_espace_virtuel(2 );
421 velocity_.valeur()[1].echange_espace_virtuel(2 );
422 velocity_.valeur()[2].echange_espace_virtuel(2 );
423 pressure_->echange_espace_virtuel(1);
447 postraiter_thermals(forcer);
450 postraiter_stats(forcer);
464 if(!interface_post_required_ || !ref_ijk_ft_->has_interface())
472 const ArrOfInt& comp_c = ref_ijk_ft_->get_interface().maillage_ft_ijk().compo_connexe_facettes();
473 dumplata_ft_field(
nom_fich_,
"INTERFACES",
"COMPO_CONNEXE",
"ELEM", comp_c, latastep);
481 if (requested_loc == Entity::ELEMENT && loc_ijk == LocIJK::ELEM)
483 if (requested_loc == Entity::NODE && loc_ijk == LocIJK::NODES)
485 if ((loc_ijk == LocIJK::FACES_I || loc_ijk == LocIJK::FACES_J || loc_ijk == LocIJK::FACES_K))
487 if(requested_loc == Entity::FACE)
return true;
488 if(requested_loc == Entity::ELEMENT)
501 int latastep = ref_ijk_ft_->schema_temps_ijk().get_tstep();
504 dumplata_newtime(
nom_fich_, ref_ijk_ft_->schema_temps_ijk().get_current_time());
513 bool want_interpolation = get<1>(v);
515 Motcle fld_nam = get<0>(fld_info);
516 Entity fld_loc = get<1>(fld_info);
517 Nature_du_champ nat = get<2>(fld_info);
518 bool is_on_interf = get<3>(fld_info);
520 if (!ref_ijk_ft_->has_champ(fld_nam) && !ref_ijk_ft_->has_champ_vectoriel(fld_nam) )
522 Cerr << finl <<
"ERROR Field '" << fld_nam <<
"' is not available for postprocessing!" << finl << finl;
523 Cerr <<
"(Fields currently available are : " << finl;
525 ref_ijk_ft_->get_noms_champs_postraitables(ns, Option::DESCRIPTION);
526 for (
const auto& n: ns) Cerr << n <<
" ";
531 if (nat == Nature_du_champ::scalaire)
533 const IJK_Field_double* fld = &(ref_ijk_ft_->get_IJK_field(fld_nam));
537 dumplata_ft_field(
nom_fich_,
"INTERFACES", fld_nam, entity_to_str(fld_loc), fld->
data(), latastep);
540 if (!check_loc_compat(fld_loc, fld->
get_localisation(), want_interpolation))
542 Cerr <<
"ERROR Field '" << fld_nam <<
"' is available for postprocessing, but NOT at localisation '" << entity_to_str(fld_loc) <<
"'!" << finl;
545 if(want_interpolation)
548 if (post_projected_field_.get_ptr(0) ==
nullptr)
549 allocate_cell_vector(post_projected_field_, domaine_ijk_, 0);
552 int compo_num = extract_component(fld_nam);
553 interpolate_to_center_compo(post_projected_field_[compo_num], *fld);
554 post_projected_field_[compo_num].dumplata_scalar(
nom_fich_, latastep);
560 else if (nat == Nature_du_champ::vectoriel)
564 Cerr <<
"ERROR: post-processing of vectorial field on the interface not implemented (here '" << fld_nam <<
"') !" << finl;
568 const IJK_Field_vector3_double& fld = ref_ijk_ft_->get_IJK_field_vector(fld_nam);
571 if (loc == Entity::ELEMENT && fld_loc == Entity::FACE)
573 Cerr <<
"ERROR Field '" << fld_nam <<
"' is available for postprocessing on '" << entity_to_str(loc) <<
"' and can not be projected to '" << entity_to_str(fld_loc) <<
"'" << finl;
576 if (want_interpolation)
578 assert(loc == Entity::FACE && fld_loc == Entity::FACE);
580 if (post_projected_field_.get_ptr(0) ==
nullptr)
581 allocate_cell_vector(post_projected_field_, domaine_ijk_, 0);
587 interpolate_to_center(post_projected_field_, fld);
588 dumplata_cellvector(
nom_fich_,
Nom(
"CELL_") + fld_nam, post_projected_field_, latastep);
592 Cerr <<
"ERROR Field '" << fld_nam <<
"' is available for postprocessing, but NOT at localisation '" << entity_to_str(fld_loc) <<
"' !" << finl;
599 Process::exit(
"ERROR: post-processing vectorial field on NODES not implemented!");
601 case Entity::ELEMENT:
602 dumplata_cellvector(
nom_fich_, fld_nam, fld, latastep);
605 dumplata_vector(
nom_fich_, fld_nam, fld[0], fld[1], fld[2], latastep);
619 domaine_ijk_ = dom_ijk;
620 domaine_ft_ = dom_ft;
651 Cerr <<
"fichier_reprise_vitesse_ should be specified in the restart file in Navier_Stokes_FTD_IJK object" << endl;
654 const int timestep_reprise_integrated_timescale_ = 1;
657 if (!lata_has_field(ns.
fichier_reprise_vitesse_, timestep_reprise_integrated_timescale_, geom_name,
"INTEGRATED_TIMESCALE"))
659 Cerr <<
"fichier_reprise_vitesse_ " << ns.
fichier_reprise_vitesse_ <<
" does not contain field INTEGRATED_TIMESCALE to restart statistics. You may specify the flag reset_reprise_integrated in postprocessing to reset statistics" << endl;
685 Cerr <<
"fichier_reprise_vitesse_ should be specified in the restart file in Navier_Stokes_FTD_IJK object" << endl;
688 const int timestep_reprise_integrated_velocity_ = 1;
689 const Nom& geom_name = velocity_.valeur()[0].get_domaine().
le_nom();
691 if (!lata_has_field(ns.
fichier_reprise_vitesse_, timestep_reprise_integrated_velocity_, geom_name,
"INTEGRATED_VELOCITY"))
693 Cerr <<
"fichier_reprise_vitesse_ " << ns.
fichier_reprise_vitesse_ <<
" does not contain field INTEGRATED_VELOCITY to restart statistics. You may specify the flag reset_reprise_integrated in postprocessing to reset statistics" << endl;
697 cout <<
"Lecture vitesse integree initiale dans fichier " << ns.
fichier_reprise_vitesse_ <<
" timestep= " << timestep_reprise_integrated_velocity_ << endl;
703 for (
int i = 0; i < 3; i++)
705 velocity_.valeur()[0].echange_espace_virtuel(velocity_.valeur()[0].ghost());
706 velocity_.valeur()[1].echange_espace_virtuel(velocity_.valeur()[1].ghost());
707 velocity_.valeur()[2].echange_espace_virtuel(velocity_.valeur()[2].ghost());
726 Cerr <<
"fichier_reprise_vitesse_ should be specified in the restart file in Navier_Stokes_FTD_IJK object" << endl;
729 const int timestep_reprise_integrated_pressure_ = 1;
730 const Nom& geom_name = pressure_->get_domaine().
le_nom();
732 if (!lata_has_field(ns.
fichier_reprise_vitesse_, timestep_reprise_integrated_pressure_, geom_name,
"INTEGRATED_PRESSURE"))
734 Cerr <<
"fichier_reprise_vitesse_ " << ns.
fichier_reprise_vitesse_ <<
" does not contain field INTEGRATED_PRESSURE to restart statistics. You may specify the flag reset_reprise_integrated in postprocessing to reset statistics" << endl;
737 cout <<
"Lecture pression integree initiale dans fichier " << ns.
fichier_reprise_vitesse_ <<
" timestep= " << timestep_reprise_integrated_pressure_ << endl;
812 if (vol_bulle_monodisperse >= 0.)
815 vol_bulles.
resize_array(interfaces_->get_nb_bulles_reelles());
816 vol_bulles = vol_bulle_monodisperse;
819 const int nb_groups = interfaces_->nb_groups();
822 groups_statistiques_FT_.dimensionner(nb_groups);
823 for (
int igroup = 0; igroup < nb_groups; igroup++)
824 groups_statistiques_FT_[igroup].initialize(ref_ijk_ft_, splitting,
check_stats_);
834 const int timestep_reprise_indicatrice_non_perturbe = 1;
846 ArrOfDouble volume_reel;
848 interfaces_->calculer_volume_bulles(volume_reel, position);
849 interfaces_->compute_indicatrice_non_perturbe(
indicatrice_non_perturbe_, ref_ijk_ft_->get_interface().I(), volume_reel, position);
867 for (
int flag_valeur_instantanee = 0; flag_valeur_instantanee < 2; flag_valeur_instantanee++)
874 if (flag_valeur_instantanee == 0)
875 n +=
"statistiques_";
877 n +=
"moyenne_spatiale_";
879 n +=
Nom(current_time);
883 f.
setf(ios::scientific);
891 for (
int igroup = 0; igroup < interfaces_->nb_groups(); igroup++)
894 figroup.
setf(ios::scientific);
896 groups_statistiques_FT_[igroup].postraiter(figroup, flag_valeur_instantanee );
897 if (flag_valeur_instantanee == 1)
898 groups_statistiques_FT_[igroup].postraiter_thermique(current_time);
915 const DoubleTab& gravite = ref_ijk_ft_->milieu_ijk().gravite().valeurs();
919 ArrOfDouble aspect_ratio;
920 ArrOfDouble surfactant;
921 ArrOfDouble surfactant_min;
922 ArrOfDouble surfactant_max;
923 const int nbulles = interfaces_->get_nb_bulles_reelles();
924 DoubleTab hauteurs_bulles(nbulles, 3);
925 DoubleTab bounding_box;
926 interfaces_->calculer_bounding_box_bulles(bounding_box);
927 for (
int ib = 0; ib < nbulles; ib++)
928 for (
int dir = 0; dir < 3; dir++)
929 hauteurs_bulles(ib, dir) = bounding_box(ib, dir, 1) - bounding_box(ib, dir, 0);
933 interfaces_->calculer_surface_bulles(surface);
938 interfaces_->calculer_volume_bulles(volume, position);
939 interfaces_->calculer_aspect_ratio(aspect_ratio);
940 interfaces_->calculer_surfactant(surfactant, surfactant_min, surfactant_max);
942 position.
resize(nbulles, 3);
945 interfaces_->calculer_poussee_bulles(gravite, poussee);
947 if(ref_ijk_ft_->has_thermals())
953 const char *nomcas = nom_cas;
956 IOS_OPEN_MODE mode = (reset) ? ios::out : ios::app;
958 auto write_func_tab = [&](
const char * fnam,
const DoubleTab& tab,
int col)
960 snprintf(s, 1000, fnam, nomcas);
962 snprintf(s, 1000,
"%.16e ", current_time);
964 for (
int i = 0; i < n; i++)
966 snprintf(s, 1000,
"%.16e ", tab(i, col));
973 auto write_func_arr = [&](
const char * fnam,
const ArrOfDouble& tab)
975 snprintf(s, 1000, fnam, nomcas);
977 snprintf(s, 1000,
"%.16e ", current_time);
979 for (
int i = 0; i < n; i++)
981 snprintf(s, 1000,
"%.16e ", tab[i]);
988 write_func_tab(
"%s_bulles_pousseex.out", poussee, 0);
989 write_func_tab(
"%s_bulles_hx.out", hauteurs_bulles,0);
990 write_func_tab(
"%s_bulles_hy.out", hauteurs_bulles,1);
991 write_func_tab(
"%s_bulles_hz.out", hauteurs_bulles,2);
993 write_func_tab(
"%s_bulles_centre_x.out", position, 0);
994 write_func_tab(
"%s_bulles_centre_y.out", position, 1);
995 write_func_tab(
"%s_bulles_centre_z.out", position, 2);
997 write_func_arr(
"%s_bulles_surface.out", surface);
998 write_func_arr(
"%s_bulles_volume.out", volume);
999 write_func_arr(
"%s_bulles_aspect_ratio.out", aspect_ratio);
1000 write_func_arr(
"%s_bulles_volume.out", volume);
1002 if (!interfaces_->maillage_ft_ijk().Surfactant_facettes().get_disable_surfactant())
1004 write_func_arr(
"%s_bulles_surfactant.out", surfactant);
1005 write_func_arr(
"%s_bulles_surfactant_min.out", surfactant_min);
1006 write_func_arr(
"%s_bulles_surfactant_max.out", surfactant_max);
1008 if (interfaces_->follow_colors())
1010 const ArrOfInt& colors = interfaces_->get_colors();
1011 snprintf(s, 1000,
"%s_bulles_colors.out", nomcas);
1013 snprintf(s, 1000,
"%.16e ", current_time);
1015 for (
int i = 0; i < n; i++)
1017 snprintf(s, 1000,
"%d ", (
int) colors[i]);
1041 ns.
calculer_vitesse_gauche(velocity_.valeur()[0],velocity_.valeur()[1],velocity_.valeur()[2],v_x_gauche,v_y_gauche,v_z_gauche);
1042 ns.
calculer_vitesse_droite(velocity_.valeur()[0],velocity_.valeur()[1],velocity_.valeur()[2],v_x_droite,v_y_droite,v_z_droite);
1047 const char *nomcas = nom_cas;
1049 IOS_OPEN_MODE mode = (reset) ? ios::out : ios::app;
1051 snprintf(s, 1000,
"%s_cisaillement.out", nomcas);
1055 for (
const auto v: {current_time, v_x_droite, v_y_droite, v_z_droite, v_x_gauche, v_y_gauche, v_z_gauche})
1057 snprintf(s, 1000,
"%.16e ", v);
1072 double ax_PID, ay_PID, az_PID;
1074 const_cast<Postprocessing_IJK*
>(
this)->ref_ijk_ft_->eq_ns().calculer_terme_asservissement(ax_PID,ay_PID,az_PID);
1079 const char *nomcas = nom_cas;
1081 IOS_OPEN_MODE mode = (reset) ? ios::out : ios::app;
1083 snprintf(s, 1000,
"%s_mrf.out", nomcas);
1086 for (
const auto v: {current_time, ax_PID, ay_PID, az_PID})
1088 snprintf(s, 1000,
"%.16e ", v);
1104 const int nbulles = interfaces_->get_nb_bulles_reelles();
1108 interfaces_->calculer_volume_bulles(volume, position);
1110 position.
resize(nbulles, 3);
1119 DoubleTab compteur_base;
1120 DoubleTab compteur_bulles;
1128 const_cast<Postprocessing_IJK*
>(
this)->ref_ijk_ft_->eq_ns().calculer_vitesses_bulle(ref_ijk_ft_->eq_ns().velocity_[0],ref_ijk_ft_->eq_ns().velocity_[1],ref_ijk_ft_->eq_ns().velocity_[2],u_bulles,compteur_bulles);
1129 const_cast<Postprocessing_IJK*
>(
this)->ref_ijk_ft_->eq_ns().calculer_base_amont_bulle(ref_ijk_ft_->eq_ns().velocity_[0],ref_ijk_ft_->eq_ns().velocity_[1],ref_ijk_ft_->eq_ns().velocity_[2],u_bulles,d1,d2,d3,compteur_base);
1130 const_cast<Postprocessing_IJK*
>(
this)->ref_ijk_ft_->eq_ns().calculer_v_amont_bulle(ref_ijk_ft_->eq_ns().velocity_[0],ref_ijk_ft_->eq_ns().velocity_[1],ref_ijk_ft_->eq_ns().velocity_[2],ref_ijk_ft_->eq_ns().velocity_[0],ref_ijk_ft_->eq_ns().velocity_[1],ref_ijk_ft_->eq_ns().velocity_[2],v_amont,w_amont,d1,d2,d3,compteur);
1136 cout <<
"Vecteur 1 : " << d1(0,0) <<
" " << d1(0,1) <<
" " << d1(0,2) << endl;
1137 cout <<
"Vecteur 2 : " << d2(0,0) <<
" " << d2(0,1) <<
" " << d2(0,2) << endl;
1138 cout <<
"Vecteur 3 : " << d3(0,0) <<
" " << d3(0,1) <<
" " << d3(0,2) << endl;
1139 v_amont.
resize(nbulles, 3);
1140 w_amont.
resize(nbulles, 3);
1141 compteur.resize(nbulles, 1);
1143 u_bulles.
resize(nbulles, 3);
1148 const char *nomcas = nom_cas;
1151 IOS_OPEN_MODE mode = (reset) ? ios::out : ios::app;
1153 snprintf(s, 1000,
"%s_bulles_ux.out", nomcas);
1156 snprintf(s, 1000,
"%.16e ", current_time);
1158 for (
int i = 0; i < n; i++)
1160 snprintf(s, 1000,
"%.16e ", u_bulles(i, 0));
1166 snprintf(s, 1000,
"%s_bulles_uy.out", nomcas);
1169 snprintf(s, 1000,
"%.16e ", current_time);
1171 for (
int i = 0; i < n; i++)
1173 snprintf(s, 1000,
"%.16e ", u_bulles(i, 1));
1179 snprintf(s, 1000,
"%s_bulles_uz.out", nomcas);
1182 snprintf(s, 1000,
"%.16e ", current_time);
1184 for (
int i = 0; i < n; i++)
1186 snprintf(s, 1000,
"%.16e ", u_bulles(i, 2));
1192 snprintf(s, 1000,
"%s_bulles_vx_amont.out", nomcas);
1195 snprintf(s, 1000,
"%.16e ", current_time);
1197 for (
int i = 0; i < n; i++)
1199 snprintf(s, 1000,
"%.16e ", v_amont(i, 0));
1205 snprintf(s, 1000,
"%s_bulles_vy_amont.out", nomcas);
1208 snprintf(s, 1000,
"%.16e ", current_time);
1210 for (
int i = 0; i < n; i++)
1212 snprintf(s, 1000,
"%.16e ", v_amont(i, 1));
1218 snprintf(s, 1000,
"%s_bulles_vz_amont.out", nomcas);
1221 snprintf(s, 1000,
"%.16e ", current_time);
1223 for (
int i = 0; i < n; i++)
1225 snprintf(s, 1000,
"%.16e ", v_amont(i, 2));
1231 snprintf(s, 1000,
"%s_bulles_wx_amont.out", nomcas);
1234 snprintf(s, 1000,
"%.16e ", current_time);
1236 for (
int i = 0; i < n; i++)
1238 snprintf(s, 1000,
"%.16e ", w_amont(i, 0));
1244 snprintf(s, 1000,
"%s_bulles_wy_amont.out", nomcas);
1247 snprintf(s, 1000,
"%.16e ", current_time);
1249 for (
int i = 0; i < n; i++)
1251 snprintf(s, 1000,
"%.16e ", w_amont(i, 1));
1257 snprintf(s, 1000,
"%s_bulles_wz_amont.out", nomcas);
1260 snprintf(s, 1000,
"%.16e ", current_time);
1262 for (
int i = 0; i < n; i++)
1264 snprintf(s, 1000,
"%.16e ", w_amont(i, 2));
1280 const int nbulles = interfaces_->get_nb_bulles_reelles();
1284 interfaces_->calculer_volume_bulles(volume, position);
1286 position.
resize(nbulles, 3);
1288 DoubleTab S_surfacePX;
1289 DoubleTab S_surfaceMX;
1290 DoubleTab S_surfacePY;
1291 DoubleTab S_surfaceMY;
1292 DoubleTab S_surfacePZ;
1293 DoubleTab S_surfaceMZ;
1294 DoubleTab S_volumique;
1296 const_cast<Postprocessing_IJK*
>(
this)->ref_ijk_ft_->eq_ns().calculer_terme_S_x(ref_ijk_ft_->eq_ns().velocity_[0],ref_ijk_ft_->eq_ns().velocity_[1],ref_ijk_ft_->eq_ns().velocity_[2], pressure_, S_surfacePX, 1);
1297 const_cast<Postprocessing_IJK*
>(
this)->ref_ijk_ft_->eq_ns().calculer_terme_S_x(ref_ijk_ft_->eq_ns().velocity_[0],ref_ijk_ft_->eq_ns().velocity_[1],ref_ijk_ft_->eq_ns().velocity_[2], pressure_, S_surfaceMX, -1);
1298 const_cast<Postprocessing_IJK*
>(
this)->ref_ijk_ft_->eq_ns().calculer_terme_S_y(ref_ijk_ft_->eq_ns().velocity_[0],ref_ijk_ft_->eq_ns().velocity_[1],ref_ijk_ft_->eq_ns().velocity_[2], pressure_, S_surfacePY, 1);
1299 const_cast<Postprocessing_IJK*
>(
this)->ref_ijk_ft_->eq_ns().calculer_terme_S_y(ref_ijk_ft_->eq_ns().velocity_[0],ref_ijk_ft_->eq_ns().velocity_[1],ref_ijk_ft_->eq_ns().velocity_[2], pressure_, S_surfaceMY, -1);
1300 const_cast<Postprocessing_IJK*
>(
this)->ref_ijk_ft_->eq_ns().calculer_terme_S_z(ref_ijk_ft_->eq_ns().velocity_[0],ref_ijk_ft_->eq_ns().velocity_[1],ref_ijk_ft_->eq_ns().velocity_[2], pressure_, S_surfacePZ, 1);
1301 const_cast<Postprocessing_IJK*
>(
this)->ref_ijk_ft_->eq_ns().calculer_terme_S_z(ref_ijk_ft_->eq_ns().velocity_[0],ref_ijk_ft_->eq_ns().velocity_[1],ref_ijk_ft_->eq_ns().velocity_[2], pressure_, S_surfaceMZ, -1);
1302 const_cast<Postprocessing_IJK*
>(
this)->ref_ijk_ft_->eq_ns().calculer_terme_volumique(ref_ijk_ft_->eq_ns().velocity_[0],ref_ijk_ft_->eq_ns().velocity_[1],ref_ijk_ft_->eq_ns().velocity_[2], ref_ijk_ft_->eq_ns().rho_field_, interfaces_->In(), S_volumique);
1304 S_surfacePX.
resize(nbulles, 3);
1305 S_surfaceMX.
resize(nbulles, 3);
1306 S_surfacePY.
resize(nbulles, 3);
1307 S_surfaceMY.
resize(nbulles, 3);
1308 S_surfacePZ.
resize(nbulles, 3);
1309 S_surfaceMZ.
resize(nbulles, 3);
1310 S_volumique.
resize(nbulles, 3);
1315 const char *nomcas = nom_cas;
1318 IOS_OPEN_MODE mode = (reset) ? ios::out : ios::app;
1320 snprintf(s, 1000,
"%s_bulles_FX.out", nomcas);
1323 snprintf(s, 1000,
"%.16e ", current_time);
1325 for (
int i = 0; i < n; i++)
1327 snprintf(s, 1000,
"%.16e ", S_surfacePX(i, 0) + S_surfaceMX(i, 0) + S_surfacePY(i, 0) + S_surfaceMY(i, 0) + S_surfacePZ(i, 0) + S_surfaceMZ(i, 0));
1333 snprintf(s, 1000,
"%s_bulles_FY.out", nomcas);
1336 snprintf(s, 1000,
"%.16e ", current_time);
1338 for (
int i = 0; i < n; i++)
1340 snprintf(s, 1000,
"%.16e ", S_surfacePX(i, 1) + S_surfaceMX(i, 1) + S_surfacePY(i, 1) + S_surfaceMY(i, 1) + S_surfacePZ(i, 1) + S_surfaceMZ(i, 1));
1346 snprintf(s, 1000,
"%s_bulles_FZ.out", nomcas);
1349 snprintf(s, 1000,
"%.16e ", current_time);
1351 for (
int i = 0; i < n; i++)
1353 snprintf(s, 1000,
"%.16e ", S_surfacePX(i, 2) + S_surfaceMX(i, 2) + S_surfacePY(i, 2) + S_surfaceMY(i, 2) + S_surfacePZ(i, 2) + S_surfaceMZ(i, 2));
1359 snprintf(s, 1000,
"%s_bulles_VX.out", nomcas);
1362 snprintf(s, 1000,
"%.16e ", current_time);
1364 for (
int i = 0; i < n; i++)
1366 snprintf(s, 1000,
"%.16e ", S_volumique(i, 0));
1372 snprintf(s, 1000,
"%s_bulles_VY.out", nomcas);
1375 snprintf(s, 1000,
"%.16e ", current_time);
1377 for (
int i = 0; i < n; i++)
1379 snprintf(s, 1000,
"%.16e ", S_volumique(i, 1));
1385 snprintf(s, 1000,
"%s_bulles_VZ.out", nomcas);
1388 snprintf(s, 1000,
"%.16e ", current_time);
1390 for (
int i = 0; i < n; i++)
1392 snprintf(s, 1000,
"%.16e ", S_volumique(i, 2));
1427 int nb_groups = interfaces_->nb_groups();
1432 for (
int igroup = -1; igroup < nb_groups; igroup++)
1463 groups_statistiques_FT_[igroup].update_stat(ref_ijk_ft_, dt);
1477 compute_and_store_gradU_cell(velocity_.valeur()[0], velocity_.valeur()[1], velocity_.valeur()[2],
1481 statistiques_FT_.compute_and_store_gradU_cell(velocity_.valeur()[0], velocity_.valeur()[1], velocity_.valeur()[2]);
1490 const IJK_Field_vector3_double& gradU=
statistiques_FT_.get_IJK_field_vector(
"dUd");
1491 const IJK_Field_vector3_double& gradV=
statistiques_FT_.get_IJK_field_vector(
"dVd");
1492 const IJK_Field_vector3_double& gradW=
statistiques_FT_.get_IJK_field_vector(
"dWd");
1493 const IJK_Field_double& dudx = gradU[0];
1494 const IJK_Field_double& dudy = gradU[1];
1495 const IJK_Field_double& dudz = gradU[2];
1496 const IJK_Field_double& dvdx = gradV[0];
1497 const IJK_Field_double& dvdy = gradV[1];
1498 const IJK_Field_double& dvdz = gradV[2];
1499 const IJK_Field_double& dwdx = gradW[0];
1500 const IJK_Field_double& dwdy = gradW[1];
1501 const IJK_Field_double& dwdz = gradW[2];
1504 const int kmax = critere_Q.
nk();
1505 const int imax = critere_Q.
ni();
1506 const int jmax = critere_Q.
nj();
1507 for (
int k = 0; k < kmax; k++)
1508 for (
int j = 0; j < jmax; j++)
1509 for (
int i = 0; i < imax; i++)
1511 rot[0](i, j, k) = dwdy(i, j, k) - dvdz(i, j, k);
1512 rot[1](i, j, k) = dudz(i, j, k) - dwdx(i, j, k);
1513 rot[2](i, j, k) = dvdx(i, j, k) - dudy(i, j, k);
1515 critere_Q(i, j, k) = -0.5
1516 * (dudx(i, j, k) * dudx(i, j, k)
1517 + 2. * dudy(i, j, k) * dvdx(i, j, k)
1518 + 2. * dudz(i, j, k) * dwdx(i, j, k)
1519 + dvdy(i, j, k) * dvdy(i, j, k)
1520 + 2. * dvdz(i, j, k) * dwdy(i, j, k)
1521 + dwdz(i, j, k) * dwdz(i, j, k));
1535 std::vector<FieldInfo_t> c =
1539 {
"CURL", Entity::ELEMENT, Nature_du_champ::vectoriel,
false },
1540 {
"CRITERE_Q", Entity::ELEMENT, Nature_du_champ::scalaire,
false },
1541 {
"NUM_COMPO", Entity::ELEMENT, Nature_du_champ::scalaire,
false },
1542 {
"FORCE_PH", Entity::FACE, Nature_du_champ::vectoriel,
false },
1543 {
"COORDS", Entity::FACE, Nature_du_champ::vectoriel,
false },
1544 {
"LAMBDA2", Entity::ELEMENT, Nature_du_champ::scalaire,
false },
1546 {
"VELOCITY_ANA", Entity::FACE, Nature_du_champ::vectoriel,
false },
1547 {
"ECART_ANA", Entity::FACE, Nature_du_champ::vectoriel,
false },
1548 {
"PRESSURE_ANA", Entity::ELEMENT, Nature_du_champ::scalaire,
false },
1549 {
"ECART_P_ANA", Entity::ELEMENT, Nature_du_champ::scalaire,
false },
1550 {
"D_VELOCITY_ANA", Entity::FACE, Nature_du_champ::vectoriel,
false },
1552 {
"D_VELOCITY", Entity::FACE, Nature_du_champ::vectoriel,
false },
1553 {
"OP_CONV", Entity::FACE, Nature_du_champ::vectoriel,
false },
1554 {
"D_PRESSURE", Entity::ELEMENT, Nature_du_champ::scalaire,
false },
1555 {
"MU", Entity::ELEMENT, Nature_du_champ::scalaire,
false },
1556 {
"RHO", Entity::ELEMENT, Nature_du_champ::scalaire,
false },
1557 {
"INDICATRICE_NS", Entity::ELEMENT, Nature_du_champ::scalaire,
false },
1560 {
"INDICATRICE_FT", Entity::ELEMENT, Nature_du_champ::scalaire,
false },
1561 {
"GRAD_INDICATRICE_FT", Entity::FACE, Nature_du_champ::vectoriel,
false },
1562 {
"REBUILT_INDICATRICE_FT", Entity::ELEMENT, Nature_du_champ::scalaire,
false },
1563 {
"GROUPS_FT", Entity::ELEMENT, Nature_du_champ::vectoriel,
false },
1568 {
"RHO_SOURCE_QDM_INTERF", Entity::FACE, Nature_du_champ::vectoriel,
false },
1569 {
"RHO_SOURCE_QDM_INTERF", Entity::ELEMENT, Nature_du_champ::vectoriel,
false },
1570 {
"BK_SOURCE_QDM_INTERF", Entity::FACE, Nature_du_champ::vectoriel,
false },
1572 {
"AIRE_INTERF", Entity::ELEMENT, Nature_du_champ::scalaire,
false },
1573 {
"COURBURE_AIRE_INTERF", Entity::ELEMENT, Nature_du_champ::scalaire,
false },
1574 {
"NORMALE_EULER", Entity::ELEMENT, Nature_du_champ::vectoriel,
false },
1575 {
"PRESSURE_LIQ", Entity::ELEMENT, Nature_du_champ::scalaire,
false },
1576 {
"PRESSURE_VAP", Entity::ELEMENT, Nature_du_champ::scalaire,
false },
1577 {
"GROUPS", Entity::ELEMENT, Nature_du_champ::vectoriel,
false },
1578 {
"SURFACE_VAPEUR_PAR_FACE", Entity::FACE, Nature_du_champ::vectoriel,
false },
1579 {
"BARYCENTRE_VAPEUR_PAR_FACE", Entity::FACE, Nature_du_champ::vectoriel,
false },
1581 {
"VARIABLE_SOURCE", Entity::FACE, Nature_du_champ::vectoriel,
false },
1582 {
"INTEGRATED_VELOCITY", Entity::FACE, Nature_du_champ::vectoriel,
false },
1583 {
"INTEGRATED_PRESSURE", Entity::ELEMENT, Nature_du_champ::scalaire,
false },
1584 {
"INDICATRICE_PERTURBE", Entity::ELEMENT, Nature_du_champ::scalaire,
false },
1585 {
"INTEGRATED_TIMESCALE", Entity::ELEMENT, Nature_du_champ::scalaire,
false }
1588 chps.insert(chps.end(), c.begin(), c.end());
1627 Cerr <<
"ERROR in Postprocessing_IJK::get_IJK_field : " << finl;
1628 Cerr <<
"Requested field '" << nom <<
"' is not recognized by Postprocessing_IJK::get_IJK_field()." << finl;
1632 double current_time = ref_ijk_ft_->schema_temps_ijk().get_current_time();
1635 if (nom ==
"LAMBDA2")
1637 if (nom ==
"CRITERE_Q")
1640 if (nom ==
"NUM_COMPO")
1643 const int ni = num_compo_ft.
ni(), nj = num_compo_ft.
nj(), nk = num_compo_ft.
nk();
1644 const IntVect& num_compo = interfaces_->get_num_compo();
1645 for (
int k = 0; k < nk; k++)
1646 for (
int j = 0; j < nj; j++)
1647 for (
int i = 0; i < ni; i++)
1649 const int num_elem = domaine_ft_->convert_ijk_cell_to_packed(i, j, k);
1650 num_compo_ft(i, j, k) = num_compo[num_elem];
1654 if (nom ==
"AIRE_INTERF")
1657 interfaces_->calculer_aire_interfaciale(ai_ft);
1659 if (nom ==
"PRESSURE_ANA")
1663 if (nom ==
"ECART_P_ANA")
1666 double ct = current_time;
1669 ct -= ref_ijk_ft_->schema_temps_ijk().get_timestep();
1671 else if ( sub_type(
Schema_RK3_IJK, ref_ijk_ft_->schema_temps_ijk()) )
1676 if ((rk_step_before == 0) || (rk_step_before == 3))
1678 else if (rk_step_before == 1)
1683 Cerr <<
"rkstep_before " << rk_step_before << finl;
1684 const double intermediate_dt = compute_fractionnal_timestep_rk3(rk3.
get_timestep(), rk_step_before);
1685 ct -= intermediate_dt;
1689 Cerr <<
"To do for other time scheme" << endl;
1691 Cerr <<
"GB: ERROR P FIELD " << ct;
1694 const int ni = pressure_->ni();
1695 const int nj = pressure_->nj();
1696 const int nk = pressure_->nk();
1699 const double cst_press = pressure_ana(0, 0, 0) - pressure_.valeur()(0, 0, 0);
1700 for (
int k = 0; k < nk; k++)
1701 for (
int j = 0; j < nj; j++)
1702 for (
int i = 0; i < ni; i++)
1704 const double val = pressure_ana(i, j, k) - pressure_.valeur()(i, j, k) - cst_press;
1709 err = sqrt(err /
static_cast<double>(ntot));
1713 Process::Journal() <<
"Postprocessing_IJK::posttraiter_champs_instantanes : OWN_PTR(Champ_base) ECART_P_ANA sur ce proc (ni,nj,nk,ntot):" <<
" " << ni <<
" " << nj <<
" " << nk <<
" " << ntot << finl;
1799 Cerr <<
"ERROR in Postprocessing_IJK::get_IJK_field_vector : " << finl;
1800 Cerr <<
"Requested field '" << nom <<
"' is not recognized by Postprocessing_IJK::get_IJK_field_vector()." << finl;
1804 double current_time = ref_ijk_ft_->schema_temps_ijk().get_current_time();
1806 if (nom ==
"VELOCITY_ANA")
1808 for (
int i = 0; i < 3; i++)
1811 if (nom ==
"ECART_ANA")
1813 Cerr <<
"GB: ERROR FIELD " << current_time;
1814 for (
int dir = 0; dir < 3; dir++)
1818 const int ni = ref_ijk_ft_->eq_ns().velocity_[dir].ni();
1819 const int nj = ref_ijk_ft_->eq_ns().velocity_[dir].nj();
1820 const int nk = ref_ijk_ft_->eq_ns().velocity_[dir].nk();
1822 for (
int k = 0; k < nk; k++)
1823 for (
int j = 0; j < nj; j++)
1824 for (
int i = 0; i < ni; i++)
1826 const double val =
velocity_ana_[dir](i, j, k) - ref_ijk_ft_->eq_ns().velocity_[dir](i, j, k);
1831 err = sqrt(err / ntot);
1835 Process::Journal() <<
"Postprocessing_IJK::posttraiter_champs_instantanes : OWN_PTR(Champ_base) ECART_ANA sur ce proc (ni,nj,nk,ntot):" <<
" " << ni <<
" " << nj <<
" " << nk <<
" " << ntot << finl;
1841 if (nom ==
"INTEGRATED_VELOCITY")
1845 if (nom ==
"INTEGRATED_PRESSURE")
1849 if (nom ==
"INTEGRATED_TIMESCALE")
1853 if (nom ==
"INDICATRICE_PERTURBE")
1865 Cerr <<
"Erreur dans Postprocessing_IJK::get_IJK_variable : " <<
"Variable demandee : " << nom <<
" Liste des variables possibles : " << finl;
1890 Cerr <<
"All bubbles : " << endl;
1894 if (interfaces_->nb_groups() > 1)
1896 Cerr <<
"Group by group :" << endl;
1897 fichier <<
" groups_statistiques_FT " << groups_statistiques_FT_;
1905 param.
ajouter(
"groups_statistiques_FT", &groups_statistiques_FT_);
1912 for (
int i = 0; i < 3; i++)
1913 op_conv_[i].data() = d_velocity_.valeur()[i].data();
1922 for (
int i = 0; i < 3; i++)
1923 volume *= domaine_ijk_->get_constant_delta(i);
1927 IJK_Field_vector3_double& rho_Ssigma =
vect_post_fields_.at(
"RHO_SOURCE_QDM_INTERF");
1928 for (
int dir = 0; dir < 3; dir++)
1930 IJK_Field_double& source = ref_ijk_ft_->eq_ns().terme_source_interfaces_ns_[dir];
1931 for (
int k = 0; k < source.
nk(); k++)
1932 for (
int j = 0; j < source.
nj(); j++)
1933 for (
int i = 0; i < source.
ni(); i++)
1934 rho_Ssigma[dir](i,j,k) = source(i,j,k)/volume;
1941 interpolate_to_center(
cell_rho_Ssigma_,ref_ijk_ft_->eq_ns().terme_source_interfaces_ns_);
1942 for (
int dir = 0; dir < 3; dir++)
1945 for (
int k = 0; k < source.
nk(); k++)
1946 for (
int j = 0; j < source.
nj(); j++)
1947 for (
int i = 0; i < source.
ni(); i++)
1961 for (
int dir = 0; dir < 3; dir++)
1970 for (
int dir = 0; dir < 3; dir++)
2028 allocate_velocity(
velocity_ana_, domaine_ijk_, 1,
"VELOCITY_ANA");
2034 allocate_velocity(
ecart_ana_, domaine_ijk_, 1,
"ECART_ANA");
2079 if (interfaces_->nb_groups() > 1)
2082 if (interfaces_->nb_groups() > 3)
2084 Cerr <<
"More than 3 groups are planned, but the allocated fields has only 3 components" << endl;
2102 allocate_velocity(
ana_gradP_, domaine_ijk_, 1);
2103 allocate_cell_vector(
ana_dUd_, domaine_ijk_, 0);
2104 allocate_cell_vector(
ana_dVd_, domaine_ijk_, 0);
2105 allocate_cell_vector(
ana_dWd_, domaine_ijk_, 0);
2123 bool flag_variable_source = ref_ijk_ft_->eq_ns().get_flag_variable_source();
2126 allocate_velocity(
grad_I_ft_, domaine_ft_, 2);
2132 allocate_velocity(
op_conv_, domaine_ijk_, ref_ijk_ft_->eq_ns().d_velocity_[0].ghost());
2137 allocate_cell_vector(
cell_op_conv_, domaine_ijk_, ref_ijk_ft_->eq_ns().d_velocity_[0].ghost());
2143 IJK_Field_vector3_double& rho_Ssigma =
vect_post_fields_.at(
"RHO_SOURCE_QDM_INTERF");
2144 allocate_velocity(rho_Ssigma, domaine_ijk_, 1,
"RHO_SOURCE_QDM_INTERF");
2154 allocate_velocity(
grad_I_ns_, domaine_ijk_, 1);
2163 noms_coords.dimensionner_force(3);
2164 noms_coords[0] =
"X";
2165 noms_coords[1] =
"Y";
2166 noms_coords[2] =
"Z";
2167 allocate_velocity(
coords_, domaine_ijk_, 1);
2168 for (
int i = 0; i < 3; i++)
2171 set_field_data(
coords_[i], noms_coords[i]);
2176void Postprocessing_IJK::postraiter_thermals(
bool stop)
2178 if (ref_ijk_ft_->has_thermals())
2225void Postprocessing_IJK::postraiter_stats(
bool stop)
2234 const int tstep_sauv = tstep + tstep_init;
2237 auto should_post = [&](
int nb_pas_dt,
double time_interv)
2240 || (nb_pas_dt >= 0 && tstep_sauv % nb_pas_dt == nb_pas_dt - 1)
2241 || (std::floor((current_time-timestep)/time_interv) < std::floor(current_time/time_interv)))
2261static void ijk_interpolate_implementation_bis(
const IJK_Field_double& field,
const DoubleTab& coordinates, ArrOfDouble& result,
int skip_unknown_points,
double value_for_bad_points,
2262 const IJK_Field_double& indic)
2264 const int ghost = field.
ghost();
2265 const int ni = field.
ni();
2266 const int nj = field.
nj();
2267 const int nk = field.
nk();
2276 const int nb_coords = coordinates.
dimension(0);
2277 const int gh = indic.
ghost();
2279 for (
int idx = 0; idx < nb_coords; idx++)
2281 const double x = coordinates(idx, 0);
2282 const double y = coordinates(idx, 1);
2283 const double z = coordinates(idx, 2);
2284 const double x2 = (x - origin_x) / dx;
2285 const double y2 = (y - origin_y) / dy;
2286 const double z2 = (z - origin_z) / dz;
2287 const int index_i = (int) (floor(x2)) - geom.
get_offset_local(DIRECTION_I);
2288 const int index_j = (int) (floor(y2)) - geom.
get_offset_local(DIRECTION_J);
2289 const int index_k = (int) (floor(z2)) - geom.
get_offset_local(DIRECTION_K);
2290 const int index_kp1 = index_k + 1;
2291 const double xfact = x2 - floor(x2);
2292 const double yfact = y2 - floor(y2);
2293 const double zfact = z2 - floor(z2);
2314 if ((kmin == 0) || (kmin + nk == nktot))
2318 if (index_k >= 0 && index_k < nk && index_kp1 >= 0 && index_kp1 < nk && index_i >= 0 && index_i < ni && index_j >= 0 && index_j < nj)
2320 c_1 = indic(index_i, index_j, index_k);
2321 if (index_i != ni - 1)
2322 c_2 = indic(index_i + 1, index_j, index_k);
2323 if (index_j != nj - 1)
2324 c_3 = indic(index_i, index_j + 1, index_k);
2325 if (index_i != ni - 1 && index_j != nj - 1)
2326 c_4 = indic(index_i + 1, index_j + 1, index_k);
2328 c_5 = indic(index_i, index_j, index_kp1);
2329 if (index_i != ni - 1)
2330 c_6 = indic(index_i + 1, index_j, index_kp1);
2331 if (index_j != nj - 1)
2332 c_7 = indic(index_i, index_j + 1, index_kp1);
2333 if (index_i != ni - 1 && index_j != nj - 1)
2334 c_8 = indic(index_i + 1, index_j + 1, index_kp1);
2347 if (index_k >= 0 && index_kp1 >= 0 && index_i >= -gh && index_i < ni + gh && index_j >= -gh && index_j < nj + gh && index_kp1 < nk && index_k < nk)
2349 c_1 = indic(index_i, index_j, index_k);
2350 if (index_i != ni + gh - 1)
2351 c_2 = indic(index_i + 1, index_j, index_k);
2352 if (index_j != nj + gh - 1)
2353 c_3 = indic(index_i, index_j + 1, index_k);
2354 if (index_i != ni + gh - 1 && index_j != nj + gh - 1)
2355 c_4 = indic(index_i + 1, index_j + 1, index_k);
2357 c_5 = indic(index_i, index_j, index_kp1);
2358 if (index_i != ni + gh - 1)
2359 c_6 = indic(index_i + 1, index_j, index_kp1);
2360 if (index_j != nj + gh - 1)
2361 c_7 = indic(index_i, index_j + 1, index_kp1);
2362 if (index_i != ni + gh - 1 && index_j != nj + gh - 1)
2363 c_8 = indic(index_i + 1, index_j + 1, index_kp1);
2366 else if (kmin + nk == nktot)
2368 if (index_k < nk && index_kp1 < nk && index_i >= -gh && index_i < ni + gh && index_j >= -gh && index_j < nj + gh && index_kp1 >= 0 && index_k >= 0)
2372 c_1 = indic(index_i, index_j, index_k);
2373 if (index_i != ni + gh - 1)
2374 c_2 = indic(index_i + 1, index_j, index_k);
2375 if (index_j != nj + gh - 1)
2376 c_3 = indic(index_i, index_j + 1, index_k);
2377 if (index_i != ni + gh - 1 && index_j != nj + gh - 1)
2378 c_4 = indic(index_i + 1, index_j + 1, index_k);
2380 c_5 = indic(index_i, index_j, index_kp1);
2381 if (index_i != ni + gh - 1)
2382 c_6 = indic(index_i + 1, index_j, index_kp1);
2383 if (index_j != nj + gh - 1)
2384 c_7 = indic(index_i, index_j + 1, index_kp1);
2385 if (index_i != ni + gh - 1 && index_j != nj + gh - 1)
2386 c_8 = indic(index_i + 1, index_j + 1, index_kp1);
2391 if (index_k < nk + gh && index_kp1 < nk + gh && index_i >= -gh && index_i < ni + gh && index_j >= -gh && index_j < nj + gh && index_kp1 >= -gh && index_k >= -gh)
2393 c_1 = indic(index_i, index_j, index_k);
2394 if (index_i < ni + gh - 1)
2395 c_2 = indic(index_i + 1, index_j, index_k);
2396 if (index_j < nj + gh - 1)
2397 c_3 = indic(index_i, index_j + 1, index_k);
2398 if (index_i < ni + gh - 1 && index_j < nj + gh - 1)
2399 c_4 = indic(index_i + 1, index_j + 1, index_k);
2401 c_5 = indic(index_i, index_j, index_kp1);
2402 if (index_i < ni + gh - 1)
2403 c_6 = indic(index_i + 1, index_j, index_kp1);
2404 if (index_j < nj + gh - 1)
2405 c_7 = indic(index_i, index_j + 1, index_kp1);
2406 if (index_i < ni + gh - 1 && index_j < nj + gh - 1)
2407 c_8 = indic(index_i + 1, index_j + 1, index_kp1);
2415 if (index_k < nk + gh && index_kp1 < nk + gh && index_i >= -gh && index_i < ni + gh && index_j >= -gh && index_j < nj + gh && index_kp1 >= -gh && index_k >= -gh)
2417 c_1 = indic(index_i, index_j, index_k);
2418 if (index_i < ni + gh - 1)
2419 c_2 = indic(index_i + 1, index_j, index_k);
2420 if (index_j < nj + gh - 1)
2421 c_3 = indic(index_i, index_j + 1, index_k);
2422 if (index_i < ni + gh - 1 && index_j < nj + gh - 1)
2423 c_4 = indic(index_i + 1, index_j + 1, index_k);
2425 c_5 = indic(index_i, index_j, index_kp1);
2426 if (index_i < ni + gh - 1)
2427 c_6 = indic(index_i + 1, index_j, index_kp1);
2428 if (index_j < nj + gh - 1)
2429 c_7 = indic(index_i, index_j + 1, index_kp1);
2430 if (index_i < ni + gh - 1 && index_j < nj + gh - 1)
2431 c_8 = indic(index_i + 1, index_j + 1, index_kp1);
2437 bool ok_2 = (c_1 + c_2 + c_3 + c_4 + c_5 + c_6 + c_7 + c_8 >= 7.99);
2440 bool ok = (index_i >= -ghost && index_i < ni + ghost - 1) && (index_j >= -ghost && index_j < nj + ghost - 1) && (index_k >= -ghost && index_k < nk + ghost - 1);
2443 if (skip_unknown_points)
2445 result[idx] = value_for_bad_points;
2451 Cerr <<
"Error in ijk_interpolate_implementation: request interpolation of point " << x <<
" " << y <<
" " << z <<
" which is outside of the domain on processor " <<
Process::me()
2457 double r = (((1. - xfact) * field(index_i, index_j, index_k) + xfact * field(index_i + 1, index_j, index_k)) * (1. - yfact)
2458 + ((1. - xfact) * field(index_i, index_j + 1, index_k) + xfact * field(index_i + 1, index_j + 1, index_k)) * (yfact)) * (1. - zfact)
2459 + (((1. - xfact) * field(index_i, index_j, index_kp1) + xfact * field(index_i + 1, index_j, index_kp1)) * (1. - yfact)
2460 + ((1. - xfact) * field(index_i, index_j + 1, index_kp1) + xfact * field(index_i + 1, index_j + 1, index_kp1)) * (yfact)) * (zfact);
2464void ijk_interpolate_skip_unknown_points_bis(
const IJK_Field_double& field,
const DoubleTab& coordinates, ArrOfDouble& result,
const double value_for_bad_points,
const IJK_Field_double& indic)
2466 ijk_interpolate_implementation_bis(field, coordinates, result, 1 , value_for_bad_points, indic);
2487 DoubleTab positions_liq(2 * nbsom, 3);
2488 DoubleTab positions_vap(2 * nbsom, 3);
2489 IntTab crossed_cells(nbsom, 3);
2507 int errcount_pext = 0;
2509 for (
int k = 0; k < nk; k++)
2510 for (
int j = 0; j < nj; j++)
2511 for (
int i = 0; i < ni; i++)
2513 if ((interfaces_->In_ft()(i, j, k) > 1.e-6) && (1. - interfaces_->In_ft()(i, j, k) > 1.e-6))
2519 for (
int c = 0; c < 3; c++)
2521 normale[c] = interfaces_->get_norm_par_compo_itfc_in_cell_ft()[c](i, j, k);
2522 bary_facettes_dans_elem[c] = interfaces_->get_bary_par_compo_itfc_in_cell_ft()[c](i, j, k);
2524 norm = sqrt(normale[0] * normale[0] + normale[1] * normale[1] + normale[2] * normale[2]);
2532 Process::Journal() <<
"Indicatrice[" << i <<
"," << j <<
"," << k <<
"] = " << interfaces_->In_ft()(i, j, k) << finl;
2533 Process::Journal() <<
"[WARNING-Extended-pressure] on Proc. " <<
Process::me() <<
"Floating Point Exception is barely avoided (" <<
" normale " << normale[0] <<
" " << normale[1]
2534 <<
" " << normale[2] <<
" )" << finl;
2535 Process::Journal() <<
" But we have no distance to extrapolate the pressure" << finl;
2536 dist = 1.52 * sqrt(dx * dx + dy * dy + dz * dz) / 3.;
2537 if (interfaces_->In_ft()(i, j, k) * (1 - interfaces_->In_ft()(i, j, k)) > 1.e-6)
2539 Process::Journal() <<
"[WARNING-Extended-pressure] " <<
"Indicatrice[" << i <<
"," << j <<
"," << k <<
"] = " << interfaces_->In_ft()(i, j, k) << finl;
2540 if (interfaces_->In_ft()(i, j, k) > 0.99)
2542 Process::Journal() <<
"[WARNING-Extended-pressure] " <<
"Pressure_ft_ will be kept as an extension for p_liq pressure_[" << i <<
"," << j <<
"," << k <<
"] = "
2548 Process::Journal() <<
"[WARNING-Extended-pressure] " <<
"Pressure_ft_ will be kept as an extension for p_vap pressure_[" << i <<
"," << j <<
"," << k <<
"] = "
2557 for (
int dir = 0; dir < 3; dir++)
2558 if (normale[dir] != 0)
2559 normale[dir] = (normale[dir] > 0.) ? 1.0 : -1.0;
2561 norm = sqrt(normale[0] * normale[0] + normale[1] * normale[1] + normale[2] * normale[2]);
2562 if (std::fabs(norm) < 1.e-10)
2564 Process::Journal() <<
"[WARNING-Extended-pressure] ||normal|| < 1.e-10" << finl;
2569 if (std::fabs(norm) < 1.e-10)
2571 Process::Journal() <<
"[WARNING-Extended-pressure] Even with precaution, the normal truely is zero in compute_extended_pressures()... " << finl;
2572 Cerr <<
"We ignore the extrapolation and keep the local value... (hopefully rare enough)" << finl;
2578 dist = 1.52 * (std::fabs(dx * normale[0]) + std::fabs(dy * normale[1]) + std::fabs(dz * normale[2])) / norm;
2588 crossed_cells.
resize(nbsom, 3, RESIZE_OPTIONS::COPY_INIT);
2589 positions_liq.
resize(2 * nbsom, 3, RESIZE_OPTIONS::COPY_INIT);
2590 positions_vap.
resize(2 * nbsom, 3, RESIZE_OPTIONS::COPY_INIT);
2592 crossed_cells(nbsom - 1, 0) = i;
2593 crossed_cells(nbsom - 1, 1) = j;
2594 crossed_cells(nbsom - 1, 2) = k;
2596 for (
int dir = 0; dir < 3; dir++)
2600 positions_liq(2 * nbsom - 2, dir) = bary_facettes_dans_elem[dir] + dist * normale[dir];
2601 positions_liq(2 * nbsom - 1, dir) = bary_facettes_dans_elem[dir] + 2 * dist * normale[dir];
2603 positions_vap(2 * nbsom - 2, dir) = bary_facettes_dans_elem[dir] - dist * normale[dir];
2604 positions_vap(2 * nbsom - 1, dir) = bary_facettes_dans_elem[dir] - 2 * dist * normale[dir];
2613 Cerr <<
"[WARNING-Extended-pressure] Error Count = " << errcount_pext << endl;
2618 ArrOfDouble p_interp_liq(2 * nbsom);
2619 ArrOfDouble p_interp_vap(2 * nbsom);
2620 ijk_interpolate_skip_unknown_points(
pressure_ft_, positions_vap, p_interp_vap, 1.e5 );
2621 ijk_interpolate_skip_unknown_points_bis(
pressure_ft_, positions_liq, p_interp_liq, 1.e5 , interfaces_->In_ft());
2624 int inval_pl_count = 0.;
2625 int inval_pv_count = 0.;
2626 for (
int icell = 0; icell < nbsom; icell++)
2628 const int i = crossed_cells(icell, 0);
2629 const int j = crossed_cells(icell, 1);
2630 const int k = crossed_cells(icell, 2);
2632 const int nb_compo_traversantes = interfaces_->nb_compo_traversantes(i, j, k);
2633 if (nb_compo_traversantes != 1)
2640 extended_pv_ft_(i, j, k) = 2 * p_interp_vap[2 * icell] - 1 * p_interp_vap[2 * icell + 1];
2644 if (p_interp_liq[2 * icell + 1] == 1.e5)
2646 if (p_interp_liq[2 * icell] == 1.e5)
2660 if (p_interp_liq[2 * icell] != 1.e5)
2662 extended_pl_ft_(i, j, k) = 2 * p_interp_liq[2 * icell] - 1 * p_interp_liq[2 * icell + 1];
2676 Cerr <<
"[WARNING-Extended-pressure] Invalid p_l cells Count = " << inval_pl_count << endl;
2678 Cerr <<
"[WARNING-Extended-pressure] Invalid p_v cells Count = " << inval_pv_count << endl;
2694 liste.add(
"TEMPERATURE");
2696 liste.add(
"LAMBDA");
2697 liste.add(
"TEMPERATURE_ANA");
2698 liste.add(
"ECART_T_ANA");
2699 liste.add(
"DIV_LAMBDA_GRAD_T_VOLUME");
2700 liste.add(
"SOURCE_TEMPERATURE");
2701 liste.add(
"TEMPERATURE_ADIM_BULLES");
2702 liste.add(
"TEMPERATURE_PHYSIQUE_T");
2703 liste.add(
"TEMPERATURE_ADIMENSIONNELLE_THETA");
2704 liste.add(
"SOURCE_TEMPERATURE_ANA");
2705 liste.add(
"ECART_SOURCE_TEMPERATURE_ANA");
2706 liste.add(
"GRAD_T");
2707 liste.add(
"GRAD_T0");
2708 liste.add(
"GRAD_T1");
2709 liste.add(
"GRAD_T2");
2710 liste.add(
"T_RUST");
2711 liste.add(
"DIV_RHO_CP_T_V");
2719 liste.add(
"TEMPERATURE");
2721 liste.add(
"LAMBDA");
2722 liste.add(
"TEMPERATURE_ANA");
2723 liste.add(
"ECART_T_ANA");
2724 liste.add(
"DIV_LAMBDA_GRAD_T_VOLUME");
2725 liste.add(
"SOURCE_TEMPERATURE");
2726 liste.add(
"TEMPERATURE_ADIM_BULLES");
2727 liste.add(
"TEMPERATURE_PHYSIQUE_T");
2728 liste.add(
"TEMPERATURE_ADIMENSIONNELLE_THETA");
2729 liste.add(
"SOURCE_TEMPERATURE_ANA");
2730 liste.add(
"ECART_SOURCE_TEMPERATURE_ANA");
2731 liste.add(
"GRAD_T");
2732 liste.add(
"GRAD_T0");
2733 liste.add(
"GRAD_T1");
2734 liste.add(
"GRAD_T2");
2735 liste.add(
"T_RUST");
2736 liste.add(
"DIV_RHO_CP_T_V");
2744double modulo(
double dividend,
double divisor)
2746 return ((std::floor(dividend/divisor) + 1)*divisor - dividend);
2752void add_max_timestep(std::vector<double>& timesteps,
double current_time,
double interval)
2754 if (interval>0 && (modulo(current_time, interval) != 0))
2755 timesteps.push_back(modulo(current_time, interval)*(1+1e-12));
2768 std::vector<double> timesteps;
2769 timesteps.push_back(DMAXFLOAT);
2779 double min=*std::min_element(timesteps.begin(),timesteps.end());
This class encapsulates all the information related to the eulerian mesh for TrioIJK.
int get_offset_local(int direction) const
Returns the local offset in requested direction.
int get_nb_elem_local(int direction) const
Returns the number of elements owned by this processor in the given direction.
bool get_periodic_flag(int direction) const
Method returns true if periodic in this direction.
double get_constant_delta(int direction) const
Returns the size of cells in a direction.
double get_origin(int direction) const
Returns the coordinate of the first node (global) of the mesh in the requested direction.
int get_nb_items_global(Localisation loc, int direction) const
Returns the number of local items (on this processor) for the given localisation in the requested dir...
Localisation
Localisation sub class.
Class defining operators and methods for all reading operation in an input flow (file,...
classe Equation_base Le role d'une equation est le calcul d'un ou plusieurs champs....
const Nom & le_nom() const override
Renvoie le nom de l'equation.
virtual Nature_du_champ nature_du_champ() const
void allocate(const Domaine_IJK &d, Domaine_IJK::Localisation l, int ghost_size, int additional_k_layers=0, int nb_compo=1, const Nom &name=Nom(), bool external_storage=false, int monofluide=0, double rov=0., double rol=0., int use_inv_rho_in_pressure_solver=0)
Domaine_IJK::Localisation get_localisation() const
virtual void dumplata_scalar(const char *filename, int step) const
const Domaine_IJK & get_domaine() const
static void Fill_postprocessable_fields(std::vector< FieldInfo_t > &chps)
void dumplata_ft_mesh(const char *filename, const char *meshname, int step) const
static void Fill_postprocessable_fields(std::vector< FieldInfo_t > &chps)
Une chaine de caractere (Nom) en majuscules.
Un tableau d'objets de la classe Motcle.
double coef_immobilisation_
void calculer_vitesse_gauche(const IJK_Field_double &vx, const IJK_Field_double &vy, const IJK_Field_double &vz, double &vx_moy, double &vy_moy, double &vz_moy)
Redistribute_Field redistribute_to_splitting_ft_elem_
Redistribute_Field redistribute_from_splitting_ft_elem_
Nom fichier_reprise_vitesse_
void calculer_vitesse_droite(const IJK_Field_double &vx, const IJK_Field_double &vy, const IJK_Field_double &vz, double &vx_moy, double &vy_moy, double &vz_moy)
class Nom Une chaine de caractere pour nommer les objets de TRUST
const std::string & getString() const
const Nom & le_nom() const override
Renvoie *this;.
Un tableau de chaine de caracteres (VECT(Nom)).
const Nom & que_suis_je() const
renvoie la chaine identifiant la classe.
virtual Entree & readOn(Entree &)
Lecture d'un Objet_U sur un flot d'entree Methode a surcharger.
static const Nom & nom_du_cas()
Renvoie une reference constante vers le nom du cas.
virtual Sortie & printOn(Sortie &) const
Ecriture de l'objet sur un flot de sortie Methode a surcharger.
static bool DISABLE_DIPHASIQUE
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(const char *keyword, const int *value, Param::Nature nat=Param::OPTIONAL)
Register an integer parameter.
bool is_stats_bulles_activated() const
IJK_Field_vector3_double ana_grad2Pc_
IJK_Field_vector3_double ana_dUd_
void init_integrated_and_ana(bool reprise)
IJK_Field_double extended_pl_ft_
void ecrire_statistiques_fh(int reset, const Nom &nom_cas, const double current_time) const
void alloc_velocity_and_co()
void calculer_gradient_indicatrice(const IJK_Field_double &indic)
int nb_pas_dt_post_stats_bulles_
IJK_Field_double integrated_timescale_
int nb_pas_dt_post_stats_cisaillement_
void ecrire_statistiques_mrf(int reset, const Nom &nom_cas, const double current_time) const
int first_step_thermals_post_
void ecrire_statistiques_cisaillement(int reset, const Nom &nom_cas, const double current_time) const
IJK_Field_vector3_double ana_gradP_
Noms expression_gradP_analytique_
bool is_post_required(const Motcle &nom) const
std::map< Motcle, IJK_Field_vector3_double > vect_post_fields_
std::map< Motcle, IJK_Field_double > scalar_post_fields_
Noms expression_gradU_analytique_
void prepare_lata_and_stats()
void improved_initial_pressure_guess(bool imp)
double time_interval_post_stats_bulles_
IJK_Field_double rebuilt_indic_
void init_indicatrice_non_perturbe()
IJK_Field_vector3_double normale_cell_ft_
void ecrire_statistiques_amont(int reset, const Nom &nom_cas, const double current_time)
void sauvegarder_post(const Nom &lata_name)
int nb_pas_dt_post_stats_fh_
const IJK_Field_double & get_IJK_field(const Motcle &nom) override
IJK_Field_vector3_double d_velocity_ana_
void get_update_lambda2_and_rot_and_Q()
IJK_Field_double kappa_ai_ns_
static void Fill_postprocessable_fields(std::vector< FieldInfo_t > &chps)
Noms expression_grad2W_analytique_
double time_interval_post_thermals_probes_
bool is_stats_amont_activated() const
int nb_pas_dt_post_stats_mrf_
Noms expression_gradW_analytique_
double time_interval_post_stats_mrf_
const IJK_Field_vector3_double & get_IJK_field_vector(const Motcle &nom) override
int nb_pas_dt_post_stats_plans_
void update_gradU_lambda2(const bool need_lambda2=false)
IJK_Field_double kappa_ai_ft_
Noms expression_vitesse_analytique_
Motcles liste_post_instantanes_
void ecrire_statistiques_bulles(int reset, const Nom &nom_cas, const double current_time) const
Champs_compris_IJK champs_compris_
the actual fields registered and managed by the post-processing part (=all the extra fields,...
bool reset_reprise_integrated_
std::vector< FieldIndex_t > field_post_idx_
IJK_Field_double integrated_pressure_
double time_interval_post_
IJK_Field_vector3_double ana_dVd_
std::pair< int, bool > FieldIndex_t
Noms expression_grad2V_analytique_
IJK_Field_vector3_double velocity_ana_
IJK_Field_double extended_pv_
IJK_Field_vector3_double ana_grad2Ui_
bool is_stats_mrf_activated() const
bool is_stats_plans_activated() const
double time_interval_post_stats_amont_
IJK_Field_double ecart_p_ana_
Nom fichier_reprise_indicatrice_non_perturbe_
void associer_probleme(const Probleme_FTD_IJK_base &)
IJK_Field_vector3_double ana_grad2Pi_
static std::vector< FieldInfo_t > champs_postraitables_
list of fields that can be potentially postprocessed
double time_interval_post_stats_plans_
void fill_surface_force(IJK_Field_vector3_double &the_field_you_know)
IJK_Field_vector3_double grad_I_ft_
int write_extra_mesh() override
double time_interval_post_stats_cisaillement_
IJK_Field_vector3_double ana_grad2Wc_
IJK_Field_double extended_pv_ft_
void compute_extended_pressures()
void postraiter(int forcer) override
void update_stat_ft(const double dt)
IJK_Field_vector3_double cell_rho_Ssigma_
void posttraiter_tous_champs_thermique(Motcles &liste, const int idx) const
void set_param(Param ¶m) const override
int lire_champs_a_postraiter(Entree &is, bool expect_acco) override
IJK_Field_double indicatrice_non_perturbe_
int extended_pressure_computed_
Noms expression_grad2U_analytique_
bool postraiter_sous_pas_de_temps_
Noms expression_grad2P_analytique_
IJK_Field_vector3_double ana_dWd_
bool is_stats_fh_activated() const
Nom expression_pression_analytique_
IJK_Field_vector3_double ana_grad2Vc_
void sauvegarder_post_maitre(const Nom &lata_name, SFichier &fichier) const
IJK_Field_vector3_double integrated_velocity_
IJK_Field_vector3_double cell_op_conv_
Noms expression_dvitesse_analytique_
void fill_indic(bool reprise=0)
IJK_Field_vector3_double ana_grad2Uc_
void get_noms_champs_postraitables(Noms &noms, Option opt=NONE) const
bool is_stats_cisaillement_activated() const
int postraiter_champs() override
void posttraiter_champs_instantanes(const char *lata_name, double time, int time_iteration)
IJK_Field_double pressure_ft_
void associer_domaines(Domaine_IJK &dom_ijk, Domaine_IJK &dom_ft)
bool has_champ_vectoriel(const Motcle &nom) const override
IJK_Field_vector3_double coords_
double get_max_timestep_for_post(double current_time) const
Compute the max possible timestep to use during the next iteration in order to not skip a time interv...
void register_one_field(const Motcle &fld_nam, const Motcle &loc)
void reprendre_post(Param ¶m)
Noms expression_gradV_analytique_
Champs_compris_IJK_interface::FieldInfo_t FieldInfo_t
int nb_pas_dt_post_thermals_probes_
double time_interval_post_stats_fh_
void register_interface_field(const Motcle &nom_champ, const Motcle &loc) override
IJK_Field_vector3_double ecart_ana_
IJK_Field_vector3_double op_conv_
IJK_Field_vector3_double grad_I_ns_
IJK_Field_vector3_double normale_cell_ns_
void posttraiter_statistiques_plans(double time)
const int & get_IJK_flag(const Nom &nom) const
IJK_Field_double extended_pl_
double t_debut_statistiques_
void initialise_stats(Domaine_IJK &splitting, ArrOfDouble &vol_bulles, const double vol_bulle_monodisperse)
std::vector< Motcle > list_post_required_
Statistiques_dns_ijk_FT statistiques_FT_
int nb_pas_dt_post_stats_amont_
IJK_Field_vector3_double ana_grad2Wi_
void lire_entete_bloc_interface(Entree &is) override
bool has_champ(const Motcle &nom) const override
void posttraiter_tous_champs_energie(Motcles &liste, const int idx) const
IJK_Field_vector3_double ana_grad2Vi_
void set_param(Param ¶m) const override
void completer_sondes() override
void postraiter(int forcer) override
static Sortie & Journal(int message_level=0)
Renvoie un objet statique de type Sortie qui sert de journal d'evenements.
static double mp_sum(double)
Calcule la somme de x sur tous les processeurs du groupe courant.
static double mp_sum_as_double(int v)
static int me()
renvoie mon rang dans le groupe de communication courant.
static void exit(int exit_code=-1)
Routine de sortie de TRUST dans une region Kokkos.
static int je_suis_maitre()
renvoie 1 si on est sur le processeur maitre du groupe courant (c'est a dire me() == 0),...
void redistribute(const IJK_Field_double &input_field, IJK_Field_double &output_field)
Cette classe est a la classe C++ ofstream ce que la classe Sortie est a la classe C++ ostream Elle re...
Explicit Euler scheme for IJK setups.
int get_tstep_init() const
double get_timestep() const
double get_current_time() const
virtual int ouvrir(const char *name, IOS_OPEN_MODE mode=ios::out)
void precision(int pre) override
void setf(IOS_FORMAT code) override
Classe de base des flux de sortie.
void resize_array(_SIZE_ new_size, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)
void resize(_SIZE_ n, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)
_SIZE_ dimension(int d) const