TRUST 1.9.8
HPC thermohydraulic platform
Loading...
Searching...
No Matches
Traitement_particulier_NS_Profils_thermo_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_thermo_VDF.h>
17#include <Domaine_VDF.h>
18#include <Probleme_base.h>
19#include <LecFicDistribueBin.h>
20#include <EcrFicCollecteBin.h>
21#include <Navier_Stokes_std.h>
22#include <Convection_Diffusion_Temperature.h>
23#include <Convection_Diffusion_Chaleur_QC.h>
24#include <communications.h>
25
26Implemente_instanciable_sans_constructeur(Traitement_particulier_NS_Profils_thermo_VDF,"Traitement_particulier_NS_Profils_thermo_VDF",Traitement_particulier_NS_Profils_VDF);
27// XD profils_thermo traitement_particulier_base profils_thermo NO_BRACE non documente
28// XD attr bloc bloc_lecture bloc REQ not_set
29
30Traitement_particulier_NS_Profils_thermo_VDF::Traitement_particulier_NS_Profils_thermo_VDF():oui_repr_stats_thermo(0)
31{
32}
33
35{
36 return is;
37}
38
40{
41 return is;
42}
43
48
50{
51 // Par defaut on ne fait pas de statistiques sur la temperature.
52
53 if (motlu=="stats_thermo")
54 {
55 //Statistiques sur le champ de temperature
57 }
58 else
59 {
60 if(motlu=="reprise_thermo")
61 {
62 // Reprise des statistiques pour le champs de temperature
63 oui_repr_stats_thermo = 1; // On veut reprendre les statistiques sur la temperature
64 is >> fich_repr_stats_thermo ; // Indication du nom du fichier de reprise des stats pour le champs de temperature
65 Cerr << "On reprend les statistiques sur le champs thermique" << finl;
66 }
67 else
68 {
69 if(motlu=="tmin_tmax")
70 {
71 // On demande les max et min de temperature dans un fichier
72 tmin_tmax = 1;
73 Cerr << "User asked to monitor min and max of temperature" << finl;
74 Cerr << "in channel flow computation." << finl;
75 }
76 else
77 {
79 }
80 }
81 }
82 return is;
83}
84
86{
88
89 const Probleme_base& pb = mon_equation->probleme();
90 int flag=0;
91 for(int i=0; i<pb.nombre_d_equations(); i++)
92 {
94 {
95 mon_equation_NRJ = ref_cast(Convection_Diffusion_Temperature,pb.equation(i));
96 flag=1;
97 }
98 else if(sub_type(Convection_Diffusion_Chaleur_QC,pb.equation(i)))
99 {
100 mon_equation_NRJ = ref_cast(Convection_Diffusion_Chaleur_QC,pb.equation(i));
101 flag=1;
102 }
103
104 }
105 if (flag==0)
106 {
107 Cerr << "Error : Equation of NRJ was not found..." << finl;
108 Cerr << "User can not ask for statistics on temperature" << finl;
109 Cerr << "if we do not solve a heat equation." << finl;
110 Cerr << "Try to remove the '_thermo' part at key-word 'Profils'" << finl;
111 exit();
112 }
113}
114
115// #################### Postraitement Statistique du Champ de Temperature #########
116
118{
120
121 DoubleTab Tmoy_m(n_probes,Nap);
122 Tmoy_m=0.;
123 DoubleTab Trms_m(n_probes,Nap);
124 Trms_m=0.;
125 DoubleTab upTp_m(n_probes,Nap);
126 upTp_m=0.;
127 DoubleTab vpTp_m(n_probes,Nap);
128 vpTp_m=0.;
129 DoubleTab wpTp_m(n_probes,Nap);
130 wpTp_m=0.;
131
132 DoubleTab Tmoy_p(n_probes,Nap);
133 Tmoy_p=0.;
134 DoubleTab Trms_p(n_probes,Nap);
135 Trms_p=0.;
136 DoubleTab upTp_p(n_probes,Nap);
137 upTp_p=0.;
138 DoubleTab vpTp_p(n_probes,Nap);
139 vpTp_p=0.;
140 DoubleTab wpTp_p(n_probes,Nap);
141 wpTp_p=0.;
142
143 double tps = mon_equation->inconnue().temps();
144
145
146 // On ne fait des statistiques sur le champ thermique que si l'on fait des statistiques sur le champ dynamique en meme temps.
147 if ((oui_u_inst != 0)&&(oui_stats_thermo != 0))
148 {
149 calculer_moyennes_spatiales_thermo(Tmoy_m,Trms_m,upTp_m,vpTp_m,wpTp_m,corresp_uv_m,compt_uv_m,Nuv,xUVm);
150 calculer_moyennes_spatiales_thermo(Tmoy_p,Trms_p,upTp_p,vpTp_p,wpTp_p,corresp_uv_p,compt_uv_p,Nuv,xUVp);
151
152 static double temps_dern_post_inst = -100.;
153 if (std::fabs(tps-temps_dern_post_inst)>=dt_post_inst)
154 {
155 ecriture_fichier_moy_spat_thermo(Tmoy_m,Trms_m,upTp_m,vpTp_m,wpTp_m,Tmoy_p,Trms_p,upTp_p,vpTp_p,wpTp_p,Yuv_m,Nuv,delta_UVm, delta_UVp);
156
157 temps_dern_post_inst = tps;
158 }
159 }
160
161
162 // Moyennes temporelles :
163
164 // On ne fait des statistiques sur le champ thermique que si l'on fait des statistiques sur le champ dynamique en meme temps.
165 if ((oui_u_inst != 0)&&(oui_stats_thermo != 0)&&(oui_stat != 0))
166 {
167 double tpsbis = mon_equation->inconnue().temps();
168 if ((tpsbis>=temps_deb)&&(tpsbis<=temps_fin))
169 {
170 static int init_stat_temps = 0;
171 if((init_stat_temps==0)&&( oui_repr != 1)) // si ce n est pas une reprise : sinon valeurs lues dans le fichier
172 {
173 double dt_v = mon_equation->schema_temps().pas_de_temps();
174 temps_deb = tpsbis-dt_v;
175 init_stat_temps++;
176 }
177
183
184 static double temps_dern_post_stat = -100.;
185 if (std::fabs(tpsbis-temps_dern_post_stat)>=dt_post_stat)
186 {
187 double dt = tpsbis-temps_deb;
189 temps_dern_post_stat = tpsbis;
190 }
191 }
192 }
193}
194
195
196
197
198
199// #################### Calcul Moyennes #################################
200
201void Traitement_particulier_NS_Profils_thermo_VDF::calculer_moyennes_spatiales_thermo(DoubleTab& tmoy, DoubleTab& trms, DoubleTab& uptp, DoubleTab& vptp, DoubleTab& wptp, const IntTab& corresp, const IntTab& compt, const IntVect& NN, const DoubleTab& xUV)
202{
203
204 const Domaine_dis_base& zdisbase=mon_equation->inconnue().domaine_dis_base();
205 const Domaine_VDF& domaine_VDF=ref_cast(Domaine_VDF, zdisbase);
206 const IntTab& elem_faces = domaine_VDF.elem_faces();
207
208 // Pour trouver les coordonnees des points de temperature max et min :
209 const DoubleTab& xp = domaine_VDF.xp();
210
211 // Le nombre d'elements du domaine VDF.
212 int nb_elems = domaine_VDF.domaine().nb_elem();
213
214 // On veut acceder aux valeurs des 3 composantes de la vitesse a partir de mon_equation.
215 const DoubleTab& vitesse = mon_equation->inconnue().valeurs();
216
217 // On veut acceder aux valeurs de la temperature a partir de mon_equation_NRJ.
218 const DoubleTab& Temp = mon_equation_NRJ->inconnue().valeurs();
219
220
221
222 // Ces 3 vecteurs comportent les valeurs des 3 composantes U, V et W moyennees au centre des elements et sur tout l'espace.
223 // Ils correspondent a <U>, <V> et <W>.
224 DoubleTab u_moy_cent(n_probes,Nap);
225 u_moy_cent= 0.;
226 DoubleTab v_moy_cent(n_probes,Nap);
227 v_moy_cent= 0.;
228 DoubleTab w_moy_cent(n_probes,Nap);
229 w_moy_cent= 0.;
230
231 // t2moy correspond
232 DoubleTab t2moy(n_probes,Nap);
233 t2moy = 0.;
234
235 // vitu, vitv et vitw sont les valeurs des 3 composantes de la vitesse prises au centre de l'element,
236 // c'est a dire moyennees.
237 double vitu,vitv,vitw;
238
239 // Pour verification des bornes de temperature en canal plan
240 double Tmin=1000000000.,Tmax=0.;
241 int elem_min=0, elem_max=0;
242
243 // On se sert de face_ui_j pour avoir le numero de la face portant la composante de la vitesse ui
244 // et 0 et 1 etant les deux faces qui se font face pour faire une moyenne au centre de l'element.
245 // On doit procede comme ca entre autre parceque l'on va parcourir les elements.
246 int face_u_0,face_u_1,face_v_0,face_v_1,face_w_0,face_w_1;
247
248 int i,j,deja_fait=0;
249 int num_elem;
250
251 // tmoy est la moyenne de T : <T>(y,t)
252 tmoy = 0.;
253 // trms est l'ecart-type de la temperature : sqrt(<Tp^2>)(y,t)=<T^2>-<T>^2
254 trms = 0.;
255 // uptp : <U><T>-<UT>
256 uptp = 0.;
257 // vptp : <V><T>-<VT>
258 vptp = 0.;
259 // wptp : <W><T>-<WT>
260 wptp = 0.;
261
262 for(i=0; i<n_probes; i++)
263 {
264 // On parcourt tous les elements pour faire toutes les moyennes au centre des elements.
265 for (num_elem=0; num_elem<nb_elems; num_elem++)
266 {
267 // <T>
268 if(xp(num_elem,dir_profil)==xUV(i))
269 {
270 tmoy(i,corresp(i,num_elem)) += Temp[num_elem];
271 face_u_0 = elem_faces(num_elem,0);
272 face_u_1 = elem_faces(num_elem,dimension);
273 vitu = 0.5*(vitesse[face_u_0]+vitesse[face_u_1]);
274
275 face_v_0 = elem_faces(num_elem,1);
276 face_v_1 = elem_faces(num_elem,dimension+1);
277 vitv = 0.5*(vitesse[face_v_0]+vitesse[face_v_1]);
278
279 face_w_0 = elem_faces(num_elem,2);
280 face_w_1 = elem_faces(num_elem,dimension+2);
281 vitw = 0.5*(vitesse[face_w_0]+vitesse[face_w_1]);
282 // <U>
283 u_moy_cent(i,corresp(i,num_elem)) += vitu;
284 // <V>
285 v_moy_cent(i,corresp(i,num_elem)) += vitv;
286 // <W>
287 w_moy_cent(i,corresp(i,num_elem)) += vitw;
288 // Trms : en fait ici on calcul <T^2> mais ensuite on va soustraire la partie <T>^2
289 trms(i,corresp(i,num_elem)) += Temp[num_elem]*Temp[num_elem];
290 // On calcule <uT>, <vT>, et <wT>
291 uptp(i,corresp(i,num_elem)) += vitu*Temp[num_elem];
292 vptp(i,corresp(i,num_elem)) += vitv*Temp[num_elem];
293 wptp(i,corresp(i,num_elem)) += vitw*Temp[num_elem];
294 }
295
296 // Pour trouver les temperatures max et min dans l'ecoulement.
297 if(Temp[num_elem]<Tmin)
298 {
299 Tmin=Temp[num_elem];
300 elem_min=num_elem;
301 }
302 if(Temp[num_elem]>Tmax)
303 {
304 Tmax=Temp[num_elem];
305 elem_max=num_elem;
306 }
307
308 }//FIN boucle sur les elements
309
310 if((tmin_tmax==1)&&(deja_fait==0))
311 {
312 SFichier fic1("T_min_max.dat",ios::app);
313 double tps = mon_equation->inconnue().temps();
314 fic1 << tps << " " << Tmin << " " << xp(elem_min,0) << " " << xp(elem_min,1);
315 fic1 << " " << Tmax << " " << xp(elem_max,0) << " " << xp(elem_max,1) <<finl;
316 fic1.flush();
317 fic1.close();
318 deja_fait=1;
319 }
320 } // On a parcouru tous les profils
321
322 // NN correspond au nombre de valeurs differentes pour Y, c'est a dire le nombre de points de la courbe finale apres moyenne.
323
324 // compt[j] correspond au nombre d'elements qui ont ete utilises pour calculer une meme valeur de temperature moyenne,
325 // ie le nombre d'elements ayant la meme coordonnee Y.
326 // POUR LE PARALLELE !!
327 IntTab compt_p(compt);
328 envoyer(compt_p,Process::me(),0,Process::me());
329
330 DoubleTab tmoy_p(tmoy);
331 envoyer(tmoy_p,Process::me(),0,Process::me());
332
333 DoubleTab trms_p(trms);
334 envoyer(trms_p,Process::me(),0,Process::me());
335
336 DoubleTab uptp_p(uptp);
337 envoyer(uptp_p,Process::me(),0,Process::me());
338
339 DoubleTab vptp_p(vptp);
340 envoyer(vptp_p,Process::me(),0,Process::me());
341
342 DoubleTab wptp_p(wptp);
343 envoyer(wptp_p,Process::me(),0,Process::me());
344
345 DoubleTab u_moy_cent_p(u_moy_cent);
346 envoyer(u_moy_cent_p,Process::me(),0,Process::me());
347
348 DoubleTab v_moy_cent_p(v_moy_cent);
349 envoyer(v_moy_cent_p,Process::me(),0,Process::me());
350
351 DoubleTab w_moy_cent_p(w_moy_cent);
352 envoyer(w_moy_cent_p,Process::me(),0,Process::me());
353
354 if(je_suis_maitre())
355 {
356 IntTab compt_tot(compt);
357 DoubleTab tmoy_tot(tmoy);
358 DoubleTab trms_tot(trms);
359 DoubleTab uptp_tot(uptp);
360 DoubleTab vptp_tot(vptp);
361 DoubleTab wptp_tot(wptp);
362 DoubleTab u_moy_cent_tot(u_moy_cent);
363 DoubleTab v_moy_cent_tot(v_moy_cent);
364 DoubleTab w_moy_cent_tot(w_moy_cent);
365
366 compt_tot=0;
367 tmoy_tot=0.;
368 trms_tot=0.;
369 uptp_tot=0.;
370 vptp_tot=0.;
371 wptp_tot=0.;
372 u_moy_cent_tot=0.;
373 v_moy_cent_tot=0.;
374 w_moy_cent_tot=0.;
375
376 for(int p=0; p<Process::nproc(); p++)
377 {
378 recevoir(compt_p,p,0,p);
379 compt_tot+=compt_p;
380
381 recevoir(tmoy_p,p,0,p);
382 tmoy_tot+=tmoy_p;
383
384 recevoir(trms_p,p,0,p);
385 trms_tot+=trms_p;
386
387 recevoir(uptp_p,p,0,p);
388 uptp_tot+=uptp_p;
389
390 recevoir(vptp_p,p,0,p);
391 vptp_tot+=vptp_p;
392
393 recevoir(wptp_p,p,0,p);
394 wptp_tot+=wptp_p;
395
396 recevoir(u_moy_cent_p,p,0,p);
397 u_moy_cent_tot+=u_moy_cent_p;
398
399 recevoir(v_moy_cent_p,p,0,p);
400 v_moy_cent_tot+=v_moy_cent_p;
401
402 recevoir(w_moy_cent_p,p,0,p);
403 w_moy_cent_tot+=w_moy_cent_p;
404
405
406 }
407
408 for(i=0; i<n_probes; i++)
409 {
410 for (j=0; j<NN(i); j++)
411 {
412 tmoy(i,j) = tmoy_tot(i,j) / compt_tot(i,j);
413 trms(i,j) = trms_tot(i,j) / compt_tot(i,j);
414 uptp(i,j) = uptp_tot(i,j) / compt_tot(i,j);
415 vptp(i,j) = vptp_tot(i,j) / compt_tot(i,j);
416 wptp(i,j) = wptp_tot(i,j) / compt_tot(i,j);
417 u_moy_cent(i,j) = u_moy_cent_tot(i,j) / compt_tot(i,j);
418 v_moy_cent(i,j) = v_moy_cent_tot(i,j) / compt_tot(i,j);
419 w_moy_cent(i,j) = w_moy_cent_tot(i,j) / compt_tot(i,j);
420
421 trms(i,j) -= tmoy(i,j)*tmoy(i,j);
422 uptp(i,j) -= u_moy_cent(i,j)*tmoy(i,j);
423 vptp(i,j) -= v_moy_cent(i,j)*tmoy(i,j);
424 wptp(i,j) -= w_moy_cent(i,j)*tmoy(i,j);
425 }
426 }// Fin boucle sur les profils
427
428 }// FIN Parallele
429
430}
431
432
433
434// #################### Calcul Integrale Temporelle ###############################
435
436void Traitement_particulier_NS_Profils_thermo_VDF::calculer_integrales_temporelles(DoubleTab& moy_temp, const DoubleTab& moy_spat_m, const DoubleTab& moy_spat_p, const DoubleVect& delta_m, const DoubleVect& delta_p)
437{
438 int i,j;
439 double dt_v = mon_equation->schema_temps().pas_de_temps();
440 DoubleTab moy(moy_temp);
441 for(i=0; i<n_probes; i++)
442 {
443 for(j=0; j<Nap; j++)
444 {
445 moy(i,j)=moy_spat_m(i,j)*delta_m(i)/(delta_m(i)+delta_p(i));
446 moy(i,j)+=moy_spat_p(i,j)*delta_p(i)/(delta_m(i)+delta_p(i));
447 }
448 }
449 if(je_suis_maitre())
450 ////moy_temp.ajoute(dt_v,moy);
451 moy_temp.ajoute_sans_ech_esp_virt(dt_v,moy);
452
453}
454
455
456
457
458
459// #################### Ecriture Moyennes Spatiales dans Fichier ##################
460
461
462void Traitement_particulier_NS_Profils_thermo_VDF::ecriture_fichier_moy_spat_thermo(const DoubleTab& Tmoy_m, const DoubleTab& Trms_m, const DoubleTab& upTp_m, const DoubleTab& vpTp_m, const DoubleTab& wpTp_m, const DoubleTab& Tmoy_p, const DoubleTab& Trms_p, const DoubleTab& upTp_p, const DoubleTab& vpTp_p, const DoubleTab& wpTp_p, const DoubleTab& Y, const IntVect& NN, const DoubleVect& delta_m, const DoubleVect& delta_p)
463{
464
465 int i,j;
466 double tps = mon_equation->inconnue().temps();
467 Nom temps = Nom(tps);
468
469 for(i=0; i<n_probes; i++)
470 {
471 Nom nom_fic = "./Space_Avg/Avg_temp_";
472 switch(dir_profil)
473 {
474 case 0:
475 {
476 nom_fic +="X_";
477 break;
478 }
479 case 1:
480 {
481 nom_fic +="Y_";
482 break;
483 }
484 case 2:
485 {
486 nom_fic +="Z_";
487 break;
488 }
489 }
490 Nom pos = Nom(positions(i));
491 nom_fic += pos;
492 nom_fic += "_t_";
493 nom_fic += temps;
494 nom_fic += ".dat";
495
496 if(je_suis_maitre())
497 {
498 SFichier fic (nom_fic);
499 fic << "# Space Averaged Statistics" << finl ;
500 fic << "# Y <T> Trms <upTp> -<vpTp> -<wpTp>" << finl ;
501
502 DoubleTab Tmoy(Tmoy_m);
503 DoubleTab Trms(Trms_m);
504 DoubleTab upTp(upTp_m);
505 DoubleTab vpTp(vpTp_m);
506 DoubleTab wpTp(wpTp_m);
507
508 for(j=0; j<NN(i); j++)
509 {
510 Tmoy(i,j)=Tmoy_m(i,j)*delta_m(i)/(delta_m(i)+delta_p(i));
511 Tmoy(i,j)+=Tmoy_p(i,j)*delta_p(i)/(delta_m(i)+delta_p(i));
512 Trms(i,j)=Trms_m(i,j)*delta_m(i)/(delta_m(i)+delta_p(i));
513 Trms(i,j)+=Trms_p(i,j)*delta_p(i)/(delta_m(i)+delta_p(i));
514 upTp(i,j)=upTp_m(i,j)*delta_m(i)/(delta_m(i)+delta_p(i));
515 upTp(i,j)+=upTp_p(i,j)*delta_p(i)/(delta_m(i)+delta_p(i));
516 vpTp(i,j)=vpTp_m(i,j)*delta_m(i)/(delta_m(i)+delta_p(i));
517 vpTp(i,j)+=vpTp_p(i,j)*delta_p(i)/(delta_m(i)+delta_p(i));
518 wpTp(i,j)=wpTp_m(i,j)*delta_m(i)/(delta_m(i)+delta_p(i));
519 wpTp(i,j)+=wpTp_p(i,j)*delta_p(i)/(delta_m(i)+delta_p(i));
520 }
521
522 for (j=0; j<NN(i); j++)
523 fic << Y(i,j) << " " << Tmoy(i,j) << " " << sqrt(std::max(Trms(i,j),0.0)) << " " << upTp(i,j) << " " << -vpTp(i,j) << " " << -wpTp(i,j) << finl;
524 fic.flush();
525 fic.close();
526 } //Fin du si je suis maitre
527 }//FIN de boucle sur les probes
528}
529
530
531
532
533
534// #################### Ecriture Moyennes temporelles dans Fichier ################
535
536void Traitement_particulier_NS_Profils_thermo_VDF::ecriture_fichier_moy_temp_thermo(const DoubleTab& Tmoy, const DoubleTab& Trms, const DoubleTab& upTp, const DoubleTab& vpTp, const DoubleTab& wpTp, const DoubleTab& Y, const double dt, const IntVect& NN)
537{
538
539 int i,j;
540 for(i=0; i<n_probes; i++)
541 {
542 Nom nom_fic = "./Time_Avg/Avg_time_temp_";
543 double tps = mon_equation->inconnue().temps();
544
545 switch(dir_profil)
546 {
547 case 0:
548 {
549 nom_fic +="X_";
550 break;
551 }
552 case 1:
553 {
554 nom_fic +="Y_";
555 break;
556 }
557 case 2:
558 {
559 nom_fic +="Z_";
560 break;
561 }
562 }
563 Nom pos = Nom(positions(i));
564 nom_fic += pos;
565 nom_fic +="_t_";
566
567 Nom temps = Nom(tps);
568 nom_fic+= temps;
569
570 nom_fic+=".dat";
571
572 if(je_suis_maitre())
573 {
574 SFichier fic (nom_fic);
575 fic << "# Time Averaged Statistics" << finl ;
576 fic << "# Y <T> Trms <upTp> -<vpTp> -<wpTp>" << finl ;
577
578
579 for (j=0; j<NN(i) ; j++)
580 fic << Y(i,j) << " " << Tmoy(i,j)/dt << " " << sqrt(std::max(Trms(i,j)/dt,0.0)) << " " << upTp(i,j)/dt << " " << -vpTp(i,j)/dt << " " << -wpTp(i,j)/dt << finl;
581 fic.flush();
582 fic.close();
583 }
584 }//FIN boucle sur les probes
585}
586
587
588
589
590
591// #################### Sauvegarde des statistiques temporelles ###################
592
594{
595
597 double tps = mon_equation->inconnue().temps();
598
599 if ( (oui_stat == 1)&&(tps>=temps_deb)&&(tps<=temps_fin) )
600 {
601 Cerr << "In Traitement_particulier_NS_Profils_thermo_VDF::sauver_stat" << finl;
602 // On sauve la somme (sans diviser par dt)
603 int i,j;
604 Nom temps = Nom(tps);
605 Nom fich_sauv_temp ="temperature_field_avg_time_";
606 fich_sauv_temp+=temps;
607 fich_sauv_temp+=".sauv";
608
609 // On sauve u_moy!!
610 EcrFicCollecteBin fict (fich_sauv_temp);
611 fict << temps << finl;
612 for(i=0; i<n_probes; i++)
613 {
614 fict << Nuv(i) << finl;
615 for (j=0; j<Nuv(i); j++)
616 {
617 fict << Tmoy_temp(i,j) << " " << finl;
618 fict << Trms_temp(i,j) << " " << finl;
619 fict << upTp_temp(i,j) << " " << finl;
620 fict << vpTp_temp(i,j) << " " << finl;
621 fict << wpTp_temp(i,j) << " " << finl;
622 }
623 }
624 fict << temps_deb << finl;
625 fict.flush();
626 fict.close();
627 Cerr << "Temperature statistics saved at t=" << tps << finl;
628 }
629}
630
631
632
633
634
636{
638 double tps = mon_equation->inconnue().temps();
639 int i,j;
640 double ti;
641 // double ti2;
642 Nom temps;
643 if (oui_stat == 1)
644 {
645 ifstream fict(fich_repr_stats_thermo);
646 if (fict)
647 {
649 fict2 >> temps;
650 Tmoy_temp.resize(n_probes,Nap);
651 Trms_temp.resize(n_probes,Nap);
652 upTp_temp.resize(n_probes,Nap);
653 vpTp_temp.resize(n_probes,Nap);
654 wpTp_temp.resize(n_probes,Nap);
655
656 for(i=0; i<n_probes; i++)
657 {
658 fict2 >> Nuv(i);
659 for (j=0; j<Nuv(i); j++)
660 {
661 fict2 >> Tmoy_temp(i,j) ;
662 fict2 >> Trms_temp(i,j);
663 fict2 >> upTp_temp(i,j) ;
664 fict2 >> vpTp_temp(i,j) ;
665 fict2 >> wpTp_temp(i,j) ;
666 }
667 }
668 fict2 >> ti ;
669 Cerr << "ti=" << ti << finl;
670 Nom chc_ti = Nom(ti), chc_temps_deb = Nom(temps_deb);
671 Cerr << "chc_ti=" << chc_ti << " chc_temps_deb=" << chc_temps_deb << finl;
672 if (chc_ti!=chc_temps_deb)
673 {
674 if (ti > temps_deb)
675 {
676 Cerr << "Pb de reprise des stats du champ thermique :" << finl;
677 Cerr << "Le temps de debut des stats demande " << temps_deb << finl;
678 Cerr << "est inferieur a celui de debut des stats sauvees !" << ti << finl;
679 exit();
680 }
681 else
682 {
683 if (temps_deb>=tps)
684 {
685 Cerr << "On recommence le calcul des stats thermiques a partir de t=" << temps_deb << "s." << finl;
686 Tmoy_temp = 0.;
687 Trms_temp = 0.;
688 upTp_temp = 0.;
689 vpTp_temp = 0.;
690 wpTp_temp = 0.;
692 }
693 else
694 {
695 Cerr << "On a deja depasse le temps auquel vous voulez commencer les stats thermiques !" << finl;
696 exit();
697 }
698 }
699 }
700 else
701 {
702 Cerr << "On continue le calcul des stats thermiques, debute a t=" << ti << "s." << finl;
703 temps_deb = ti;
704 }
705 }
706 else
707 {
708 if (tps<=temps_deb)
709 {
710 Cerr << "On n a pas encore debute le calcul des stats thermiques." << finl;
712 }
713 else
714 {
715 Cerr << "Il faut donner le fichier pour reprendre les stats thermiques !" << finl;
716 exit();
717 }
718 }
719 }
720 else
721 {
722 // Cerr << "Pas de calcul des stats commence." << finl;
723 // Cerr << "Pas de reprise des statistiques thermiques." << finl;
724 }
725}
726
727
728
729
730
735
736
738{
739 if ((oui_u_inst != 0)||(oui_profil_nu_t != 0))
740 // On fait appel uniquement a la methode dans NS_Profils_VDF pour initialiser
741 // le calcul des moyennes puisque on y fait uniquement la creation des tableaux
742 // de correspondance et le dimensionnement des grandeurs Yuv et Nuv.
743
745
746 if (oui_stat != 0)
747 // Par contre, pour debuter le calcul des stats il faut faire un petit traitement
748 // pour la thermo puisqu'il faut dimensionner les tableaux des moyennes temporelles
749 // specifiques a la thermo, ainsi que ceux de l'hydraulique classique dans NS_Profils.
750
752}
753
754
755
756
758{
760
762 {
763 // L'utilisateur ne demande pas de reprise, c'est a dire qu'il n'y aura pas de lecture
764 // dans un fichier et qu'il faut donc dimensionner nos tableaux nous meme pour debuter les statistiques.
765 // Ces tableaux sont declares dans le Traitement_particulier_NS_Profils_thermo_VDF.h
766
767 Tmoy_temp.resize(n_probes,Nap);
768 Tmoy_temp=0;
769 Trms_temp.resize(n_probes,Nap);
770 Trms_temp=0;
771 upTp_temp.resize(n_probes,Nap);
772 upTp_temp=0;
773 vpTp_temp.resize(n_probes,Nap);
774 vpTp_temp=0;
775 wpTp_temp.resize(n_probes,Nap);
776 wpTp_temp=0;
777 }
778}
classe Convection_Diffusion_Chaleur_QC Cas particulier de Convection_Diffusion_Chaleur_Fluide_Dilatab...
classe Convection_Diffusion_Temperature Cas particulier de Convection_Diffusion_std
int_t nb_elem() const
Definition Domaine.h:131
class Domaine_VDF
Definition Domaine_VDF.h:64
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
Ecriture dans un fichier au format binaire Cette classe implemente les operateurs et les methodes vir...
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
classe Equation_base Le role d'une equation est le calcul d'un ou plusieurs champs....
Lecture dans un fichier au format binaire.
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
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
classe Probleme_base C'est un Probleme_U qui n'est pas un couplage.
virtual int nombre_d_equations() const =0
virtual const Equation_base & equation(int) const =0
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)
class Trait_part_NS_Profils_VDF This classe enables a particular treatment
Entree & lire(const Motcle &, Entree &) override
classe Traitement_particulier_NS_Profils_thermo_VDF
void ecriture_fichier_moy_spat_thermo(const DoubleTab &, const DoubleTab &, const DoubleTab &, const DoubleTab &, const DoubleTab &, const DoubleTab &, const DoubleTab &, const DoubleTab &, const DoubleTab &, const DoubleTab &, const DoubleTab &, const IntVect &, const DoubleVect &, const DoubleVect &)
void calculer_moyennes_spatiales_thermo(DoubleTab &, DoubleTab &, DoubleTab &, DoubleTab &, DoubleTab &, const IntTab &, const IntTab &, const IntVect &, const DoubleTab &)
void calculer_integrales_temporelles(DoubleTab &, const DoubleTab &, const DoubleTab &, const DoubleVect &, const DoubleVect &)
void ecriture_fichier_moy_temp_thermo(const DoubleTab &, const DoubleTab &, const DoubleTab &, const DoubleTab &, const DoubleTab &, const DoubleTab &, const double, const IntVect &)
virtual void associer_eqn(const Equation_base &)