TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Traitement_particulier_NS_Profils_VDF.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_Profils_VDF.h>
17#include <Domaine_VDF.h>
18#include <Schema_Temps_base.h>
19#include <communications.h>
20#include <SFichier.h>
21#include <Navier_Stokes_std.h>
22#include <Modele_turbulence_hyd_base.h>
23
24Implemente_instanciable(Traitement_particulier_NS_Profils_VDF,"Traitement_particulier_NS_Profils_VDF",Traitement_particulier_NS_Profils);
25
26
27/*! @brief
28 *
29 * @param (Sortie& is) un flot de sortie
30 * @return (Sortie&) le flot de sortie modifie
31 */
33{
34 return is;
35}
36
37
38/*! @brief
39 *
40 * @param (Entree& is) un flot d'entree
41 * @return (Entree&) le flot d'entree modifie
42 */
44{
45 return is;
46}
47
52
54{
55 if (motlu=="nb_points")
56 {
57 is >> Nap;
58 }
59 else
60 {
61 Cerr << "Error while reading in Traitement_particulier_NS_Profils_VDF::readOn" << finl;
62 Cerr << "Possible key-words are : nb_points , { and } " << finl;
63 Cerr << "User specified :" << motlu << finl;
64 exit();
65 }
66 return is;
67}
68
70{
71 DoubleTab umoy_x_m(n_probes,Nap);
72 umoy_x_m=0.;
73 DoubleTab umoy_y_m(n_probes,Nap);
74 umoy_y_m=0.;
75 DoubleTab umoy_z_m(n_probes,Nap);
76 umoy_z_m=0.;
77 DoubleTab umoy_2_m(n_probes,Nap);
78 umoy_2_m=0.;
79 DoubleTab vmoy_2_m(n_probes,Nap);
80 vmoy_2_m=0.;
81 DoubleTab wmoy_2_m(n_probes,Nap);
82 wmoy_2_m=0.;
83 DoubleTab umoy_3_m(n_probes,Nap);
84 umoy_3_m=0.;
85 DoubleTab vmoy_3_m(n_probes,Nap);
86 vmoy_3_m=0.;
87 DoubleTab wmoy_3_m(n_probes,Nap);
88 wmoy_3_m=0.;
89 DoubleTab umoy_4_m(n_probes,Nap);
90 umoy_4_m=0.;
91 DoubleTab vmoy_4_m(n_probes,Nap);
92 vmoy_4_m=0.;
93 DoubleTab wmoy_4_m(n_probes,Nap);
94 wmoy_4_m=0.;
95 DoubleTab uv_moy_m(n_probes,Nap);
96 uv_moy_m=0.;
97 DoubleTab nu_t_inst_m(n_probes,Nap);
98 nu_t_inst_m=0.;
99
100 DoubleTab umoy_x_p(n_probes,Nap);
101 umoy_x_p=0.;
102 DoubleTab umoy_y_p(n_probes,Nap);
103 umoy_y_p=0.;
104 DoubleTab umoy_z_p(n_probes,Nap);
105 umoy_z_p=0.;
106 DoubleTab umoy_2_p(n_probes,Nap);
107 umoy_2_p=0.;
108 DoubleTab vmoy_2_p(n_probes,Nap);
109 vmoy_2_p=0.;
110 DoubleTab wmoy_2_p(n_probes,Nap);
111 wmoy_2_p=0.;
112 DoubleTab umoy_3_p(n_probes,Nap);
113 umoy_3_p=0.;
114 DoubleTab vmoy_3_p(n_probes,Nap);
115 vmoy_3_p=0.;
116 DoubleTab wmoy_3_p(n_probes,Nap);
117 wmoy_3_p=0.;
118 DoubleTab umoy_4_p(n_probes,Nap);
119 umoy_4_p=0.;
120 DoubleTab vmoy_4_p(n_probes,Nap);
121 vmoy_4_p=0.;
122 DoubleTab wmoy_4_p(n_probes,Nap);
123 wmoy_4_p=0.;
124 DoubleTab uv_moy_p(n_probes,Nap);
125 uv_moy_p=0.;
126 DoubleTab nu_t_inst_p(n_probes,Nap);
127 nu_t_inst_p=0.;
128
129 double tps = mon_equation->inconnue().temps();
130 if (oui_u_inst != 0)
131 {
132 calculer_moyenne_spatiale_vitesse(umoy_x_m,umoy_2_m,umoy_3_m,umoy_4_m,corresp_u_m,compt_x_m,Nxy,0,xUm);
133 calculer_moyenne_spatiale_vitesse(umoy_x_p,umoy_2_p,umoy_3_p,umoy_4_p,corresp_u_p,compt_x_p,Nxy,0,xUp);
134
135 calculer_moyenne_spatiale_vitesse(umoy_y_m,vmoy_2_m,vmoy_3_m,vmoy_4_m,corresp_v_m,compt_y_m,Nyy,1,xVm);
136 calculer_moyenne_spatiale_vitesse(umoy_y_p,vmoy_2_p,vmoy_3_p,vmoy_4_p,corresp_v_p,compt_y_p,Nyy,1,xVp);
137
138 calculer_moyenne_spatiale_vitesse(umoy_z_m,wmoy_2_m,wmoy_3_m,wmoy_4_m,corresp_w_m,compt_z_m,Nzy,2,xWm);
139 calculer_moyenne_spatiale_vitesse(umoy_z_p,wmoy_2_p,wmoy_3_p,wmoy_4_p,corresp_w_p,compt_z_p,Nzy,2,xWp);
142 static double temps_dern_post_inst = -100.;
143
144 if (std::fabs(tps-temps_dern_post_inst)>=dt_post_inst)
145 {
146 ecriture_fichiers_moy_spat(umoy_x_m,umoy_2_m,umoy_3_m,umoy_4_m,umoy_x_p,umoy_2_p,umoy_3_p,umoy_4_p,delta_Um,delta_Up,Nxy,Yu_m,0);
147 ecriture_fichiers_moy_spat(umoy_y_m,vmoy_2_m,vmoy_3_m,vmoy_4_m,umoy_y_p,vmoy_2_p,vmoy_3_p,vmoy_4_p,delta_Vm,delta_Vp,Nyy,Yv_m,1);
148 ecriture_fichiers_moy_spat(umoy_z_m,wmoy_2_m,wmoy_3_m,wmoy_4_m,umoy_z_p,wmoy_2_p,wmoy_3_p,wmoy_4_p,delta_Wm,delta_Wp,Nzy,Yw_m,2);
150
151 temps_dern_post_inst = tps;
152 }
153 }
154
155 if (oui_profil_nu_t != 0)
156 {
159
160 static double temps_dern_post_inst_nut = -100.;
161 if (std::fabs(tps-temps_dern_post_inst_nut)>=dt_post_inst)
162 {
164 temps_dern_post_inst_nut = tps;
165 }
166 }
167
168 ////// Moyenne temporelle*********************************************//
169 if (oui_stat != 0)
170 {
171 double tpsbis = mon_equation->inconnue().temps();
172 if ((tpsbis>=temps_deb)&&(tpsbis<=temps_fin))
173 {
174 static int init_stat_temps = 0;
175 if((init_stat_temps==0)&&( oui_repr != 1)) // si ce n est pas une reprise : sinon valeurs lues dans le fichier de reprise
176 {
177 double dt_v = mon_equation->schema_temps().pas_de_temps();
178 temps_deb = tpsbis-dt_v;
179 init_stat_temps++;
180 }
181
185
187
191
195
199
200
201 if (oui_profil_nu_t != 0)
203
204 static double temps_dern_post_stat = -100.;
205 if (std::fabs(tpsbis-temps_dern_post_stat)>=dt_post_stat)
206 {
207 double dt = tpsbis-temps_deb;
208
213 if (oui_profil_nu_t != 0)
215 temps_dern_post_stat = tpsbis;
216 }
217 }
218 }
219}
220
221
222
223
224
225
226
228{
229 // On va initialiser les differents parametres membres de la classe
230 // utiles au calcul des differentes moyennes
231 // Initialisation de : Yu,Yv,Yw,Yuv + compt_x,compt_y,compt_z,compt_uv
232 // + corresp_u,corresp_v,corresp_w,corresp_uv
233 const Domaine_dis_base& zdisbase=mon_equation->inconnue().domaine_dis_base();
234 const Domaine_VDF& domaine_VDF=ref_cast(Domaine_VDF, zdisbase);
235
236 const DoubleTab& xv = domaine_VDF.xv();
237 const DoubleTab& xp = domaine_VDF.xp();
238
239 int nb_faces = domaine_VDF.nb_faces();
240 int nb_elems = domaine_VDF.domaine().nb_elem();
241
242 const IntVect& orientation = domaine_VDF.orientation();
243
244 int num_face,num_elem,ori,indic_m,indicv_m,indicw_m,indicuv_m,indic_p,indicv_p,indicw_p,indicuv_p,trouve;
245 int i,j;
246 double y;
247 j=0;
248 indic_m = indic_p = 0;
249 indicv_m = indicv_p = 0;
250 indicw_m = indicw_p = 0;
251 indicuv_m = indicuv_p = 0;
252
253 // initialisation des differentes tailles de tableaux
254 Nxy.resize(n_probes);
255 Nyy.resize(n_probes);
256 Nzy.resize(n_probes);
257 Nuv.resize(n_probes);
258 Nxy = Nap;
259 Nyy = Nap;
260 Nzy = Nap;
261 Nuv = Nap;
262
263 // dimensionnement aux valeurs rentrees dans le jeu de donnees
264 // The points before the value of the probe
265 xUm.resize(n_probes);
266 xWm.resize(n_probes);
267 xVm.resize(n_probes);
268 xUVm.resize(n_probes);
269
270 delta_Um.resize(n_probes);
271 delta_Wm.resize(n_probes);
272 delta_Vm.resize(n_probes);
273 delta_UVm.resize(n_probes);
274
275 // The points after the value of the probe
276 xUp.resize(n_probes);
277 xWp.resize(n_probes);
278 xVp.resize(n_probes);
279 xUVp.resize(n_probes);
280
281 delta_Up.resize(n_probes);
282 delta_Wp.resize(n_probes);
283 delta_Vp.resize(n_probes);
284 delta_UVp.resize(n_probes);
285
286 // initialisation
287 // The points before the value of the probe
288 Yu_m = -100.;
289 Yv_m = -100.;
290 Yw_m = -100.;
291 Yuv_m = -100.;
292
293 compt_x_m = 0;
294 compt_y_m = 0;
295 compt_z_m = 0;
296 compt_uv_m = 0;
297
298 corresp_u_m = -1;
299 corresp_v_m = -1;
300 corresp_w_m = -1;
301 corresp_uv_m = -1;
302 // The points after the value of the probe
303 Yu_p = -100.;
304 Yv_p = -100.;
305 Yw_p = -100.;
306 Yuv_p = -100.;
307
308 compt_x_p = 0;
309 compt_y_p = 0;
310 compt_z_p = 0;
311 compt_uv_p = 0;
312
313 corresp_u_p = -1;
314 corresp_v_p = -1;
315 corresp_w_p = -1;
316 corresp_uv_p = -1;
317
319
320 Cerr << (int)system("mkdir Space_Avg") << finl;
321 Cerr << (int)system("mkdir Time_Avg") << finl;
322
323 // remplissage des tableaux ci-dessus
324
325 // On cherche tout d'abord les coordonnees des points les plus proches de chaque cote et on les stocke
326 for(i=0; i<n_probes; i++)
327 {
328 //Boucle sur les faces
329 for (num_face=0; num_face<nb_faces; num_face++)
330 {
331 ori = orientation(num_face);
332
333 if((xv(num_face,dir_profil)-positions(i))>=0)
334 {
335 if(ori==0)
336 {
337 if((xv(num_face,dir_profil)-positions(i))<delta_Up(i))
338 {
339 xUp(i)=xv(num_face,dir_profil);
340 delta_Up(i)=xv(num_face,dir_profil)-positions(i);
341 }
342 }
343 else if(ori==2)
344 {
345 if((xv(num_face,dir_profil)-positions(i))<delta_Wp(i))
346 {
347 xWp(i)=xv(num_face,dir_profil);
348 delta_Wp(i)=xv(num_face,dir_profil)-positions(i);
349 }
350 }
351 else if(ori==1)
352 {
353 if((xv(num_face,dir_profil)-positions(i))<delta_Vp(i))
354 {
355 xVp(i)=xv(num_face,dir_profil);
356 delta_Vp(i)=xv(num_face,dir_profil)-positions(i);
357 }
358 }
359 else
360 {
361 Cerr << "Pb dans Traitement_particulier_NS_Profils_VDF::init_calcul_moyenne" << finl;
362 Cerr << "Pb avec la direction de la face!" << finl;
363 exit();
364 }
365 }
366 else
367 {
368 if(ori==0)
369 {
370 if((positions(i)-xv(num_face,dir_profil))<delta_Um(i))
371 {
372 xUm(i)=xv(num_face,dir_profil);
373 delta_Um(i)=positions(i)-xv(num_face,dir_profil);
374 }
375 }
376 else if(ori==2)
377 {
378 if((positions(i)-xv(num_face,dir_profil))<delta_Wm(i))
379 {
380 xWm(i)=xv(num_face,dir_profil);
381 delta_Wm(i)=positions(i)-xv(num_face,dir_profil);
382 }
383 }
384 else if(ori==1)
385 {
386 if((positions(i)-xv(num_face,dir_profil))<delta_Vm(i))
387 {
388 xVm(i)=xv(num_face,dir_profil);
389 delta_Vm(i)=positions(i)-xv(num_face,dir_profil);
390 }
391 }
392
393 else
394 {
395 Cerr << "Pb dans Traitement_particulier_NS_Profils_VDF::init_calcul_moyenne" << finl;
396 Cerr << "Pb avec la direction de la face!" << finl;
397 exit();
398 }
399 }
400 }
401
402
403 //Boucle sur les elements
404 for (num_elem=0; num_elem<nb_elems; num_elem++)
405 {
406 if((xp(num_elem,dir_profil)-positions(i))>=0)
407 {
408 if((xp(num_elem,dir_profil)-positions(i))<delta_UVp(i))
409 {
410 xUVp(i)=xp(num_elem,dir_profil);
411 delta_UVp(i)=xp(num_elem,dir_profil)-positions(i);
412 }
413 }
414 else
415 {
416 if((positions(i)-xp(num_elem,dir_profil))<delta_UVm(i))
417 {
418 xUVm(i)=xp(num_elem,dir_profil);
419 delta_UVm(i)=positions(i)-xp(num_elem,dir_profil);
420 }
421 }
422 }//Fin boucle sur les elements
423
424 }
425
426 int numb_del_probes=0;
427 //Verification des sondes pour voir si elles sont bien toutes definies
428 //dans le domaine de calcul
429 for(i=0; i<n_probes; i++)
430 {
431 if((delta_Um(i)==10000000)||(delta_Up(i)==10000000)||
432 (delta_Wm(i)==10000000)||(delta_Wp(i)==10000000)||
433 (delta_Vm(i)==10000000)||(delta_Vp(i)==10000000)||
434 (delta_UVm(i)==10000000)||(delta_UVp(i)==10000000))
435 {
436 Cerr << "Probe Number " << i+1+numb_del_probes << " undefined in computational domain." << finl;
437 Cerr << "It will be deleted from profile list !" << finl;
438 n_probes--;
439 numb_del_probes++;
440 for(j=i; j<n_probes; j++)
441 {
442 delta_Um(j)=delta_Um(j+1);
443 delta_Up(j)=delta_Up(j+1);
444 delta_Wm(j)=delta_Wm(j+1);
445 delta_Wp(j)=delta_Wp(j+1);
446 delta_Vm(j)=delta_Vm(j+1);
447 delta_Vp(j)=delta_Vp(j+1);
448 delta_UVm(j)=delta_UVm(j+1);
449 delta_UVp(j)=delta_UVp(j+1);
450 xUm(j)=xUm(j+1);
451 xUp(j)=xUp(j+1);
452 xWm(j)=xWm(j+1);
453 xWp(j)=xWp(j+1);
454 xVm(j)=xVm(j+1);
455 xVp(j)=xVp(j+1);
456 xUVm(j)=xUVm(j+1);
457 xUVp(j)=xUVp(j+1);
458 positions(j)=positions(j+1);
459 }
460 i=i-1;
461 }
462 }
463
464 //Dimensionnement maintenant que l'on connait le nombre exact de probes
465 Yu_m.resize(n_probes,Nap);
466 Yv_m.resize(n_probes,Nap);
467 Yw_m.resize(n_probes,Nap);
468 Yuv_m.resize(n_probes,Nap);
469
470 compt_x_m.resize(n_probes,Nap);
471 compt_y_m.resize(n_probes,Nap);
472 compt_z_m.resize(n_probes,Nap);
473 compt_uv_m.resize(n_probes,Nap);
474
475 corresp_u_m.resize(n_probes,nb_faces);
476 corresp_v_m.resize(n_probes,nb_faces);
477 corresp_w_m.resize(n_probes,nb_faces);
478 corresp_uv_m.resize(n_probes,nb_elems);
479
480 Yu_p.resize(n_probes,Nap);
481 Yv_p.resize(n_probes,Nap);
482 Yw_p.resize(n_probes,Nap);
483 Yuv_p.resize(n_probes,Nap);
484
485 compt_x_p.resize(n_probes,Nap);
486 compt_y_p.resize(n_probes,Nap);
487 compt_z_p.resize(n_probes,Nap);
488 compt_uv_p.resize(n_probes,Nap);
489
490 corresp_u_p.resize(n_probes,nb_faces);
491 corresp_v_p.resize(n_probes,nb_faces);
492 corresp_w_p.resize(n_probes,nb_faces);
493 corresp_uv_p.resize(n_probes,nb_elems);
494
495
496
497
498
499 // Impression dans le Cerr pour verifications
500 Cerr << finl;
501 Cerr << " UPPER/LOWER BOUNDS FOR PROFILES :" << finl;
502 for(i=0; i<n_probes; i++)
503 {
504 Cerr << "Profile " << i+1 << " : X= " << positions(i) << finl;
505 Cerr << "xUm= " << xUm(i) << " xUp= " << xUp(i) << finl;
506 Cerr << "xElm= " << xUVm(i) << " xElp= " << xUVp(i) << finl;
507 Cerr << finl;
508 }
509
510
511
512 //On remplit les tableaux de correspondances
513 for(i=0; i<n_probes; i++)
514 {
515 indic_m = indic_p = 0;
516 indicv_m = indicv_p = 0;
517 indicw_m = indicw_p = 0;
518 indicuv_m = indicuv_p = 0;
519 //Boucle sur les faces pour avoir la correspondance pour les composantes de la vitesse.
520 for (num_face=0; num_face<nb_faces; num_face++)
521 {
522 ori = orientation(num_face);
523 switch(ori)
524 {
525 //Pour la composante de vitesse U
526 case 0:
527 {
528 //Point avant
529 if(xv(num_face,dir_profil)==xUm(i))
530 {
531 y = xv(num_face,3-homo_dir-dir_profil);
532 trouve = 0;
533 for (j=0; j-(indic_m+1)<0; j++)
534 {
535 if (j==Nap)
536 {
537 Cerr << "Erreur dans la valeur du nombre de points pour le traitement particulier"<<finl;
538 Cerr <<"qui est trop petite dans votre jeu de donnees=" << Nap << finl;
539 exit();
540 }
541 if(est_egal(y,Yu_m(i,j)))
542 {
543 corresp_u_m(i,num_face) = j;
544 compt_x_m(i,j) ++;
545 j=indic_m+1;
546 trouve = 1;
547 }
548 }
549 if (trouve==0)
550 {
551 corresp_u_m(i,num_face) = indic_m;
552 Yu_m(i,indic_m)=y;
553 compt_x_m(i,indic_m) ++;
554 indic_m++;
555 }
556 }
557 //Point apres
558 else if(xv(num_face,dir_profil)==xUp(i))
559 {
560 y = xv(num_face,3-homo_dir-dir_profil);
561 trouve = 0;
562 for (j=0; j-(indic_p+1)<0; j++)
563 {
564 if (j==Nap)
565 {
566 Cerr << "Erreur dans la valeur du nombre de points pour le traitement particulier"<<finl;
567 Cerr <<"qui est trop petite dans votre jeu de donnees=" << Nap << finl;
568 exit();
569 }
570 if(est_egal(y,Yu_p(i,j)))
571 {
572 corresp_u_p(i,num_face) = j;
573 compt_x_p(i,j) ++;
574 j=indic_p+1;
575 trouve = 1;
576 }
577 }
578 if (trouve==0)
579 {
580 corresp_u_p(i,num_face) = indic_p;
581 Yu_p(i,indic_p)=y;
582 compt_x_p(i,indic_p) ++;
583 indic_p++;
584 }
585 }
586 break;
587 }
588 //Pour la composante de vitesse V
589 case 1 :
590 {
591 //Point avant
592 if(xv(num_face,dir_profil)==xVm(i))
593 {
594 y = xv(num_face,3-homo_dir-dir_profil);
595 trouve = 0;
596 for (j=0; j-(indicv_m+1)<0; j++)
597 {
598 if (j==Nap)
599 {
600 Cerr << "Erreur dans la valeur du nombre de points pour le traitement particulier"<<finl;
601 Cerr <<"qui est trop petite dans votre jeu de donnees=" << Nap << finl;
602 exit();
603 }
604 if(est_egal(y,Yv_m(i,j)))
605 {
606 corresp_v_m(i,num_face) = j;
607 compt_y_m(i,j) ++;
608 j=indicv_m+1;
609 trouve = 1;
610 }
611 }
612 if (trouve==0)
613 {
614 corresp_v_m(i,num_face) = indicv_m;
615 Yv_m(i,indicv_m)=y;
616 compt_y_m(i,indicv_m) ++;
617 indicv_m++;
618 }
619 }
620 //Point apres
621 else if(xv(num_face,dir_profil)==xVp(i))
622 {
623 y = xv(num_face,3-homo_dir-dir_profil);
624 trouve = 0;
625 for (j=0; j-(indicv_p+1)<0; j++)
626 {
627 if (j==Nap)
628 {
629 Cerr << "Erreur dans la valeur du nombre de points pour le traitement particulier"<<finl;
630 Cerr <<"qui est trop petite dans votre jeu de donnees=" << Nap << finl;
631 exit();
632 }
633 if(est_egal(y,Yv_p(i,j)))
634 {
635 corresp_v_p(i,num_face) = j;
636 compt_y_p(i,j) ++;
637 j=indicv_p+1;
638 trouve = 1;
639 }
640 }
641 if (trouve==0)
642 {
643 corresp_v_p(i,num_face) = indicv_p;
644 Yv_p(i,indicv_p)=y;
645 compt_y_p(i,indicv_p) ++;
646 indicv_p++;
647 }
648 }
649 break;
650 }
651 //Pour la composante de vitesse W
652 case 2 :
653 {
654 //Point avant
655 if(xv(num_face,dir_profil)==xWm(i))
656 {
657 y = xv(num_face,3-homo_dir-dir_profil);
658 trouve = 0;
659 for (j=0; j-(indicw_m+1)<0; j++)
660 {
661 if (j==Nap)
662 {
663 Cerr << "Erreur dans la valeur du nombre de points pour le traitement particulier"<<finl;
664 Cerr <<"qui est trop petite dans votre jeu de donnees=" << Nap << finl;
665 exit();
666 }
667 if(est_egal(y,Yw_m(i,j)))
668 {
669 corresp_w_m(i,num_face) = j;
670 compt_z_m(i,j) ++;
671 j=indicw_m+1;
672 trouve = 1;
673 }
674 }
675 if (trouve==0)
676 {
677 corresp_w_m(i,num_face) = indicw_m;
678 Yw_m(i,indicw_m)=y;
679 compt_z_m(i,indicw_m) ++;
680 indicw_m++;
681 }
682 }
683 //Point apres
684 else if(xv(num_face,dir_profil)==xWp(i))
685 {
686 y = xv(num_face,3-homo_dir-dir_profil);
687 trouve = 0;
688 for (j=0; j-(indicw_p+1)<0; j++)
689 {
690 if (j==Nap)
691 {
692 Cerr << "Erreur dans la valeur du nombre de points pour le traitement particulier"<<finl;
693 Cerr <<"qui est trop petite dans votre jeu de donnees=" << Nap << finl;
694 exit();
695 }
696 if(est_egal(y,Yw_p(i,j)))
697 {
698 corresp_w_p(i,num_face) = j;
699 compt_z_p(i,j) ++;
700 j=indicw_p+1;
701 trouve = 1;
702 }
703 }
704 if (trouve==0)
705 {
706 corresp_w_p(i,num_face) = indicw_p;
707 Yw_p(i,indicw_p)=y;
708 compt_z_p(i,indicw_p) ++;
709 indicw_p++;
710 }
711 }
712 break;
713 }
714 default :
715 {
716 Cerr << "Cas de figure impossible..." << finl;
717 exit();
718 break;
719 }
720 }//Fin du switch
721 }//Fin de boucle sur faces
722
723
724 //Boucle sur les elements pour table de correspondance pour nu_t et temperature
725 for (num_elem=0; num_elem<nb_elems; num_elem++)
726 {
727 //Point avant
728 if(xp(num_elem,dir_profil)==xUVm(i))
729 {
730 y = xp(num_elem,3-homo_dir-dir_profil);
731 trouve = 0;
732 for (j=0; j-(indicuv_m+1)<0; j++)
733 {
734 if(y==Yuv_m(i,j))
735 {
736 corresp_uv_m(i,num_elem) = j;
737 compt_uv_m(i,j) ++;
738 j=indicuv_m+1;
739 trouve = 1;
740 }
741 }
742 if (trouve==0)
743 {
744 corresp_uv_m(i,num_elem) = indicuv_m;
745 Yuv_m(i,indicuv_m)=y;
746 compt_uv_m(i,indicuv_m) ++;
747 indicuv_m++;
748 }
749 }
750 //Point apres
751 if(xp(num_elem,dir_profil)==xUVp(i))
752 {
753 y = xp(num_elem,3-homo_dir-dir_profil);
754 trouve = 0;
755 for (j=0; j-(indicuv_p+1)<0; j++)
756 {
757 if(y==Yuv_p(i,j))
758 {
759 corresp_uv_p(i,num_elem) = j;
760 compt_uv_p(i,j) ++;
761 j=indicuv_p+1;
762 trouve = 1;
763 }
764 }
765 if (trouve==0)
766 {
767 corresp_uv_p(i,num_elem) = indicuv_p;
768 Yuv_p(i,indicuv_p)=y;
769 compt_uv_p(i,indicuv_p) ++;
770 indicuv_p++;
771 }
772 }
773 }//Fin de boucle sur elements
774
775
776 //Verification pour voir si avant et apres le profil on a le meme nombre de points...
777 //Ce n'est pas le cas si par exemple on a une marche et un profil juste sur l'arete :
778 //dans ce cas, on a plus de points du cote du bas de la marche que du cote du haut de la marche.
779 if(indic_p!=indic_m)
780 {
781 Cerr << "indic_m = " << indic_m << " != indic_p = " << indic_p << finl;
782 Cerr << "Problem : move profile at position " << positions(i) <<" !" << finl;
783 exit();
784 }
785 if(indicv_p!=indicv_m)
786 {
787 Cerr << "indicv_m = " << indicv_m << " != indicv_p = " << indicv_p << finl;
788 Cerr << "Problem : move profile at position " << positions(i) <<" !" << finl;
789 exit();
790 }
791 if(indicw_p!=indicw_m)
792 {
793 Cerr << "indicw_m = " << indicw_m << " != indicw_p = " << indicw_p << finl;
794 Cerr << "Problem : move profile at position " << positions(i) <<" !" << finl;
795 exit();
796 }
797 if(indicuv_p!=indicuv_m)
798 {
799 Cerr << "indicuv_m = " << indicuv_m << " != indicuv_p = " << indicuv_p << finl;
800 Cerr << "Problem : move profile at position " << positions(i) <<" !" << finl;
801 exit();
802 }
803
804 Nxy(i) = indic_m; // nombre de y pour umoy
805 Nyy(i) = indicv_m;
806 Nzy(i) = indicw_m;
807 Nuv(i) = indicuv_m; // nombre de y pour uv_moy (et pour nu_t!!)
808
809 }//Fin de boucle sur probes
810}
811
812
813
814
815
816
817
818
819//####################################################################################################################
820
821void Traitement_particulier_NS_Profils_VDF::calculer_moyenne_spatiale_nut(DoubleTab& u_moy, const IntTab& corresp, const IntTab& compt, const IntVect& tab_Nuv, const DoubleTab& xUV)
822{
823 int i,j;
824 const Domaine_dis_base& zdisbase=mon_equation->inconnue().domaine_dis_base();
825 const Domaine_VDF& domaine_VDF=ref_cast(Domaine_VDF, zdisbase);
826 const DoubleTab& xp = domaine_VDF.xp();
827
828 const RefObjU& modele_turbulence = mon_equation->get_modele(TURBULENCE);
829 const Modele_turbulence_hyd_base& mod_turb = ref_cast(Modele_turbulence_hyd_base,modele_turbulence.valeur());
830 const DoubleTab& nu_t = mod_turb.viscosite_turbulente().valeurs();
831
832 int nb_elems = domaine_VDF.domaine().nb_elem();
833 int num_elem;
834
835 u_moy = 0.;
836 for(i=0; i<n_probes; i++)
837 {
838 // Calcul de nut
839 for (num_elem=0; num_elem<nb_elems; num_elem++)
840 if(xp(num_elem,dir_profil)==xUV(i))
841 {
842 u_moy(i,corresp(i,num_elem)) += nu_t[num_elem];
843 }
844 } // on a parcouru tous les profils
845
846
847 // POUR LE PARALLELE
848 IntTab compt_p(compt);
849 envoyer(compt_p,Process::me(),0,Process::me());
850
851 DoubleTab u_moy_p(u_moy);
852 envoyer(u_moy_p,Process::me(),0,Process::me());
853
854 if(je_suis_maitre())
855 {
856 IntTab compt_tot(compt);
857 DoubleTab u_moy_tot(u_moy);
858
859 compt_tot=0;
860 u_moy_tot=0.;
861
862 for(int p=0; p<Process::nproc(); p++)
863 {
864 recevoir(compt_p,p,0,p);
865 compt_tot+=compt_p;
866
867 recevoir(u_moy_p,p,0,p);
868 u_moy_tot+=u_moy_p;
869 }
870
871 for(i=0; i<n_probes; i++)
872 for (j=0; j<tab_Nuv(i); j++)
873 u_moy(i,j) = u_moy_tot(i,j)/compt_tot(i,j);
874
875 }
876 // FIN DU PARALLELE
877
878}
879
880
881
882
883void Traitement_particulier_NS_Profils_VDF::calculer_moyenne_spatiale_vitesse(DoubleTab& u_moy,DoubleTab& u_moy_2,DoubleTab& u_moy_3,DoubleTab& u_moy_4, const IntTab& corresp, const IntTab& compt, const IntVect& NN, const int ori, const DoubleTab& xU)
884{
885 int i,j;
886 const Domaine_dis_base& zdisbase=mon_equation->inconnue().domaine_dis_base();
887 const Domaine_VDF& domaine_VDF=ref_cast(Domaine_VDF, zdisbase);
888 const DoubleTab& xv = domaine_VDF.xv();
889
890 const DoubleTab& vitesse = mon_equation->inconnue().valeurs();
891 int nb_faces = domaine_VDF.nb_faces();
892 const IntVect& orientation = domaine_VDF.orientation();
893
894 int num_face,ori_face;
895 double vit;
896
897 u_moy = 0.;
898 u_moy_2 = 0.;
899
900 for(i=0; i<n_probes; i++)
901 {
902 for(num_face=0; num_face<nb_faces; num_face++)
903 {
904 ori_face = orientation[num_face];
905 if ((ori_face==ori)&&(xv(num_face,dir_profil)==xU(i)))
906 {
907 vit = vitesse[num_face];
908 u_moy(i,corresp(i,num_face)) += vit;
909 u_moy_2(i,corresp(i,num_face)) += vit*vit;
910 u_moy_3(i,corresp(i,num_face)) += vit*vit*vit;
911 u_moy_4(i,corresp(i,num_face)) += vit*vit*vit*vit;
912 }
913 }
914 }// On a parcouru tous les profils
915
916 // POUR LE PARALLELE
917 IntTab compt_p(compt);
918 envoyer(compt_p,Process::me(),0,Process::me());
919
920 DoubleTab u_moy_p(u_moy);
921 envoyer(u_moy_p,Process::me(),0,Process::me());
922
923 DoubleTab u_moy_2_p(u_moy_2);
924 envoyer(u_moy_2_p,Process::me(),0,Process::me());
925
926 DoubleTab u_moy_3_p(u_moy_3);
927 envoyer(u_moy_3_p,Process::me(),0,Process::me());
928
929 DoubleTab u_moy_4_p(u_moy_4);
930 envoyer(u_moy_4_p,Process::me(),0,Process::me());
931
932 if(je_suis_maitre())
933 {
934 IntTab compt_tot(compt);
935 DoubleTab u_moy_tot(u_moy);
936 DoubleTab u_moy_2_tot(u_moy_2);
937 DoubleTab u_moy_3_tot(u_moy_3);
938 DoubleTab u_moy_4_tot(u_moy_4);
939
940 compt_tot=0;
941 u_moy_tot=0.;
942 u_moy_2_tot=0.;
943 u_moy_3_tot=0.;
944 u_moy_4_tot=0.;
945
946 for(int p=0; p<Process::nproc(); p++)
947 {
948 recevoir(compt_p,p,0,p);
949 compt_tot+=compt_p;
950
951 recevoir(u_moy_p,p,0,p);
952 u_moy_tot+=u_moy_p;
953
954 recevoir(u_moy_2_p,p,0,p);
955 u_moy_2_tot+=u_moy_2_p;
956
957 recevoir(u_moy_3_p,p,0,p);
958 u_moy_3_tot+=u_moy_3_p;
959
960 recevoir(u_moy_4_p,p,0,p);
961 u_moy_4_tot+=u_moy_4_p;
962 }
963
964 for(i=0; i<n_probes; i++)
965 for (j=0; j<NN(i); j++)
966 {
967 u_moy(i,j) = u_moy_tot(i,j)/compt_tot(i,j);
968 u_moy_2(i,j) = u_moy_2_tot(i,j)/compt_tot(i,j);
969 u_moy_3(i,j) = u_moy_3_tot(i,j)/compt_tot(i,j);
970 u_moy_4(i,j) = u_moy_4_tot(i,j)/compt_tot(i,j);
971 }
972 }
973 // FIN DU PARALLELE
974
975 // commente par guillaume
976 //Calcul de uprime2 ou vprime2 ou wprime2
977 // for (j=0;j<NN(i);j++)
978 // u_moy_2(i,j) -= u_moy(i,j)*u_moy(i,j);
979}
980
981
982
983
984
985void Traitement_particulier_NS_Profils_VDF::calculer_moyenne_spatiale_uv(DoubleTab& uv_moy, const IntTab& corresp, const IntTab& compt, const IntVect& NN , const DoubleTab& xUV)
986{
987 int i,j;
988 const Domaine_dis_base& zdisbase=mon_equation->inconnue().domaine_dis_base();
989 const Domaine_VDF& domaine_VDF=ref_cast(Domaine_VDF, zdisbase);
990 const DoubleTab& xp = domaine_VDF.xp();
991
992 const DoubleTab& vitesse = mon_equation->inconnue().valeurs();
993 const IntTab& elem_faces = domaine_VDF.elem_faces();
994
995 int nb_elems = domaine_VDF.domaine().nb_elem();
996 int num_elem;
997 int face_u_0,face_u_1,face_v_0,face_v_1;
998 double vitu,vitv;
999
1000 DoubleTab u_moy_cent(n_probes,Nap);
1001 u_moy_cent= 0.;
1002 DoubleTab v_moy_cent(n_probes,Nap);
1003 v_moy_cent= 0.;
1004 uv_moy = 0.;
1005
1006 for(i=0; i<n_probes; i++)
1007 {
1008 // Calcul de uv
1009 for (num_elem=0; num_elem<nb_elems; num_elem++)
1010 {
1011 if(xp(num_elem,dir_profil)==xUV(i))
1012 {
1013 face_u_0 = elem_faces(num_elem,0);
1014 face_u_1 = elem_faces(num_elem,dimension);
1015 vitu = 0.5*(vitesse[face_u_0]+vitesse[face_u_1]);
1016 face_v_0 = elem_faces(num_elem,1);
1017 face_v_1 = elem_faces(num_elem,1+dimension);
1018 vitv = 0.5*(vitesse[face_v_0]+vitesse[face_v_1]);
1019 uv_moy(i,corresp(i,num_elem)) += vitu*vitv;
1020 u_moy_cent(i,corresp(i,num_elem)) += vitu;
1021 v_moy_cent(i,corresp(i,num_elem)) += vitv;
1022 }
1023 }
1024 } // On a parcouru tous les profils
1025
1026 // POUR LE PARALLELE
1027 IntTab compt_p(compt);
1028 envoyer(compt_p,Process::me(),0,Process::me());
1029
1030 DoubleTab uv_moy_p(uv_moy);
1031 envoyer(uv_moy_p,Process::me(),0,Process::me());
1032
1033 DoubleTab u_moy_cent_p(u_moy_cent);
1034 envoyer(u_moy_cent_p,Process::me(),0,Process::me());
1035
1036 DoubleTab v_moy_cent_p(v_moy_cent);
1037 envoyer(v_moy_cent_p,Process::me(),0,Process::me());
1038
1039 if(je_suis_maitre())
1040 {
1041 IntTab compt_tot(compt);
1042 DoubleTab uv_moy_tot(uv_moy);
1043 DoubleTab u_moy_cent_tot(u_moy_cent);
1044 DoubleTab v_moy_cent_tot(v_moy_cent);
1045
1046 compt_tot=0;
1047 uv_moy_tot=0.;
1048 u_moy_cent_tot=0.;
1049 v_moy_cent_tot=0.;
1050
1051 for(int p=0; p<Process::nproc(); p++)
1052 {
1053 recevoir(compt_p,p,0,p);
1054 compt_tot+=compt_p;
1055
1056 recevoir(uv_moy_p,p,0,p);
1057 uv_moy_tot+=uv_moy_p;
1058
1059 recevoir(u_moy_cent_p,p,0,p);
1060 u_moy_cent_tot+=u_moy_cent_p;
1061
1062 recevoir(v_moy_cent_p,p,0,p);
1063 v_moy_cent_tot+=v_moy_cent_p;
1064 }
1065
1066 for(i=0; i<n_probes; i++)
1067 {
1068 for (j=0; j<NN(i); j++)
1069 {
1070 uv_moy(i,j) = uv_moy_tot(i,j)/compt_tot(i,j);
1071 u_moy_cent(i,j) = u_moy_cent_tot(i,j)/compt_tot(i,j);
1072 v_moy_cent(i,j) = v_moy_cent_tot(i,j)/compt_tot(i,j);
1073 uv_moy(i,j) *= -1.;
1074 }
1075 for (j=0; j<NN(i); j++)
1076 uv_moy(i,j) += u_moy_cent(i,j)*v_moy_cent(i,j);
1077 }
1078 }
1079 // FIN DU PARALLELE
1080
1081}
1082
1083
1084
1085
1086
1087void Traitement_particulier_NS_Profils_VDF::calculer_integrale_temporelle(DoubleTab& u_moy_temp, DoubleTab& umoy_m, DoubleTab& umoy_p, const DoubleVect& delta_m, const DoubleVect& delta_p)
1088{
1089 int i,j;
1090 double dt_v = mon_equation->schema_temps().pas_de_temps();
1091 DoubleTab umoy(u_moy_temp);
1092
1093 for(i=0; i<n_probes; i++)
1094 {
1095 for(j=0; j<Nap; j++)
1096 {
1097 umoy(i,j)=umoy_m(i,j)*delta_m(i)/(delta_m(i)+delta_p(i));
1098 umoy(i,j)+=umoy_p(i,j)*delta_p(i)/(delta_m(i)+delta_p(i));
1099 }
1100 }
1101 if(je_suis_maitre())
1102 ////u_moy_temp.ajoute(dt_v,umoy);
1103 u_moy_temp.ajoute_sans_ech_esp_virt(dt_v,umoy);
1104}
1105
1106
1107
1108
1109void Traitement_particulier_NS_Profils_VDF::ecriture_fichiers_moy_spat(const DoubleTab& umoy_m,const DoubleTab& umoy_2_m,const DoubleTab& umoy_3_m,const DoubleTab& umoy_4_m, const DoubleTab& umoy_p, const DoubleTab& umoy_2_p, const DoubleTab& umoy_3_p, const DoubleTab& umoy_4_p, const DoubleVect& delta_m, const DoubleVect& delta_p, const IntVect& NN, const DoubleTab& Y, const int ori)
1110{
1111 int i,j;
1112
1113 for(i=0; i<n_probes; i++)
1114 {
1115 Nom nom_fic ="./Space_Avg/Avg_vel_";
1116 switch(ori)
1117 {
1118 case 0:
1119 {
1120 nom_fic +="U_";
1121 break;
1122 }
1123 case 1:
1124 {
1125 nom_fic +="V_";
1126 break;
1127 }
1128 case 2:
1129 {
1130 nom_fic +="W_";
1131 break;
1132 }
1133 }
1134 switch(dir_profil)
1135 {
1136 case 0:
1137 {
1138 nom_fic +="X_";
1139 break;
1140 }
1141 case 1:
1142 {
1143 nom_fic +="Y_";
1144 break;
1145 }
1146 case 2:
1147 {
1148 nom_fic +="Z_";
1149 break;
1150 }
1151 }
1152 Nom pos = Nom(positions(i));
1153 nom_fic += pos;
1154 nom_fic += "_t_";
1155 double tps = mon_equation->inconnue().temps();
1156 Nom temps = Nom(tps);
1157 nom_fic += temps;
1158 nom_fic += ".dat";
1159
1160 //Pour calculer les interpolations lineaires...
1161 DoubleTab umoy(umoy_m);
1162 DoubleTab umoy_2(umoy_2_m);
1163 DoubleTab umoy_3(umoy_3_m);
1164 DoubleTab umoy_4(umoy_4_m);
1165
1166 for(j=0; j<NN(i); j++)
1167 {
1168 umoy(i,j)=umoy_m(i,j)*delta_m(i)/(delta_m(i)+delta_p(i));
1169 umoy(i,j)+=umoy_p(i,j)*delta_p(i)/(delta_m(i)+delta_p(i));
1170 umoy_2(i,j)=umoy_2_m(i,j)*delta_m(i)/(delta_m(i)+delta_p(i));
1171 umoy_2(i,j)+=umoy_2_p(i,j)*delta_p(i)/(delta_m(i)+delta_p(i));
1172 umoy_3(i,j)=umoy_3_m(i,j)*delta_m(i)/(delta_m(i)+delta_p(i));
1173 umoy_3(i,j)+=umoy_3_p(i,j)*delta_p(i)/(delta_m(i)+delta_p(i));
1174 umoy_4(i,j)=umoy_4_m(i,j)*delta_m(i)/(delta_m(i)+delta_p(i));
1175 umoy_4(i,j)+=umoy_4_p(i,j)*delta_p(i)/(delta_m(i)+delta_p(i));
1176 }
1177 if(je_suis_maitre())
1178 {
1179 SFichier fic (nom_fic);
1180 double val_moy, val2,val3,val4;
1181
1182 fic << "# Space Averaged Statistics" << finl ;
1183 fic << "# Y <U> Urms S=MOY[(u-umoy)^3]/(MOY[(u-umoy)^2])^3/2 F=MOY[(u-umoy)^4]/(MOY[(u-umoy)^2])^2 " << finl ;
1184
1185 for (j=0; j<NN(i) ; j++)
1186 {
1187 val_moy = umoy(i,j);
1188 // Pour eviter NAN, on prend le std::max(,0):
1189 val2 = sqrt(std::max(umoy_2(i,j)-val_moy*val_moy,0.0));
1190
1191 if (val2 ==0 )
1192 {
1193 val3=0.;
1194 val4=0.;
1195 }
1196 else
1197 {
1198 val3 = umoy_3(i,j)+2*val_moy*val_moy*val_moy-3*umoy_2(i,j)*val_moy;
1199 val3 = val3/pow(val2,3);
1200
1201 val4 = umoy_4(i,j)-4*umoy_3(i,j)*val_moy+6*umoy_2(i,j)*val_moy*val_moy-3*val_moy*val_moy*val_moy*val_moy;
1202 val4 = val4/pow(val2,4);
1203 }
1204
1205 if ((val_moy<0.)&&(std::fabs(val_moy)<1.e-10)) val_moy=0.;
1206 fic << Y (i,j) << " " << umoy(i,j) << " " << val2 << " " << val3 << " " << val4 << finl;
1207 }
1208 fic.flush();
1209 fic.close();
1210 } // Fin du si je suis maitre
1211 }//FIN boucle sur les probes
1212}
1213
1214
1215
1216
1217void Traitement_particulier_NS_Profils_VDF::ecriture_fichiers_moy_spat_1col(const DoubleTab& umoy_m, const DoubleTab& umoy_p, const DoubleTab& Y, const DoubleVect& delta_m, const DoubleVect& delta_p, const IntVect& NN, const int ori)
1218{
1219 int i,j;
1220 Nom nom_fic;
1221 for(i=0; i<n_probes; i++)
1222 {
1223 switch(ori)
1224 {
1225 case 3:
1226 {
1227 nom_fic ="./Space_Avg/Avg_vel_uvp_";
1228 break;
1229 }
1230 case 4:
1231 {
1232 nom_fic ="./Space_Avg/Avg_nut_";
1233 break;
1234 }
1235 }
1236 switch(dir_profil)
1237 {
1238 case 0:
1239 {
1240 nom_fic +="X_";
1241 break;
1242 }
1243 case 1:
1244 {
1245 nom_fic +="Y_";
1246 break;
1247 }
1248 case 2:
1249 {
1250 nom_fic +="Z_";
1251 break;
1252 }
1253 }
1254 Nom pos = Nom(positions(i));
1255 nom_fic += pos;
1256 nom_fic += "_t_";
1257 double tps = mon_equation->inconnue().temps();
1258 Nom temps = Nom(tps);
1259 nom_fic+= temps;
1260 nom_fic+= ".dat";
1261 if(je_suis_maitre())
1262 {
1263 SFichier fic (nom_fic);
1264
1265 //Pour calculer les interpolations lineaires...
1266 DoubleTab umoy(umoy_m);
1267 for(j=0; j<NN(i); j++)
1268 {
1269 umoy(i,j)=umoy_m(i,j)*delta_m(i)/(delta_m(i)+delta_p(i));
1270 umoy(i,j)+=umoy_p(i,j)*delta_p(i)/(delta_m(i)+delta_p(i));
1271 }
1272
1273 for (j=0; j<NN(i); j++)
1274 fic << Y (i,j) << " " << umoy(i,j) << finl;
1275 fic.flush();
1276 fic.close();
1277 } // Fin de si je suis maitre
1278 }//FIN boucle sur les probes
1279}
1280
1281
1282
1283
1284
1285
1286void Traitement_particulier_NS_Profils_VDF::ecriture_fichiers_moy_temp(const DoubleTab& umoy, const DoubleTab& umoy_2, const DoubleTab& umoy_3, const DoubleTab& umoy_4, const DoubleTab& Y, const IntVect& NN, const int ori, const double dt)
1287{
1288 int i,j;
1289
1290 Nom nom_fic;
1291 for(i=0; i<n_probes; i++)
1292 {
1293 nom_fic ="./Time_Avg/Avg_time_vel_";
1294 switch(ori)
1295 {
1296 case 0:
1297 {
1298 nom_fic +="U_";
1299 break;
1300 }
1301 case 1:
1302 {
1303 nom_fic +="V_";
1304 break;
1305 }
1306 case 2:
1307 {
1308 nom_fic +="W_";
1309 break;
1310 }
1311 }
1312 switch(dir_profil)
1313 {
1314 case 0:
1315 {
1316 nom_fic +="X_";
1317 break;
1318 }
1319 case 1:
1320 {
1321 nom_fic +="Y_";
1322 break;
1323 }
1324 case 2:
1325 {
1326 nom_fic +="Z_";
1327 break;
1328 }
1329 }
1330 Nom pos = Nom(positions(i));
1331 nom_fic += pos;
1332 nom_fic += "_t_";
1333
1334 double tps = mon_equation->inconnue().temps();
1335 Nom temps = Nom(tps);
1336 nom_fic+= temps;
1337 nom_fic+= ".dat";
1338 if(je_suis_maitre())
1339 {
1340 SFichier fic (nom_fic);
1341 double val_moy,val2,val3,val4;
1342
1343 fic << "# Time Averaged Statistics" << finl ;
1344 fic << "# Y <U> Urms S=MOY[(u-umoy)^3]/(MOY[(u-umoy)^2])^3/2 F=MOY[(u-umoy)^4]/(MOY[(u-umoy)^2])^2 " << finl ;
1345
1346 for (j=0; j<NN(i) ; j++)
1347 {
1348 val_moy = umoy(i,j)/dt;
1349 val2 = umoy_2(i,j)/dt -val_moy*val_moy;
1350 // Pour eviter NAN, on prend le std::max(,0):
1351 val2 = sqrt(std::max(val2,0.0));
1352
1353 if (val2 ==0.0 )
1354 {
1355 val3=0.;
1356 val4=0.;
1357 }
1358 else
1359 {
1360 val3 = umoy_3(i,j)/dt+2*val_moy*val_moy*val_moy-3*umoy_2(i,j)/dt*val_moy;
1361 val3 = val3/pow(val2,3);
1362
1363 val4 = umoy_4(i,j)/dt-4*umoy_3(i,j)/dt*val_moy+6*umoy_2(i,j)/dt*val_moy*val_moy-3*val_moy*val_moy*val_moy*val_moy;
1364 val4 = val4/pow(val2,4);
1365 }
1366 if ((val_moy<0.)&&(std::fabs(val_moy)<1.e-10)) val_moy=0.;
1367 fic << Y (i,j) << " " << val_moy << " " << val2 << " " << val3 << " " << val4 << finl;
1368 }
1369 fic.flush();
1370 fic.close();
1371 } // Fin de si je suis maitre
1372 }//FIN boucle sur les probes
1373}
1374
1375
1376
1377
1378void Traitement_particulier_NS_Profils_VDF::ecriture_fichiers_moy_temp_1col(const DoubleTab& umoy, const DoubleTab& Y, const IntVect& NN, const int ori, const double dt)
1379{
1380 int i,j;
1381 Nom nom_fic;
1382 for(i=0; i<n_probes; i++)
1383 {
1384 switch(ori)
1385 {
1386 case 3:
1387 {
1388 nom_fic ="./Time_Avg/Avg_time_vel_uvp_";
1389 break;
1390 }
1391 case 4:
1392 {
1393 nom_fic ="./Time_Avg/Avg_time_nut_";
1394 break;
1395 }
1396 }
1397 switch(dir_profil)
1398 {
1399 case 0:
1400 {
1401 nom_fic +="X_";
1402 break;
1403 }
1404 case 1:
1405 {
1406 nom_fic +="Y_";
1407 break;
1408 }
1409 case 2:
1410 {
1411 nom_fic +="Z_";
1412 break;
1413 }
1414 }
1415 Nom pos = Nom(positions(i));
1416 nom_fic += pos;
1417 nom_fic += "_t_";
1418 double tps = mon_equation->inconnue().temps();
1419 Nom temps = Nom(tps);
1420 nom_fic+= temps;
1421 nom_fic+= ".dat";
1422 if(je_suis_maitre())
1423 {
1424 SFichier fic (nom_fic);
1425
1426 for (j=0; j<NN(i) ; j++)
1427 fic << Y (i,j) << " " << umoy(i,j)/dt << finl;
1428 fic.flush();
1429 fic.close();
1430 } // Fin de si je suis maitre
1431 }//FIN boucle sur les probes
1432}
1433
DoubleTab & valeurs() override
Surcharge Champ_base::valeurs() Renvoie le tableau des valeurs.
int_t nb_elem() const
Definition Domaine.h:131
class Domaine_VDF
Definition Domaine_VDF.h:64
int orientation(int) const override
inline DoubleVect& Domaine_VDF::porosite_face() {
int nb_faces() const
renvoie le nombre global de faces.
Definition Domaine_VF.h:471
double xv(int num_face, int k) const
Definition Domaine_VF.h:76
int elem_faces(int i, int j) const
renvoie le numero de le ieme face de la maille num_elem la facon dont ces faces sont numerotees est
Definition Domaine_VF.h:543
double xp(int num_elem, int k) const
Definition Domaine_VF.h:77
classe Domaine_dis_base Cette classe est la base de la hierarchie des domaines discretisees.
const Domaine & domaine() const
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
Classe Modele_turbulence_hyd_base Cette classe sert de base a la hierarchie des classes.
const Champ_Fonc_base & viscosite_turbulente() const
Une chaine de caractere (Nom) en majuscules.
Definition Motcle.h:26
class Nom Une chaine de caractere pour nommer les objets de TRUST
Definition Nom.h:31
friend class Entree
Definition Objet_U.h:76
static int dimension
Definition Objet_U.h:99
virtual Entree & readOn(Entree &)
Lecture d'un Objet_U sur un flot d'entree Methode a surcharger.
Definition Objet_U.cpp:293
virtual Sortie & printOn(Sortie &) const
Ecriture de l'objet sur un flot de sortie Methode a surcharger.
Definition Objet_U.cpp:282
static int nproc()
renvoie le nombre de processeurs dans le groupe courant Voir Comm_Group::nproc() et PE_Groups::curren...
Definition Process.cpp:104
static int me()
renvoie mon rang dans le groupe de communication courant.
Definition Process.cpp:125
static void exit(int exit_code=-1)
Routine de sortie de TRUST dans une region Kokkos.
Definition Process.cpp:455
static int je_suis_maitre()
renvoie 1 si on est sur le processeur maitre du groupe courant (c'est a dire me() == 0),...
Definition Process.cpp:86
Cette classe est a la classe C++ ofstream ce que la classe Sortie est a la classe C++ ostream Elle re...
Definition SFichier.h:27
Sortie & flush() override
Force l'ecriture sur disque des donnees dans le tampon Utilise l'implementation de la classe ofstream...
Classe de base des flux de sortie.
Definition Sortie.h:52
void ajoute_sans_ech_esp_virt(_SCALAR_TYPE_ alpha, const TRUSTVect &y, Mp_vect_options opt=VECT_REAL_ITEMS)
const Objet_U & valeur() const
Definition TRUST_Ref.h:134
class Trait_part_NS_Profils_VDF This classe enables a particular treatment
void calculer_moyenne_spatiale_vitesse(DoubleTab &, DoubleTab &, DoubleTab &, DoubleTab &, const IntTab &, const IntTab &, const IntVect &, const int, const DoubleTab &)
void calculer_moyenne_spatiale_nut(DoubleTab &, const IntTab &, const IntTab &, const IntVect &, const DoubleTab &)
Entree & lire(const Motcle &, Entree &) override
void ecriture_fichiers_moy_spat(const DoubleTab &, const DoubleTab &, const DoubleTab &, const DoubleTab &, const DoubleTab &, const DoubleTab &, const DoubleTab &, const DoubleTab &, const DoubleVect &, const DoubleVect &, const IntVect &, const DoubleTab &, const int)
void calculer_moyenne_spatiale_uv(DoubleTab &, const IntTab &, const IntTab &, const IntVect &, const DoubleTab &)
void ecriture_fichiers_moy_temp_1col(const DoubleTab &, const DoubleTab &, const IntVect &, const int, const double)
void ecriture_fichiers_moy_temp(const DoubleTab &, const DoubleTab &, const DoubleTab &, const DoubleTab &, const DoubleTab &, const IntVect &, const int, const double)
void calculer_integrale_temporelle(DoubleTab &, DoubleTab &, DoubleTab &, const DoubleVect &, const DoubleVect &)
void ecriture_fichiers_moy_spat_1col(const DoubleTab &, const DoubleTab &, const DoubleTab &, const DoubleVect &, const DoubleVect &, const IntVect &, const int)