TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Traitement_particulier_NS_canal_VEF.cpp
1/****************************************************************************
2* Copyright (c) 2024, 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 <Traitement_particulier_NS_canal_VEF.h>
17#include <Navier_Stokes_std.h>
18#include <Modele_turbulence_hyd_base.h>
19#include <Equation_base.h>
20#include <Domaine_VEF.h>
21#include <Milieu_base.h>
22#include <Fluide_base.h>
23#include <TRUST_Ref.h>
24
25Implemente_instanciable(Traitement_particulier_NS_canal_VEF,"Traitement_particulier_NS_CANAL_VEF",Traitement_particulier_NS_canal);
26
28
30
35
36void Traitement_particulier_NS_canal_VEF::remplir_Y(DoubleVect& tabY, DoubleVect& tabcompt, int& aNy) const
37{
38 // Initialize the various class member parameters
39 // used for computing the different averages
40 // Initialize: Y, compt
41
42 const Domaine_dis_base& zdisbase = mon_equation->inconnue().domaine_dis_base();
43 const Domaine_VF& domaine_VF=ref_cast(Domaine_VF, zdisbase);
44 const DoubleTab& xv = domaine_VF.xv();
45 const Domaine_VEF& domaine_VEF=ref_cast(Domaine_VEF, zdisbase);
46 const ArrOfInt& faces_doubles = domaine_VEF.faces_doubles();
47 int nb_faces = domaine_VF.nb_faces();
48 int num_face,j,indic,trouve;
49 double y;
50
51 j=0;
52 indic = 0;
53
54 tabY.resize(200);
55 tabcompt.resize(200);
56
57 tabY = -100.;
58 tabcompt = 0;
59
60 //Fill the Y array
61 ////////////////////////////////////////////////////////
62
63 // GF PQ. we add 2 to compt for standard faces, 1 for double faces
64 // and divide compt by 2 at the end.
65 // to be consistent on the number of faces with calculer_moyenne_spatiale_vitesse_rho_mu
66
67 for (num_face=0; num_face<nb_faces; num_face++)
68 {
69 int c = (faces_doubles[num_face]==1) ? 1 : 2 ;
70 y = xv(num_face,1);
71 trouve = 0;
72
73 for (j=0; j<indic+1; j++)
74 {
75 if(est_egal(y,tabY[j]))
76 {
77 tabcompt[j] +=c;
78 j=indic+1;
79 trouve = 1;
80 break;
81 }
82 }
83 if (trouve==0)
84 {
85 tabY[indic]=y;
86 tabcompt[indic] +=c;
87 indic++;
88
89 tabY.resize(indic+1);
90 tabY(indic)=-100.;
91 tabcompt.resize(indic+1);
92 }
93 }
94
95 aNy = indic;
96
97 tabY.resize(aNy);
98 tabcompt.resize(aNy);
99 tabcompt/=2;
100}
101
102
104{
105 const Domaine_dis_base& zdisbase=mon_equation->inconnue().domaine_dis_base();
106 const Domaine_VEF& domaine_VEF=ref_cast(Domaine_VEF, zdisbase);
107 const DoubleTab& xv = domaine_VEF.xv();
108 const IntTab& face_voisins = domaine_VEF.face_voisins();
109 const DoubleTab& vitesse = mon_equation->inconnue().valeurs();
110 double y,u,v,wl;
111 int nb_faces = domaine_VEF.nb_faces();
112 int num_face,i,elem0,elem1;
113 const ArrOfInt& faces_doubles = domaine_VEF.faces_doubles();
114 double c;
115
116 const Fluide_base& le_fluide = ref_cast(Fluide_base,mon_equation->milieu());
117 const DoubleTab& visco_dyn = le_fluide.viscosite_dynamique().valeurs();
118 const DoubleTab& tab_rho_face = le_fluide.masse_volumique().valeurs();
119 int taille_mu=visco_dyn.dimension(0);
120 int taille_rho=tab_rho_face.dimension(0);
121
122 if (visco_dyn.nb_dim()>2)
123 {
124 Cerr<<"Error in Traitement_particulier_NS_canal_VEF::calculer_moyenne_spatiale_vitesse_rho_mu()"<<finl;
126 }
127
128 for (num_face=0; num_face<nb_faces; num_face++)
129 {
130 c = (faces_doubles[num_face]==1) ? 0.5 : 1. ;
131
132 y=xv(num_face,1);
133
134 u = vitesse(num_face,0);
135 v = vitesse(num_face,1);
136
137 for (i=0; i<Ny; i++)
138 if(est_egal(y,Y[i])) break;
139
140 val_moy(i,0) += c*u;
141 val_moy(i,1) += c*v;
142 val_moy(i,3) += c*u*u;
143 val_moy(i,4) += c*v*v;
144 val_moy(i,6) += c*u*v;
145
146 if(dimension==2) val_moy(i,9) += c*sqrt(u*u); //tangential velocity for friction computation
147
148 if(dimension==3)
149 {
150
151 wl = vitesse(num_face,2);
152
153 val_moy(i,2) += c*wl;
154 val_moy(i,5) += c*wl*wl;
155 val_moy(i,7) += c*u*wl;
156 val_moy(i,8) += c*v*wl;
157 val_moy(i,9) += c*sqrt(u*u+wl*wl); //tangential velocity for friction computation
158 }
159
160
161 if (taille_rho==1) val_moy(i,10) += c*tab_rho_face(0,0);
162 else val_moy(i,10) += c*tab_rho_face[num_face];
163
164
165
166 elem0 = face_voisins(num_face,0);
167 elem1 = face_voisins(num_face,1);
168
169 if (taille_mu==1)
170 val_moy(i,11) += c*visco_dyn(0,0);
171 else
172 {
173 if (elem1!=-1)
174 {
175 val_moy(i,11) += c*0.5*(visco_dyn(elem0,0)+visco_dyn(elem1,0));
176 }
177 else
178 {
179 val_moy(i,11) += c*visco_dyn(elem0,0);
180 }
181 }
182 }
183}
184
186{
187 const Domaine_dis_base& zdisbase=mon_equation->inconnue().domaine_dis_base();
188 const Domaine_VEF& domaine_VEF=ref_cast(Domaine_VEF, zdisbase);
189 const DoubleTab& xv = domaine_VEF.xv();
190 const Equation_base& N_S_Turb = mon_equation.valeur();
191 const RefObjU& modele_turbulence_hydr = N_S_Turb.get_modele(TURBULENCE);
192 const Modele_turbulence_hyd_base& le_modele = ref_cast(Modele_turbulence_hyd_base,modele_turbulence_hydr.valeur());
193 const DoubleTab& nu_t = le_modele.viscosite_turbulente().valeurs();
194 const IntTab& face_voisins = domaine_VEF.face_voisins();
195 double y;
196 int nb_faces = domaine_VEF.nb_faces();
197 int num_face,i,elem0,elem1;
198 const ArrOfInt& faces_doubles = domaine_VEF.faces_doubles();
199 double c;
200
201 for (num_face=0; num_face<nb_faces; num_face++)
202 {
203 c = (faces_doubles[num_face]==1) ? 0.5 : 1. ;
204
205 y=xv(num_face,1);
206
207 for (i=0; i<Ny; i++)
208 if(est_egal(y,Y[i])) break;
209
210 elem0 = face_voisins(num_face,0);
211 elem1 = face_voisins(num_face,1);
212
213 if (elem1!=-1)
214 {
215 val_moy(i,12) += c*0.5*(nu_t[elem0]+nu_t[elem1]);
216 }
217 else
218 {
219 val_moy(i,12) += c*nu_t[elem0];
220 }
221 }
222}
223
225{
226 const Domaine_dis_base& zdisbase=mon_equation->inconnue().domaine_dis_base();
227 const Domaine_VEF& domaine_VEF=ref_cast(Domaine_VEF, zdisbase);
228 const DoubleTab& xv = domaine_VEF.xv();
229 const DoubleTab& temperature = Temp->valeurs();
230 const DoubleTab& vitesse = mon_equation->inconnue().valeurs();
231 double y,u,v,wl,T;
232 int nb_faces = domaine_VEF.nb_faces();
233 int num_face,i;
234 const ArrOfInt& faces_doubles = domaine_VEF.faces_doubles();
235 double c;
236
237
238 for (num_face=0; num_face<nb_faces; num_face++)
239 {
240 c = (faces_doubles[num_face]==1) ? 0.5 : 1. ;
241
242 y=xv(num_face,1);
243
244 T = temperature[num_face];
245 u = vitesse(num_face,0);
246 v = vitesse(num_face,1);
247
248 for (i=0; i<Ny; i++)
249 if(est_egal(y,Y[i])) break;
250
251 val_moy(i,13) += c*T;
252 val_moy(i,14) += c*T*T;
253 val_moy(i,15) += c*u*T;
254 val_moy(i,16) += c*v*T;
255
256 if(Objet_U::dimension==3)
257 {
258 wl = vitesse(num_face,2);
259
260 val_moy(i,17) += c*wl*T;
261 }
262 }
263}
DoubleTab & valeurs() override
Overrides Champ_base::valeurs() Returns the array of values.
virtual DoubleTab & valeurs()=0
class Domaine_VEF
Definition Domaine_VEF.h:53
class Domaine_VF
Definition Domaine_VF.h:44
int nb_faces() const
Returns the total number of faces.
Definition Domaine_VF.h:471
double xv(int num_face, int k) const
Definition Domaine_VF.h:76
ArrOfInt & faces_doubles()
Returns 1 for faces belonging to a periodic boundary or a shared item, 0 by default.
Definition Domaine_VF.h:566
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.
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 RefObjU & get_modele(Type_modele type) const
Base class for an incompressible fluid and its properties:
Definition Fluide_base.h:36
const Champ_Don_base & viscosite_dynamique() const
Definition Fluide_base.h:58
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 Champ_Fonc_base & viscosite_turbulente() const
friend class Entree
Definition Objet_U.h:71
static int dimension
Definition Objet_U.h:94
virtual Entree & readOn(Entree &)
Reads an Objet_U from an input stream. Virtual method to override.
Definition Objet_U.cpp:289
virtual Sortie & printOn(Sortie &) const
Writes the object to an output stream. Virtual method to override.
Definition Objet_U.cpp:278
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 nb_dim() const
Definition TRUSTTab.h:199
_SIZE_ dimension(int d) const
Definition TRUSTTab.tpp:133
void resize(_SIZE_, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)
Definition TRUSTVect.tpp:91
const Objet_U & valeur() const
Definition TRUST_Ref.h:134
class Traitement_particulier_NS_canal_VEF This class performs special post-processing
void calculer_moyenne_spatiale_Temp(DoubleTab &) const override
Entree & lire(const Motcle &, Entree &)
void remplir_Y(DoubleVect &, DoubleVect &, int &) const override
void calculer_moyenne_spatiale_vitesse_rho_mu(DoubleTab &) const override
void calculer_moyenne_spatiale_nut(DoubleTab &) const override
Traitement_particulier_NS_canal This class performs specific post-processing treatments.