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>
32 if (liste_thermique_.size())
33 liste_thermique_.vide();
39 Process::exit(
"Error while reading the IJK_Thermals list. One expected an opened bracket '{' to start !!! \n");
43 liste_thermique_.add(
OWN_PTR(IJK_Thermal_base)());
46 if (nom ==
"}")
return is;
49 Cerr <<
"Error while reading the IJK_Thermals list. One expected a comma ',' or a closing bracket '}' and not " << nom << finl;
58 if (!liste_thermique_.est_vide())
59 for (
auto& itr : liste_thermique_)
60 itr->set_fichier_reprise(lataname);
65 assert(!liste_thermique_.est_vide());
66 return liste_thermique_[0]->get_fichier_reprise();
73 Cerr <<
"You forgot to associate a fluid to the problem named " <<
probleme().
le_nom() << finl;
76 return le_fluide_.valeur();
83 Cerr <<
"You forgot to associate a fluid to the problem named " <<
probleme().
le_nom() << finl;
86 return le_fluide_.valeur();
95 Cerr <<
"Error in IJK_Thermals::verifie_milieu() !! " << finl;
96 Cerr <<
"You forgot to define the cp and/or fields in your Fluide_Diphasique_IJK medium ! Update your data file." << finl;
105 if (nb_cp0 != liste_thermique_.size() || nb_lamb0 != nb_cp0 || nb_cp1 != nb_cp0 || nb_lamb1 != nb_cp0)
107 Cerr <<
"Error in IJK_Thermals::verifie_milieu() !! " << finl;
108 Cerr <<
"You define " << liste_thermique_.size() <<
" thermal equations in your list which is not coherent with the medium :"<< finl;
109 Cerr <<
" - Size cp vapour field = " << nb_cp0 << finl;
110 Cerr <<
" - Size cp liquid field = " << nb_cp1 << finl;
111 Cerr <<
" - Size lambda vapour field = " << nb_lamb0 << finl;
112 Cerr <<
" - Size lambda liquid field = " << nb_lamb1 << finl;
122 le_fluide_ = un_fluide;
126 Cerr <<
"Error of fluid type for the method IJK_Thermals::associer_milieu_base" << finl;
133 for (
auto& itr : liste_thermique_)
135 itr->associer_milieu_base(un_milieu, idth);
144 Cerr <<
"Error for the method IJK_Interfaces::associer_pb_base\n";
145 Cerr <<
" IJK_Thermals equation must be associated to\n";
146 Cerr <<
" a Probleme_FTD_IJK_base problem type\n";
163 for (
auto& itr : liste_thermique_)
165 itr->associer(ref_ijk_ft_.valeur());
169 if (!liste_thermique_.est_vide())
175 int compute_distance = 1;
176 int compute_curvature = 1;
177 int n_iter_distance = 3;
178 int avoid_gfm_parallel_calls = 0;
179 IJK_Field_local_double boundary_flux_kmin;
180 IJK_Field_local_double boundary_flux_kmax;
181 assert(!liste_thermique_.est_vide());
182 liste_thermique_[0]->get_boundary_fluxes(boundary_flux_kmin, boundary_flux_kmax);
183 for (
auto& itr : liste_thermique_)
184 itr->retrieve_ghost_fluid_params(compute_distance,
187 avoid_gfm_parallel_calls);
191 avoid_gfm_parallel_calls,
198 ref_ijk_ft_post_ = ijk_ft_post;
199 for (
auto& itr : liste_thermique_)
200 itr->associer_post(ijk_ft_post);
205 ref_ijk_ft_switch_ = ijk_ft_switch;
206 for (
auto& itr : liste_thermique_)
207 itr->associer_switch(ref_ijk_ft_switch_);
220 std::vector<FieldInfo_t> c =
223 {
"TEMPERATURE", Entity::ELEMENT, Nature_du_champ::scalaire,
false },
224 {
"TEMPERATURE_ANA", Entity::ELEMENT, Nature_du_champ::scalaire,
false },
225 {
"ECART_T_ANA", Entity::ELEMENT, Nature_du_champ::scalaire,
false },
226 {
"TEMPERATURE_ADIMENSIONNELLE_THETA", Entity::ELEMENT, Nature_du_champ::scalaire,
false },
227 {
"TEMPERATURE_PHYSIQUE_T", Entity::ELEMENT, Nature_du_champ::scalaire,
false },
228 {
"SOURCE_TEMPERATURE", Entity::ELEMENT, Nature_du_champ::scalaire,
false },
229 {
"T_RUST", Entity::ELEMENT, Nature_du_champ::scalaire,
false },
230 {
"DIV_LAMBDA_GRAD_T_VOLUME", Entity::ELEMENT, Nature_du_champ::scalaire,
false },
231 {
"DIV_RHO_CP_T_VOLUME", Entity::ELEMENT, Nature_du_champ::scalaire,
false },
232 {
"U_T_CONVECTIVE_VOLUME", Entity::ELEMENT, Nature_du_champ::scalaire,
false },
233 {
"U_T_CONVECTIVE", Entity::ELEMENT, Nature_du_champ::scalaire,
false }
236 chps.insert(chps.end(), c.begin(), c.end());
241 for (
auto& itr : liste_thermique_)
243 itr->get_noms_champs_postraitables(noms,opt);
252 for (
auto& itr : liste_thermique_)
254 if (itr->has_champ(nom))
270 for (
auto& itr : liste_thermique_)
272 if (itr->has_champ(nom))
274 return itr->get_IJK_field(nom);
282 Cerr <<
"IJK_Thermals::get_IJK_field requested field " << nom <<
" is not known by any equation"<< finl;
288 for (
auto& itr : liste_thermique_)
290 if (itr->has_champ(nom))
292 return itr->get_IJK_field_vector(nom);
300 Cerr <<
"IJK_Thermals::get_IJK_field requested field vector " << nom <<
" is not known by any equation"<< finl;
307 ref_intersection_ijk_cell_ = intersection_ijk_cell;
308 ref_intersection_ijk_face_ = intersection_ijk_face;
309 for (
auto& itr : liste_thermique_)
310 itr->associer_interface_intersections(intersection_ijk_cell, intersection_ijk_face);
315 double modified_time;
316 if (liste_thermique_.est_vide())
317 modified_time = ref_ijk_ft_->schema_temps_ijk().get_current_time();
320 for (
auto& itr : liste_thermique_)
321 modified_time = std::max(modified_time, itr->get_modified_time());
322 return modified_time;
326 int& fill_rising_velocities,
327 int& use_bubbles_velocities_from_interface,
328 int& use_bubbles_velocities_from_barycentres)
330 if (!liste_thermique_.est_vide())
331 for (
auto& itr : liste_thermique_)
332 itr->get_rising_velocities_parameters(compute_rising_velocities,
333 fill_rising_velocities,
334 use_bubbles_velocities_from_interface,
335 use_bubbles_velocities_from_barycentres);
342 for (
auto& itr : liste_thermique_)
344 itr->sauvegarder_temperature(lata_name, idth, stop);
351 int flag_list_not_empty_th = 0;
352 if (liste_thermique_.size() > 0)
354 fichier <<
" thermals {\n" ;
355 flag_list_not_empty_th = 1;
357 for(
auto itr = liste_thermique_.begin(); itr != liste_thermique_.end(); )
361 if (itr != liste_thermique_.end())
366 if (flag_list_not_empty_th)
372 for (
auto& itr : liste_thermique_)
374 const double dt_th = itr->compute_timestep(dt_thermals, dxmin);
376 dt_thermals = std::min(dt_thermals, dt_th);
382 if (!liste_thermique_.est_vide())
386 Nom thermal_outputs_rank_base =
Nom(
"thermal_outputs_rank_");
387 const int max_digit = 3;
388 for (
auto& itr : liste_thermique_)
390 itr->initialize(splitting);
392 itr->update_thermal_properties();
393 const int max_rank_digit = idth < 1 ? 1 : (int) (log10(idth) + 1);
394 thermal_rank_folder_.add(thermal_outputs_rank_base
395 +
Nom(std::string(max_digit - max_rank_digit,
'0')) +
Nom(idth));
410 for (
auto& itr : liste_thermique_)
420 for (
auto& itr : liste_thermique_)
421 itr->recompute_temperature_init();
427 for (
auto& itr : liste_thermique_)
429 if (thermal_problem == itr->get_thermal_problem_type())
437 for (
auto& itr : liste_thermique_)
438 itr->update_thermal_properties();
443 for (
auto& itr : liste_thermique_)
444 itr->euler_time_step(timestep);
450 for (
auto& itr : liste_thermique_)
452 itr->euler_rustine_step(timestep);
457 for (
auto& itr : liste_thermique_)
459 int thermal_rank = itr->get_thermal_rank();
460 switch (thermal_rank)
463 Cerr <<
"RK3 Time scheme is not implemented yet with" << itr->get_thermal_words()[thermal_rank] << finl;
466 Cerr <<
"RK3 Time scheme is not implemented yet with" << itr->get_thermal_words()[thermal_rank] << finl;
469 itr->rk3_sub_step(rk_step, total_timestep, time);
470 Cerr <<
"RK3 Time scheme is implemented with" << itr->get_thermal_words()[thermal_rank] << finl;
473 Cerr <<
"RK3 Time scheme is not implemented 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;
486 const double fractionnal_timestep,
const double time)
488 for (
auto& itr : liste_thermique_)
489 itr->rk3_rustine_sub_step(rk_step, total_timestep, fractionnal_timestep, time);
495 for (
auto &itr : liste_thermique_)
497 itr->ecrire_statistiques_bulles(reset, nom_cas, current_time, surface, idx_th);
505 for (
auto &itr : liste_thermique_)
507 itr->posttraiter_tous_champs_thermal(liste_post_instantanes_, idx_th);
513 const char *lata_name,
515 const double current_time,
545 for (
auto& itr : liste_thermique_)
547 Cout <<
"Reading the old temperature field from " <<
Nom(itr->get_fichier_sauvegarde())
548 <<
" to fill the liste_thermique_ field."<< finl;
549 itr->initialize_switch(splitting, idx);
556 for (
auto& itr : liste_thermique_)
557 itr->set_fichier_sauvegarde(lata_name);
562 Cerr <<
" potentially saving temperature fields... " << finl;
563 int flag_list_not_empty = 0;
564 if ((
int) liste_thermique_.size() > 0)
566 fichier <<
" thermals {\n" ;
567 flag_list_not_empty = 1;
570 for (
auto itr = liste_thermique_.begin(); itr != liste_thermique_.end(); )
572 (*itr)->set_fichier_sauvegarde(lata_name);
575 if (itr != liste_thermique_.end() )
579 Cerr <<
" end of temperature field #" << idx <<
"... " << finl;
582 if (flag_list_not_empty)
589 for (
auto& itr : liste_thermique_)
591 ghost_fluid = itr->get_ghost_fluid_flag();
600 for (
auto& itr : liste_thermique_)
601 itr->compute_ghost_cell_numbers_for_subproblems(splitting, ghost_init);
606 int ghost_cells = ghost_init;
607 for (
auto& itr : liste_thermique_)
609 const int itr_ghost_cells = itr->get_ghost_cells();
610 if (itr_ghost_cells > ghost_cells)
611 ghost_cells = itr_ghost_cells;
618 for (
auto& itr : liste_thermique_)
619 itr->update_intersections();
624 for (
auto& itr : liste_thermique_)
625 itr->clean_ijk_intersections();
630 assert(!liste_thermique_.est_vide());
636 assert(!liste_thermique_.est_vide());
642 assert(!liste_thermique_.est_vide());
648 if (!liste_thermique_.est_vide())
658 int disable_post_processing_probes_out_files = 1;
659 for (
auto& itr : liste_thermique_)
660 disable_post_processing_probes_out_files = (disable_post_processing_probes_out_files && itr->get_disable_post_processing_probes_out_files());
661 return disable_post_processing_probes_out_files;
667 for (
auto& itr : liste_thermique_)
668 itr->set_latastep_reprise(ref_ijk_ft_->schema_temps_ijk().get_tstep() + 1);
682 for (
auto& itr : liste_thermique_)
685 const int max_digit_time = 8;
686 const int nb_digit_tstep = last_time < 1 ? 1 : (int) (log10(last_time) + 1);
687 Nom prefix_local_quantities = thermal_rank_folder_[rank] +
"/";
688 Nom suffix_local_quantities =
Nom(std::string(max_digit_time - nb_digit_tstep,
'0')) +
Nom(last_time);
689 Nom local_quantities_thermal_probes_time_index_folder = prefix_local_quantities
692 + suffix_local_quantities;
696 Nom local_quantities_thermal_slices_time_index_folder = prefix_local_quantities
699 + suffix_local_quantities;
700 Nom local_quantities_thermal_lines_time_index_folder = prefix_local_quantities
703 + suffix_local_quantities;
705 create_folders(local_quantities_thermal_probes_time_index_folder);
706 create_folders(local_quantities_thermal_slices_time_index_folder);
709 itr->thermal_subresolution_outputs(interfacial_quantities_thermal_probes,
710 shell_quantities_thermal_probes,
711 overall_bubbles_quantities,
712 local_quantities_thermal_probes_time_index_folder,
713 local_quantities_thermal_slices_time_index_folder,
714 local_quantities_thermal_lines_time_index_folder);
717 const int nb_dt_max = ref_ijk_ft_->schema_temps_ijk().get_nb_timesteps();
718 if ((ref_ijk_ft_->schema_temps_ijk().get_tstep() + dt_post_thermals_probes) >= nb_dt_max)
719 latastep_reprise = nb_dt_max + 1;
720 itr->set_latastep_reprise(latastep_reprise);
729 for (
int idth = 0; idth < liste_thermique_.size(); idth++)
746 Nom folder_name =
"mkdir -p";
747 folder_name = folder_name + spacing + folder_name_base.
getString();
748 Cerr <<
"Shell command executed: " << folder_name << finl;
749 int error = system(folder_name);
758 first_step_thermals_post = 0;
759 for (
int idth = 0; idth < liste_thermique_.size(); idth++)
760 first_step_thermals_post = (first_step_thermals_post || liste_thermique_[idth]->get_first_step_thermals_post());
765 for (
auto& itr : liste_thermique_)
766 itr->compute_temperature_init();
771 const Nom& lata_name,
779 IJK_Field_double new_thermal_field;
780 if (liste_thermique_.size() > 0)
783 switch_double_ft.
calculer_coeff(coeff_i,Indice_i,coeff_j,Indice_j,coeff_k,Indice_k);
787 for (
auto& itr : liste_thermique_)
795 Cout <<
"Writing " <<
Nom(
"TEMPERATURE_") +
Nom(idth) <<
" into " << lata_name << finl;
796 dumplata_scalar(lata_name,
Nom(
"TEMPERATURE_") +
Nom(idth), new_thermal_field, 0 );
803 for (
auto& itr : liste_thermique_)
804 itr->copy_previous_interface_state();
809 for (
auto& itr : liste_thermique_)
810 itr->copie_pure_vers_diph_sans_interpolation();
815 for (
auto& itr : liste_thermique_)
816 itr->echange_pure_vers_diph_cellules_initialement_pures();
821 for (
auto& itr : liste_thermique_)
822 itr->echange_diph_vers_pure_cellules_finalement_pures();
827 for (
auto& itr : liste_thermique_)
828 itr->vide_phase_invalide_cellules_diphasiques();
833 for (
auto& itr : liste_thermique_)
834 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