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--)
413 Cerr <<
"You forgot to associate problems to the coupled problem named " <<
le_nom() << finl;
428 Cerr <<
"You forgot to associate problems to the coupled problem named " <<
le_nom() << finl;
448 Cerr<<
"The problem that we are starting to discretize is "<<
probleme(i).
le_nom()<<finl;
457 bool pdi_format =
false;
463 if(
Motcle(format) ==
"pdi")
467 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;
480 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
Should we print the execution statistics now?
void addProblem(Probleme_U &)
class Discretisation_base This class represents a spatial discretization scheme, which
virtual int calculer_coeffs_echange(double temps)
Computes the exchange coefficients for thermally coupled problems.
virtual void mettre_a_jour(double temps, Domaine_dis_base &, Probleme_base &)
class Ecrire_YAML Use this to generate a yaml file that will then be read by the PDI library (for che...
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()
Returns the discretized boundary condition domain associated with the equation.
static Objet_U & objet(const Nom &)
See Interprete_bloc::objet_global(). BM: the Interprete class is not the best place for this.
A character string (Nom) in uppercase.
class Nom: a character string for naming TRUST objects.
Nom & prefix(const char *const)
const std::string & getString() const
const Nom & que_suis_je() const
Returns the string identifying the class.
virtual Entree & readOn(Entree &)
Reads an Objet_U from an input stream. Virtual method to override.
Objet_U()
Default constructor: assigns a unique identifier to the object (object_id_) and registers the object ...
virtual Sortie & printOn(Sortie &) const
Writes the object to an output stream. Virtual method to override.
bool solveTimeStep() override
For possible re-implementation and unified call from python.
Probleme_Couple This is the historical coupling class of TRUST.
virtual void discretiser(Discretisation_base &)
Associates a discretization with all problems of the coupled problem.
void sauver() const override
Save the problem state to disk.
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 &)
Associates a copy of the time scheme with each problem of the coupled problem.
int associer_(Objet_U &) override
Overrides Objet_U::associer_(Objet_U&): associates an object with the coupled problem,...
bool updateGivenFields() override
WARNING:
bool solveTimeStep() override
For possible re-implementation and unified call from python.
virtual const Schema_Temps_base & schema_temps() const
Returns the time scheme associated with the coupled problems (const version).
void ajouter(Probleme_base &)
Adds a problem to the list of coupled problems.
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
Returns the name of the Objet_U. Virtual method to override: returns "neant" in this implementation.
virtual bool iterateTimeStep(bool &converged)
In the case solveTimeStep uses an iterative process, this method executes a single iteration.
virtual bool solveTimeStep()
For possible re-implementation and unified call from python.
virtual bool updateGivenFields()
WARNING:
virtual double computeTimeStep(bool &stop) const
Compute the value the Problem would like for the next time step.
class Probleme_base It is a Probleme_U that is not a coupling.
virtual void discretiser(Discretisation_base &)
Assigns a discretization to the problem Discretizes the Domain associated with the problem with the d...
const Nom & checkpoint_filename() const
void associer_pb_couple(const Probleme_Couple &pbc)
const Nom & checkpoint_format() const
const Domaine & domaine() const
Returns the domain associated with the problem.
bool updateGivenFields() override
WARNING:
const Nom & yaml_filename() const
virtual void associer_sch_tps_base(const Schema_Temps_base &)
Associates a time scheme with the problem.
const Schema_Temps_base & schema_temps() const
Returns the time scheme associated with the problem.
virtual int nombre_d_equations() const =0
virtual const Equation_base & equation(int) const =0
const Domaine_dis_base & domaine_dis() const
Returns the discretized domain associated with the problem (const version).
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
virtual int faire_un_pas_de_temps_pb_couple(Probleme_Couple &, int &ok)
double temps_courant() const
Returns the current time.
const double & residu() const
int stationnaire_atteint() const
double facteur_securite_pas() const
Returns the safety factor or multiplier of delta_t.
Base class for output streams.
static void init(std::string IO_config)
static int is_PDI_initialized()