17#include <Paroi_TBLE_scal_VDF.h>
18#include <ParoiVDF_TBLE.h>
19#include <Paroi_std_hyd_VDF.h>
21#include <Domaine_Cl_VDF.h>
22#include <Dirichlet_paroi_fixe.h>
23#include <Echange_externe_impose.h>
24#include <Champ_Uniforme.h>
25#include <Champ_front_calc.h>
26#include <Convection_Diffusion_Temperature.h>
27#include <Convection_Diffusion_Concentration.h>
28#include <Modele_turbulence_scal_base.h>
29#include <Constituant.h>
30#include <Fluide_base.h>
32#include <Modele_turbulence_hyd_base.h>
33#include <Probleme_base.h>
34#include <Echange_contact_VDF.h>
35#include <Diffu_totale_scal_base.h>
37#include <verif_cast.h>
38#include <EcrFicPartage.h>
57 Motcle acc_ouverte(
"{");
58 Motcle acc_fermee(
"}");
67 les_mots[0]=
"alpha_cv";
70 assert(mot_lu==acc_ouverte);
72 if(mot_lu == acc_ouverte)
77 while(mot_lu != acc_fermee)
79 int rang=les_mots.search(mot_lu);
85 Cerr <<
" Les termes convectifs sont negliges dans TBLE ! " << finl;
87 Cerr <<
" Les termes convectifs sont pris en compte dans TBLE ! " << finl;
90 Cerr <<
"alpha_cv doit valoir 0 ou 1 !" << finl;
127 const IntTab& face_voisins = domaine_VDF.
face_voisins();
128 int nb_elems = domaine_VDF.
nb_elem();
129 const DoubleVect& volumes = domaine_VDF.
volumes();
131 const Equation_base& eqn_temp = mon_modele_turb_scal->equation();
134 const RefObjU& modele_turbulence_hydr = eqn_hydr.
get_modele(TURBULENCE);
142 Cerr <<
"Une loi de paroi TBLE en thermique doit etre utilisee obligatoirement avec une loi de paroi TBLE sur la QDM " << finl;
149 int compteur_faces_paroi = 0;
151 corresp.resize(le_dom_dis_->nb_faces_bord());
156 for (
int n_bord=0; n_bord<domaine_VDF.
nb_front_Cl(); n_bord++)
158 const Cond_lim& la_cl = le_dom_Cl_dis_->les_conditions_limites(n_bord);
167 for (
int num_face=ndeb; num_face<nfin; num_face++)
169 corresp[num_face]=compteur_faces_paroi;
170 fic_corresp << num_face <<
" " << corresp[num_face] << finl;
171 compteur_faces_paroi++;
177 corresp.resize(compteur_faces_paroi);
178 compteur_faces_paroi = 0;
180 DoubleTab termes_sources;
181 termes_sources.
resize(nb_elems,1);
183 termes_sources /= rhoCp;
188 for (
int n_bord=0; n_bord<domaine_VDF.
nb_front_Cl(); n_bord++)
190 const Cond_lim& la_cl = le_dom_Cl_dis_->les_conditions_limites(n_bord);
198 for (
int num_face=ndeb; num_face<nfin; num_face++)
200 if ((elem = face_voisins(num_face,0)) == -1)
201 elem = face_voisins(num_face,1);
209 eq_temp[compteur_faces_paroi].set_y0(0.);
210 eq_temp[compteur_faces_paroi].set_yn(dist);
216 double ts = termes_sources(elem)/volumes(elem);
218 eq_temp[compteur_faces_paroi].set_F(0, ts);
219 eq_temp[compteur_faces_paroi].set_u_y0(0,T0);
220 eq_temp[compteur_faces_paroi].set_u_yn(0,Temp(elem));
223 eq_temp[compteur_faces_paroi].set_Uinit_lin(0, Temp(elem), Temp(elem));
227 for (
int itble=0; itble<
nb_pts+1; itble++)
228 eq_temp[compteur_faces_paroi].set_Uinit(0,itble,
valeurs_reprises(compteur_faces_paroi, itble)) ;
231 compteur_faces_paroi ++;
251 const IntTab& face_voisins = domaine_VDF.
face_voisins();
252 const int nb_elems = domaine_VDF.
nb_elem();
253 const IntVect& orientation = domaine_VDF.
orientation();
254 const DoubleVect& volumes = domaine_VDF.
volumes();
263 DoubleTab termes_sources;
264 termes_sources.
resize(nb_elems,1);
266 termes_sources /= rhoCp;
268 DoubleTab& alpha_t = diffusivite_turb.
valeurs();
269 const DoubleTab& tab_visco = ch_visco_cin.
valeurs();
283 Cerr <<
"In Paroi_TBLE_scal_VDF::calculer_scal : visco = " << tab_visco.
local_min_vect() <<
" <= 0 ? " << finl;
302 int compteur_faces_paroi = 0;
304 for (
int n_bord=0; n_bord<domaine_VDF.
nb_front_Cl(); n_bord++)
306 const Cond_lim& la_cl = le_dom_Cl_dis_->les_conditions_limites(n_bord);
316 int boundary_index=-1;
318 boundary_index=n_bord;
319 assert(boundary_index >= 0);
321 for (
int num_face=ndeb; num_face<nfin; num_face++)
323 ori = orientation(num_face);
324 if ((elem = face_voisins(num_face,0)) == -1)
325 elem = face_voisins(num_face,1);
340 double Ts = la_cl_ech.
T_ext(num_face-ndeb);
359 const DoubleTab& T_wall = la_cl_couplee.
T_wall();
366 T0 = T_wall(num_face-ndeb,0);
381 eq_temp[compteur_faces_paroi].set_dt(1.e12);
383 eq_temp[compteur_faces_paroi].set_dt(dt);
384 eq_temp[compteur_faces_paroi].set_y0(0.);
385 eq_temp[compteur_faces_paroi].set_yn(dist);
387 double ts = termes_sources(elem)/volumes(elem);
389 eq_temp[compteur_faces_paroi].set_u_y0(0,T0);
390 eq_temp[compteur_faces_paroi].set_u_yn(0,Temp(elem));
397 calculer_convection(compteur_faces_paroi, elem, ndeb, nfin, ori, ts);
400 for(
int i=1 ; i<
nb_pts+1 ; i++)
401 eq_temp[compteur_faces_paroi].set_F(0, i, ts);
405 eq_temp[compteur_faces_paroi].aller_au_temps(tps);
415 int global_face=num_face;
417 if(std::fabs(eq_temp[compteur_faces_paroi].get_Unp1(0,1) - T0)<1e-10)
420 equivalent_distance_[boundary_index][local_face] = (Temp(elem)-T0)*(eq_temp[compteur_faces_paroi].get_y(1)-eq_temp[compteur_faces_paroi].get_y(0))
421 /(eq_temp[compteur_faces_paroi].get_Unp1(0,1) - T0);
425 alpha_t(elem)=eq_temp[compteur_faces_paroi].get_nu_t_yn();
427 compteur_faces_paroi++;
449int Paroi_TBLE_scal_VDF::calculer_stats()
453 const IntVect& orientation = domaine_VDF.
orientation();
459 const RefObjU& modele_turbulence_hydr = eqn_hydr.
get_modele(TURBULENCE);
475 for(
int i=0 ; i<
nb_pts+1 ; i++)
490 for(
int i=0 ; i<
nb_pts+1 ; i++)
501 for(
int i=0 ; i<
nb_pts+1 ; i++)
512 for(
int i=0 ; i<
nb_pts+1 ; i++)
546 double tps = mon_modele_turb_scal->equation().inconnue().temps();
557 double tps_reprise = mon_modele_turb_scal->equation().schema_temps().temps_courant();
565void Paroi_TBLE_scal_VDF::calculer_convection(
int compteur_faces_paroi,
int elem,
int ndeb,
int nfin,
int ori,
double ts)
568 const RefObjU& modele_turbulence_hydr = eqn_hydr.
get_modele(TURBULENCE);
574 const IntTab& face_voisins = domaine_VDF.
face_voisins();
575 const IntTab& elem_faces = domaine_VDF.
elem_faces();
576 const IntVect& orientation = domaine_VDF.
orientation();
577 int elem_gauche0, elem_gauche1, elem_droite0, elem_droite1;
578 int face_gauche0, face_gauche1, face_droite0, face_droite1;
581 int face1 = elem_faces(elem,(ori+1));
582 int face2 = elem_faces(elem,(ori+4)%6);
584 int face3 = elem_faces(elem,(ori+2));
585 int face4 = elem_faces(elem,(ori+5)%6);
589 elem_gauche0 = face_voisins(face1,0);
590 elem_droite0 = face_voisins(face2,1);
591 if (elem_gauche0 == elem)
593 elem_droite0 = face_voisins(face1,1);
594 elem_gauche0 = face_voisins(face2,0);
597 elem_gauche1 = face_voisins(face3,0);
598 elem_droite1 = face_voisins(face4,1);
599 if (elem_gauche1 == elem)
601 elem_droite1 = face_voisins(face3,1);
602 elem_gauche1 = face_voisins(face4,0);
606 if((elem_droite1!=-1)&&(elem_droite0!=-1)&&(elem_gauche1!=-1)&&(elem_gauche0!=-1))
609 face_gauche0 = elem_faces(elem_gauche0, ori);
610 if ((face_voisins(face_gauche0,0) != -1)&&(face_voisins(face_gauche0,1) != -1))
612 face_gauche0 = elem_faces(elem_gauche0, ori+3);
614 face_droite0 = elem_faces(elem_droite0, ori);
615 if ((face_voisins(face_droite0,0) != -1)&&(face_voisins(face_droite0,1) != -1))
617 face_droite0 = elem_faces(elem_droite0, ori+3);
620 face_gauche1 = elem_faces(elem_gauche1, ori);
621 if ((face_voisins(face_gauche1,0) != -1)&&(face_voisins(face_gauche1,1) != -1))
623 face_gauche1 = elem_faces(elem_gauche1, ori+3);
625 face_droite1 = elem_faces(elem_droite1, ori);
626 if ((face_voisins(face_droite1,0) != -1)&&(face_voisins(face_droite1,1) != -1))
628 face_droite1 = elem_faces(elem_droite1, ori+3);
633 if((face_droite1<nfin)&&(face_droite0<nfin)&&(face_gauche1<nfin)&&(face_gauche0<nfin)&&
634 (ndeb<=face_droite1)&&(ndeb<=face_droite0)&&(ndeb<=face_gauche1)&&(ndeb<=face_gauche0))
640 double d00d0 = 0., d0vdy= 0., d01d1= 0.;
642 eq_temp[compteur_faces_paroi].set_F(0, 0, ts - alpha_cv*(d00d0+d01d1+d0vdy));
644 for(
int i=1 ; i<
nb_pts ; i++)
647 *0.5*(eq_temp[corresp[face_gauche0]].get_Unp1(0,i)+eq_temp[compteur_faces_paroi].get_Unp1(0,i))
649 *0.5*(eq_temp[corresp[face_droite0]].get_Unp1(0,i)+eq_temp[compteur_faces_paroi].get_Unp1(0,i)))
654 *0.5*(eq_temp[corresp[face_gauche0]].get_Unp1(0,i)+eq_temp[compteur_faces_paroi].get_Unp1(0,i))
656 *0.5*(eq_temp[corresp[face_droite0]].get_Unp1(0,i)+eq_temp[compteur_faces_paroi].get_Unp1(0,i)))
660 d0vdy = (eq_temp[compteur_faces_paroi].get_Unp1(0,i+1)*loi_tble_hyd.
get_eq_couch_lim(compteur_faces_paroi).
get_v(i+1)
661 -eq_temp[compteur_faces_paroi].get_Unp1(0,i-1)*loi_tble_hyd.
get_eq_couch_lim(compteur_faces_paroi).
get_v(i-1))
662 /(eq_temp[compteur_faces_paroi].get_y(i+1)-eq_temp[compteur_faces_paroi].get_y(i-1));
664 eq_temp[compteur_faces_paroi].set_F(0, i, ts - alpha_cv*(d00d0+d01d1+d0vdy));
671 *0.5*(eq_temp[corresp[face_gauche0]].get_Unp1(0,i)+eq_temp[compteur_faces_paroi].get_Unp1(0,i))
673 *0.5*(eq_temp[corresp[face_droite0]].get_Unp1(0,i)-eq_temp[compteur_faces_paroi].get_Unp1(0,i)))
678 *0.5*(eq_temp[corresp[face_gauche0]].get_Unp1(0,i)+eq_temp[compteur_faces_paroi].get_Unp1(0,i))
680 *0.5*(eq_temp[corresp[face_droite0]].get_Unp1(0,i)-eq_temp[compteur_faces_paroi].get_Unp1(0,i)))
684 d0vdy = (eq_temp[compteur_faces_paroi].get_Unp1(0,i)*loi_tble_hyd.
get_eq_couch_lim(compteur_faces_paroi).
get_v(i)
685 -eq_temp[compteur_faces_paroi].get_Unp1(0,i-1)*loi_tble_hyd.
get_eq_couch_lim(compteur_faces_paroi).
get_v(i-1))
686 /(eq_temp[compteur_faces_paroi].get_y(i)-eq_temp[compteur_faces_paroi].get_y(i-1));
688 eq_temp[compteur_faces_paroi].set_F(0, i, ts - (d00d0+d01d1+d0vdy));
694 for(
int i=1 ; i<
nb_pts+1 ; i++)
696 eq_temp[compteur_faces_paroi].set_F(0, i, ts);
712 const RefObjU& modele_turbulence_hydr = eqn_hydr.
get_modele(TURBULENCE);
722 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;
746 // Moyennes Spatiales
750 for (int n_bord=0; n_bord<domaine_VDF.nb_front_Cl(); n_bord++)
752 const Cond_lim& la_cl = le_dom_Cl_dis_->les_conditions_limites(n_bord);
754 if (sub_type(Dirichlet_paroi_fixe,la_cl.valeur()) )
756 const Front_VF& le_bord = ref_cast(Front_VF,la_cl->frontiere_dis());
757 ndeb = le_bord.num_premiere_face();
758 nfin = ndeb + le_bord.nb_faces();
759 for(int i=0 ; i<nb_pts+1 ; i++)
763 for(int num_face=ndeb; num_face<nfin; num_face++)
765 if(face_voisins(num_face,0)==-1)
767 Tmean(i)+=eq_temp[corresp[num_face]].get_Unp1(0,i);
768 Tmean_2(i)+=eq_temp[corresp[num_face]].get_Unp1(0,i)*eq_temp[corresp[num_face]].get_Unp1(0,i);
769 UTmean(i)+=eq_temp[corresp[num_face]].get_Unp1(0,i)*loi_tble_hyd.get_eq_couch_lim(corresp[num_face]).get_Unp1(1,i);
770 VTmean(i)+=eq_temp[corresp[num_face]].get_Unp1(0,i)*loi_tble_hyd.get_eq_couch_lim(corresp[num_face]).get_v(i);
771 WTmean(i)+=eq_temp[corresp[num_face]].get_Unp1(0,i)*loi_tble_hyd.get_eq_couch_lim(corresp[num_face]).get_Unp1(0,i);
772 //Alpha_mean(i)+=eq_temp[corresp[num_face]].get_nut(i);
775 Tmean(i) = Tmean(i)/nb_faces_bas;
776 //Alpha_mean(i) = Alpha_mean(i)/nb_faces_bas;
777 UTmean(i) = UTmean(i)/nb_faces_bas;
778 VTmean(i) = VTmean(i)/nb_faces_bas;
779 WTmean(i) = WTmean(i)/nb_faces_bas;
780 Tmean_2(i) = Tmean_2(i)/nb_faces_bas;
783 for(int i=0 ; i<nb_pts ; i++)
787 for(int num_face=ndeb; num_face<nfin; num_face++)
789 if(face_voisins(num_face,0)==-1)
791 Alpha_mean(i)+=eq_temp[corresp[num_face]].get_nut(i);
794 Alpha_mean(i) = Alpha_mean(i)/nb_faces_bas;
798 //Cerr << "Tmean_spat_sum(N) = " << Tmean(nb_pts) << " " << nb_faces_bas << " " << tps << 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.
const Cond_lim & les_conditions_limites(int) const
Returns the i-th boundary condition.
double dist_norm_bord_axi(int num_face) const
Returns the normal distance for a boundary face (cylindrical coordinates).
int orientation(int) const override
inline DoubleVect& Domaine_VDF::porosite_face() {
double dist_elem_period(int, int, int) const
double dist_norm_bord(int num_face) const override
Returns the normal distance for a boundary face (Cartesian coordinates).
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.
int face_voisins(int num_face, int i) const
Returns the neighbouring element of num_face in direction i.
const Front_VF & front_VF(int i) const
Classe Echange_externe_impose: This class represents the special case of the class.
virtual double T_ext(int num) const
Returns the value of the imposed temperature on the i-th component of the boundary field.
Sortie & syncfile() override
Triggers writing to disk of the data accumulated on the different processors since the last call to s...
Class defining operators and methods for all reading operation in an input flow (file,...
double get_Unp1(int j, int i)
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
virtual Domaine_Cl_dis_base & domaine_Cl_dis()
Returns the discretized boundary condition domain associated with the equation.
Probleme_base & probleme()
Returns the problem associated with the equation.
Schema_Temps_base & schema_temps()
Returns the time scheme associated with the equation.
Base class for an incompressible fluid and its properties:
const Champ_Don_base & viscosite_cinematique() const
int num_local_face(const int) const
int num_premiere_face() const
const Nom & le_nom() const override
Returns the name of the geometric boundary.
virtual const Champ_Don_base & capacite_calorifique() const
Returns the heat capacity 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.
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)
IntTab num_global_faces_post
void imprimer_stat(Sortie &, double) const
MuLambda_TBLE_base & getMuLambda()
Eq_couch_lim & get_eq_couch_lim(int i)
CLASS: Paroi_ODVM_scal_VDF.
int calculer_scal(Champ_Fonc_base &) override
void imprimer_nusselt(Sortie &) const override
int reprendre(Entree &) override
Restores an Objet_U from an input stream. Virtual method to override.
const Probleme_base & getPbBase() const override
int sauvegarder(Sortie &) const override
Saves an Objet_U to an output stream. Virtual method to override.
int init_lois_paroi() override
MuLambda_TBLE_base & getMuLambda() override
Paroi_TBLE_QDM & getLoiParoiHydraulique() override
Eq_couch_lim & get_eq_couch_lim(int) override
void imprimer_nusselt(Sortie &) const override
classe Paroi_std_scal_hyd_VDF
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.
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)
_TYPE_ local_min_vect(Mp_vect_options opt=VECT_REAL_ITEMS) const
const Objet_U & valeur() const
Base class for the hierarchy of wall-law models computing turbulent quantities near walls....
DoubleVects equivalent_distance_