16#include <Schema_Euler_Implicite.h>
17#include <Probleme_Couple.h>
18#include <EcrFicCollecte.h>
19#include <Postraitement.h>
20#include <Equation_base.h>
21#include <Milieu_base.h>
23#include <Domaine_VF.h>
24#include <TRUST_2_PDI.h>
25#include <Ecrire_YAML.h>
89 std::set<const Domaine*> processed_domains;
94 if (processed_domains.insert(&dom).second)
99 if (sch_clones.size())
105 if (!ok)
return false;
107 for (
int i=1; i<sch_clones.size(); i++)
125 std::vector<Schema_Euler_Implicite*> per_pb_schemas;
132 per_pb_schemas.clear();
138 if (
int(per_pb_schemas.size()) !=
nb_problemes())
Process::exit(
"Probleme_Couple_Point_Fixe::solveTimeStep only works with problems using Schema_Euler_Implicite");
143 const int max_fp_iter = 1000;
144 bool converged =
false;
149 while (compteur < nb_iter_min || (!converged && ok && compteur < max_fp_iter))
155 std::set<const Domaine*> processed_domains;
160 if (processed_domains.insert(&dom).second)
167 const double temps = per_pb_schemas[i]->temps_courant() + per_pb_schemas[i]->pas_de_temps();
177 const int cv_pb = per_pb_schemas[i]->Iterer_Pb(pb, compteur, ok);
178 converged = converged && cv_pb;
182 if (!ok || !converged)
185 per_pb_schemas[i]->notify_failed_timestep();
187 Cerr <<
le_nom() <<
" : Failure in Probleme_Couple_Point_Fixe::solveTimeStep after " << compteur <<
" iterations." << finl;
191 Cout <<
"Fixed-point convergence at t = " <<
schema_temps().
temps_courant() <<
" in " << compteur <<
" iterations." << finl;
218 for(
int i=debut_gr; ok && i<fin_gr; i++)
221 for(
int i=debut_gr; ok && i<fin_gr; i++)
225 converged = converged && cv;
243 Cerr <<
"Reading of Probleme_Couple " <<
le_nom() << finl;
249 Cerr <<
"We expected { to start to read the Probleme_Couple" << finl;
254 while (motlu!=Motcle(
"}"))
257 if (motlu != Motcle(
"groupes"))
259 Cerr <<
"The keyword " << motlu <<
" is not understood" << finl;
265 Cerr <<
"We can associate problems to Probleme_Couple" << finl;
266 Cerr <<
"* either by \"associer prob_couple pb\" (in which case they are all in the same group)" << finl;
267 Cerr <<
"* either by the keyword \"groupes\" while reading the object Probleme_Couple" << finl;
268 Cerr <<
"but not both!" << finl;
272 LIST(LIST(Nom)) les_noms;
275 groupes.resize_array(les_noms.size());
276 for (
int i=0; i<les_noms.size(); i++)
279 for (
int j=0; j<les_noms[i].size(); j++)
281 Nom nom_pb=les_noms[i][j];
283 Probleme_base& pb=ref_cast(Probleme_base,ob);
338 Cerr <<
"Warning !" << finl;
339 Cerr <<
"You define a conduction problem named "<<
probleme(0).
le_nom()<<
" before your turbulent thermalhydraulic problem named "<<
probleme(nb_pb-1).
le_nom()<<
"." << finl;
340 Cerr <<
"Please, define first your turbulent thermalhydraulic problem in your data file like:" << finl;
342 Cerr <<
"Probleme_Couple "<<
le_nom()<< finl;
343 for (
int i=nb_pb-1; i>=0; i--)
415 Cerr <<
"You forgot to associate problems to the coupled problem named " <<
le_nom() << finl;
430 Cerr <<
"You forgot to associate problems to the coupled problem named " <<
le_nom() << finl;
450 Cerr<<
"The problem that we are starting to discretize is "<<
probleme(i).
le_nom()<<finl;
459 bool pdi_format =
false;
465 if(
Motcle(format) ==
"pdi")
469 Cerr <<
"Probleme_Couple::sauver() Error! You have provided different yaml files for each of your problems to initialize PDI. It has to be the same. " << finl;
482 if(yaml_fname ==
"??")
const Probleme_U & probleme(int i) const
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.
int limpr() const override
Doit-on imprimer les statistiques d'execution maintenant ?
void addProblem(Probleme_U &)
classe Discretisation_base Cette classe represente un schema de discretisation en espace,...
virtual int calculer_coeffs_echange(double temps)
Calcul des coefficients d'echange pour les problemes couples thermiques.
virtual void mettre_a_jour(double temps, Domaine_dis_base &, Probleme_base &)
classe Ecrire_YAML Use this to generate a yaml file that will then be read by the PDI library (for ch...
void write_checkpoint_file(const std::string &yaml_fname)
Generate the YAML file that will be read for checkpoint.
void add_pb_base(const Probleme_base &pb_base, const Nom &full_file_name)
Class defining operators and methods for all reading operation in an input flow (file,...
virtual Domaine_Cl_dis_base & domaine_Cl_dis()
Renvoie le domaine des conditions aux limite discretisee associee a l'equation.
static Objet_U & objet(const Nom &)
Voir Interprete_bloc::objet_global() BM: la classe Interprete n'est pas le meilleur endroit pour cett...
Une chaine de caractere (Nom) en majuscules.
class Nom Une chaine de caractere pour nommer les objets de TRUST
Nom & prefix(const char *const)
const std::string & getString() const
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.
Objet_U()
Constructeur par defaut : attribue un numero d'identifiant unique a l'objet (object_id_),...
virtual Sortie & printOn(Sortie &) const
Ecriture de l'objet sur un flot de sortie Methode a surcharger.
bool solveTimeStep() override
pour recodage eventuel et appel unifie en python
classe Probleme_Couple C'est la classe historique de couplage de TRUST.
virtual void discretiser(Discretisation_base &)
Associe une discretisation a tous les problemes du probleme couple.
void sauver() const override
Sauvegarder l'etat du probleme sur disque.
bool initTimeStep(double dt) override
This method allocates and initializes the unknown and given fields for the future time step.
void initialize() override
This method is called once at the beginning, before any other one of the interface Problem.
double computeTimeStep(bool &stop) const override
Compute the value the Problem would like for the next time step.
virtual void associer_sch_tps_base(Schema_Temps_base &)
Associe une copie du schema en temps a chaque probleme du Probleme couple.
int associer_(Objet_U &) override
Surcharge Objet_U::associer_(Objet_U&) Associe un objet au probleme couple, en verifiant le type.
bool updateGivenFields() override
ATTENTION :
bool solveTimeStep() override
pour recodage eventuel et appel unifie en python
virtual const Schema_Temps_base & schema_temps() const
Renvoie le schema en temps associe aux problemes couples.
void ajouter(Probleme_base &)
Ajoute un probleme a la liste des problemes couples.
bool iterateTimeStep(bool &converged) override
In the case solveTimeStep uses an iterative process, this method executes a single iteration.
const Nom & le_nom() const override
Donne le nom de l'Objet_U Methode a surcharger : renvoie "neant" dans cette implementation.
virtual bool iterateTimeStep(bool &converged)
In the case solveTimeStep uses an iterative process, this method executes a single iteration.
virtual bool solveTimeStep()
pour recodage eventuel et appel unifie en python
virtual bool updateGivenFields()
ATTENTION :
virtual double computeTimeStep(bool &stop) const
Compute the value the Problem would like for the next time step.
classe Probleme_base C'est un Probleme_U qui n'est pas un couplage.
virtual void discretiser(Discretisation_base &)
Affecte une discretisation au probleme Discretise le Domaine associe au probleme avec la discretisati...
const Nom & checkpoint_filename() const
void associer_pb_couple(const Probleme_Couple &pbc)
const Nom & checkpoint_format() const
const Domaine & domaine() const
Renvoie le domaine associe au probleme.
bool updateGivenFields() override
ATTENTION :
const Nom & yaml_filename() const
virtual void associer_sch_tps_base(const Schema_Temps_base &)
Associe un schema en temps au probleme.
const Schema_Temps_base & schema_temps() const
Renvoie le schema en temps associe au probleme.
virtual int nombre_d_equations() const =0
virtual const Equation_base & equation(int) const =0
const Domaine_dis_base & domaine_dis() const
Renvoie le domaine discretise associe au probleme.
static void exit(int exit_code=-1)
Routine de sortie de TRUST dans une region Kokkos.
virtual int faire_un_pas_de_temps_pb_couple(Probleme_Couple &, int &ok)
double temps_courant() const
Renvoie le temps courant.
const double & residu() const
int stationnaire_atteint() const
double facteur_securite_pas() const
Renvoie le facteur de securite ou multiplicateur de delta_t.
Classe de base des flux de sortie.
static void init(std::string IO_config)
static int is_PDI_initialized()