16#include <Modele_turbulence_hyd_Longueur_Melange_VEF.h>
17#include <EcritureLectureSpecial.h>
18#include <VEF_discretisation.h>
19#include <Champ_Uniforme.h>
20#include <Postraitement.h>
21#include <LecFicDiffuse.h>
22#include <Fluide_base.h>
23#include <Champ_P1NC.h>
56 param.lire_avec_accolades_depuis(is);
57 const LIST(Nom) ¶ms_lu = param.get_list_mots_lus();
58 if (params_lu.contient(Motcle(
"canalx")))
60 else if (params_lu.contient(Motcle(
"tuyauz")))
62 else if (params_lu.contient(Motcle(
"tuyaux")))
64 else if (params_lu.contient(Motcle(
"tuyauy")))
66 else if ((params_lu.contient(Motcle(
"dmax"))) || (params_lu.contient(Motcle(
"fichier"))))
70 Cerr <<
" Error while reading the Longueur_Melange turbulence model. " << finl;
71 Cerr <<
" Case not selected, choose among : canalx tuyauz dmax fichier " << finl;
72 Cerr <<
" Please refer to the reference manual for a detailed documentation. " << finl;
83 param.
ajouter_condition(
"value_of_canalx_eq_2",
" canalx has been coded presently only for h=2.");
87 param.
ajouter_condition(
"value_of_tuyauz_eq_2",
" tuyauz has been coded presently only for d=2.");
88 param.
ajouter_condition(
"value_of_tuyaux_eq_2",
" tuyaux has been coded presently only for d=2.");
89 param.
ajouter_condition(
"value_of_tuyauy_eq_2",
" tuyauy has been coded presently only for d=2.");
101 const double Kappa = 0.415;
104 double temps = mon_equation_->inconnue().
temps();
106 DoubleTab& visco_turb = la_viscosite_turbulente_->valeurs();
107 DoubleVect& k = energie_cinetique_turb_->valeurs();
108 const int nb_elem = domaine_VEF.
nb_elem();
110 const DoubleTab& xp = domaine_VEF.
xp();
112 Sij2_.resize(nb_elem_tot);
116 if (visco_turb.
size() != nb_elem)
118 Cerr <<
"Size error for the array containing the values of the turbulent viscosity." << finl;
122 Debog::verifier(
"Modele_turbulence_hyd_Longueur_Melange_VEF::calculer_viscosite_turbulente visco_turb 0", visco_turb);
124 if (k.
size() != nb_elem)
126 Cerr <<
"Size error for the array containing the values of the turbulent kinetic energy." << finl;
133 for (
int elem = 0; elem < nb_elem; elem++)
135 double y = xp(elem, 1);
139 visco_turb(elem) = Kappa * Kappa * y * y * (1. - y) * sqrt(2. *
Sij2_[elem]);
140 k(elem) = pow(visco_turb(elem) / (Cmu * y), 2);
167 for (
int elem = 0; elem < nb_elem; elem++)
169 double x = xp(elem, dir1);
170 double y = xp(elem, dir2);
171 double r = sqrt(x * x + y * y);
173 visco_turb(elem) = Kappa * Kappa * (1. - r) * (1. - r) * (1. - r) * sqrt(2. *
Sij2_[elem]);
174 k(elem) = pow(visco_turb(elem) / (Cmu * (1. - r)), 2);
184 for (
int elem = 0; elem < nb_elem; elem++)
187 double wl = wall_length(elem);
190 visco_turb(elem) = pow(f_vd * f_vd * Kappa * lm, 2) * sqrt(2. *
Sij2_[elem]);
191 k(elem) = pow(visco_turb(elem) / (Cmu * lm), 2);
201 Debog::verifier(
"Modele_turbulence_hyd_Longueur_Melange_VEF::calculer_viscosite_turbulente visco_turb 1", visco_turb);
203 la_viscosite_turbulente_->changer_temps(temps);
206 return la_viscosite_turbulente_;
211 const DoubleTab& la_vitesse = mon_equation_->inconnue().valeurs();
223 DoubleTab ubar(la_vitesse);
228 for (
int elem = 0; elem < nb_elem; elem++)
234 Sij = 0.5 * (duidxj(elem, i, j) + duidxj(elem, j, i));
235 Sij2_(elem) += Sij * Sij;
253 Cerr <<
" File " <<
nom_fic_ <<
" doesn't exist. To generate it, please, refer to html.doc (Distance_paroi) " << finl;
264 Cerr <<
"Recall : " <<
nom_fic_ <<
" obtained from boundaries nammed : " << finl;
265 for (
int b = 0; b < nom_paroi.size(); b++)
267 Cerr << nom_paroi[b] << finl;
277 const double Kappa = 0.415;
278 const double A_plus = 26.;
295 const int nb_elem = domaine_VEF.
nb_elem();
298 const IntTab& elem_faces = domaine_VEF.
elem_faces();
302 const DoubleTab& tab_visco = ch_visco_cin.
valeurs();
303 const DoubleTab& vit = mon_equation_->inconnue().valeurs();
309 double dist, d_visco, norm_v, u_plus_d_plus, dp, up1, up2, r, y_plus;
311 const int itmax = 25;
312 double seuil = 0.001;
319 visco = std::max(tab_visco(0, 0), DMINFLOAT);
328 Cerr <<
"In Modele_turbulence_hyd_Longueur_Melange_VEF::calculer_f_amortissement : visco = " << tab_visco.
local_min_vect() <<
" <= 0 ? " << finl;
333 for (
int elem = 0; elem < nb_elem; elem++)
336 dist = wall_length(elem);
341 d_visco = tab_visco[elem];
343 for (
int i = 0; i < nb_face_elem; i++)
345 int face = elem_faces(elem, i);
347 for (
int comp = 0; comp <
dimension; comp++)
348 vc[comp] += vit(face, comp);
352 norm_v = norme_array(vc);
354 u_plus_d_plus = norm_v * dist / d_visco;
356 if (u_plus_d_plus < 1.)
358 y_plus = sqrt(u_plus_d_plus);
361 else if (u_plus_d_plus < 2784.)
363 up1 = u_plus_d_plus / 100.;
367 while ((iter++ < itmax) && (r > seuil))
369 dp = u_plus_d_plus / up1;
370 up2 = ((1 / Kappa) * log(1 + Kappa * dp)) + 7.8 * (1 - exp(-dp / 11.) - exp(-dp / 3.) * dp / 11.);
371 up1 = 0.5 * (up1 + up2);
372 r = std::fabs(up1 - up2) / up1;
375 erreur_non_convergence();
377 y_plus = u_plus_d_plus / up1;
387 bool contient_distance_paroi =
false;
388 for (
auto &itr :
equation().probleme().postraitements())
389 if (!contient_distance_paroi)
394 for (
int i = 0; i < post.noms_champs_a_post().size(); i++)
396 if (post.noms_champs_a_post()[i].contient(
"DISTANCE_PAROI"))
398 contient_distance_paroi =
true;
404 if (!contient_distance_paroi &&
cas_ == 4)
class Champ_Don_base base class of Given Fields (not calculated)
DoubleTab & valeurs() override
Overrides Champ_base::valeurs() Returns the array of values.
class Champ_Fonc_base Base class of fields that are functions of a calculated quantity
static DoubleTab & calcul_gradient(const DoubleTab &, DoubleTab &, const Domaine_Cl_VEF &)
double temps() const
Returns the time of the field.
static void verifier(const char *const msg, double)
int nb_faces_elem(int=0) const
Returns the number of faces of type i of the geometric elements that make up the domain.
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.
double xp(int num_elem, int k) const
int rang_frontiere(const Nom &)
const Domaine & domaine() const
static void lecture_special(Champ_base &ch, Entree &fich)
Simple call to EcritureLectureSpecial::lecture_special (const Domaine_VF& zvf,Entree& fich,...
Class defining operators and methods for all reading operation in an input flow (file,...
Base class for an incompressible fluid and its properties:
const Champ_Don_base & viscosite_cinematique() const
This class implements the operators and virtual methods of the EFichier class as follows: The file to...
int ouvrir(const char *name, IOS_OPEN_MODE mode=ios::in) override
Opens the file.
void set_bin(bool bin) override
Calls get_entree_master().
void mettre_a_jour(double) override
Class Turbulence_hyd_Longueur_Melange_VEF.
void lire_distance_paroi()
int lire_motcle_non_standard(const Motcle &, Entree &) override
Reads non-simple-type parameters of an Objet_U from an input stream.
Champ_Fonc_base & calculer_viscosite_turbulente() override
DoubleVect f_amortissement_
int preparer_calcul() override
Prepares the computation.
void set_param(Param ¶m) const override
void calculer_f_amortissement()
Mixing-length turbulence model for the Navier-Stokes equations.
LIST(Nom) boundaries_list_
virtual int preparer_calcul()
Prepares the computation.
Equation_base & equation()
Returns the equation associated with the turbulence model.
A character string (Nom) in uppercase.
An array of character strings (VECT(Nom)).
virtual void set_param(Param &) const
virtual int lire_motcle_non_standard(const Motcle &motlu, Entree &is)
Reads non-simple-type parameters of an Objet_U from an input stream.
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 const Nom & le_nom() const
Returns the name of the Objet_U. Virtual method to override: returns "neant" in this implementation.
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_condition(const char *condition, const char *message, const char *name=0)
Declare a post-read logical condition that must hold on the parameter values.
void ajouter(const char *keyword, const int *value, Param::Nature nat=Param::OPTIONAL)
Register an integer parameter.
class Postraitement. The class holds -a list of generic fields champs_post_complet_ containing
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.
Base class for output streams.
_TYPE_ local_min_vect(Mp_vect_options opt=VECT_REAL_ITEMS) const