TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Paroi_loi_WW_hyd_EF.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_hyd_EF.h>
17#include <Fluide_base.h>
18#include <Champ_Uniforme.h>
19#include <Dirichlet_paroi_fixe.h>
20#include <Dirichlet_paroi_defilante.h>
21#include <Domaine.h>
22#include <Modele_turbulence_hyd_base.h>
23#include <Equation_base.h>
24#include <Param.h>
25
26Implemente_instanciable_sans_constructeur(Paroi_loi_WW_hyd_EF,"loi_WW_hydr_EF",Paroi_std_hyd_EF);
27
28// PrintOn
30{
31 return s << que_suis_je() << " " << le_nom();
32}
33
34// ReadOn
36{
37 Cerr<<"Reading of data for a "<<que_suis_je()<<" wall law"<<finl;
38 Param param(que_suis_je());
39 set_param(param);
40 param.lire_avec_accolades_depuis(is);
41 return is ;
42}
43
45{
47 param.ajouter_flag("impr",&impr);
48}
49
50/////////////////////////////////////////////////////////////////////
51//
52// Implementation des fonctions de la classe Paroi_loi_WW_hyd_EF
53//
54/////////////////////////////////////////////////////////////////////
55
56// Remplissage de la table
58{
59 Cmu_ = mon_modele_turb_hyd->get_Cmu();
60 A= 8.3 ;
61 B= 1./7. ;
62 Y0= 11.81 ;
63 return 1;
64}
65
66// On annule les valeurs des grandeurs turbulentes qui
67// correspondent aux mailles de paroi
69{
70 return 1;
71}
72
73// calculer_hyd pour le k-epsilon
74int Paroi_loi_WW_hyd_EF::calculer_hyd(DoubleTab& tab_k_eps)
75{
76 Cerr << " Paroi_loi_WW_hyd_EF::calculer_hyd(DoubleTab& tab_k_eps) " << finl;
77 Cerr << "on ne doit pas entrer dans cette methode" << finl;
78 Cerr << " car elle est definie uniquement pour la LES " << finl ;
79 return 1 ;
80}
81
82
83
84int Paroi_loi_WW_hyd_EF::calculer_hyd(DoubleTab& tab_nu_t,DoubleTab& tab_k)
85{
86 const Domaine_EF& domaine_EF = ref_cast(Domaine_EF, le_dom_dis_.valeur());
87 const IntTab& face_voisins = domaine_EF.face_voisins();
88 const Equation_base& eqn_hydr = mon_modele_turb_hyd->equation();
89 const Fluide_base& le_fluide = ref_cast(Fluide_base, eqn_hydr.milieu());
90 const Champ_Don_base& ch_visco_cin = le_fluide.viscosite_cinematique();
91 const DoubleTab& vitesse = eqn_hydr.inconnue().valeurs();
92 const DoubleTab& tab_visco = ch_visco_cin.valeurs();
93 double visco=-1;
94 int l_unif;
95 if (sub_type(Champ_Uniforme,ch_visco_cin))
96 {
97 visco = std::max(tab_visco(0,0),DMINFLOAT);
98 l_unif = 1;
99 }
100 else
101 l_unif = 0;
102
103 // preparer_calcul_hyd(tab);
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_hyd_EF::calculer_hyd : visco = " << tab_visco.local_min_vect() << " <= 0 ? " << finl;
108 throw;
109 }
110 //tab_visco+=DMINFLOAT;
111
112 int ndeb,nfin;
113 double norm_v;
114 double dist_G,dist_som;
115 double d_visco;
116
117 ArrOfDouble vit(dimension);
118 ArrOfDouble val(dimension);
119
120 int nsom = domaine_EF.nb_som_face();
121 int nsom_elem = domaine_EF.domaine().nb_som_elem();
122 const IntTab& elems=domaine_EF.domaine().les_elems() ;
123
124 ArrOfDouble vit_face(dimension);
125 ArrOfInt nodes_face(nsom);
126 int nb_nodes_free = nsom_elem - nsom;
127
128 // Boucle sur les bords
129
130 for (int n_bord=0; n_bord<domaine_EF.nb_front_Cl(); n_bord++)
131 {
132
133 // pour chaque condition limite on regarde son type
134 // On applique les lois de paroi uniquement
135 // aux voisinages des parois
136
137 const Cond_lim& la_cl = le_dom_Cl_dis_->les_conditions_limites(n_bord);
138
139 if (sub_type(Dirichlet_paroi_fixe,la_cl.valeur()) )
140 {
141 const Front_VF& le_bord = ref_cast(Front_VF,la_cl->frontiere_dis());
142
143 // Loop on real faces
144 ndeb = 0;
145 nfin = le_bord.nb_faces_tot();
146 for (int ind_face=ndeb; ind_face<nfin; ind_face++)
147 {
148 int num_face=le_bord.num_face(ind_face);
149 int elem = face_voisins(num_face,0);
150
151 // vitesse face CL
152 vit_face=0.;
153 nodes_face=0;
154 for(int jsom=0; jsom<nsom; jsom++)
155 {
156 int num_som = domaine_EF.face_sommets(num_face, jsom);
157 nodes_face[jsom] = num_som;
158 for(int comp=0; comp<dimension; comp++) vit_face[comp]+=vitesse(num_som,comp)/nsom;
159 }
160
161 vit=0.;
162 // Loop on nodes : vitesse moyenne des noeuds n'appartenant pas a la face CL
163 for (int i=0; i<nsom_elem; i++)
164 {
165 int node=elems(elem,i);
166 int IOK = 1;
167 for(int jsom=0; jsom<nsom; jsom++)
168 if (nodes_face[jsom] == node) IOK=0;
169 // Le noeud contribue
170 if (IOK)
171 for (int j=0; j<dimension; j++)
172 vit[j]+=(vitesse(node,j)-vit_face[j])/nb_nodes_free; // permet de soustraire la vitesse de glissement eventuelle
173 }
174 norm_v = norm_vit_lp(vit,num_face,domaine_EF,val);
175
176 if (l_unif)
177 d_visco = visco;
178 else
179 d_visco = tab_visco[elem];
180
181 dist_G = distance_face_elem(num_face,elem,domaine_EF);
182 dist_som = 2.0*dist_G;
183
184 // Calcul de u* et des grandeurs turbulentes:
185 // a partir de de norm_v
186 calculer_local(d_visco,tab_nu_t,tab_k,norm_v,dist_G,dist_som,elem,num_face);
187
188 // Calcul de la contrainte tangentielle:
189 // Signe du cisaillement : on le donne dans l OpDift
190 double vit_frot = tab_u_star(num_face)*tab_u_star(num_face);
191 for (int j=0; j<dimension; j++) Cisaillement_paroi_(num_face,j) = vit_frot*val[j];
192 }
193 } // fin de Dirichlet_paroi_fixe
194
195
196 // ATTENTION : CODER PAROI DEFILANTE
197 else if (sub_type(Dirichlet_paroi_defilante,la_cl.valeur()) )
198 {
199 Cerr << "pour l instant Werner et Wengle n'est pas code pour la condition de paroi defilante!!" << finl;
200 } // fin de Dirichlet_paroi_defilante
201 } // fin du for bord CL
202
203 Cisaillement_paroi_.echange_espace_virtuel();
204 tab_nu_t.echange_espace_virtuel();
206 return 1;
207} // fin du calcul_hyd (nu-t)
208
209
211 DoubleTab& tab_nu_t,DoubleTab& tab_k,double norm_vit,
212 double dist_G,double dist_som,int elem,int num_face)
213{
214 // C est la hauteur de la premiere maille en int qui doit etre testee dist_som
215 double up_lim = d_visco*Y0*Y0/dist_som;
216
217 if (norm_vit <= up_lim)
218 {
219 calculer_u_star_sous_couche_visq(norm_vit,d_visco,dist_som,num_face);
220 //calculer_sous_couche_visq(tab_nu_t,tab_k,elem);
221 tab_nu_t(elem) = 0.;
222 tab_k(elem) = 0.;
223
224 if (impr==1) Cerr << "Domaine lineaire" << finl;
225 }
226 else
227 {
228 calculer_u_star_couche_puissance(norm_vit,d_visco,dist_som,num_face);
229 calculer_couche_puissance(tab_nu_t,tab_k,dist_som,elem,num_face);
230 if (impr==1) Cerr << "Domaine en puissance" << finl;
231 }
232 return 1;
233}
234
235
237 double d_visco,double dist,
238 int face)
239{
240 // Dans la sous couche visqueuse: u* = sqrt(u*nu/d)
241
242 tab_u_star_(face) = sqrt(norm_vit*d_visco/dist);
243 tab_d_plus_(face) = (dist*tab_u_star_(face))/d_visco;
244 uplus_(face) = norm_vit/tab_u_star_(face);
245
246 return 1;
247}
248
249
251 double dist, int face)
252{
253 // Implementation Werner, Wengle 1993
254 // double part1, part2 ;
255 // static double Apuiss = pow(A,(1+B)/(1-B));
256
257 // part1= ( (B+1) * pow(d_visco,B) * norm_vit ) / (A *pow(2.*dist,B) );
258 // part2= ( (1-B) * pow(d_visco,B+1) * Apuiss ) / (2 * pow(2.*dist,B+1) ) ;
259
260 // tab_u_star_(face)= pow(part1+part2, 1/(B+1) );
261
262 // Implementation Wilhelm, Jacob, Sagaut 2018
263 double part1bis;
264 part1bis= ( pow(d_visco,B) * norm_vit ) / (A *pow(dist,B) );
265 tab_u_star_(face)= pow(part1bis, 1/(B+1) );
266 tab_d_plus_(face) = (dist*tab_u_star_(face))/d_visco;
267 uplus_(face) = norm_vit/tab_u_star_(face);
268
269 return 1;
270}
271
272
273int Paroi_loi_WW_hyd_EF::calculer_couche_puissance(DoubleTab& nu_t,DoubleTab& tab_k,
274 double dist,int elem,int face)
275{
276 // nu_t = Cmu*k*k/eps
277 //
278 // 2 3
279 // En utilisant k = u*/sqrt(Cmu_) et eps = u* / Kd
280 //
281 // on calcule nu_t en fonction de u*
282
283 double u_star = tab_u_star(face);
284
285 tab_k(elem) = u_star*u_star/sqrt(Cmu_);
286 nu_t(elem) = u_star*Kappa_*dist ;
287
288 return 1;
289}
class Champ_Don_base base class of Given Fields (not calculated)
DoubleTab & valeurs() override
Overrides Champ_base::valeurs() Returns the array of values.
DoubleTab & valeurs() override
Returns the array of field values at the current time.
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
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.
int nb_som_elem() const
Returns the number of vertices of the geometric elements that make up the domain.
Definition Domaine.h:474
IntTab_t & les_elems()
Definition Domaine.h:129
class Domaine_EF
Definition Domaine_EF.h:56
int face_sommets(int i, int j) const
Returns the index of the i-th vertex of face num_face.
Definition Domaine_VF.h:582
int nb_som_face() const
Returns the number of vertices per face.
Definition Domaine_VF.h:493
int face_voisins(int num_face, int i) const
Returns the neighbouring element of num_face in direction i.
Definition Domaine_VF.h:418
int nb_front_Cl() const
const Domaine & domaine() 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 Champ_Inc_base & inconnue() const =0
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
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
virtual Sortie & printOn(Sortie &) const
Writes the object to an output stream. Virtual method to override.
Definition Objet_U.cpp:278
Helper class to factorize the readOn method of Objet_U classes.
Definition Param.h:112
void ajouter_flag(const char *keyword, const bool *value)
Register a boolean flag whose mere presence switches it to true.
Definition Param.cpp:474
int preparer_calcul_hyd(DoubleTab &)
int calculer_local(double, DoubleTab &, DoubleTab &, double, double, double, int, int)
int init_lois_paroi_hydraulique() override
int calculer_hyd(DoubleTab &) override
void set_param(Param &param) const override
int calculer_couche_puissance(DoubleTab &, DoubleTab &, double, int, int)
int calculer_u_star_sous_couche_visq(double, double, double, int)
int calculer_u_star_couche_puissance(double, double, double, int)
CLASS: Paroi_std_hyd_EF.
void set_param(Param &param) const override
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
virtual void echange_espace_virtuel(IsExchangeBlocking exchange_type=IsExchangeBlocking::DefaultBlocking, const std::string kernel_name="noname")
const DoubleVect & tab_u_star() const