TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Paroi_TBLE_scal_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
17#include <Paroi_TBLE_scal_VDF.h>
18#include <ParoiVDF_TBLE.h>
19#include <Paroi_std_hyd_VDF.h>
20#include <Eq_ODVM.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>
31#include <EFichier.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>
36#include <time.h>
37#include <verif_cast.h>
38#include <EcrFicPartage.h>
39
40Implemente_instanciable_sans_constructeur(Paroi_TBLE_scal_VDF,"Paroi_TBLE_scal_VDF",Paroi_std_scal_hyd_VDF);
41
42// printOn()
43/////
44
46{
47 return os << que_suis_je() << " " << le_nom();
48}
49
50//// readOn
51//
52
54{
55
56 Motcle mot_lu;
57 Motcle acc_ouverte("{");
58 Motcle acc_fermee("}");
59
60 // Valeurs par defaut
62 alpha_cv = 0; // termes convectifs dans l'equation TBLE (1=oui/0=non)
63 // FIN valeurs par defaut
64
65 Motcles les_mots(1);
66 {
67 les_mots[0]="alpha_cv";
68 }
69 is >> mot_lu;
70 assert(mot_lu==acc_ouverte);
71 is >> mot_lu;
72 if(mot_lu == acc_ouverte)
73 {
74 // on passe l'accolade ouvrante
75 is >> mot_lu;
76 }
77 while(mot_lu != acc_fermee)
78 {
79 int rang=les_mots.search(mot_lu);
80 switch(rang)
81 {
82 case 0 :
83 is >> alpha_cv;
84 if (alpha_cv==0)
85 Cerr << " Les termes convectifs sont negliges dans TBLE ! " << finl;
86 else if (alpha_cv==1)
87 Cerr << " Les termes convectifs sont pris en compte dans TBLE ! " << finl;
88 else
89 {
90 Cerr << "alpha_cv doit valoir 0 ou 1 !" << finl;
92 }
93 break;
94 default :
95 {
97 }
98 }
99 is >> mot_lu;
100 }
101
102 return is;
103
104}
105
106/////////////////////////////////////////////////////////////////////
107//
108// Implementation des fonctions de la classe Paroi_TBLE_scal_VDF
109//
110/////////////////////////////////////////////////////////////////////
111
112
113// /////////////////////////////////////////////////
114// // Initialisation des tableaux
115// ////////////////////////////////////////////////
116
118{
119
120 // Pour passer a l'echange contact pour imposer la temperature a l'interface.
121
122 int ndeb,nfin;
123 int elem;
124 double dist; //distance du premier centre de maille a la paroi
125 const Domaine_VDF& domaine_VDF = ref_cast(Domaine_VDF, le_dom_dis_.valeur());
126
127 const IntTab& face_voisins = domaine_VDF.face_voisins();
128 int nb_elems = domaine_VDF.nb_elem();
129 const DoubleVect& volumes = domaine_VDF.volumes();
130
131 const Equation_base& eqn_temp = mon_modele_turb_scal->equation();
132 const DoubleTab& Temp = eqn_temp.inconnue().valeurs();
133 const Equation_base& eqn_hydr = mon_modele_turb_scal->equation().probleme().equation(0);
134 const RefObjU& modele_turbulence_hydr = eqn_hydr.get_modele(TURBULENCE);
135 const Modele_turbulence_hyd_base& mod_turb_hydr = ref_cast(Modele_turbulence_hyd_base,modele_turbulence_hydr.valeur());
136 const Turbulence_paroi_base& loi = mod_turb_hydr.loi_paroi();
137 const Fluide_base& le_fluide = ref_cast(Fluide_base, eqn_hydr.milieu());
138 const double rhoCp = le_fluide.capacite_calorifique().valeurs()(0, 0) * le_fluide.masse_volumique().valeurs()(0, 0);
139
140 if (!sub_type(ParoiVDF_TBLE,loi))
141 {
142 Cerr << "Une loi de paroi TBLE en thermique doit etre utilisee obligatoirement avec une loi de paroi TBLE sur la QDM " << finl;
144 }
145
147 Paroi_TBLE_QDM_Scal::init_lois_paroi(domaine_VDF, le_dom_Cl_dis_.valeur());
148
149 int compteur_faces_paroi = 0;
150
151 corresp.resize(le_dom_dis_->nb_faces_bord());
152
153 EcrFicPartage fic_corresp("corresp.dat",ios::app); // impression de la correspondance
154
155
156 for (int n_bord=0; n_bord<domaine_VDF.nb_front_Cl(); n_bord++)
157 {
158 const Cond_lim& la_cl = le_dom_Cl_dis_->les_conditions_limites(n_bord);
159
160 if (sub_type(Dirichlet_paroi_fixe,la_cl.valeur()) )
161
162 {
163 const Front_VF& le_bord = ref_cast(Front_VF,la_cl->frontiere_dis());
164 ndeb = le_bord.num_premiere_face();
165 nfin = ndeb + le_bord.nb_faces();
166
167 for (int num_face=ndeb; num_face<nfin; num_face++)
168 {
169 corresp[num_face]=compteur_faces_paroi;
170 fic_corresp << num_face << " " << corresp[num_face] << finl;
171 compteur_faces_paroi++;
172 }
173 }
174 }
175 fic_corresp.syncfile();
176
177 corresp.resize(compteur_faces_paroi); //Redimensionnement de corresp
178 compteur_faces_paroi = 0; //Reinitialisation de compteur_faces_paroi
179
180 DoubleTab termes_sources;
181 termes_sources.resize(nb_elems,1);
182 eqn_temp.sources().calculer(termes_sources); //les termes sources
183 termes_sources /= rhoCp;
184
185 double T0=0.;// temperature de paroi
186
187
188 for (int n_bord=0; n_bord<domaine_VDF.nb_front_Cl(); n_bord++)
189 {
190 const Cond_lim& la_cl = le_dom_Cl_dis_->les_conditions_limites(n_bord);
191
192 if (sub_type(Dirichlet_paroi_fixe,la_cl.valeur()) )
193 {
194 const Front_VF& le_bord = ref_cast(Front_VF,la_cl->frontiere_dis());
195 ndeb = le_bord.num_premiere_face();
196 nfin = ndeb + le_bord.nb_faces();
197
198 for (int num_face=ndeb; num_face<nfin; num_face++)
199 {
200 if ((elem = face_voisins(num_face,0)) == -1)
201 elem = face_voisins(num_face,1);
202
203 //Distance a la paroi du 1er centre de maille
204 if (axi)
205 dist = domaine_VDF.dist_norm_bord_axi(num_face);
206 else
207 dist = domaine_VDF.dist_norm_bord(num_face);
208
209 eq_temp[compteur_faces_paroi].set_y0(0.); //ordonnee de la paroi
210 eq_temp[compteur_faces_paroi].set_yn(dist); //ordonnee du 1er centre de maille
211
212 assert(nb_comp==1); // il ne doit pas en etre autrement ici !
213 eq_temp[compteur_faces_paroi].initialiser(nb_comp, nb_pts,
214 fac, epsilon, max_it, nu_t_dyn); //nbre de pts maillage fin
215
216 double ts = termes_sources(elem)/volumes(elem);
217
218 eq_temp[compteur_faces_paroi].set_F(0, ts);
219 eq_temp[compteur_faces_paroi].set_u_y0(0,T0);//Temperature parietale
220 eq_temp[compteur_faces_paroi].set_u_yn(0,Temp(elem));//Temperature parietale
221
222 if (reprise_ok==0)
223 eq_temp[compteur_faces_paroi].set_Uinit_lin(0, Temp(elem), Temp(elem));
224
225 else
226 {
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)) ;
229 }
230
231 compteur_faces_paroi ++;
232 }//Fin boucle sur les faces de bords
233
234
235
236
237
238 }//Fin de paroi fixe
239
240 }//Fin boucle sur les bords parietaux
241
242
243 return 1;
244}
245
246
248{
249 const Domaine_VDF& domaine_VDF = ref_cast(Domaine_VDF, le_dom_dis_.valeur());
250
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();
255 const Convection_Diffusion_std& eqn_temp = mon_modele_turb_scal->equation();
256 const Equation_base& eqn_hydr = mon_modele_turb_scal->equation().probleme().equation(0);
257 const Fluide_base& le_fluide = ref_cast(Fluide_base, eqn_hydr.milieu());
258 const Champ_Don_base& ch_visco_cin = le_fluide.viscosite_cinematique();
259 const double tps = eqn_temp.schema_temps().temps_courant();
260 const double dt = eqn_temp.schema_temps().pas_de_temps();
261 const double dt_min = eqn_temp.schema_temps().pas_temps_min();
262 const double rhoCp = le_fluide.capacite_calorifique().valeurs()(0, 0) * le_fluide.masse_volumique().valeurs()(0, 0);
263 DoubleTab termes_sources;
264 termes_sources.resize(nb_elems,1);
265 eqn_temp.sources().calculer(termes_sources); //les termes sources
266 termes_sources /= rhoCp;
267
268 DoubleTab& alpha_t = diffusivite_turb.valeurs();
269 const DoubleTab& tab_visco = ch_visco_cin.valeurs();
270 int l_unif;
271 // double visco=-1;
272 if (sub_type(Champ_Uniforme,ch_visco_cin))
273 {
274 l_unif = 1;
275 // visco = std::max(tab_visco(0,0),DMINFLOAT);
276 }
277 else
278 l_unif = 0;
279
280 if ((!l_unif) && (tab_visco.local_min_vect()<DMINFLOAT))
281 // on ne doit pas changer tab_visco ici !
282 {
283 Cerr << "In Paroi_TBLE_scal_VDF::calculer_scal : visco = " << tab_visco.local_min_vect() << " <= 0 ? " << finl;
284 throw;
285 }
286 // tab_visco+=DMINFLOAT;
287
288 int ndeb=0,nfin=0;
289 int elem;
290 double dist;
291 int ori;
292
293 // int schmidt = 0;
294 //if (sub_type(Convection_Diffusion_Concentration,eqn_temp)) schmidt = 1;
295 // const Champ_Don_base& alpha = (schmidt==1?ref_cast(Convection_Diffusion_Concentration,eqn_temp).constituant().diffusivite_constituant():le_fluide.diffusivite());
296
297 const DoubleVect& Temp = eqn_temp.inconnue().valeurs();
298 const Domaine_Cl_VDF& domaine_Cl_VDF_th = ref_cast(Domaine_Cl_VDF,eqn_temp.domaine_Cl_dis());
299
300 double T0=0.;
301
302 int compteur_faces_paroi = 0;
303
304 for (int n_bord=0; n_bord<domaine_VDF.nb_front_Cl(); n_bord++)
305 {
306 const Cond_lim& la_cl = le_dom_Cl_dis_->les_conditions_limites(n_bord);
307
308 if (sub_type(Dirichlet_paroi_fixe,la_cl.valeur()) )
309 {
310 const Cond_lim& la_cl_th = domaine_Cl_VDF_th.les_conditions_limites(n_bord);
311 const Front_VF& le_bord = ref_cast(Front_VF,la_cl->frontiere_dis());
312 ndeb = le_bord.num_premiere_face();
313 nfin = ndeb + le_bord.nb_faces();
314
315 //find the associated boundary
316 int boundary_index=-1;
317 if (domaine_VDF.front_VF(n_bord).le_nom() == le_bord.le_nom())
318 boundary_index=n_bord;
319 assert(boundary_index >= 0);
320
321 for (int num_face=ndeb; num_face<nfin; num_face++)
322 {
323 ori = orientation(num_face);
324 if ((elem = face_voisins(num_face,0)) == -1)
325 elem = face_voisins(num_face,1);
326
327
328
329
330
331
332 if(sub_type(Echange_externe_impose,la_cl_th.valeur()))
333 {
334 const Echange_externe_impose& la_cl_ech = ref_cast(Echange_externe_impose,la_cl_th.valeur());
335 //OC 02/2006 : Attention, ce n'est pas encore correctement code !!!
336 //double hs = la_cl_ech.h_imp(num_face-ndeb);
337 //const DoubleTab& h_imp = la_cl_ech.h_imp().valeurs();
338 //double hs = h_imp(num_face-ndeb,0);
339
340 double Ts = la_cl_ech.T_ext(num_face-ndeb);//Temperature de paroi
341 //double hf = lambda_f(0,0)/tab_d_equiv_(num_face);
342
343 T0 = Ts;
344
345 // Cerr << "Temp("<<elem<<") = " << Temp(elem) << finl;
346 // Cerr << "T0 = " << T0 << finl;
347 // Cerr << "Ts = " << Ts << finl;
348 // Cerr << "hs = " << hs << finl;
349 // Cerr << "hf = " << hf << finl;
350 // Cerr << "deq = " << tab_d_equiv_(num_face) << finl;
351
352 //Cerr << "T0 = " << T0 << finl;
353 }
354 //############################
355 // FLUID-STRUCTURE CALCULATION
356 else if(sub_type(Echange_contact_VDF,la_cl_th.valeur()))
357 {
358 const Echange_contact_VDF& la_cl_couplee = ref_cast(Echange_contact_VDF,la_cl_th.valeur());
359 const DoubleTab& T_wall = la_cl_couplee.T_wall();
360 //Verif
361 // const double& Temp_solid = la_cl_couplee.T_autre_pb(num_face-ndeb);
362 // const DoubleTab& h_autre_pb = la_cl_couplee.h_autre_pb();
363 //Verif
364
365
366 T0 = T_wall(num_face-ndeb,0);//Temperature de paroi
367 }
368 else
369 {
370 T0=0.; // En principe si on est ici c est que la frontiere est de type flux_imposee, adiabatique... ou autre
371 // et que le d_equiv calculee par la loi de paroi ne sert a rien => on fait donc n'importe quoi sur TBLE !
372 }
373
374 //Distance a la paroi du 1er centre de maille
375 if (axi)
376 dist = domaine_VDF.dist_norm_bord_axi(num_face);
377 else
378 dist = domaine_VDF.dist_norm_bord(num_face);
379
380 if (dt<dt_min)
381 eq_temp[compteur_faces_paroi].set_dt(1.e12); // Ca ne devrait pas servir ???
382 else
383 eq_temp[compteur_faces_paroi].set_dt(dt);
384 eq_temp[compteur_faces_paroi].set_y0(0.); //ordonnee de la paroi
385 eq_temp[compteur_faces_paroi].set_yn(dist); //ordonnee du 1er centre de maille
386
387 double ts = termes_sources(elem)/volumes(elem);
388
389 eq_temp[compteur_faces_paroi].set_u_y0(0,T0);//Temperature parietale
390 eq_temp[compteur_faces_paroi].set_u_yn(0,Temp(elem));//Temperature premiere maille
391
392 ////////////////////////////////////
393 // Termes convectifs
394 ///////////////////////////////////
395
396 if (alpha_cv==1) //Si terme de convection : on ajoute terme source et convection dans la methode suivante
397 calculer_convection(compteur_faces_paroi, elem, ndeb, nfin, ori, ts);
398 else //sinon on ajoute just les termes sources ici :
399 {
400 for(int i=1 ; i<nb_pts+1 ; i++)
401 eq_temp[compteur_faces_paroi].set_F(0, i, ts);
402 }
403
404 if (statio==0)
405 eq_temp[compteur_faces_paroi].aller_au_temps(tps);
406 else
407 eq_temp[compteur_faces_paroi].aller_jusqu_a_convergence(max_it_statio, eps_statio);
408
409
410 // L'expression de d_equiv ne tient pas compte de alpha_t comme en VEF
411 // Cela dit, c'est normale car c'est lors du calcul du flux que la
412 // turbulence est prise en compte.
413 // Ne pas uniformiser l'ecriture avec le VEF, car on tombe sur des problemes
414 // au niveau des parois contacts entre plusieurs problemes (alpha_t pas recuperable !).
415 int global_face=num_face;
416 int local_face=domaine_VDF.front_VF(boundary_index).num_local_face(global_face);
417 if(std::fabs(eq_temp[compteur_faces_paroi].get_Unp1(0,1) - T0)<1e-10)
418 equivalent_distance_[boundary_index][local_face] = 1e10;
419 else
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);
422 if(equivalent_distance_[boundary_index][local_face]<1e-10)
423 equivalent_distance_[boundary_index][local_face]= dist;
424
425 alpha_t(elem)=eq_temp[compteur_faces_paroi].get_nu_t_yn();
426
427 compteur_faces_paroi++;
428
429 }//fin boucle sur les faces de bords
430 // compt++;
431
432 }//Fin de paroi fixe
433 }//fin boucle sur les bords
434
435 if(oui_stats==1)
436 calculer_stats();
437
438 // clock1=clock();
439 // double time = (clock1-clock0)*1.e-6;
440 // if(je_suis_maitre()) { Cerr << " CPU time TBLE scal : " << Process::mp_max(time) << finl; }
441
442 return 1;
443}
444
445//***************************************************************
446// Sauvegarde des champs moyennes en temps dans le maillage fin *
447//***************************************************************
448
449int Paroi_TBLE_scal_VDF::calculer_stats()
450{
451 const Domaine_VDF& domaine_VDF = ref_cast(Domaine_VDF, le_dom_dis_.valeur());
452
453 const IntVect& orientation = domaine_VDF.orientation();
454
455 const Convection_Diffusion_std& eqn_temp = mon_modele_turb_scal->equation();
456 const double tps = eqn_temp.inconnue().temps();
457 const double dt = eqn_temp.schema_temps().pas_de_temps();
458 const Equation_base& eqn_hydr = mon_modele_turb_scal->equation().probleme().equation(0);
459 const RefObjU& modele_turbulence_hydr = eqn_hydr.get_modele(TURBULENCE);
460 const Modele_turbulence_hyd_base& mod_turb_hydr = ref_cast(Modele_turbulence_hyd_base,modele_turbulence_hydr.valeur());
461 const Turbulence_paroi_base& loi = mod_turb_hydr.loi_paroi();
462 ParoiVDF_TBLE& loi_tble_hyd = ref_cast_non_const(ParoiVDF_TBLE,loi);
463
464
465
466 //////////////////////////////////////
467 //Moyennes Temporelles
468 //////////////////////////////////////
469 if(((tps>tps_deb_stats) && (tps<tps_fin_stats)) && (oui_stats!=0))
470 {
471 if (dimension==2)
472 {
473 for(int j=0; j<nb_post_pts; j++)
474 {
475 for(int i=0 ; i<nb_pts+1 ; i++)
476 {
477 double T=eq_temp[num_faces_post(j)].get_Unp1(0,i);
478 double u=loi_tble_hyd.get_eq_couch_lim(num_faces_post(j)).get_Unp1(0,i);
479 calculer_stat(j,i,u,0,0,T,dt);
480 }
481 }
482 }
483 else if (dimension==3)
484 {
485 for(int j=0; j<nb_post_pts; j++)
486 {
487 int ori=orientation(num_global_faces_post(j));
488 if (ori == 0)
489 {
490 for(int i=0 ; i<nb_pts+1 ; i++)
491 {
492 double T=eq_temp[num_faces_post(j)].get_Unp1(0,i);
493 double u=loi_tble_hyd.get_eq_couch_lim(num_faces_post(j)).get_v(i);
494 double v=loi_tble_hyd.get_eq_couch_lim(num_faces_post(j)).get_Unp1(0,i);
495 double w=loi_tble_hyd.get_eq_couch_lim(num_faces_post(j)).get_Unp1(1,i);
496 calculer_stat(j,i,u,v,w,T,dt);
497 }
498 }
499 else if (ori == 1)
500 {
501 for(int i=0 ; i<nb_pts+1 ; i++)
502 {
503 double T=eq_temp[num_faces_post(j)].get_Unp1(0,i);
504 double u=loi_tble_hyd.get_eq_couch_lim(num_faces_post(j)).get_Unp1(1,i);
505 double v=loi_tble_hyd.get_eq_couch_lim(num_faces_post(j)).get_v(i);
506 double w=loi_tble_hyd.get_eq_couch_lim(num_faces_post(j)).get_Unp1(0,i);
507 calculer_stat(j,i,u,v,w,T,dt);
508 }
509 }
510 else if (ori == 2)
511 {
512 for(int i=0 ; i<nb_pts+1 ; i++)
513 {
514 double T=eq_temp[num_faces_post(j)].get_Unp1(0,i);
515 double u=loi_tble_hyd.get_eq_couch_lim(num_faces_post(j)).get_Unp1(0,i);
516 double v=loi_tble_hyd.get_eq_couch_lim(num_faces_post(j)).get_Unp1(1,i);
517 double w=loi_tble_hyd.get_eq_couch_lim(num_faces_post(j)).get_v(i);
518 calculer_stat(j,i,u,v,w,T,dt);
519 }
520 }
521 }
522 }
523 }
524
525 return 1;
526}
527
528
529
531{
532 const Convection_Diffusion_std& eqn_temp = mon_modele_turb_scal->equation();
533 const double tps = eqn_temp.inconnue().temps();
534
536
538
540}
541
543{
544 const Domaine_VDF& domaine_VDF = ref_cast(Domaine_VDF, le_dom_dis_.valeur());
545
546 double tps = mon_modele_turb_scal->equation().inconnue().temps();
547 return Paroi_TBLE_QDM_Scal::sauvegarder(os, domaine_VDF, le_dom_Cl_dis_.valeur(), tps);
548}
549
550
552{
553 if (le_dom_dis_) // test pour ne pas planter dans "avancer_fichier(...)"
554 {
555 const Domaine_VDF& domaine_VDF = ref_cast(Domaine_VDF, le_dom_dis_.valeur());
556
557 double tps_reprise = mon_modele_turb_scal->equation().schema_temps().temps_courant();
558 return Paroi_TBLE_QDM_Scal::reprendre(is, domaine_VDF, le_dom_Cl_dis_.valeur(), tps_reprise);
559 }
560 return 1;
561}
562
563
564
565void Paroi_TBLE_scal_VDF::calculer_convection(int compteur_faces_paroi, int elem, int ndeb, int nfin, int ori, double ts)
566{
567 const Equation_base& eqn_hydr = mon_modele_turb_scal->equation().probleme().equation(0);
568 const RefObjU& modele_turbulence_hydr = eqn_hydr.get_modele(TURBULENCE);
569 const Modele_turbulence_hyd_base& mod_turb_hydr = ref_cast(Modele_turbulence_hyd_base,modele_turbulence_hydr.valeur());
570 const Turbulence_paroi_base& loi = mod_turb_hydr.loi_paroi();
571 ParoiVDF_TBLE& loi_tble_hyd = ref_cast_non_const(ParoiVDF_TBLE,loi);
572 const Domaine_VDF& domaine_VDF = ref_cast(Domaine_VDF, le_dom_dis_.valeur());
573
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;
579
580 // 1er couple de faces perpendiculaires a la paroi
581 int face1 = elem_faces(elem,(ori+1));
582 int face2 = elem_faces(elem,(ori+4)%6);
583 // 2e couple de faces perpendiculaires a la paroi
584 int face3 = elem_faces(elem,(ori+2));
585 int face4 = elem_faces(elem,(ori+5)%6);
586
587 //On cherche les elements voisins de l'element considere
588
589 elem_gauche0 = face_voisins(face1,0);
590 elem_droite0 = face_voisins(face2,1);
591 if (elem_gauche0 == elem)
592 {
593 elem_droite0 = face_voisins(face1,1);
594 elem_gauche0 = face_voisins(face2,0);
595 }
596
597 elem_gauche1 = face_voisins(face3,0);
598 elem_droite1 = face_voisins(face4,1);
599 if (elem_gauche1 == elem)
600 {
601 elem_droite1 = face_voisins(face3,1);
602 elem_gauche1 = face_voisins(face4,0);
603 }
604
605 //On evite les coins interieurs
606 if((elem_droite1!=-1)&&(elem_droite0!=-1)&&(elem_gauche1!=-1)&&(elem_gauche0!=-1))
607 {
608 //On cherche les faces parietales voisines de la face
609 face_gauche0 = elem_faces(elem_gauche0, ori);
610 if ((face_voisins(face_gauche0,0) != -1)&&(face_voisins(face_gauche0,1) != -1))
611 {
612 face_gauche0 = elem_faces(elem_gauche0, ori+3);
613 }
614 face_droite0 = elem_faces(elem_droite0, ori);
615 if ((face_voisins(face_droite0,0) != -1)&&(face_voisins(face_droite0,1) != -1))
616 {
617 face_droite0 = elem_faces(elem_droite0, ori+3);
618 }
619
620 face_gauche1 = elem_faces(elem_gauche1, ori);
621 if ((face_voisins(face_gauche1,0) != -1)&&(face_voisins(face_gauche1,1) != -1))
622 {
623 face_gauche1 = elem_faces(elem_gauche1, ori+3);
624 }
625 face_droite1 = elem_faces(elem_droite1, ori);
626 if ((face_voisins(face_droite1,0) != -1)&&(face_voisins(face_droite1,1) != -1))
627 {
628 face_droite1 = elem_faces(elem_droite1, ori+3);
629 }
630
631
632 //On evite les coins exterieurs (on evite de calculer des gradients sur des faces non parietales)
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))
635 {
636
637 // ///////////////////////////////
638 // //Calcul des termes convectifs
639 // ///////////////////////////////
640 double d00d0 = 0., d0vdy= 0., d01d1= 0.;
641
642 eq_temp[compteur_faces_paroi].set_F(0, 0, ts - alpha_cv*(d00d0+d01d1+d0vdy));
643
644 for(int i=1 ; i<nb_pts ; i++)
645 {
646 d00d0 = (loi_tble_hyd.get_eq_couch_lim(corresp[face_gauche0]).get_Unp1(0,i)
647 *0.5*(eq_temp[corresp[face_gauche0]].get_Unp1(0,i)+eq_temp[compteur_faces_paroi].get_Unp1(0,i))
648 -loi_tble_hyd.get_eq_couch_lim(corresp[face_droite0]).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)))
650 /(domaine_VDF.dist_elem_period(elem_gauche0,elem,orientation(face1))
651 +domaine_VDF.dist_elem_period(elem,elem_droite0,orientation(face1)));
652
653 d01d1 = (loi_tble_hyd.get_eq_couch_lim(corresp[face_gauche0]).get_Unp1(1,i)
654 *0.5*(eq_temp[corresp[face_gauche0]].get_Unp1(0,i)+eq_temp[compteur_faces_paroi].get_Unp1(0,i))
655 -loi_tble_hyd.get_eq_couch_lim(corresp[face_droite0]).get_Unp1(1,i)
656 *0.5*(eq_temp[corresp[face_droite0]].get_Unp1(0,i)+eq_temp[compteur_faces_paroi].get_Unp1(0,i)))
657 /(domaine_VDF.dist_elem_period(elem_gauche1,elem,orientation(face3))
658 +domaine_VDF.dist_elem_period(elem,elem_droite1,orientation(face3)));
659
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));
663
664 eq_temp[compteur_faces_paroi].set_F(0, i, ts - alpha_cv*(d00d0+d01d1+d0vdy));
665
666 }
667
668 int i=nb_pts;
669
670 d00d0 = (loi_tble_hyd.get_eq_couch_lim(corresp[face_gauche0]).get_Unp1(0,i)
671 *0.5*(eq_temp[corresp[face_gauche0]].get_Unp1(0,i)+eq_temp[compteur_faces_paroi].get_Unp1(0,i))
672 -loi_tble_hyd.get_eq_couch_lim(corresp[face_droite0]).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)))
674 /(domaine_VDF.dist_elem_period(elem_gauche0,elem,orientation(face1))
675 +domaine_VDF.dist_elem_period(elem,elem_droite0,orientation(face1)));
676
677 d01d1 = (loi_tble_hyd.get_eq_couch_lim(corresp[face_gauche0]).get_Unp1(1,i)
678 *0.5*(eq_temp[corresp[face_gauche0]].get_Unp1(0,i)+eq_temp[compteur_faces_paroi].get_Unp1(0,i))
679 -loi_tble_hyd.get_eq_couch_lim(corresp[face_droite0]).get_Unp1(1,i)
680 *0.5*(eq_temp[corresp[face_droite0]].get_Unp1(0,i)-eq_temp[compteur_faces_paroi].get_Unp1(0,i)))
681 /(domaine_VDF.dist_elem_period(elem_gauche1,elem,orientation(face3))
682 +domaine_VDF.dist_elem_period(elem,elem_droite1,orientation(face3)));
683
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));
687
688 eq_temp[compteur_faces_paroi].set_F(0, i, ts - (d00d0+d01d1+d0vdy));
689
690 }//fin if pas coins interieurs
691 }//fin if pas coins exterieurs
692 else
693 {
694 for(int i=1 ; i<nb_pts+1 ; i++)
695 {
696 eq_temp[compteur_faces_paroi].set_F(0, i, ts);
697 }
698 }
699}
700
701
703{
704 const Probleme_base& pb_base = mon_modele_turb_scal->equation().probleme();
705 return pb_base;
706}
707
709{
710 const Probleme_base& pb_base = mon_modele_turb_scal->equation().probleme();
711 const Equation_base& eqn_hydr = pb_base.equation(0);
712 const RefObjU& modele_turbulence_hydr = eqn_hydr.get_modele(TURBULENCE);
713 const Modele_turbulence_hyd_base& mod_turb_hydr = ref_cast(Modele_turbulence_hyd_base,modele_turbulence_hydr.valeur());
714 const Turbulence_paroi_base& loi = mod_turb_hydr.loi_paroi();
715
716 if (sub_type(ParoiVDF_TBLE,loi))
717 {
718 return ref_cast_non_const(ParoiVDF_TBLE,loi);
719 }
720 else
721 {
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;
724 }
725 return getLoiParoiHydraulique();//n'arrive jamais ici
726}
727
732
737
738
739// Des restes du developpement de Younes :
740/*
741 Nom nom_fic ="First_TBLE_cell_temp.dat";
742 SFichier fc(nom_fic, ios::app);
743 fc << tps << " " << eq_temp[corresp[ndeb]].get_Unp1(0,1) << finl;
744
745 //////////////////////////////////////
746 // Moyennes Spatiales
747 //////////////////////////////////////
748
749
750 for (int n_bord=0; n_bord<domaine_VDF.nb_front_Cl(); n_bord++)
751 {
752 const Cond_lim& la_cl = le_dom_Cl_dis_->les_conditions_limites(n_bord);
753
754 if (sub_type(Dirichlet_paroi_fixe,la_cl.valeur()) )
755 {
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++)
760 {
761 if (dimension == 3)
762 {
763 for(int num_face=ndeb; num_face<nfin; num_face++)
764 {
765 if(face_voisins(num_face,0)==-1)
766 {
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);
773 }
774 }// for num_face
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;
781 }// if dim3
782 }// for i = ...
783 for(int i=0 ; i<nb_pts ; i++)
784 {
785 if (dimension == 3)
786 {
787 for(int num_face=ndeb; num_face<nfin; num_face++)
788 {
789 if(face_voisins(num_face,0)==-1)
790 {
791 Alpha_mean(i)+=eq_temp[corresp[num_face]].get_nut(i);
792 }
793 }// for num_face
794 Alpha_mean(i) = Alpha_mean(i)/nb_faces_bas;
795 }// if dim3
796 }// for i = ...
797 }// boucle bords
798 //Cerr << "Tmean_spat_sum(N) = " << Tmean(nb_pts) << " " << nb_faces_bas << " " << tps << finl;
799 }
800*/
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
Champ_Uniforme Represents a field that is constant in space and time.
double temps() const
Returns the time of the field.
class Cond_lim Generic class used to represent any class
Definition Cond_lim.h:31
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.
class Domaine_Cl_VDF
const Cond_lim & les_conditions_limites(int) const
Returns the i-th boundary condition.
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).
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
Definition Domaine_VF.h:113
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.
Definition Domaine_VF.h:542
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
const DoubleTab & T_wall() 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,...
Definition Entree.h:42
double get_v(int i)
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:
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.
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.
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
CLASS: ParoiVDF_TBLE.
int reprendre(Entree &, const Domaine_dis_base &, const Domaine_Cl_dis_base &, double tps)
void imprimer_sondes(Sortie &, double, const VECT(DoubleVect)&) const
Entree & lire_donnees(const Motcle &motlu, Entree &s)
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)
void imprimer_stat(Sortie &, double) const
CLASS: Paroi_TBLE_Impl.
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.
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
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.
Definition Process.cpp:466
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.
Definition Sortie.h:52
DoubleTab & calculer(DoubleTab &) const
Calculates the contribution of all sources in the list and stores the result in the array passed as p...
Definition Sources.cpp:98
void resize(_SIZE_ n, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)
Definition TRUSTTab.tpp:469
_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....