TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Paroi_loi_WW_scal_VEF.cpp
1/****************************************************************************
2* Copyright (c) 2015 - 2016, CEA
3* All rights reserved.
4*
5* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8* 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
9*
10* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
11* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
12* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
13*
14*****************************************************************************/
15
16#include <Paroi_loi_WW_scal_VEF.h>
17#include <Paroi_std_hyd_VEF.h>
18#include <Probleme_base.h>
19#include <Champ_Uniforme.h>
20#include <Dirichlet_paroi_fixe.h>
21#include <Dirichlet_paroi_defilante.h>
22#include <Fluide_base.h>
23#include <Modele_turbulence_hyd_base.h>
24#include <Convection_Diffusion_Concentration.h>
25#include <Modele_turbulence_scal_base.h>
26#include <Constituant.h>
27
28Implemente_instanciable_sans_constructeur(Paroi_loi_WW_scal_VEF,"loi_WW_scalaire_VEF",Paroi_std_scal_hyd_VEF);
29
30
31// printOn()
32/////
33
35{
36 return s << que_suis_je() << " " << le_nom();
37}
38
39//// readOn
40//
41
43{
44 return s ;
45}
46
47void Paroi_loi_WW_scal_VEF::associer(const Domaine_dis_base& domaine_dis,const Domaine_Cl_dis_base& domaine_Cl_dis)
48{
49 le_dom_dis_ = ref_cast(Domaine_VF, domaine_dis);
50 le_dom_Cl_dis_ = domaine_Cl_dis;
51}
52
53/////////////////////////////////////////////////////////////////////////
54//
55// Implementation des fonctions de la classe Paroi_loi_WW_scal_VEF
56//
57////////////////////////////////////////////////////////////////////////
58
59// Loi analytique avec raccordement des comportements
60// asymptotiques de la temperature adimensionnee T+
61// sous-couche conductrice : T+=Pr y+
62// domaine logarithmique : T+=2.12*ln(y+)+Beta
63
64//// POUR PASSAGE A V1.4.4
65//// PROBLEME COMPATIBILITE AVEC DEVELOPPEMENT
66//// DE LOI PAROI VEF SCAL DE PATRICK
67double FthparVEF_WW(double y_plus,double Pr,double Beta)
68{
69 static double C_inv = 2.12;
70 double Gamma = (0.01*pow(Pr*y_plus,4.))/(1.+5.*pow(Pr,3.)*y_plus);
71 double f = Pr*y_plus*exp(-Gamma);
72 f += (C_inv*log(1.+y_plus) + Beta)*exp(-1./(Gamma+1e-20));
73 return f;
74}
75
76
78{
79 const Domaine_VEF& domaine_VEF = ref_cast(Domaine_VEF, le_dom_dis_.valeur());
80 DoubleTab& alpha_t = diffusivite_turb.valeurs();
81 Equation_base& eqn_hydr = mon_modele_turb_scal->equation().probleme().equation(0);
82 const Fluide_base& le_fluide = ref_cast(Fluide_base,eqn_hydr.milieu());
83 const Champ_Don_base& ch_visco_cin = le_fluide.viscosite_cinematique();
84
85 const DoubleTab& tab_visco = ch_visco_cin.valeurs();
86 int l_unif;
87
88 if (axi)
89 {
90 Cerr<<"Attention: the axisymmetric VEF case is not yet implemented"<<finl;
91 Cerr<<"in the thermal wall-function. trust will now stop."<<finl;
93 }
94
95 double visco=-1;
96 if (sub_type(Champ_Uniforme,ch_visco_cin))
97 {
98 l_unif = 1;
99 visco = std::max(tab_visco(0,0),DMINFLOAT);
100 }
101 else
102 l_unif = 0;
103
104 if ((!l_unif) && (tab_visco.local_min_vect()<DMINFLOAT))
105 // on ne doit pas changer tab_visco ici !
106 {
107 Cerr << "In Paroi_loi_WW_scal_VEF::calculer_scal : visco = " << tab_visco.local_min_vect() << " <= 0 ? " << finl;
108 throw;
109 }
110 //tab_visco+=DMINFLOAT;
111
112 int elem;
113 double dist;
114 double d_visco;
115 const RefObjU& modele_turbulence_hydr = eqn_hydr.get_modele(TURBULENCE);
116 const Modele_turbulence_hyd_base& le_modele = ref_cast(Modele_turbulence_hyd_base,modele_turbulence_hydr.valeur());
117 const Turbulence_paroi_base& loi = le_modele.loi_paroi();
118 const DoubleVect& tab_u_star = loi.tab_u_star();
119 const Convection_Diffusion_std& eqn = mon_modele_turb_scal->equation();
120
121 int schmidt = 0;
122 if (sub_type(Convection_Diffusion_Concentration,eqn)) schmidt = 1;
123 const Champ_Don_base& alpha = (schmidt==1?ref_cast(Convection_Diffusion_Concentration,eqn).constituant().diffusivite_constituant():le_fluide.diffusivite());
124
125 // Boucle sur les bords:
126 for (int n_bord=0; n_bord<domaine_VEF.nb_front_Cl(); n_bord++)
127 {
128
129 // Pour chaque condition limite on regarde son type
130 // On applique les lois de paroi thermiques uniquement
131 // aux voisinages des parois ou l'on impose la temperature
132 // Si l'on est a une paroi adiabatique, le flux a la paroi est connu et nul.
133 // Si l'on est a une paroi a flux impose, le flux est connu et il est
134 // directement pris a la condition aux limites pour le calcul des flux diffusifs.
135
136 const Cond_lim& la_cl = le_dom_Cl_dis_->les_conditions_limites(n_bord);
137 if ( (sub_type(Dirichlet_paroi_fixe,la_cl.valeur()))
138 || (sub_type(Dirichlet_paroi_defilante,la_cl.valeur())) )
139 {
140
141 const Front_VF& le_bord = ref_cast(Front_VF,la_cl->frontiere_dis());
142 int size=le_bord.nb_faces_tot();
143 for (int ind_face=0; ind_face<size; ind_face++)
144 {
145 int num_face = le_bord.num_face(ind_face);
146 const IntTab& face_voisins = domaine_VEF.face_voisins();
147
148 // We search the element touching the wall on the face "num_face".
149 elem = face_voisins(num_face,0);
150 if (elem == -1)
151 elem = face_voisins(num_face,1);
152
153 // We calculate the distance to the wall of the center of gravity of the element.
154 if (dimension == 2)
155 dist = distance_2D(num_face,elem,domaine_VEF)*1.5;
156 else
157 dist = distance_3D(num_face,elem,domaine_VEF)*4./3.;
158
159 if (l_unif)
160 d_visco = visco;
161 else
162 d_visco = tab_visco[elem];
163 double u_star = tab_u_star(num_face);
164 double (*pf)(double,double,double);
165 pf = &FthparVEF_WW;
166 double d_alpha=0.;
167 if (sub_type(Champ_Uniforme,alpha))
168 d_alpha = alpha.valeurs()(0,0);
169 else
170 {
171 if (alpha.nb_comp()==1)
172 d_alpha = alpha.valeurs()(elem);
173 else
174 d_alpha = alpha.valeurs()(elem,0);
175 }
176 double Pr = d_visco/d_alpha;
177 double Beta = pow(3.85*pow(Pr,1./3.)-1.3,2.)+2.12*log(Pr);
178
179 // Alex. C. : 28/02/2003
180 // We modify the value of the eddy diffusivity in the first off-wall element
181 // to have the value given by the theoretical mixing length model.
182
183 double y0m=(dist*u_star/d_visco)-0.5;
184 double y0p=(dist*u_star/d_visco)+0.5;
185 alpha_t(elem)=d_visco/(pf(y0p,Pr,Beta)-pf(y0m,Pr,Beta))-d_alpha;
186 if(alpha_t(elem)<0.) alpha_t(elem)=0.; // It means we are in the laminar layer.
187 equivalent_distance_[n_bord](ind_face) = (d_alpha+alpha_t(elem))*pf(dist*u_star/d_visco,Pr,Beta)/u_star;
188 }
189 }
190 }
191 return 1;
192}
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
Champ_Uniforme Represents a field that is constant in space and time.
class Cond_lim Generic class used to represent any class
Definition Cond_lim.h:31
Convection_Diffusion_Concentration Special case of Convection_Diffusion_std.
Convection_Diffusion_std This class is the base for equations modelling the transport.
Dirichlet_paroi_defilante Imposes the wall velocity in an equation of type Navier_Stokes.
Dirichlet_paroi_fixe Represents a fixed wall in a Navier-Stokes type equation.
class Domaine_Cl_dis_base Domaine_Cl_dis_base objects represent discretized boundary conditions
class Domaine_VEF
Definition Domaine_VEF.h:53
class Domaine_VF
Definition Domaine_VF.h:44
int face_voisins(int num_face, int i) const
Returns the neighbouring element of num_face in direction i.
Definition Domaine_VF.h:418
class Domaine_dis_base This class is the base of the hierarchy of discretized domains.
int nb_front_Cl() const
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
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
Probleme_base & probleme()
Returns the problem associated with the equation.
virtual int nb_comp() const
Definition Field_base.h:56
Base class for an incompressible fluid and its properties:
Definition Fluide_base.h:36
const Champ_Don_base & viscosite_cinematique() const
Definition Fluide_base.h:56
class Front_VF
Definition Front_VF.h:36
int nb_faces_tot() const
Definition Front_VF.h:58
int num_face(const int) const
Definition Front_VF.h:68
virtual const Champ_Don_base & diffusivite() const
Returns the diffusivity of the medium (const version).
Base class for the turbulence model hierarchy for Navier-Stokes equations.
const Turbulence_paroi_base & loi_paroi() const
static int dimension
Definition Objet_U.h:94
const Nom & que_suis_je() const
Returns the string identifying the class.
Definition Objet_U.cpp:104
virtual Entree & readOn(Entree &)
Reads an Objet_U from an input stream. Virtual method to override.
Definition Objet_U.cpp:289
virtual const Nom & le_nom() const
Returns the name of the Objet_U. Virtual method to override: returns "neant" in this implementation.
Definition Objet_U.cpp:317
static int axi
Definition Objet_U.h:96
virtual Sortie & printOn(Sortie &) const
Writes the object to an output stream. Virtual method to override.
Definition Objet_U.cpp:278
classe Paroi_loi_WW_scal_VEF
int calculer_scal(Champ_Fonc_base &) override
void associer(const Domaine_dis_base &, const Domaine_Cl_dis_base &) override
virtual const Equation_base & equation(int) const =0
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
Definition Process.cpp:466
Base class for output streams.
Definition Sortie.h:52
_TYPE_ local_min_vect(Mp_vect_options opt=VECT_REAL_ITEMS) const
Definition TRUSTVect.h:155
const Objet_U & valeur() const
Definition TRUST_Ref.h:134
Base class for the hierarchy of wall-law models computing turbulent quantities near walls....
const DoubleVect & tab_u_star() const