17#include <ParoiVEF_TBLE_scal.h>
18#include <ParoiVEF_TBLE.h>
19#include <Paroi_std_hyd_VEF.h>
20#include <Dirichlet_paroi_fixe.h>
21#include <Champ_Uniforme.h>
22#include <Champ_front_calc.h>
23#include <Convection_Diffusion_Temperature.h>
24#include <Modele_turbulence_scal_base.h>
25#include <Constituant.h>
26#include <Fluide_base.h>
28#include <Modele_turbulence_hyd_base.h>
29#include <Probleme_base.h>
30#include <Diffu_totale_scal_base.h>
32#include <verif_cast.h>
53 Motcle acc_ouverte(
"{");
54 Motcle acc_fermee(
"}");
61 if(mot_lu == acc_ouverte)
67 while(mot_lu != acc_fermee)
93 Cerr <<
"ParoiVEF_TBLE_scal::init_lois_paroi()" << finl;
100 const IntTab& face_voisins = domaine_VEF.
face_voisins();
101 const IntTab& elem_faces = domaine_VEF.
elem_faces();
102 const Domaine& domaine = domaine_VEF.
domaine();
104 const int nfac = domaine.nb_faces_elem();
106 const Equation_base& eqn_temp = mon_modele_turb_scal->equation();
109 const RefObjU& modele_turbulence_hydr = eq_hydr.
get_modele(TURBULENCE);
115 Cerr <<
"Une loi de paroi TBLE en thermique doit etre utilisee obligatoirement avec une loi de paroi TBLE sur la QDM " << finl;
122 int compteur_faces_paroi = 0;
138 for (
int n_bord=0; n_bord<domaine_VEF.
nb_front_Cl(); n_bord++)
140 const Cond_lim& la_cl = le_dom_Cl_dis_->les_conditions_limites(n_bord);
146 for (
int ind_face=0; ind_face<size; ind_face++)
148 Eq_couch_lim& equation_temp = eq_temp[compteur_faces_paroi];
149 int num_face = le_bord.
num_face(ind_face);
150 elem = face_voisins(num_face,0);
156 surf2 += face_normale(num_face,i)*face_normale(num_face,i);
161 num[0]=elem_faces(elem,0);
162 num[1]=elem_faces(elem,1);
164 if (num[0]==num_face) num[0]=elem_faces(elem,2);
165 else if (num[1]==num_face) num[1]=elem_faces(elem,2);
167 n[0] = face_normale(num_face,0)/sqrt(surf2);
168 n[1] = face_normale(num_face,1)/sqrt(surf2);
173 dist = distance_2D(num_face,elem,domaine_VEF)*3./2.;
176 T1 = (Temp(num[0])+Temp(num[1]))/2.;
183 num[0]=elem_faces(elem,0);
184 num[1]=elem_faces(elem,1);
185 num[2]=elem_faces(elem,2);
187 if (num[0]==num_face) num[0]=elem_faces(elem,3);
188 else if (num[1]==num_face) num[1]=elem_faces(elem,3);
189 else if (num[2]==num_face) num[2]=elem_faces(elem,3);
191 n[0] = face_normale(num_face,0)/sqrt(surf2);
192 n[1] = face_normale(num_face,1)/sqrt(surf2);
193 n[2] = face_normale(num_face,2)/sqrt(surf2);
195 if( (est_egal(n[0],0.) && est_egal(n[1],0.)) )
208 t2[0] = n[1]*t1[2] - n[2]*t1[1];
209 t2[1] = n[2]*t1[0] - n[0]*t1[2];
210 t2[2] = n[0]*t1[1] - n[1]*t1[0];
212 dist = distance_3D(num_face,elem,domaine_VEF)*4./3.;
215 T1 = (Temp(num[0])+Temp(num[1])+Temp(num[2]))/3.;
223 equation_temp.
set_yn(dist);
242 for (
int itble=0; itble<
nb_pts+1; itble++)
245 compteur_faces_paroi++;
255 for (
int n_bord=0; n_bord<domaine_VEF.
nb_front_Cl(); n_bord++)
257 const Cond_lim& la_cl = le_dom_Cl_dis_->les_conditions_limites(n_bord);
260 for (
int ind_face=0; ind_face<size; ind_face++)
262 int num_face = le_bord.
num_face(ind_face);
263 elem = face_voisins(num_face,0);
272 Cerr <<
" Reprise des stats non code dans TBLE_scal : .... a faire a l'occasion !!! " << finl;
278 Cerr <<
"fin init_lois_paroi()" << finl;
288 const IntTab& face_voisins = domaine_VEF.
face_voisins();
289 const IntTab& elem_faces = domaine_VEF.
elem_faces();
290 const Domaine& domaine = domaine_VEF.
domaine();
292 const int nfac = domaine.nb_faces_elem();
303 DoubleTab alpha_t = diffusivite_turb.
valeurs();
305 int itmax=0,itmax_loc;
307 DoubleTab termes_sources;
308 termes_sources.
resize(nb_faces,1);
310 termes_sources /= rhoCp;
327 int compteur_faces_paroi = 0;
329 for (
int n_bord=0; n_bord<domaine_VEF.
nb_front_Cl(); n_bord++)
331 const Cond_lim& la_cl = le_dom_Cl_dis_->les_conditions_limites(n_bord);
340 for (
int ind_face=0; ind_face<size; ind_face++)
342 Eq_couch_lim& equation_temp = eq_temp[compteur_faces_paroi];
343 int num_face = le_bord.
num_face(ind_face);
344 elem = face_voisins(num_face,0);
346 elem = face_voisins(num_face,1);
350 d_alpha = alpha.
valeurs()(0,0);
354 d_alpha = alpha.
valeurs()(elem);
356 d_alpha = alpha.
valeurs()(elem,0);
363 surf2 += face_normale(num_face,i)*face_normale(num_face,i);
368 num[0]=elem_faces(elem,0);
369 num[1]=elem_faces(elem,1);
371 if (num[0]==num_face) num[0]=elem_faces(elem,2);
372 else if (num[1]==num_face) num[1]=elem_faces(elem,2);
374 n[0] = face_normale(num_face,0)/sqrt(surf2);
375 n[1] = face_normale(num_face,1)/sqrt(surf2);
383 T1 = (Temp(num[0])+Temp(num[1]))/2.;
385 F = (termes_sources(num[0])/volumes_entrelaces(num[0])
386 +termes_sources(num[1])/volumes_entrelaces(num[1]))/2.;
390 num[0]=elem_faces(elem,0);
391 num[1]=elem_faces(elem,1);
392 num[2]=elem_faces(elem,2);
394 if (num[0]==num_face) num[0]=elem_faces(elem,3);
395 else if (num[1]==num_face) num[1]=elem_faces(elem,3);
396 else if (num[2]==num_face) num[2]=elem_faces(elem,3);
398 n[0] = face_normale(num_face,0)/sqrt(surf2);
399 n[1] = face_normale(num_face,1)/sqrt(surf2);
400 n[2] = face_normale(num_face,2)/sqrt(surf2);
402 if( (est_egal(n[0],0.) && est_egal(n[1],0.)) )
415 t2[0] = n[1]*t1[2] - n[2]*t1[1];
416 t2[1] = n[2]*t1[0] - n[0]*t1[2];
417 t2[2] = n[0]*t1[1] - n[1]*t1[0];
422 T1 = (Temp(num[0])+Temp(num[1])+Temp(num[2]))/3.;
424 F = (termes_sources(num[0])/volumes_entrelaces(num[0])
425 +termes_sources(num[1])/volumes_entrelaces(num[1])
426 +termes_sources(num[2])/volumes_entrelaces(num[2]))/3.;
429 if(dt<dt_min) equation_temp.
set_dt(1.e12);
430 else equation_temp.
set_dt(dt);
433 equation_temp.
set_F(0, F);
449 itmax_loc = equation_temp.
get_it();
451 if(itmax_loc>
max_it) Cerr <<
"WARNING : TOO MANY ITERATIONS ARE NEEDED IN THE TBLE MESH" << finl;
453 if(itmax_loc>itmax) itmax=itmax_loc;
461 if(std::fabs(equation_temp.
get_Unp1(0,1) - T0)<1e-10)
465 /(equation_temp.
get_Unp1(0,1) - T0);
470 compteur_faces_paroi++;
479 SFichier fic(
"iter_scal.dat",ios::app);
480 fic << tps <<
" " << itmax << finl;
490int ParoiVEF_TBLE_scal::calculer_stats()
500 const RefObjU& modele_turbulence_hydr = eq_hydr.
get_modele(TURBULENCE);
508 double t1x,t1y,t1z=0.;
509 double t2x,t2y,t2z=0.;
511 double Unp1_t1,Unp1_t2=0.;
526 surf=sqrt(face_normale(num_face,0)*face_normale(num_face,0)+
527 face_normale(num_face,1)*face_normale(num_face,1));
529 nx = face_normale(num_face,0)/surf;
530 ny = face_normale(num_face,1)/surf;
535 for(
int i=0 ; i<
nb_pts+1 ; i++)
537 T = eq_temp[num_face].get_Unp1(0,i);
553 surf=sqrt(face_normale(num_face,0)*face_normale(num_face,0)+
554 face_normale(num_face,1)*face_normale(num_face,1)+
555 face_normale(num_face,2)*face_normale(num_face,2));
557 nx = face_normale(num_face,0)/surf;
558 ny = face_normale(num_face,1)/surf;
559 nz = face_normale(num_face,2)/surf;
561 if( (est_egal(nx,0.) && est_egal(ny,0.)) )
569 t1x = -ny/sqrt(nx*nx+ny*ny);
570 t1y = nx/sqrt(nx*nx+ny*ny);
574 t2x = ny*t1z - nz*t1y;
575 t2y = nz*t1x - nx*t1z;
576 t2z = nx*t1y - ny*t1x;
578 for(
int i=0 ; i<
nb_pts+1 ; i++)
581 T = eq_temp[num_face].get_Unp1(0,i);
585 u = t1x*Unp1_t1 + t2x*Unp1_t2 ;
586 v = t1y*Unp1_t1 + t2y*Unp1_t2 ;
587 w = t1z*Unp1_t1 + t2z*Unp1_t2 ;
611 double tps = mon_modele_turb_scal->equation().inconnue().temps();
621 double tps_reprise = mon_modele_turb_scal->equation().schema_temps().temps_courant();
637 const RefObjU& modele_turbulence_hydr = eqn_hydr.
get_modele(TURBULENCE);
647 Cerr <<
"Pour utiliser des expressions de Nu et Lambda dependant de T dans TBLE, il faut avoir un probleme de thermohydraulique turbulent avec une loi de paroi de type TBLE et TBLE scalaire" << finl;
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
DoubleTab & valeurs() override
Returns the array of field values at the current time.
virtual DoubleTab & valeurs()=0
double temps() const
Returns the time of the field.
class Cond_lim Generic class used to represent any class
Convection_Diffusion_std This class is the base for equations modelling the transport.
const Champ_Inc_base & inconnue() const override=0
Dirichlet_paroi_fixe Represents a fixed wall in a Navier-Stokes type equation.
DoubleVect & volumes_entrelaces()
int nb_faces_tot() const
Returns the total number of faces.
virtual double face_normales(int face, int comp) 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.
int face_voisins(int num_face, int i) const
Returns the neighbouring element of num_face in direction i.
const Domaine & domaine() const
Class defining operators and methods for all reading operation in an input flow (file,...
void initialiser(int, int, double, double, int, int)
void set_u_y0(int j, double u)
void set_u_yn(int j, double u)
void aller_au_temps(double)
void set_Uinit_lin(int comp, double f1, double f2)
void set_F(int j, double f)
double get_Unp1(int j, int i)
void aller_jusqu_a_convergence(int, double)
void set_dt(double delta_t)
void set_Uinit(int comp, int i, double val)
class Equation_base The role of an equation is the calculation of one or more fields....
virtual const Milieu_base & milieu() const =0
virtual const RefObjU & get_modele(Type_modele type) const
Sources & sources()
Returns the source terms associated with the equation.
virtual const Champ_Inc_base & inconnue() const =0
Probleme_base & probleme()
Returns the problem associated with the equation.
Schema_Temps_base & schema_temps()
Returns the time scheme associated with the equation.
virtual int nb_comp() const
Base class for an incompressible fluid and its properties:
int num_face(const int) const
virtual const Champ_Don_base & capacite_calorifique() const
Returns the heat capacity of the medium (const version).
virtual const Champ_Don_base & diffusivite() const
Returns the diffusivity of the medium (const version).
virtual const Champ_base & masse_volumique() const
Returns the mass density of the medium (const version).
Base class for the turbulence model hierarchy for Navier-Stokes equations.
const Turbulence_paroi_base & loi_paroi() const
Classe MuLambda_TBLE_base Classe abstraite calculant Mu et Lambda sur le maillage TBLE.
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.
CLASS: ParoiVEF_TBLE_scal.
MuLambda_TBLE_base & getMuLambda() override
const Probleme_base & getPbBase() const override
Eq_couch_lim & get_eq_couch_lim(int) override
void imprimer_nusselt(Sortie &) const override
int reprendre(Entree &) override
Restores an Objet_U from an input stream. Virtual method to override.
int init_lois_paroi() override
Paroi_TBLE_QDM & getLoiParoiHydraulique() override
int sauvegarder(Sortie &) const override
Saves an Objet_U to an output stream. Virtual method to override.
int calculer_scal(Champ_Fonc_base &) override
int reprendre(Entree &, const Domaine_dis_base &, const Domaine_Cl_dis_base &, double tps)
void imprimer_sondes(Sortie &, double, const VECT(DoubleVect)&) const
DoubleTab valeurs_reprises
Entree & lire_donnees(const Motcle &motlu, Entree &s)
void init_valeurs_defaut()
int sauvegarder(Sortie &, const Domaine_dis_base &, const Domaine_Cl_dis_base &, double tps) const
int init_lois_paroi(const Domaine_VF &, const Domaine_Cl_dis_base &)
void calculer_stat(int j, int i, double u, double v, double w, double T, double dt)
void imprimer_stat(Sortie &, double) const
MuLambda_TBLE_base & getMuLambda()
Eq_couch_lim & get_eq_couch_lim(int i)
void imprimer_nusselt(Sortie &) const override
int init_lois_paroi() override
class Probleme_base It is a Probleme_U that is not a coupling.
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.
double pas_temps_min() const
Returns the minimum time step.
double pas_de_temps() const
Returns the current time step (delta_t).
Base class for output streams.
DoubleTab & calculer(DoubleTab &) const
Calculates the contribution of all sources in the list and stores the result in the array passed as p...
void resize(_SIZE_ n, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)
const Objet_U & valeur() const
Base class for the hierarchy of wall-law models computing turbulent quantities near walls....
DoubleVects equivalent_distance_