16#include <Navier_Stokes_Fluide_Dilatable_base.h>
17#include <Fluide_Dilatable_base.h>
18#include <Neumann_sortie_libre.h>
19#include <Loi_Etat_Multi_GP_QC.h>
20#include <Discretisation_base.h>
21#include <Champ_Fonc_Fonction.h>
22#include <Champ_Uniforme.h>
23#include <Probleme_base.h>
24#include <Domaine_VF.h>
43 Cerr<<
"Fluide_Dilatable_base::discretiser"<<finl;
44 if (!le_probleme_) le_probleme_ = pb;
51 dis.
discretiser_champ(
"temperature",domaine_dis,
"masse_volumique_p",
"neant",1,temps,ch_rho);
52 ch_rho_ = ch_rho.valeur();
56 Cerr<<
"Heat capacity Cp is discretized once more for space variable case."<<finl;
75 dis.
discretiser_champ(
"champ_elem",domaine_dis,
"pression_tot",
"Pa",1,temps,ch_pression_tot_);
105 loi_etat_.typer_lire(is,
"Loi_Etat_",
"Lecture et typage de la loi d'etat ...");
106 loi_etat_->associer_fluide(*
this);
109 else if (mot==
"Traitement_PTh")
115 les_options[0] =
"edo";
116 les_options[1] =
"conservation_masse";
117 les_options[2] =
"constant";
122 Cerr<< trait <<
" is not understood as an option of the keyword " << mot <<finl;
123 Cerr<<
"One of the following options was expected : " << les_options << finl;
131 ch_mu_->nommer(
"mu");
134 else if (mot==
"sutherland")
136 double mu0,T0,C=-1,Slambda=-1;
146 if (motlu==
"SLAMBDA")
154 ch_mu_.typer(
"Sutherland");
167 lambda_suth.
set_C(Slambda);
171 else if ((mot==
"beta_th") || (mot==
"beta_co"))
173 Cerr<<
"The keyword "<<mot<<
" has not to be read for a "<<
que_suis_je()<<
" type medium."<<finl;
174 Cerr<<
"Please remove it from your data set."<<finl;
194 int pression_imposee=0;
197 for (
int n=0; n<size; n++)
205 Cerr <<
"The Traitement_Pth option selected is not coherent with the boundaries conditions." << finl;
206 Cerr <<
"Traitement_Pth constant must be used for the case of free outlet." << finl;
212 Cerr <<
"The Traitement_Pth option selected is not coherent with the boundaries conditions." << finl;
213 Cerr <<
"Traitement_Pth conservation_masse must be used for the case without free outlet." << finl;
221 Cerr <<
"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << finl;
222 Cerr <<
"Error in call to Sutherland function :" << finl;
223 Cerr <<
"The syntax has changed in version 1.8.4." << finl;
224 Cerr << finl <<
" A specification of kind : sutherland problem_name mu0 1.85e-5 T0 300 [Slambda 10] C 10 was expected. "<<finl;
225 Cerr << finl <<
"Please update your dataset or contact TRUST support team." << finl;
239 msg +=
"The density rho has not been specified. \n";
246 if (ch_mu_->valeurs()(0,0) <= 0)
248 msg +=
"The dynamical viscosity mu is not striclty positive. \n";
255 msg +=
"The dynamical viscosity mu has not been specified. \n";
261 msg +=
"The conductivity lambda has not been specified. \n";
267 msg +=
"The heat capacity Cp has not been specified. \n";
280 ch_Cp_.typer(
"Champ_Uniforme");
283 DoubleTab& tab_Cp =
ch_Cp_->valeurs();
290 if (
equation_.size() && (*(
equation_.begin()->second)).inconnue().valeurs().isDataOnDevice())
293 mapToDevice(ch_rho_->valeurs());
294 mapToDevice(ch_rho_Cp_elem_->valeurs());
301 rho_cp = ch_rho_->valeurs()(0, 0);
306 tab_multiply_any_shape(rho_cp, ch_rho_->valeurs());
309 rho_cp *=
ch_Cp_->valeurs()(0, 0);
311 tab_multiply_any_shape(rho_cp,
ch_Cp_->valeurs());
329 return loi_etat_->ch_temperature();
334 return loi_etat_->ch_temperature();
342 loi_etat_->
mettre_a_jour(le_probleme_->schema_temps().temps_courant());
343 eos_tools_->mettre_a_jour(le_probleme_->schema_temps().temps_courant());
349 loi_etat()->abortTimeStep();
372 loi_etat_->calculer_lambda();
376 if (!est_egal(lold,lo))
378 Cerr <<
"Error : mu, lambda, Cp and Prandtl are all specified in your data set." << finl;
379 Cerr <<
"It is observed that your imput values leads to :" << finl;
381 Cerr <<
"mu/(lambda*Cp)=" << loi_etat_->Prandt()*(lo/lold) <<
" and Prandtl=" << loi_etat_->Prandt() << finl;
382 Cerr<<
"Please modify your data set by specifying for instance Prandtl = "<<loi_etat_->Prandt()*(lo/lold)<<finl;
395 Cerr <<
"A sutherland law cannot be requested for the conductivity "<<finl;
396 Cerr <<
"by indicating Slambda if the heat capacity (Cp) is not uniform."<<finl;
400 const double mu0 = mu_suth.
get_A();
402 double lambda0 = mu0/loi_etat_->Prandt()*
ch_Cp_->valeurs()(0,0);
403 lambda_suth.
set_A(lambda0);
417 Cerr <<
"Fluide_Dilatable_base::initialiser()" << finl;
421 ch_mu_->initialiser(temps);
423 ch_Cp_->initialiser(temps);
429 if (
equation_.size() && (*(
equation_.begin()->second)).inconnue().valeurs().isDataOnDevice())
432 mapToDevice(ch_rho_->valeurs());
433 mapToDevice(ch_rho_Cp_elem_->valeurs());
443 coeff_absorption_->initialiser(temps);
445 longueur_rayo_->initialiser(temps);
450 DoubleTab& l_rayo = longueur_rayo_->valeurs();
453 l_rayo[i] = 1/(3*K[i]);
462 DoubleTab& tab_Ptot = ch_pression_tot_->valeurs();
464 DoubleTrav tab_PHyd(n, 1);
470 const DoubleTab& centres_de_gravites=domaine.xp();
480 if(motlu ==
"source_masse_espece")
482 if (!ch_source_masse_esp_)
484 double temps = le_probleme_->schema_temps().temps_courant();
486 le_probleme_->discretisation().discretiser_champ(
"champ_elem", le_probleme_->equation(0).domaine_dis(),
"source_masse_espece",
"Kg/m3/s", 1, temps, ch_source_masse_esp_);
490 else if (motlu ==
"source_masse_projection")
494 double temps = le_probleme_->schema_temps().temps_courant();
496 le_probleme_->discretisation().discretiser_champ(
"pression", le_probleme_->equation(0).domaine_dis(),
"source_masse_projection",
"Kg/m3/s", 1, temps,
ch_source_masse_proj_);
509 if (loi_etat_->has_champ(nom, ref_champ))
520 if (loi_etat_->has_champ(nom))
533 if (loi_etat_->has_champ(nom, ref_champ))
536 throw std::runtime_error(std::string(
"Field ") + nom.
getString() + std::string(
" not found !"));
542 loi_etat_->get_noms_champs_postraitables(nom,opt);
547 ch_rho_->mettre_a_jour(temps);
549 ch_rho_->changer_temps(temps);
551 ch_mu_->changer_temps(temps);
553 ch_Cp_->mettre_a_jour(temps);
563 Cerr <<
"Fluide_Dilatable_base::preparer_calcul()" << finl;
566 loi_etat_->preparer_calcul();
574 ch_pression_tot_->mettre_a_jour(temps);
583 if (!le_probleme_) le_probleme_ = pb;
589 if (typ ==
"VEFPreP1B")
592 eos_tools_.typer(
Nom(
"EOS_Tools_") + typ);
594 eos_tools_->associer_fluide(*
this);
595 loi_etat_->assoscier_probleme(pb);
598 loi_etat_->initialiser();
607 if (typ==
"VEFPreP1B") typ =
"VEF";
615 typ += loi_etat_->type_fluide();
617 typ =
Nom(
"EDO_Pression_th_") + typ;
618 Cerr <<
"Typing the pressure ODE: " << typ << finl;
621 EDO_Pth_->associer_fluide(*
this);
622 EDO_Pth_->mettre_a_jour_CL(
Pth_);
630 Cerr <<
"Warning! evol_glob file renamed " <<
output_file_ << finl;
638 eos_tools_->mettre_a_jour(le_probleme_->schema_temps().temps_courant());
646 fic <<
"# Time sum(T*dv)/sum(dv)[K] sum(rho*dv)/sum(dv)[kg/m3] Pth[Pa]" << finl;
652 const double Ch_m = eos_tools_->moyenne_vol(ch_inco_chaleur_->valeurs());
653 const double rhom = eos_tools_->moyenne_vol(ch_rho_->valeurs());
658 fic << temps <<
" " << Ch_m <<
" " << rhom <<
" " <<
Pth_ << finl;
class Champ_Don_base base class of Given Fields (not calculated)
void mettre_a_jour(double temps) override
Time update.
void dimensionner(int, int)
Sets the number of components and the number of nodal values.
DoubleTab & valeurs() override
Overrides Champ_base::valeurs() Returns the array of values.
int nb_valeurs_nodales() const override
Returns the number of degrees of freedom per component: the number of nodes.
Class Champ_Fonc_Tabule Derived class of Champ_Fonc_base representing.
class Champ_base This class is the base of the fields hierarchy.
virtual double changer_temps(const double t)
Sets the time at which the field is defined.
virtual void creer_champ(const Motcle &motlu)=0
virtual void get_noms_champs_postraitables(Noms &nom, Option opt=NONE) const =0
virtual bool has_champ(const Motcle &nom, OBS_PTR(Champ_base)&ref_champ) const =0
class Cond_lim Generic class used to represent any class
class Discretisation_base This class represents a spatial discretization scheme, which
void discretiser_champ(const Motcle &directive, const Domaine_dis_base &z, const Nom &nom, const Nom &unite, int nb_comp, int nb_pas_dt, double temps, OWN_PTR(Champ_Inc_base)&champ, const Nom &sous_type=NOM_VIDE) const
class Domaine_Cl_dis_base Domaine_Cl_dis_base objects represent discretized boundary conditions
const Cond_lim & les_conditions_limites(int) const
Returns the i-th boundary condition.
class Domaine_dis_base This class is the base of the hierarchy of discretized domains.
Class defining operators and methods for all reading operation in an input flow (file,...
const Discretisation_base & discretisation() const
Returns the discretization associated with the equation.
virtual const Champ_Inc_base & inconnue() const =0
virtual Domaine_Cl_dis_base & domaine_Cl_dis()
Returns the discretized boundary condition domain associated with the equation.
Domaine_dis_base & domaine_dis()
Returns the discretized domain associated with the equation.
Base class for a dilatable fluid, inheriting from Fluide_base.
const Champ_Don_base & ch_temperature() const
Returns the temperature field.
const Champ_base & get_champ(const Motcle &nom) const override
void creer_champ(const Motcle &motlu) override
int initialiser(const double temps) override
Initializes the fluid parameters.
bool has_champ(const Motcle &nom, OBS_PTR(Champ_base) &ref_champ) const override
OBS_PTR(Champ_Inc_base) ch_inco_chaleur_
void warn_syntax_Sutherland()
const DoubleTab & temperature() const
Returns the array of temperature values.
void abortTimeStep() override
void mettre_a_jour(double) override
Performs a time update of the medium and therefore of its characteristic parameters.
void creer_champs_non_lus() override
int lire_motcle_non_standard(const Motcle &, Entree &) override
Reads non-simple-type parameters of an Objet_U from an input stream.
void initialiser_inco_ch()
virtual void calculer_pression_tot()
Computes the total pressure: thermodynamic pressure + hydrodynamic pressure.
virtual void checkTraitementPth(const Domaine_Cl_dis_base &)
void completer_edo(const Probleme_base &)
virtual void remplir_champ_pression_tot(int n, const DoubleTab &PHydro, DoubleTab &PTot)=0
virtual void update_pressure_fields(double)
virtual void write_mean_edo(double)
void discretiser(const Probleme_base &pb, const Discretisation_base &dis) override
void prepare_pressure_edo()
void preparer_calcul() override
Prepares the fluid for computation.
void preparer_pas_temps()
Prepares the time step.
const OWN_PTR(Loi_Etat_base) &loi_etat() const
void update_rho_cp(double temps) override
void initialiser_radiatives(const double temps)
void set_Cp(double)
Completes the fluid with a constant Cp.
void verifier_coherence_champs(int &err, Nom &message) override
Verifies that the fields read have been correctly set.
void set_param(Param ¶m) const override
virtual void write_header_edo()
void get_noms_champs_postraitables(Noms &nom, Option opt=NONE) const override
virtual void completer(const Probleme_base &)
Completes the fluid with the unknown fields associated with the problem.
Base class for an incompressible fluid and its properties:
void set_param(Param ¶m) const override
Champ_Don_base & longueur_rayo()
void discretiser(const Probleme_base &pb, const Discretisation_base &dis) override
Base state law class for ideal gases, defining a dilatable fluid with the equation of state: Pth = rh...
State law class for a mixture of ideal gases in the quasi-compressible (QC) framework.
void ecrire(Sortie &) const
Writes a medium object to an output stream.
virtual void verifier_coherence_champs(int &err, Nom &message)
int lire_motcle_non_standard(const Motcle &, Entree &) override
Reads non-simple-type parameters of an Objet_U from an input stream.
Champs_compris champs_compris_
std::map< std::string, const Equation_base * > equation_
A character string (Nom) in uppercase.
An array of Motcle objects.
int search(const Motcle &t) const
Navier_Stokes_std This class carries the terms of the momentum equation.
Neumann_sortie_libre This class represents an open boundary without imposed velocity.
class Nom: a character string for naming TRUST objects.
virtual int debute_par(const char *const n) const
const std::string & getString() const
An array of character strings (VECT(Nom)).
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.
static const Nom & nom_du_cas()
Returns a constant reference to the case name. This method is static.
virtual Sortie & printOn(Sortie &) const
Writes the object to an output stream. Virtual method to override.
Helper class to factorize the readOn method of Objet_U classes.
void ajouter_non_std(const char *keyword, const Objet_U *value, Param::Nature nat=Param::OPTIONAL)
Register a keyword handled by Objet_U::lire_motcle_non_standard.
void supprimer(const char *keyword)
Remove a previously-registered keyword from this Param.
const Nom & le_nom() const override
Returns the name of the Objet_U. Virtual method to override: returns "neant" in this implementation.
class Probleme_base It is a Probleme_U that is not a coupling.
const Schema_Temps_base & schema_temps() const
Returns the time scheme associated with the problem.
virtual const Equation_base & equation(int) const =0
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
static int je_suis_maitre()
Returns 1 if on the master processor of the current group (i.e. me() == 0), 0 otherwise.
SFichier is to the C++ ofstream class what Sortie is to the C++ ostream class.
double temps_courant() const
Returns the current time.
Base class for output streams.
void set_A(const double A)
const double & get_A() const
void set_C(const double C)
void set_Tref(const double Tref)
void set_prob(const Nom &prob)
void set_val_params(const Nom &prob, const double A, const double C, const double Tref)
_SIZE_ dimension_tot(int) const override