16#include <IJK_Thermal_Onefluid.h>
17#include <Probleme_FTD_IJK.h>
18#include <IJK_switch_FT.h>
19#include <IJK_Thermals.h>
20#include <IJK_switch.h>
21#include <Option_IJK.h>
39 if (liste_thermique_.size())
40 liste_thermique_.vide();
46 Process::exit(
"Error while reading the IJK_Thermals list. One expected an opened bracket '{' to start !!! \n");
50 liste_thermique_.add(
OWN_PTR(IJK_Thermal_base)());
53 if (nom ==
"}")
return is;
56 Cerr <<
"Error while reading the IJK_Thermals list. One expected a comma ',' or a closing bracket '}' and not " << nom << finl;
65 if (!liste_thermique_.est_vide())
66 for (
auto& itr : liste_thermique_)
67 itr->set_fichier_reprise(lataname);
72 assert(!liste_thermique_.est_vide());
73 return liste_thermique_[0]->get_fichier_reprise();
80 Cerr <<
"You forgot to associate a fluid to the problem named " <<
probleme().
le_nom() << finl;
83 return le_fluide_.valeur();
90 Cerr <<
"You forgot to associate a fluid to the problem named " <<
probleme().
le_nom() << finl;
93 return le_fluide_.valeur();
102 Cerr <<
"Error in IJK_Thermals::verifie_milieu() !! " << finl;
103 Cerr <<
"You forgot to define the cp and/or fields in your Fluide_Diphasique_IJK medium ! Update your data file." << finl;
112 if (nb_cp0 != liste_thermique_.size() || nb_lamb0 != nb_cp0 || nb_cp1 != nb_cp0 || nb_lamb1 != nb_cp0)
114 Cerr <<
"Error in IJK_Thermals::verifie_milieu() !! " << finl;
115 Cerr <<
"You define " << liste_thermique_.size() <<
" thermal equations in your list which is not coherent with the medium :"<< finl;
116 Cerr <<
" - Size cp vapour field = " << nb_cp0 << finl;
117 Cerr <<
" - Size cp liquid field = " << nb_cp1 << finl;
118 Cerr <<
" - Size lambda vapour field = " << nb_lamb0 << finl;
119 Cerr <<
" - Size lambda liquid field = " << nb_lamb1 << finl;
129 le_fluide_ = un_fluide;
133 Cerr <<
"Error of fluid type for the method IJK_Thermals::associer_milieu_base" << finl;
140 for (
auto& itr : liste_thermique_)
142 itr->associer_milieu_base(un_milieu, idth);
151 Cerr <<
"Error for the method IJK_Interfaces::associer_pb_base\n";
152 Cerr <<
" IJK_Thermals equation must be associated to\n";
153 Cerr <<
" a Probleme_FTD_IJK_base problem type\n";
170 for (
auto& itr : liste_thermique_)
172 itr->associer(ref_ijk_ft_.valeur());
176 if (!liste_thermique_.est_vide())
182 int compute_distance = 1;
183 int compute_curvature = 1;
184 int n_iter_distance = 3;
185 int avoid_gfm_parallel_calls = 0;
186 IJK_Field_local_double boundary_flux_kmin;
187 IJK_Field_local_double boundary_flux_kmax;
188 assert(!liste_thermique_.est_vide());
189 liste_thermique_[0]->get_boundary_fluxes(boundary_flux_kmin, boundary_flux_kmax);
190 for (
auto& itr : liste_thermique_)
191 itr->retrieve_ghost_fluid_params(compute_distance,
194 avoid_gfm_parallel_calls);
198 avoid_gfm_parallel_calls,
205 ref_ijk_ft_post_ = ijk_ft_post;
206 for (
auto& itr : liste_thermique_)
207 itr->associer_post(ijk_ft_post);
212 ref_ijk_ft_switch_ = ijk_ft_switch;
213 for (
auto& itr : liste_thermique_)
214 itr->associer_switch(ref_ijk_ft_switch_);
227 std::vector<FieldInfo_t> c =
230 {
"TEMPERATURE", Entity::ELEMENT, Nature_du_champ::scalaire,
false },
231 {
"TEMPERATURE_ANA", Entity::ELEMENT, Nature_du_champ::scalaire,
false },
232 {
"ECART_T_ANA", Entity::ELEMENT, Nature_du_champ::scalaire,
false },
233 {
"TEMPERATURE_ADIMENSIONNELLE_THETA", Entity::ELEMENT, Nature_du_champ::scalaire,
false },
234 {
"TEMPERATURE_PHYSIQUE_T", Entity::ELEMENT, Nature_du_champ::scalaire,
false },
235 {
"SOURCE_TEMPERATURE", Entity::ELEMENT, Nature_du_champ::scalaire,
false },
236 {
"T_RUST", Entity::ELEMENT, Nature_du_champ::scalaire,
false },
237 {
"DIV_LAMBDA_GRAD_T_VOLUME", Entity::ELEMENT, Nature_du_champ::scalaire,
false },
238 {
"DIV_RHO_CP_T_VOLUME", Entity::ELEMENT, Nature_du_champ::scalaire,
false },
239 {
"U_T_CONVECTIVE_VOLUME", Entity::ELEMENT, Nature_du_champ::scalaire,
false },
240 {
"U_T_CONVECTIVE", Entity::ELEMENT, Nature_du_champ::scalaire,
false }
243 chps.insert(chps.end(), c.begin(), c.end());
248 for (
auto& itr : liste_thermique_)
250 itr->get_noms_champs_postraitables(noms,opt);
259 for (
auto& itr : liste_thermique_)
261 if (itr->has_champ(nom))
277 for (
auto& itr : liste_thermique_)
279 if (itr->has_champ(nom))
281 return itr->get_IJK_field(nom);
289 Cerr <<
"IJK_Thermals::get_IJK_field requested field " << nom <<
" is not known by any equation"<< finl;
295 for (
auto& itr : liste_thermique_)
297 if (itr->has_champ(nom))
299 return itr->get_IJK_field_vector(nom);
307 Cerr <<
"IJK_Thermals::get_IJK_field requested field vector " << nom <<
" is not known by any equation"<< finl;
314 ref_intersection_ijk_cell_ = intersection_ijk_cell;
315 ref_intersection_ijk_face_ = intersection_ijk_face;
316 for (
auto& itr : liste_thermique_)
317 itr->associer_interface_intersections(intersection_ijk_cell, intersection_ijk_face);
322 double modified_time;
323 if (liste_thermique_.est_vide())
324 modified_time = ref_ijk_ft_->schema_temps_ijk().get_current_time();
327 for (
auto& itr : liste_thermique_)
328 modified_time = std::max(modified_time, itr->get_modified_time());
329 return modified_time;
333 int& fill_rising_velocities,
334 int& use_bubbles_velocities_from_interface,
335 int& use_bubbles_velocities_from_barycentres)
337 if (!liste_thermique_.est_vide())
338 for (
auto& itr : liste_thermique_)
339 itr->get_rising_velocities_parameters(compute_rising_velocities,
340 fill_rising_velocities,
341 use_bubbles_velocities_from_interface,
342 use_bubbles_velocities_from_barycentres);
349 for (
auto& itr : liste_thermique_)
351 itr->sauvegarder_temperature(lata_name, idth, stop);
358 int flag_list_not_empty_th = 0;
359 if (liste_thermique_.size() > 0)
361 fichier <<
" thermals {\n" ;
362 flag_list_not_empty_th = 1;
364 for(
auto itr = liste_thermique_.begin(); itr != liste_thermique_.end(); )
368 if (itr != liste_thermique_.end())
373 if (flag_list_not_empty_th)
379 for (
auto& itr : liste_thermique_)
381 const double dt_th = itr->compute_timestep(dt_thermals, dxmin);
383 dt_thermals = std::min(dt_thermals, dt_th);
389 if (!liste_thermique_.est_vide())
393 Nom thermal_outputs_rank_base =
Nom(
"thermal_outputs_rank_");
394 const int max_digit = 3;
395 for (
auto& itr : liste_thermique_)
397 itr->initialize(splitting);
399 itr->update_thermal_properties();
400 const int max_rank_digit = idth < 1 ? 1 : (int) (log10(idth) + 1);
401 thermal_rank_folder_.add(thermal_outputs_rank_base
402 +
Nom(std::string(max_digit - max_rank_digit,
'0')) +
Nom(idth));
417 for (
auto& itr : liste_thermique_)
427 for (
auto& itr : liste_thermique_)
428 itr->recompute_temperature_init();
434 for (
auto& itr : liste_thermique_)
436 if (thermal_problem == itr->get_thermal_problem_type())
444 for (
auto& itr : liste_thermique_)
445 itr->update_thermal_properties();
450 for (
auto& itr : liste_thermique_)
451 itr->euler_time_step(timestep);
457 for (
auto& itr : liste_thermique_)
459 itr->euler_rustine_step(timestep);
464 for (
auto& itr : liste_thermique_)
466 int thermal_rank = itr->get_thermal_rank();
467 switch (thermal_rank)
470 Cerr <<
"RK3 Time scheme is not implemented yet with" << itr->get_thermal_words()[thermal_rank] << finl;
473 Cerr <<
"RK3 Time scheme is not implemented yet with" << itr->get_thermal_words()[thermal_rank] << finl;
476 itr->rk3_sub_step(rk_step, total_timestep, time);
477 Cerr <<
"RK3 Time scheme is implemented with" << itr->get_thermal_words()[thermal_rank] << finl;
480 Cerr <<
"RK3 Time scheme is not implemented with" << itr->get_thermal_words()[thermal_rank] << finl;
483 itr->rk3_sub_step(rk_step, total_timestep, time);
484 Cerr <<
"RK3 Time scheme is implemented with" << itr->get_thermal_words()[thermal_rank] << finl;
493 const double fractionnal_timestep,
const double time)
495 for (
auto& itr : liste_thermique_)
496 itr->rk3_rustine_sub_step(rk_step, total_timestep, fractionnal_timestep, time);
502 for (
auto &itr : liste_thermique_)
504 itr->ecrire_statistiques_bulles(reset, nom_cas, current_time, surface, idx_th);
512 for (
auto &itr : liste_thermique_)
514 itr->posttraiter_tous_champs_thermal(liste_post_instantanes_, idx_th);
520 const char *lata_name,
522 const double current_time,
552 for (
auto& itr : liste_thermique_)
554 Cout <<
"Reading the old temperature field from " <<
Nom(itr->get_fichier_sauvegarde())
555 <<
" to fill the liste_thermique_ field."<< finl;
556 itr->initialize_switch(splitting, idx);
563 for (
auto& itr : liste_thermique_)
564 itr->set_fichier_sauvegarde(lata_name);
569 Cerr <<
" potentially saving temperature fields... " << finl;
570 int flag_list_not_empty = 0;
571 if ((
int) liste_thermique_.size() > 0)
573 fichier <<
" thermals {\n" ;
574 flag_list_not_empty = 1;
577 for (
auto itr = liste_thermique_.begin(); itr != liste_thermique_.end(); )
579 (*itr)->set_fichier_sauvegarde(lata_name);
582 if (itr != liste_thermique_.end() )
586 Cerr <<
" end of temperature field #" << idx <<
"... " << finl;
589 if (flag_list_not_empty)
596 for (
auto& itr : liste_thermique_)
598 ghost_fluid = itr->get_ghost_fluid_flag();
607 for (
auto& itr : liste_thermique_)
608 itr->compute_ghost_cell_numbers_for_subproblems(splitting, ghost_init);
613 int ghost_cells = ghost_init;
614 for (
auto& itr : liste_thermique_)
616 const int itr_ghost_cells = itr->get_ghost_cells();
617 if (itr_ghost_cells > ghost_cells)
618 ghost_cells = itr_ghost_cells;
625 for (
auto& itr : liste_thermique_)
626 itr->update_intersections();
631 for (
auto& itr : liste_thermique_)
632 itr->clean_ijk_intersections();
637 assert(!liste_thermique_.est_vide());
643 assert(!liste_thermique_.est_vide());
649 assert(!liste_thermique_.est_vide());
655 if (!liste_thermique_.est_vide())
665 int disable_post_processing_probes_out_files = 1;
666 for (
auto& itr : liste_thermique_)
667 disable_post_processing_probes_out_files = (disable_post_processing_probes_out_files && itr->get_disable_post_processing_probes_out_files());
668 return disable_post_processing_probes_out_files;
674 for (
auto& itr : liste_thermique_)
675 itr->set_latastep_reprise(ref_ijk_ft_->schema_temps_ijk().get_tstep() + 1);
689 for (
auto& itr : liste_thermique_)
692 const int max_digit_time = 8;
693 const int nb_digit_tstep = last_time < 1 ? 1 : (int) (log10(last_time) + 1);
694 Nom prefix_local_quantities = thermal_rank_folder_[rank] +
"/";
695 Nom suffix_local_quantities =
Nom(std::string(max_digit_time - nb_digit_tstep,
'0')) +
Nom(last_time);
696 Nom local_quantities_thermal_probes_time_index_folder = prefix_local_quantities
699 + suffix_local_quantities;
703 Nom local_quantities_thermal_slices_time_index_folder = prefix_local_quantities
706 + suffix_local_quantities;
707 Nom local_quantities_thermal_lines_time_index_folder = prefix_local_quantities
710 + suffix_local_quantities;
712 create_folders(local_quantities_thermal_probes_time_index_folder);
713 create_folders(local_quantities_thermal_slices_time_index_folder);
716 itr->thermal_subresolution_outputs(interfacial_quantities_thermal_probes,
717 shell_quantities_thermal_probes,
718 overall_bubbles_quantities,
719 local_quantities_thermal_probes_time_index_folder,
720 local_quantities_thermal_slices_time_index_folder,
721 local_quantities_thermal_lines_time_index_folder);
724 const int nb_dt_max = ref_ijk_ft_->schema_temps_ijk().get_nb_timesteps();
725 if ((ref_ijk_ft_->schema_temps_ijk().get_tstep() + dt_post_thermals_probes) >= nb_dt_max)
726 latastep_reprise = nb_dt_max + 1;
727 itr->set_latastep_reprise(latastep_reprise);
736 for (
int idth = 0; idth < liste_thermique_.size(); idth++)
753 Nom folder_name =
"mkdir -p";
754 folder_name = folder_name + spacing + folder_name_base.
getString();
755 Cerr <<
"Shell command executed: " << folder_name << finl;
756 int error = system(folder_name);
765 first_step_thermals_post = 0;
766 for (
int idth = 0; idth < liste_thermique_.size(); idth++)
767 first_step_thermals_post = (first_step_thermals_post || liste_thermique_[idth]->get_first_step_thermals_post());
772 for (
auto& itr : liste_thermique_)
773 itr->compute_temperature_init();
778 const Nom& lata_name,
786 IJK_Field_double new_thermal_field;
787 if (liste_thermique_.size() > 0)
790 switch_double_ft.
calculer_coeff(coeff_i,Indice_i,coeff_j,Indice_j,coeff_k,Indice_k);
794 for (
auto& itr : liste_thermique_)
802 Cout <<
"Writing " <<
Nom(
"TEMPERATURE_") +
Nom(idth) <<
" into " << lata_name << finl;
803 dumplata_scalar(lata_name,
Nom(
"TEMPERATURE_") +
Nom(idth), new_thermal_field, 0 );
810 for (
auto& itr : liste_thermique_)
811 itr->copy_previous_interface_state();
816 for (
auto& itr : liste_thermique_)
817 itr->copie_pure_vers_diph_sans_interpolation();
822 for (
auto& itr : liste_thermique_)
823 itr->echange_pure_vers_diph_cellules_initialement_pures();
828 for (
auto& itr : liste_thermique_)
829 itr->echange_diph_vers_pure_cellules_finalement_pures();
834 for (
auto& itr : liste_thermique_)
835 itr->vide_phase_invalide_cellules_diphasiques();
840 for (
auto& itr : liste_thermique_)
841 itr->remplir_tableau_pure_cellules_diphasiques(next_time);
DoubleTab & valeurs() override
Surcharge Champ_base::valeurs() Renvoie le tableau des valeurs.
This class encapsulates all the information related to the eulerian mesh for TrioIJK.
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....
OWN_PTR(Parametre_equation_base) ¶metre_equation()
Probleme_base & probleme()
Renvoie le probleme associe a l'equation.
const Fluide_Incompressible & fluide_phase(int la_phase) 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)
static void typer_lire_thermal_equation(OWN_PTR(IJK_Thermal_base)&, Entree &)
void thermal_subresolution_outputs(const int &dt_post_thermals_probes=0)
std::vector< int > lata_step_reprise_
void set_first_step_thermals_post(int &first_step_thermals_post)
void associer_switch(const Switch_FT_double &ijk_ft_switch)
void prepare_thermals(const char *lataname)
void associer_post(const Postprocessing_IJK &ijk_ft_post)
void create_folders_for_probes()
void compute_ghost_cell_numbers_for_subproblems(const Domaine_IJK &splitting, int ghost_init)
void retrieve_ghost_fluid_params()
int get_disable_post_processing_probes_out_files() const
void ecrire_statistiques_bulles(int reset, const Nom &nom_cas, const double current_time, const ArrOfDouble &surface)
void rk3_rustine_sub_step(const int rk_step, const double total_timestep, const double fractionnal_timestep, const double time)
void update_intersections()
Nom local_quantities_thermal_lines_time_index_folder_
void get_noms_champs_postraitables(Noms &noms, Option opt=NONE) const override
void set_fichier_reprise(const char *lataname)
void vide_phase_invalide_cellules_diphasiques()
void set_temperature_ini()
void echange_diph_vers_pure_cellules_finalement_pures()
void get_rising_velocities_parameters(int &compute_rising_velocities, int &fill_rising_velocities, int &use_bubbles_velocities_from_interface, int &use_bubbles_velocities_from_barycentres)
Nom local_quantities_thermal_probes_folder_
Nom shell_quantities_thermal_probes_folder_
void echange_pure_vers_diph_cellules_initialement_pures()
int get_probes_ghost_cells(int ghost_init)
Nom overall_bubbles_quantities_folder_
void remplir_tableau_pure_cellules_diphasiques(bool next_time)
void associer_interface_intersections(const Intersection_Interface_ijk_cell &intersection_ijk_cell_, const Intersection_Interface_ijk_face &intersection_ijk_face_)
void associer_milieu_base(const Milieu_base &) override
int ini_folder_out_files_
const IJK_Field_vector3_double & get_IJK_field_vector(const Motcle &nom) override
bool has_champ(const Motcle &nom) const override
void clean_ijk_intersections()
void sauvegarder_temperature(Nom &lata_name, const int &stop)
void initialize(const Domaine_IJK &splitting)
void euler_rustine_step(const double timestep)
void set_latastep_reprise(const bool stop)
void ecrire_fichier_reprise(SFichier &fichier, const char *lata_name)
void posttraiter_tous_champs_thermal(Motcles &liste_post_instantanes_)
void init_switch_thermals(const Domaine_IJK &splitting)
void copy_previous_interface_state()
const Nom & get_fichier_reprise()
Nom local_quantities_thermal_probes_time_index_folder_
const IJK_Field_double & get_IJK_field(const Motcle &nom) override
Nom local_quantities_thermal_slices_folder_
static void Fill_postprocessable_fields(std::vector< FieldInfo_t > &chps)
std::vector< int > lata_step_reprise_ini_
void sauvegarder_thermals(SFichier &fichier)
Nom local_quantities_thermal_slices_time_index_folder_
int size_thermal_problem(Nom thermal_problem)
double get_modified_time()
IJK_Ghost_Fluid_Fields ghost_fluid_fields_
void posttraiter_champs_instantanes_thermal(const Motcles &liste_post_instantanes, const char *lata_name, const int latastep, const double current_time, int &n)
void update_thermal_properties()
void compute_new_thermal_field(Switch_FT_double &switch_double_ft, const Domaine_IJK &new_mesh, const Nom &lata_name, DoubleTab &coeff_i, IntTab Indice_i, DoubleTab &coeff_j, IntTab Indice_j, DoubleTab &coeff_k, IntTab Indice_k)
void compute_eulerian_distance_curvature()
Fluide_Diphasique_IJK & milieu_ijk()
void completer() override
Complete la construction (initialisation) des objets associes a l'equation.
void rk3_sub_step(const int rk_step, const double total_timestep, const double time)
void associer_pb_base(const Probleme_base &) override
S'associe au Probleme passe en parametre.
void create_folders(Nom folder_name_base)
void compute_eulerian_curvature()
void compute_timestep(double &dt_thermals, const double dxmin)
Nom local_quantities_thermal_lines_folder_
Nom interfacial_quantities_thermal_probes_folder_
void compute_eulerian_distance()
void recompute_temperature_init()
void compute_eulerian_curvature_from_interface()
const Milieu_base & milieu() const override
void euler_time_step(const double timestep)
void copie_pure_vers_diph_sans_interpolation()
classe Milieu_base Cette classe est la base de la hierarchie des milieux (physiques)
bool has_conductivite() const
virtual const Champ_Don_base & capacite_calorifique() const
Renvoie la capacite calorifique du milieu.
bool has_capacite_calorifique() const
virtual const Champ_Don_base & conductivite() const
Renvoie la conductivite du milieu.
Une chaine de caractere (Nom) en majuscules.
Un tableau d'objets de la classe Motcle.
class Nom Une chaine de caractere pour nommer les objets de TRUST
const std::string & getString() const
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.
virtual Sortie & printOn(Sortie &) const
Ecriture de l'objet sur un flot de sortie Methode a surcharger.
static bool DISABLE_DIPHASIQUE
const Nom & le_nom() const override
Donne le nom de l'Objet_U Methode a surcharger : renvoie "neant" dans cette implementation.
classe Probleme_base C'est un Probleme_U qui n'est pas un couplage.
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),...
Cette classe est a la classe C++ ofstream ce que la classe Sortie est a la classe C++ ostream Elle re...
Classe de base des flux de sortie.
void calculer_coeff(DoubleTab &coeff_i, IntTab &Indice_i, DoubleTab &coeff_j, IntTab &Indice_j, DoubleTab &coeff_k, IntTab &Indice_k)
void calculer_coords_elem()
void switch_scalar_field(const IJK_Field_double &oldf, IJK_Field_double &newf, DoubleTab coeff_i, IntTab Indice_i, DoubleTab coeff_j, IntTab Indice_j, DoubleTab coeff_k, IntTab Indice_k) const