16#include <Navier_Stokes_FTD_IJK_tools.h>
17#include <Schema_Euler_explicite_IJK.h>
18#include <IJK_Navier_Stokes_tools.h>
19#include <Statistiques_dns_ijk_FT.h>
20#include <EcritureLectureSpecial.h>
21#include <Probleme_FTD_IJK_tools.h>
22#include <Probleme_FTD_IJK_base.h>
23#include <Navier_Stokes_FTD_IJK.h>
24#include <Postprocessing_IJK.h>
25#include <IJK_discretisation.h>
26#include <LecFicDiffuse_JDD.h>
27#include <IJK_Field_vector.h>
28#include <init_forcage_THI.h>
29#include <IJK_Lata_writer.h>
30#include <Interprete_bloc.h>
31#include <MaillerParallel.h>
32#include <corrections_qdm.h>
33#include <communications.h>
34#include <Ouvrir_fichier.h>
35#include <Schema_RK3_IJK.h>
36#include <Init_spectral.h>
37#include <Probleme_base.h>
38#include <Domaine_IJK.h>
39#include <Option_IJK.h>
40#include <Domaine_VF.h>
67 Process::exit(
"Probleme_FTD_IJK_base currently available in 3D !\n");
69 Cerr <<
"Reading of the problem " <<
le_nom() << finl;
75 Cerr <<
"We expected { to start to read the problem" << finl;
81 Cerr <<
"Probleme_FTD_IJK_base::readOn => We expect to read " << (int)equations_.size() <<
" equations." << finl;
86 for (
auto& itr : equations_)
88 Cerr <<
"Probleme_FTD_IJK_base::readOn => Will read equation of type : " << itr->que_suis_je() <<
" ..." << finl;
98 param.lire_avec_accolades(is);
111 Cerr <<
"We expected } to start to read the problem" << finl;
142 Noms noms_eq, noms_eq_maj;
144 for (
auto &itr : noms_eq) noms_eq_maj.add(
Motcle(itr));
150 if (read_mc !=
"SOLVED_EQUATIONS")
152 Cerr <<
"Error in Probleme_FTD_IJK_base::lire_solved_equations !!! We expected reading the SOLVED_EQUATIONS bloc instead of " << read_mc <<
" !!!" << finl;
153 Cerr <<
"Fix your data file !!!" << finl;
160 Cerr <<
"Error in Probleme_FTD_IJK_base::lire_solved_equations !!! We expected { instead of " << read_mc <<
" !!!" << finl;
161 Cerr <<
"Fix your data file !!!" << finl;
165 std::vector<Nom> eq_types, eq_name;
167 for (is >> read_mc; read_mc !=
"}"; is >> read_mc)
169 const bool non_accepted_eqs = (!read_mc.
contient(
"_FTD_IJK") && (read_mc !=
"IJK_INTERFACES") && (read_mc !=
"IJK_THERMALS") );
171 if (noms_eq_maj.
rang(read_mc) == -1 || non_accepted_eqs)
173 Cerr <<
"Error in Probleme_FTD_IJK_base::lire_solved_equations !!! The equation " << read_mc <<
" could not be used with a problem of type " <<
que_suis_je() <<
" !!!" << finl;
174 Cerr <<
"You can only use the following equations :" << finl;
175 for (
auto &itr : noms_eq_maj)
176 if (itr.contient(
"_FTD_IJK") || itr ==
"IJK_INTERFACES" || itr ==
"IJK_THERMALS")
177 Cerr <<
" - " << itr << finl;
181 eq_types.push_back(read_mc);
183 eq_name.push_back(nom_eq);
186 if (eq_types.size() != eq_name.size())
188 Cerr <<
"Error in Probleme_FTD_IJK_base::lire_solved_equations !!! The number of strings read in the bloc SOLVED_EQUATIONS is not correct !!!" << finl;
189 Cerr <<
"Fix your data file !!!" << finl;
195 for (
int i = 0; i < static_cast<int>(eq_types.size()); i++)
196 if (eq_types[i] ==
"NAVIER_STOKES_FTD_IJK")
203 for (
int i = 0; i < static_cast<int>(eq_types.size()); i++)
204 if (eq_types[i] ==
"IJK_INTERFACES")
211 for (
int i = 0; i < static_cast<int>(eq_types.size()); i++)
212 if (eq_types[i] ==
"IJK_THERMALS")
221 const int nb_milieu = 1;
224 for (
int i = 0; i < nb_milieu; i++)
247 for (
auto& itr : equations_)
270 for (
const auto &n: nams) noms.add(n);
276 for (
const auto &n: nams) noms.add(n);
283 for (
const auto &n: nams) noms.add(n);
288 for (
const auto &n: nams) noms.add(n);
361 statistics().begin_count(STD_COUNTERS::backup_file, statistics().get_last_opened_counter_level()+1);
369 Nom lata_name(fichier_sauvegarde);
370 Nom interf_name = lata_name +
".interfaces";
371 lata_name +=
".lata";
372 dumplata_header(lata_name, velocity[0] );
373 dumplata_newtime(lata_name, current_time);
374 dumplata_vector(lata_name,
"VELOCITY", velocity[0], velocity[1], velocity[2], 0);
380 Nom xyz_name(fichier_sauvegarde);
383 dumpxyz_vector(*
this, velocity, xyz_name,
true);
392 dumplata_finish(lata_name);
398 fichier.
ouvrir(fichier_sauvegarde);
399 Cerr <<
"T= " << current_time <<
" Checkpointing dans le fichier " << fichier_sauvegarde << finl;
401 fichier.
setf(std::ios_base::scientific);
430 Cerr <<
"T= " << current_time <<
" Checkpointing dans le fichier l.1168 " << fichier_sauvegarde << finl;
432 statistics().end_count(STD_COUNTERS::backup_file);
466 Nom prefix = dirname(fichier_reprise);
480 Cerr <<
que_suis_je() <<
"::initialise_ijk_fields()" << finl;
485 eq_ns.initialise_ijk_fields();
495 int ghost_fluid_flag = 0;
501 eq_ns.get_use_bubbles_velocities_from_barycentres());
509 eq_ns.get_fill_rising_velocities(),
eq_ns.get_use_bubbles_velocities_from_interface(),
eq_ns.get_use_bubbles_velocities_from_barycentres());
512 eq_ns.complete_initialise_ijk_fields();
530 statistics().create_custom_counter(
"Deplacement de l'interface",3,
"FrontTracking");
531 statistics().begin_count(
"Deplacement de l'interface",statistics().get_last_opened_counter_level()+1);
545 Cerr <<
"Compute Eulerian distance and curvature fields" << finl;
547 Cerr <<
"Clean IJK intersections" << finl;
549 Cerr <<
"Copy interface state for post-processing on surface" << finl;
556 ns.
deplacer_interfaces(timestep, rk_step, var_volume_par_bulle, first_step_interface_smoothing);
570 statistics().end_count(
"Deplacement de l'interface");
575 ArrOfDouble& var_volume_par_bulle)
581 ref_cast(
Navier_Stokes_FTD_IJK, equations_.front().valeur()).deplacer_interfaces_rk3(timestep, rk_step, var_volume_par_bulle);
634 for(
int i=0; i<2; i++)
648 Cerr <<
que_suis_je() <<
"::initialise_interfaces()" << finl;
650 const Domaine_dis_base& domaine_dis_ft = refprobleme_ft_disc_->domaine_dis();
665 Cerr <<
"Discretization (IJK) of the domain associated with the problem '" <<
le_nom() <<
"' (nothing to do ...)" << finl;
667 Process::exit(
"Error!! IJK problem must be associated with an IJK discretisation!!");
674 static bool alreadyDone =
false;
676 if (alreadyDone)
return;
688 std::vector<FieldInfo_t> more;
689 const std::vector<std::string> compos = {
"_X",
"_Y",
"_Z"};
690 for (
const auto& c: chps)
692 if (get<2>(c) == Nature_du_champ::vectoriel)
697 get<0>(n) +=
Nom(compos[d]);
698 get<2>(n) = Nature_du_champ::scalaire;
703 chps.insert(chps.end(), more.begin(), more.end());
709 Cerr <<
"Probleme_FTD_IJK_base::initialize()" << finl;
782 statistics().create_custom_counter(
"Mise a jour de la vitesse",3,
"FrontTracking");
783 statistics().begin_count(
"Mise a jour de la vitesse",statistics().get_last_opened_counter_level()+1);
792 statistics().end_count(
"Mise a jour de la vitesse");
799 assert(rk_step >= 0 && rk_step < 3);
800 statistics().create_custom_counter(
"Mise a jour de la vitesse",3,
"FrontTracking");
801 statistics().begin_count(
"Mise a jour de la vitesse",statistics().get_last_opened_counter_level()+1);
807 ref_cast(
Navier_Stokes_FTD_IJK, equations_.front().valeur()).rk3_sub_step(rk_step, total_timestep, fractionnal_timestep, time);
809 statistics().end_count(
"Mise a jour de la vitesse");
866 master_file <<
"FIN" << finl;
878 DoubleTrav var_volume_par_bulle(nbulles_tot);
879 var_volume_par_bulle = 0.;
895 Cerr <<
"Erreur dans Probleme_FTD_IJK_base::solveTimeStep() : time_scheme " <<
schema_temps_ijk().
que_suis_je() <<
" inconnu !" << finl;
933 int counter_first_iter = 1;
938 first_step_interface_smoothing = first_step_interface_smoothing && counter_first_iter;
940 counter_first_iter--;
941 if (first_step_interface_smoothing)
953 while (first_step_interface_smoothing);
1013 for (rk_step = 0; rk_step < 3; rk_step++)
1015 const double fractionnal_timestep = compute_fractionnal_timestep_rk3(timestep , rk_step);
1025 rk3_sub_step(rk_step, timestep, fractionnal_timestep, current_time_at_rk3_step);
1046 current_time_at_rk3_step += fractionnal_timestep;
1081 Cerr <<
"Probleme_FTD_IJK_base::run()" << finl;
1087 statistics().end_count(STD_COUNTERS::computation_start_up);
1089 statistics().print_TU_files(
"Computation start-up statistics");
1094 statistics().start_timeloop();
1098 statistics().start_time_step();
1099 statistics().begin_count(STD_COUNTERS::timeloop);
1143 statistics().end_time_step(tstep);
1144 statistics().end_count(STD_COUNTERS::timeloop);
1147 statistics().end_timeloop();
1152 statistics().print_TU_files(
"Time loop statistics");
1158 Cerr <<
"Construction du domaine VDF NS pour les sondes..." << finl;
1159 refprobleme_ns_ = creer_domaine_vdf(domaine_ijk_.valeur(),
"DOM_NS_VDF");
1161 Cerr <<
"Construction du domaine VDF..." << finl;
1162 build_extended_splitting(domaine_ijk_.valeur(),
domaine_ft_, domaine_ijk_->ft_extension());
1163 refprobleme_ft_disc_ = creer_domaine_vdf(
domaine_ft_,
"DOM_VDF");
1166 ref_cast(
Navier_Stokes_FTD_IJK, equations_.front().valeur()).build_redistribute_extended_splitting_ft();
double get_t0_shear() const
double get_dU_perio(int fluctuations=0) const
classe Discretisation_base Cette classe represente un schema de discretisation en espace,...
This class encapsulates all the information related to the eulerian mesh for TrioIJK.
classe Domaine_dis_base Cette classe est la base de la hierarchie des domaines discretisees.
Class defining operators and methods for all reading operation in an input flow (file,...
double get_delta_rho() const
void calculate_direction_gravite()
static int alloc_counter()
static void Fill_postprocessable_fields(std::vector< FieldInfo_t > &chps)
void associate_rising_velocities_parameters(const Domaine_IJK &splitting, const int &compute_rising_velocities, const int &fill_rising_velocities, const int &use_bubbles_velocities_from_interface, const int &use_bubbles_velocities_from_barycentres)
void initialize(const Domaine_IJK &splitting_FT, const Domaine_IJK &splitting_NS, const Domaine_dis_base &domaine_dis, const int thermal_probes_ghost_cells=0, const bool compute_vint=true, const bool is_switch=false)
void set_param_reprise_pb(Param &)
int get_nb_bulles_ghost(const int print=0) const
void calculer_indicatrice_apres_remaillage(const bool parcourir=true)
void creer_duplicata_bulles()
void update_indicatrice_variables_monofluides()
int get_nb_bulles_reelles() const
bool has_champ(const Motcle &nom) const override
void get_noms_champs_postraitables(Noms &noms, Option opt=NONE) const override
void update_old_intersections()
void RK3_G_store_vi_echange_esp_vect()
void detecter_et_supprimer_rejeton(bool duplicatas_etaient_presents)
void set_fichier_reprise_interface(const Nom &prefix)
static void Fill_postprocessable_fields(std::vector< FieldInfo_t > &chps)
void RK3_G_store_vi_resize(int n, int n2)
void initialise_ijk_compo_connex_bubbles_params()
void switch_indicatrice_next_old()
const Maillage_FT_IJK & maillage_ft_ijk() const
void transferer_bulle_perio()
bool has_champ_vectoriel(const Motcle &nom) const override
void parcourir_maillage()
void calculer_indicatrice_avant_remaillage(const bool parcourir=true)
const IJK_Field_double & get_IJK_field(const Motcle &nom) override
void supprimer_duplicata_bulles()
const IJK_Field_vector3_double & get_IJK_field_vector(const Motcle &nom) override
void sauvegarder_interfaces(const char *lata_name, const Nom &interf_name="??")
void allocate_ijk_compo_connex_fields(const Domaine_IJK &splitting, const int &allocate_compo_fields)
void calculer_indicatrice_next(const DoubleTab &gravite, const double delta_rho, const double sigma, const double time, const int itstep, const bool parcourir=true)
static double shear_x_time_
bool has_champ_vectoriel(const Motcle &nom) const override
void rk3_rustine_sub_step(const int rk_step, const double total_timestep, const double fractionnal_timestep, const double time)
void get_noms_champs_postraitables(Noms &noms, Option opt=NONE) const override
void set_post_pro_first_call()
void set_fichier_reprise(const char *lataname)
void set_temperature_ini()
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)
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 copy_previous_interface_state()
const IJK_Field_double & get_IJK_field(const Motcle &nom) override
static void Fill_postprocessable_fields(std::vector< FieldInfo_t > &chps)
void update_thermal_properties()
void compute_eulerian_distance_curvature()
void rk3_sub_step(const int rk_step, const double total_timestep, const double time)
void euler_time_step(const double timestep)
class IJK_discretisation handles the IJK discretisation of the problem
Cette classe implemente les operateurs et les methodes virtuelles de la classe EFichier de la facon s...
int nb_sommets() const
renvoie le nombre de sommets (reels et virtuels) (egal a sommets().
Une chaine de caractere (Nom) en majuscules.
bool has_champ(const Motcle &nom) const override
void calculer_vitesse_ft()
void calculer_terme_source_acceleration(IJK_Field_double &vx, const double time, const double timestep, const int rk_step)
void maj_indicatrice_rho_mu(const bool parcourir=true)
const IJK_Field_double & get_IJK_field(const Motcle &nom) override
void initialise_ns_fields()
void set_fichier_reprise_vitesse(const Nom &prefix)
bool has_champ_vectoriel(const Motcle &nom) const override
void get_noms_champs_postraitables(Noms &noms, Option opt=NONE) const override
void sauvegarder_equation(const Nom &, SFichier &) const
void set_param_reprise_pb(Param &)
void deplacer_interfaces(const double timestep, const int rk_step, ArrOfDouble &var_volume_par_bulle, const int first_step_interface_smoothing)
void forcage_control_ecoulement()
const Boundary_Conditions & get_boundary_conditions() const
const IJK_Field_vector3_double & get_velocity() const
const IJK_Field_vector3_double & get_IJK_field_vector(const Motcle &nom) override
void update_indicatrice_variables_monofluides()
void compute_var_volume_par_bulle(ArrOfDouble &var_volume_par_bulle)
void euler_time_step(ArrOfDouble &var_volume_par_bulle)
void associer_interfaces(const IJK_Interfaces &inter)
void update_v_or_rhov(bool with_p=false)
int preparer_calcul() override
Tout ce qui ne depend pas des autres problemes eventuels.
void test_etapes_et_bilan_rho_u_euler(bool apres)
static void Fill_postprocessable_fields(std::vector< FieldInfo_t > &chps)
int get_suppression_rejetons() const
class Nom Une chaine de caractere pour nommer les objets de TRUST
bool contient(const Nom &nom) const
Un tableau de chaine de caracteres (VECT(Nom)).
int rang(const char *const ch) const
classe Objet_U Cette classe est la classe de base des Objets de TRUST
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.
int lire_avec_accolades(Entree &is)
Alias of lire_avec_accolades_depuis.
int postraiter(int force=1) override
Demande au probleme de postraiter ses champs, sondes,.
void sauvegarder_post(const Nom &lata_name)
const IJK_Field_double & get_IJK_field(const Motcle &nom) override
static void Fill_postprocessable_fields(std::vector< FieldInfo_t > &chps)
static std::vector< FieldInfo_t > & Get_champs_postraitables()
const IJK_Field_vector3_double & get_IJK_field_vector(const Motcle &nom) override
void associer_probleme(const Probleme_FTD_IJK_base &)
void compute_extended_pressures()
void update_stat_ft(const double dt)
void sauvegarder_post_maitre(const Nom &lata_name, SFichier &fichier) const
void get_noms_champs_postraitables(Noms &noms, Option opt=NONE) const
void associer_domaines(Domaine_IJK &dom_ijk, Domaine_IJK &dom_ft)
bool has_champ_vectoriel(const Motcle &nom) const override
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 reprendre_post(Param ¶m)
bool has_champ(const Motcle &nom) const override
int postraiter_sondes()
Effectue le postraitement lie au sondes de facon imperative.
static void Fill_postprocessable_fields()
void get_noms_champs_postraitables(Noms &noms, Option opt) const override
void initialise_ijk_fields()
Fluide_Diphasique_IJK & milieu_ijk()
void completer() override
Complete les equations associees au probleme.
void typer_lire_milieu(Entree &is) override
void update_pre_remeshing_indicator_field()
int thermal_probes_ghost_cells_
bool has_champ_vectoriel(const Motcle &nom) const override
virtual void set_param(Param ¶m) const override
void reprendre_probleme(const char *fichier_reprise)
void terminate() override
This method is called once at the end, after any other one.
const IJK_Interfaces & get_interface() const
void sauver() const override
Ecriture sur fichier en vue d'une reprise (sauvegarde).
const IJK_Field_double & get_IJK_field(const Motcle &nom) override
Champs_compris_IJK_interface::FieldInfo_t FieldInfo_t
virtual void create_forced_dilation()
void parcourir_maillage()
void initialise_interfaces()
int associer_(Objet_U &) override
surcharge Objet_U::associer_(Objet_U& ob) Associe differents objets au probleme en controlant
void update_thermal_properties()
const Schema_Temps_IJK_base & schema_temps_ijk() const
void euler_time_step(ArrOfDouble &var_volume_par_bulle)
void rk3_sub_step(const int rk_step, const double total_timestep, const double fractionnal_timestep, const double time)
const Postprocessing_IJK & get_post() const
void sauvegarder_probleme(const char *fichier_sauvegarde, const int &stop)
void preparer_calcul() override
Prepare le calcul: initialise les parametres du milieu et prepare le calcul de chacune des equations.
void lire_solved_equations(Entree &is) override
IJK_Field_int treatment_count_
void solveTimeStep_Euler(DoubleTrav &)
virtual void update_twice_indicator_field()
virtual void deplacer_interfaces_rk3(const double timestep, const int rk_step, ArrOfDouble &var_volume_par_bulle)
virtual void update_indicator_field()
bool solveTimeStep() override
pour recodage eventuel et appel unifie en python
void update_post_remeshing_indicator_field()
const IJK_Field_vector3_double & get_IJK_field_vector(const Motcle &nom) override
void initialize() override
This method is called once at the beginning, before any other one of the interface Problem.
bool initTimeStep(double dt) override
This method allocates and initializes the unknown and given fields for the future time step.
const Navier_Stokes_FTD_IJK & eq_ns() const
void abortTimeStep() override
Aborts the resolution of the current time step.
void discretiser(Discretisation_base &dis) override
bool has_champ(const Motcle &nom) const override
void validateTimeStep() override
Validates the calculated unknown by moving the present time at the end of the time step.
virtual void deplacer_interfaces(const double timestep, const int rk_step, ArrOfDouble &var_volume_par_bulle, const int first_step_interface_smoothing)
void update_old_intersections()
void solveTimeStep_RK3(DoubleTrav &)
const IJK_Thermals & get_ijk_thermals() const
bool run() override
Cette methode est une sorte de main() du Problem Elle peut etre utilisee si le probleme n'est couple ...
double computeTimeStep(bool &stop) const override
Compute the value the Problem would like for the next time step.
double t_debut_statistiques() const
Equation_base & getset_equation_by_name(const Nom &le_nom) override
(B. Math): Methode virtuelle ajoutee pour les problemes ayant plusieurs equations de meme type (Probl...
void add_FT_equation(const Nom &, const Nom &)
int associer_(Objet_U &ob) override
surcharge Objet_U::associer_(Objet_U& ob) Associe differents objets au probleme en controlant
const Nom & le_nom() const override
Donne le nom de l'Objet_U Methode a surcharger : renvoie "neant" dans cette implementation.
void init_postraitements()
Flag le premier et le dernier postraitement pour chaque fichier Et initialise les postraitements.
Postraitements les_postraitements_
std::vector< OWN_PTR(Milieu_base)> le_milieu_
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...
Explicit Euler scheme for IJK setups.
double & get_current_time_at_rk3_step()
void set_max_timestep(const double t)
int get_tstep_init() const
int get_nb_timesteps() const
double computeTimeStep(bool &stop) const override
bool & get_first_step_interface_smoothing()
void set_max_timestep_if_smaller(const double t)
double get_timestep() const
void completer() override
void set_param_reprise_pb(Param &)
int get_dt_sauvegarde() const
void set_modified_time_ini(const double t)
void set_tstep_sauv(const int ts)
void set_current_time(const double t)
void check_stop_criteria(bool &stop) const
double get_current_time() const
double get_max_timestep() 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.
static void Fill_postprocessable_fields(std::vector< FieldInfo_t > &chps)
static int les_sous_types(const Nom &, Noms &sous_types)
Donne les noms des sous-types, un type mere etant donne par son nom.