TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Paroi_std_scal_hyd_VDF.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_std_scal_hyd_VDF.h>
17#include <Paroi_std_hyd_VDF.h>
18#include <Champ_Uniforme.h>
19#include <Champ_Uniforme_Morceaux.h>
20#include <Champ_Fonc_Tabule.h>
21#include <Champ_Fonc_Tabule_P0_VDF.h>
22#include <Domaine_Cl_VDF.h>
23#include <Dirichlet_paroi_fixe.h>
24#include <Dirichlet_paroi_defilante.h>
25#include <Probleme_base.h>
26#include <Fluide_base.h>
27#include <Modele_turbulence_hyd_base.h>
28#include <Convection_Diffusion_Concentration.h>
29#include <Modele_turbulence_scal_base.h>
30#include <Constituant.h>
31#include <Debog.h>
32#include <Param.h>
33
34Implemente_instanciable_sans_constructeur(Paroi_std_scal_hyd_VDF,"loi_standard_hydr_scalaire_VDF",Paroi_scal_hyd_base_VDF);
35Implemente_instanciable(Loi_expert_scalaire_VDF,"Loi_expert_scalaire_VDF",Paroi_std_scal_hyd_VDF);
36
37// printOn()
38/////
39
41{
42 return s << que_suis_je() << " " << le_nom();
43}
44
45//// readOn
46//
47
49{
50 return s ;
51}
52
53// printOn()
54/////
55
57{
58 return s;
59}
60
61//// readOn
62//
63
65{
66 Param param(que_suis_je());
67 param.ajouter("prdt_sur_kappa",&Prdt_sur_kappa_);
68 param.lire_avec_accolades_depuis(s);
69 return s ;
70}
71
72
73/////////////////////////////////////////////////////////////////////////
74//
75// Implementation des fonctions de la classe Paroi_std_scal_hyd_VDF
76//
77////////////////////////////////////////////////////////////////////////
78
83
85{
86 const Domaine_VDF& domaine_VDF = ref_cast(Domaine_VDF, le_dom_dis_.valeur());
87 const IntTab& face_voisins = domaine_VDF.face_voisins();
88 DoubleTab& alpha_t = diffusivite_turb.valeurs();
89 const Equation_base& eqn_hydr = mon_modele_turb_scal->equation().probleme().equation(0);
90 const Fluide_base& le_fluide = ref_cast(Fluide_base,eqn_hydr.milieu());
91 const Champ_Don_base& ch_visco_cin = le_fluide.viscosite_cinematique();
92
93 const DoubleTab& tab_visco = ch_visco_cin.valeurs();
94 int l_unif;
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_std_scal_hyd_VDF::calculer_scal : visco = " << tab_visco.local_min_vect() << " <= 0 ? " << finl;
108 throw;
109 } // tab_visco+=DMINFLOAT;
110
111 double dist;
112
113 // On recupere directement u_star par la loi de paroi. Il ne faut surtout pas
114 // utiliser la methode calculer_u_star_avec_cisaillement car c'est faux en QC.
115 // En effet,on recupere alors u_star*rho^0.5 et non u_star -> influence sur les
116 // flux et l'impression du Nusselt.
117
118 const RefObjU& modele_turbulence_hydr = eqn_hydr.get_modele(TURBULENCE);
119 const Modele_turbulence_hyd_base& mod_turb_hydr = ref_cast(Modele_turbulence_hyd_base,modele_turbulence_hydr.valeur());
120 const Turbulence_paroi_base& loi = mod_turb_hydr.loi_paroi();
121 const DoubleVect& tab_u_star = loi.tab_u_star();
122 const Convection_Diffusion_std& eqn = mon_modele_turb_scal->equation();
123 const IntVect& orientation = domaine_VDF.orientation();
124
125 // Recuperation de la diffusivite en fonction du type d'equation:
126 int schmidt = (sub_type(Convection_Diffusion_Concentration,eqn) ? 1 : 0);
127 const Champ_Don_base& alpha = (schmidt==1?ref_cast(Convection_Diffusion_Concentration,eqn).constituant().diffusivite_constituant():le_fluide.diffusivite());
128 int alpha_uniforme = (sub_type(Champ_Uniforme,alpha) ? 1 : 0);
129
130 // Verifications (l'algorithme n'est valable que si d_alpha est le meme pour chaque constituant)
131 if (schmidt)
132 {
133 if (alpha_uniforme)
134 {
135 double d_alpha = alpha.valeurs()(0,0);
136 assert(ref_cast(Convection_Diffusion_Concentration,eqn).constituant().nb_constituants()==alpha.valeurs().line_size());
137 for (int nc=0; nc<alpha.valeurs().line_size(); nc++)
138 {
139 if (d_alpha!=alpha.valeurs()(0,nc))
140 {
141 Cerr << "Error!" << finl;
142 Cerr << "Law of the wall are not implemented yet for constituants with different diffusion coefficients." << finl;
144 }
145 }
146 }
147 else
148 {
149 for (int elem=0; elem<alpha.valeurs().dimension(0); elem++)
150 {
151 double d_alpha = alpha.valeurs()(elem,0);
152 for (int nc=0; nc<alpha.valeurs().line_size(); nc++)
153 {
154 if (d_alpha!=alpha.valeurs()(elem,nc))
155 {
156 Cerr << "Error!" << finl;
157 Cerr << "Law of the wall are not implemented yet for constituants with different diffusion coefficients." << finl;
159 }
160 }
161 }
162 }
163 }
164
165 // Boucle sur les bords:
166 for (int n_bord=0; n_bord<domaine_VDF.nb_front_Cl(); n_bord++)
167 {
168
169 // Pour chaque condition limite on regarde son type
170 // On applique les lois de paroi thermiques uniquement
171 // aux voisinages des parois ou l'on impose la temperature
172 // Si l'on est a une paroi adiabatique, le flux a la paroi est connu et nul.
173 // Si l'on est a une paroi a flux impose, le flux est connu et il est
174 // directement pris a la condition aux limites pour le calcul des flux diffusifs.
175
176 const Cond_lim& la_cl = le_dom_Cl_dis_->les_conditions_limites(n_bord);
177 if ( (sub_type(Dirichlet_paroi_fixe,la_cl.valeur()))
178 || (sub_type(Dirichlet_paroi_defilante,la_cl.valeur())) )
179 {
180
181 const Front_VF& le_bord = ref_cast(Front_VF,la_cl->frontiere_dis());
182 int ndeb = le_bord.num_premiere_face();
183 int nfin = ndeb + le_bord.nb_faces();
184
185 //find the associated boundary
186 int boundary_index=-1;
187 if (domaine_VDF.front_VF(n_bord).le_nom() == le_bord.le_nom())
188 boundary_index=n_bord;
189 assert(boundary_index >= 0);
190
191 for (int num_face=ndeb; num_face<nfin; num_face++)
192 {
193 int elem = face_voisins(num_face,0);
194 if (elem == -1)
195 elem = face_voisins(num_face,1);
196 if (axi)
197 dist = domaine_VDF.dist_norm_bord_axi(num_face);
198 else
199 dist = domaine_VDF.dist_norm_bord(num_face);
200
201 double u_star = tab_u_star(num_face);
202 double d_alpha = (alpha_uniforme ? alpha.valeurs()(0,0) : alpha.valeurs()(elem,0) );
203
204 int global_face=num_face;
205 int local_face=domaine_VDF.front_VF(boundary_index).num_local_face(global_face);
206
207 if (u_star == 0 || d_alpha == 0)
208 {
209 equivalent_distance_[boundary_index](local_face)=dist;
210 alpha_t(elem) = 0;
211 }
212 else
213 {
214 // calcul de la viscosite en y+
215 double d_visco = (l_unif ? visco : tab_visco(elem,0));
216 double Pr = d_visco/d_alpha;
217 double y_plus = dist*u_star/d_visco;
218 // L'expression de d_equiv ne tient pas compte de alpha_t comme en VEF
219 // Cela dit, c'est normale car c'est lors du calcul du flux que la
220 // turbulence est prise en compte.
221 // Ne pas uniformiser l'ecriture avec le VEF, car on tombe sur des problemes
222 // au niveau des parois contacts entre plusieurs problemes (alpha_t pas recuperable !).
223 equivalent_distance_[boundary_index](local_face)=d_alpha * T_plus(y_plus,Pr,Prdt_sur_kappa_) / u_star;
224
225 // Alex. C. : 19/02/2003
226 // We modify the value of the eddy diffusivity in the first off-wall element
227 // to have the value given by the theoretical mixing length model.
228 int ori = orientation(num_face);
229 double y0=0.5*domaine_VDF.dim_elem(elem,ori)*u_star/d_visco;
230 if (y0<0.5)
231 alpha_t(elem)=0.; // It means we are in the laminar layer.
232 else
233 {
234 double y0m=y0-0.5;
235 double y0p=y0+0.5;
236 alpha_t(elem)=d_visco/(T_plus(y0p,Pr,Prdt_sur_kappa_)-T_plus(y0m,Pr,Prdt_sur_kappa_))-d_alpha;
237 }
238 }
239 }
240 }
241 }
242 return 1;
243}
244
246{
247 /*
248 // Initialisations de tab_d_equiv
249 // On initialise les distances equivalentes avec les distances geometriques
250 const Domaine_VDF& zvdf = le_dom_VDF.valeur();
251
252 if (axi)
253 for (int num_face=0; num_face<zvdf.nb_faces_bord(); num_face++)
254 tab_d_equiv_[num_face] = zvdf.dist_norm_bord_axi(num_face);
255 else
256 for (int num_face=0; num_face<zvdf.nb_faces_bord(); num_face++)
257 tab_d_equiv_[num_face] = zvdf.dist_norm_bord(num_face); */
258 return 1;
259
260}
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_VDF
Definition Domaine_VDF.h:61
double dist_norm_bord_axi(int num_face) const
Returns the normal distance for a boundary face (cylindrical coordinates).
double dim_elem(int, int) const
int orientation(int) const override
inline DoubleVect& Domaine_VDF::porosite_face() {
double dist_norm_bord(int num_face) const override
Returns the normal distance for a boundary face (Cartesian coordinates).
int face_voisins(int num_face, int i) const
Returns the neighbouring element of num_face in direction i.
Definition Domaine_VF.h:418
const Front_VF & front_VF(int i) const
Definition Domaine_VF.h:112
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.
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 num_local_face(const int) const
Definition Front_VF.h:87
int nb_faces() const
Definition Front_VF.h:53
int num_premiere_face() const
Definition Front_VF.h:63
const Nom & le_nom() const override
Returns the name of the geometric boundary.
cette classe permet de specifier des options a la loi de paroi standard.
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_std_scal_hyd_VDF
int calculer_scal(Champ_Fonc_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
int line_size() const
Definition TRUSTVect.tpp:67
_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
KOKKOS_INLINE_FUNCTION double T_plus(double y_plus, double Pr, double Prdt_sur_kappa)