16#include <Fluide_Weakly_Compressible.h>
17#include <Loi_Etat_Multi_GP_WC.h>
18#include <Neumann_sortie_libre.h>
19#include <Domaine_Cl_dis_base.h>
20#include <Champ_Fonc_Fonction.h>
21#include <Discretisation_base.h>
22#include <Schema_Temps_base.h>
24#include <Probleme_base.h>
25#include <Equation_base.h>
26#include <Domaine_VF.h>
55 param.
ajouter(
"pression_xyz", &ch_Pth_xyz_);
78 Cerr <<
"Fluide_Weakly_Compressible::completer";
81 Cerr <<
" Pth = " <<
Pth_ << finl;
90 if (ch_Pth_xyz_->que_suis_je() !=
"Champ_Fonc_xyz")
92 Cerr <<
"Error in your data file : This is not allowed !" << finl;
93 Cerr <<
"Pression_xyz should be defined with Champ_Fonc_xyz !" << finl;
98 Cerr <<
"Error in your data file : This is not allowed !" << finl;
99 Cerr <<
"You can not specify both pression_xyz and pression_thermo !" << finl;
104 Cerr <<
"Error in your data file : This is not allowed !" << finl;
105 Cerr <<
"You need to define pression_thermo when using the flags use_total_pressure or use_hydrostatic_pressure !" << finl;
115 Cerr <<
"Error in your data file : This is not allowed !" << finl;
116 Cerr <<
"You need to specify either pression_xyz or pression_thermo !" << finl;
122 Cerr <<
"Error in your data file : This is not allowed !" << finl;
123 Cerr <<
"You should define time_activate_ptot when using the flag use_total_pressure !" << finl;
129 Cerr <<
"Error in your data file : This is not allowed !" << finl;
130 Cerr <<
"Not possible to activate the two flags use_total_pressure and use_hydrostatic_pressure at same time !" << finl;
136 Cerr <<
"Error in your data file : This is not allowed !" << finl;
137 Cerr <<
"Not possible to activate the flag use_hydrostatic_pressure without defining a gravity vector !" << finl;
147 Cerr <<
"Initializing the thermo-dynamic pressure Pth_xyz ..." << finl;
167 Cerr <<
"Initializing the thermo-dynamic pressure ..." << finl;
170 const int n =
Pth_tab_.dimension_tot(0);
171 for (
int i = 0; i < n; i++)
183 ch_pression_eos_->mettre_a_jour(le_probleme_->schema_temps().temps_courant());
196 Cerr <<
"The EDO option for the pressure treatment is not yet supported for the Weakly_Compressible module !" << finl;
197 Cerr <<
"Please use either conservation_masse or constant options !" << finl;
211 if (pb.
que_suis_je() ==
"Pb_Hydraulique_Melange_Binaire_WC" || pb.
que_suis_je() ==
"Pb_Hydraulique_Melange_Binaire_Turbulent_WC")
212 dis.
discretiser_champ(
"temperature", domaine_dis,
"fraction_massique",
"neant", 1, temps, loi_etat_->temperature_);
214 dis.
discretiser_champ(
"temperature", domaine_dis,
"temperature",
"K", 1, temps, loi_etat_->temperature_);
229 if (pb.
que_suis_je() ==
"Pb_Thermohydraulique_Especes_WC")
248 calculer_pression_hydro();
263 remplir_champ_pression_for_EOS();
266void Fluide_Weakly_Compressible::remplir_champ_pression_tot(
int n,
const DoubleTab& PHydro, DoubleTab& PTot)
270 for (
int i = 0; i < n; i++)
271 PTot(i, 0) = PHydro(i, 0) +
Pth_tab_(i, 0);
273 for (
int i = 0; i < n; i++)
274 PTot(i, 0) = PHydro(i, 0) +
Pth_;
280void Fluide_Weakly_Compressible::calculer_pression_hydro()
283 const Domaine_dis_base& domaine_dis=
ch_pression_->domaine_dis_base();
284 const Domaine_VF& domaine = ref_cast(Domaine_VF, domaine_dis);
285 int is_VDF = domaine_dis.
que_suis_je() ==
"Domaine_VDF" ? 1 : 0;
286 const DoubleTab& centres_de_gravites = is_VDF ? domaine.xp() : domaine.xv();
290 for (
int i = 0; i < n; i++)
293 for (
int dir = 0; dir <
dimension; dir++)
294 gz += centres_de_gravites(i, dir) * grav(0, dir);
296 tab_Phydro(i) = tab_rho(i) * gz;
299 remplir_champ_pression_for_EOS();
305void Fluide_Weakly_Compressible::remplir_champ_pression_for_EOS()
309 double t0 = le_probleme_->schema_temps().temps_courant(), t1 = le_probleme_->schema_temps().temps_futur(1);
314 for (
int i = 0; i <
Pth_tab_.dimension_tot(0); i++)
319 const Domaine_VF& zvf = ref_cast(Domaine_VF,
inco_chaleur().domaine_dis_base());
323 const DoubleVect& volumes = zvf.
volumes();
328 for (
int ele = 0; ele < nb_elem_tot; ele++)
329 for (
int s = 0; s < nb_face_elem; s++)
332 vol_tot(elem_faces(ele, s)) += volumes(ele);
334 for (
int f = 0; f < zvf.
nb_faces(); f++)
344 if (le_probleme_->schema_temps().nb_pas_dt() == 0 &&
use_saved_data())
349 const int n =
Pth_tab_.dimension_tot(0);
350 for (
int i = 0; i < n; i++)
356 Cerr <<
"The method Fluide_Weakly_Compressible::remplir_champ_pression_for_EOS() should not be called !" << finl;
367 fic <<
"# Time sum(T*dv)/sum(dv)[K] sum(rho*dv)/sum(dv)[kg/m3] Pth[Pa]" << finl;
369 fic <<
"# Time sum(T*dv)/sum(dv)[K] sum(rho*dv)/sum(dv)[kg/m3] Mean_Pth[Pa]" << finl;
375 const double Ch_m = eos_tools_->moyenne_vol(ch_inco_chaleur_->valeurs());
376 const double rhom = eos_tools_->moyenne_vol(ch_rho_->valeurs());
382 fic << temps <<
" " << Ch_m <<
" " << rhom <<
" " <<
Pth_ << finl;
384 fic << temps <<
" " << Ch_m <<
" " << rhom <<
" " << eos_tools_->moyenne_vol(
Pth_tab_) << finl;
DoubleTab & valeurs() override
Overrides Champ_base::valeurs() Returns the array of values.
virtual DoubleTab & valeurs()=0
class Champ_base This class is the base of the fields hierarchy.
virtual Champ_base & affecter_(const Champ_base &)=0
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
int nb_faces() const
Returns the total number of faces.
int nb_faces_tot() const
Returns the total number of faces.
double volumes(int i) const
int elem_faces(int i, int j) const
Returns the index of the i-th face of element num_elem; the face numbering convention is.
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 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.
void abortTimeStep() override
virtual void calculer_pression_tot()
Computes the total pressure: thermodynamic pressure + hydrodynamic pressure.
virtual void checkTraitementPth(const Domaine_Cl_dis_base &)
const Champ_Inc_base & inco_chaleur() const
virtual void update_pressure_fields(double)
void discretiser(const Probleme_base &pb, const Discretisation_base &dis) override
const DoubleTab & rho_np1() const
void set_param(Param ¶m) const override
const Nom type_fluide() const
virtual void completer(const Probleme_base &)
Completes the fluid with the unknown fields associated with the problem.
Fluide_Weakly_Compressible class This class represents a weakly compressible fluid,...
void set_param(Param ¶m) const override
void discretiser(const Probleme_base &pb, const Discretisation_base &dis) override
void write_mean_edo(double) override
void update_pressure_fields(double) override
bool use_total_hydro_pressure()
void calculer_pression_tot() override
Calcule la pression totale : pression thermodynamique + pression hydrodynamique.
double time_activate_ptot_
bool use_total_pressure()
bool use_hydrostatic_pressure()
void write_header_edo() override
void completer(const Probleme_base &) override
Complete le fluide avec les champs inconnus associes au probleme.
void checkTraitementPth(const Domaine_Cl_dis_base &) override
void abortTimeStep() override
int use_grad_pression_eos_
int use_hydrostatic_pressure_
const Champ_Don_base & viscosite_dynamique() const
virtual const Champ_base & masse_volumique() const
Returns the mass density of the medium (const version).
Champs_compris champs_compris_
virtual int a_gravite() const
Returns 1 if gravity has been initialized.
virtual const Champ_Don_base & gravite() const
Returns the gravity of the medium if it has been associated, raises an error otherwise (const version...
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.
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(const char *keyword, const int *value, Param::Nature nat=Param::OPTIONAL)
Register an integer parameter.
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.
_SIZE_ dimension_tot(int) const override
_SIZE_ dimension(int d) const