TRUST 1.9.8
HPC thermohydraulic platform
Loading...
Searching...
No Matches
Modele_rayo_transp.cpp
1/****************************************************************************
2* Copyright (c) 2026, 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 <Modele_rayo_transp.h>
17#include <Discretisation_base.h>
18#include <Domaine_Cl_dis_base.h>
19#include <Frontiere_dis_base.h>
20#include <Schema_Temps_base.h>
21#include <communications.h>
22#include <Pb_Fluide_base.h>
23#include <LecFicDiffuse.h>
24#include <SFichierBin.h>
25#include <EFichierBin.h>
26#include <Fluide_base.h>
27#include <Interprete.h>
28#include <sys/stat.h>
29#include <Param.h>
30
31Implemente_instanciable(Modele_rayo_transp, "Modele_rayonnement_milieu_transparent|Transparent_medium_radiation_model", Objet_U);
32
33// XD transparent_medium_radiation_model objet_u modele_rayonnement_milieu_transparent BRACE Transparent medium
34// XD_CONT radiation model associated to a fluid problem
35
36Sortie& Modele_rayo_transp::printOn(Sortie& os) const { return os; }
37
39{
40 Nom fichier_face_rayo, fichier_fij;
41 Cerr << "Reading params of " << que_suis_je() << finl;
42 Param param(que_suis_je());
43 param.ajouter("fichier_face_rayo", &fichier_face_rayo, Param::REQUIRED); // XD_ADD_P chaine
44 // XD_CONT Face radiation file (boundaries, surface and emisivity)
45 param.ajouter("fichier_fij", &fichier_fij, Param::REQUIRED); // XD_ADD_P chaine
46 // XD_CONT View factor file matrix
47 param.ajouter("fichier_matrice", &nom_fic_mat_ray_inv_); // XD_ADD_P chaine
48 // XD_CONT File name to dump matrix
49 param.ajouter("relaxation", &relaxation_); // XD_ADD_P double
50 // XD_CONT Relaxation parameter
51 param.ajouter_flag("format_binaire", &fic_mat_ray_inv_bin_); // XD_ADD_P rien
52 // XD_CONT Flag to dump matrix in a binary file. By default it it ASCII
53 param.lire_avec_accolades_depuis(is);
54
55 Cerr << "Modele_rayo_transp::lire_fichiers" << finl;
56 if (fic_mat_ray_inv_bin_)
57 lire_fichiers(fichier_face_rayo, fichier_fij, nom_fic_mat_ray_inv_);
58 else
59 lire_fichiers(fichier_face_rayo, fichier_fij);
60
61 return is;
62}
63
64void Modele_rayo_transp::lire_fichiers(Nom& fich_faces_rayo, Nom& fich_fij, Nom& fich_mat)
65{
66 Cerr << "fichier_matrice = " << fich_mat << finl;
67
68 struct stat f, e, m;
69
70 // 3 fichiers a tester :
71 const char *facteur_file = fich_fij;
72 const char *emissivite_file = fich_faces_rayo;
73 const char *matrice_inverse_file = fich_mat;
74
75 if (stat(facteur_file, &f))
76 {
77 Cerr << facteur_file << " doesn't exist." << finl;
79 }
80
81 if (stat(emissivite_file, &e))
82 {
83 Cerr << emissivite_file << " doesn't exist." << finl;
85 }
86
87 if (stat(matrice_inverse_file, &m))
88 lire_matrice_inv_ = false;
89 else
90 lire_matrice_inv_ = true;
91
92 // Teste si facteur_file ou emissivite_file plus recent que matrice_inverse_file
93 if (lire_matrice_inv_ && (f.st_mtime > m.st_mtime || e.st_mtime > m.st_mtime))
94 lire_matrice_inv_ = false;
95
96 // Pour l'instant, on se contente de relire les deux premiers fichiers. Le dernier nom (nom3)
97 // sert de test pour indiquer qu'il faut inverser la matrice
98 lire_fichiers(fich_faces_rayo, fich_fij);
99}
100
101void Modele_rayo_transp::lire_fichiers(Nom& fich_faces_rayo, Nom& fich_fij)
102{
103 Cerr << "fichier_face_rayo = " << fich_faces_rayo << finl;
104 Cerr << "fichier_fij = " << fich_fij << finl;
105
106 LecFicDiffuse fic1(fich_faces_rayo);
107 LecFicDiffuse fic2(fich_fij);
108
109 // lecture du nombre de face rayonnante et des faces rayonnantes dans fic1
110 Cerr << "Lecture du fichier : " << fich_faces_rayo << finl;
111
112 fic1 >> nb_faces_totales_ >> nb_faces_rayonnantes_;
113 Cerr << "Vous avez defini " << nb_faces_rayonnantes_ << " faces rayonnantes sur " << nb_faces_totales_ << " faces en tout" << finl;
114 les_faces_rayonnantes_.dimensionner(nb_faces_totales_);
115 les_flux_radiatifs_.resize(nb_faces_rayonnantes());
116
117 int irayo = 0, jrayo = 0;
118 for (int i = 0; i < nb_faces_totales_; i++)
119 {
120 fic1 >> les_faces_rayonnantes_[i];
121 if (les_faces_rayonnantes_[i].emissivite() != -1)
122 {
123 if (les_faces_rayonnantes_[i].emissivite() < 0.)
124 {
125 Cerr << "Erreur dans " << fich_faces_rayo << " !!! emissivite <0 et != -1 : " << les_faces_rayonnantes_[i].emissivite() << finl;
127 }
128 if (irayo >= nb_faces_rayonnantes_)
129 {
130 Cerr << "Erreur dans " << fich_faces_rayo << finl;
131 Cerr << " nb_faces_rayonnantes utilisateur " << nb_faces_rayonnantes_ << finl;
132 Cerr << " nb_faces_rayonnantes deduites des emissivites " << irayo + 1 << finl;
133 // G.F.
134 Cerr << "On a corrige emissivite = 0 ne veut pas dire pas de rayonnement ... " << finl;
135 Cerr << "Il faut mettre maintenant l'emissivite a -1 pour ne pas tenir compte de certains bords " << finl;
137 }
138 irayo++;
139 jrayo++;
140 }
141 else
142 jrayo++;
143 }
144
145 if (irayo != nb_faces_rayonnantes_)
146 {
147 Cerr << "Erreur dans " << fich_faces_rayo << finl;
148 Cerr << " nb_faces_rayonnantes utilisateur " << nb_faces_rayonnantes_ << finl;
149 Cerr << " nb_faces_rayonnantes deduites des emissivites " << irayo << finl;
151 }
152
153 if (!lire_matrice_inv_) // lecture fichier fij dans ce cas !!
154 {
155 Cerr << "Lecture du fichier : " << fich_fij << finl;
156
157 fic2 >> ordre_mat_forme_;
158 if (ordre_mat_forme_ != nb_faces_totales_)
159 {
160 Cerr << "Le nombre de faces dans la matrice des facteurs de formes est different de celui du fichier des faces rayonnantes" << finl;
161 Cerr << "Verifier votre fichier " << fich_fij << finl;
163 }
164
165 Cerr << "l'ordre de la matrice est " << ordre_mat_forme_ << finl;
166 // Dimensionnement de la "matrice" des facteurs de formes.
167 les_facteurs_de_forme_.resize(nb_faces_rayonnantes(), nb_faces_rayonnantes());
168 irayo = 0;
169 jrayo = 0;
170 double poub = -123.;
171 for (int ii = 0; ii < nb_faces_totales_; ii++)
172 {
173 if (les_faces_rayonnantes_[ii].emissivite() != -1)
174 {
175 for (int j = 0; j < nb_faces_totales_; j++)
176 if (les_faces_rayonnantes_[j].emissivite() != -1)
177 {
178 fic2 >> les_facteurs_de_forme_(irayo, jrayo);
179 jrayo++;
180 }
181 else
182 fic2 >> poub;
183 irayo++;
184 }
185 else
186 {
187 for (int j = 0; j < nb_faces_totales_; j++)
188 fic2 >> poub;
189 }
190 jrayo = 0;
191 }
192 }
193 else
194 {
195 Cerr << "On ne lit pas la matrice des facteurs de forme puisque l'on va " << finl;
196 Cerr << "lire directement la matrice inverse qui a deja ete calculee lors d'un calcul precedent." << finl;
197 }
198 Cerr << "La lecture des fichiers du prepro est terminee. Fichiers corrects." << finl;
199}
200
202{
203 nom_pb_rayonnant_ = pb.le_nom();
204 Cerr << "The fluid radiation problem found : " << nom_pb_rayonnant_ << finl;
205
206 if (sub_type(Pb_Fluide_base, pb))
207 pb_fluide_rayo_ = ref_cast(Pb_Fluide_base, pb);
208 else
209 Process::exit("Error in Modele_rayo_transp::associer_pb_fluide_rayo ! You try to associate a non-fluid problem !!! \n");
210}
211
213{
214 for (int i = 0; i < nb_faces_totales(); i++)
215 if (les_faces_rayonnantes_[i].emissivite() != -1)
216 les_faces_rayonnantes_[i].calculer_temperature();
217}
218
220{
221 int jrayo = 0;
222
223 if (processeur_rayonnant() != -1)
224 {
225 assert(me() == 0);
226 ArrOfDouble secmem(nb_faces_rayonnantes());
227
228 // Remplissage du second membre.
229 int irayo = 0;
230
231 for (int i = 0; i < nb_faces_totales(); i++)
232 {
233 const Face_rayo_transp& Facei = les_faces_rayonnantes_[i];
234 if (Facei.emissivite() != -1)
235 {
236 // secmem(irayo) = Facei.emissivite()*SIGMA*(pow(Facei.T_face_rayo(),4));
237 secmem[irayo] = (pow(Facei.T_face_rayo(), 4));
238 irayo++;
239 }
240 }
241
242 // La matrice_rayo a ete inversee au debut du calcule dans Modele_rayo_transp::preparer_calcul.
243 // Il ne reste ici qu'a calculer le produit du second membre avec la matrice inverse.
244 for (int ii = 0; ii < nb_faces_rayonnantes(); ii++)
245 {
246 les_flux_radiatifs_(ii) = 0.;
247 for (int jj = 0; jj < nb_faces_rayonnantes(); jj++)
248 les_flux_radiatifs_(ii) += matrice_rayo_(ii, jj) * secmem[jj];
249 }
250 }
251 envoyer_broadcast(les_flux_radiatifs_, 0);
252
253 for (int i = 0; i < nb_faces_totales_; i++)
254 {
255 Face_rayo_transp& Facei = les_faces_rayonnantes_[i];
256 if (Facei.emissivite() != -1)
257 {
258 Facei.mettre_a_jour_flux_radiatif(les_flux_radiatifs_(jrayo));
259 jrayo++;
260 }
261 }
262}
263
265{
266 // Impression en plus du modele de rayonnement
267 if (processeur_rayonnant() != -1)
268 if (pb_fluide_rayo_->schema_temps().limpr())
269 {
270 Cout << "Impression des flux radiatifs sur les bords de rayonnement" << finl;
271 Cout << "----------------------------------------------------------------" << finl;
273 }
274
275 return 1;
276}
277
279{
280 if (Process::me()) return; /* seulement maitre qui imprime ! */
281
282 Nom fichier1(nom_du_cas());
283 fichier1 += "_";
284 fichier1 += nom_pb_rayonnant_;
285 fichier1 += "_Flux_radiatif.out";
286
287 Nom espace = "\t\t";
288
289 Nom fichier2(nom_du_cas());
290 fichier2 += "_";
291 fichier2 += nom_pb_rayonnant_;
292 fichier2 += "_Temperature_rayonnante.out";
293
294 if (deja_imprime_ == 0)
295 {
296 SFichier os1(fichier1);
297 SFichier os2(fichier2);
298 deja_imprime_ = 1;
299 os1 << "# Impression sur les bords rayonnants de l'equation du transfert radiatif" << finl << "# Flux radiatif [W]" << finl << "# Bord:";
300 os2 << "# Impression sur les bords rayonnants de l'equation du transfert radiatif" << finl << "# Temperature de bord moyenne en K" << finl << "# Bord:";
301 for (int i = 0; i < nb_faces_totales(); i++)
302 if (les_faces_rayonnantes_[i].emissivite() != -1)
303 {
304
305 os1 << espace << les_faces_rayonnantes_[i].nom_bord_rayo_lu();
306 os2 << espace << les_faces_rayonnantes_[i].nom_bord_rayo_lu();
307 }
308 os1 << espace << "Total" << finl << "# Temps" << finl;
309 os2 << finl << "# Temps" << finl;
310 }
311 SFichier os1(fichier1, ios::app);
312 SFichier os2(fichier2, ios::app);
313 //const int& precision=sch.precision_impr();
314 int precision = 3;
315 os1.precision(precision);
316 os1.setf(ios::scientific);
317 os2.precision(precision);
318 os2.setf(ios::scientific);
319
320 double flux_tot = 0;
321
322 os1 << temps_;
323 os2 << temps_;
324 for (int i = 0; i < nb_faces_totales(); i++)
325 if (les_faces_rayonnantes_[i].emissivite() != -1)
326 flux_tot += les_faces_rayonnantes_[i].imprimer_flux_radiatif(os, os1, os2);
327
328 os1 << "\t" << flux_tot << finl;
329 os2 << finl;
330 os << "Bilan flux radiatifs : " << flux_tot << " W" << finl;
331}
332
333double Modele_rayo_transp::flux_radiatif(int num_face) const
334{
335 if (corres_.size() == 0)
336 {
337 // on recupere le domaine et on cherche la premiere cond_lim rayo
338 int i0 = 0;
339 while (((les_faces_rayonnantes_[i0].ensembles_faces_bord(0).nb_faces_bord() == 0) || (les_faces_rayonnantes_[i0].emissivite() == -1)) && (i0 < nb_faces_totales()))
340 i0++;
341
342 int nbre_face_de_bord = -123;
343
344 if (i0 == nb_faces_totales())
345 nbre_face_de_bord = 0;
346 else
347 nbre_face_de_bord = les_faces_rayonnantes_[i0].ensembles_faces_bord(0).la_cl_base().domaine_Cl_dis().nb_faces_Cl();
348
349 corres_.resize(nbre_face_de_bord);
350 corres_ = -1;
351
352 for (int i = 0; i < nb_faces_totales(); i++)
353 if (les_faces_rayonnantes_[i].emissivite() != -1)
354 {
355 const Ensemble_faces_rayo_transp& ensemble = les_faces_rayonnantes_[i].ensembles_faces_bord(0);
356 if (ensemble.nb_faces_bord() != 0)
357 {
358 const Frontiere& la_front = ensemble.la_cl_base().frontiere_dis().frontiere();
359 int ndeb = la_front.num_premiere_face();
360 int nbfaces = la_front.nb_faces();
361 for (int face = 0; face < nbfaces; face++)
362 {
363 if (ensemble.contient(face))
364 {
365 int nglob = ndeb + face;
366 if (corres_[nglob] != -1)
367 {
368 Cerr << me() << "la face " << nglob << " semble etre contenu par les faces_rayonnantes " << i << " et " << corres_[nglob] << finl;
369 Cerr << me() << les_faces_rayonnantes_[i].nom_bord_rayo_lu() << " " << les_faces_rayonnantes_[corres_[nglob]].nom_bord_rayo_lu() << finl;
370 Cerr << ensemble.nb_faces_bord() << finl;
372 }
373 else
374 corres_[nglob] = i;
375 }
376 }
377 }
378 }
379
380 for (int i = 0; i < nbre_face_de_bord; i++)
381 if (corres_[i] == -1)
382 Cout << "Face " << i << " sans groupes " << finl;
383 }
384 return les_faces_rayonnantes_[corres_[num_face]].flux_radiatif();
385}
386
388{
389 // Lire Ensemble_faces_rayo_transp
390 for (int i = 0; i < nb_faces_totales(); i++)
391 {
392 Face_rayo_transp& face_rayo = face_rayonnante(i);
393 for (int j = 0; j < face_rayo.nb_ensembles_faces(); j++)
394 if (face_rayo.nom_bord_rayo() != face_rayo.nom_bord_rayo_lu())
395 {
396 Ensemble_faces_rayo_transp& faces_j = face_rayo.ensembles_faces_bord(j);
397 faces_j.lire(face_rayo.nom_bord_rayo_lu(), face_rayo.nom_bord_rayo(), pb_fluide_rayo_->domaine());
398 }
399 }
400
401 int compte_nb_bords_rayo = 0;
402
403 for (int j = 0; j < pb_fluide_rayo_->nombre_d_equations(); j++)
404 {
405 Domaine_Cl_dis_base& la_zcl = pb_fluide_rayo_->equation(j).domaine_Cl_dis();
406 for (int num_cl = 0; num_cl < la_zcl.nb_cond_lim(); num_cl++)
407 {
408 Cond_lim_base& la_cl = la_zcl.les_conditions_limites(num_cl).valeur();
409
410 Cond_lim_rayo_milieu_transp *la_cl_rayo;
411 if (la_cl.is_bc_rayo_milieu_transp(la_cl_rayo))
412 {
413
414 // on associe la cl liee au pb fluide
415 int ok = 0;
416 for (int i = 0; i < nb_faces_totales(); i++)
417 {
418 if (face_rayonnante(i).nom_bord_rayo() == la_cl.frontiere_dis().le_nom())
419 {
420 if (face_rayonnante(i).emissivite() != -1)
421 ok = 1;
423 compte_nb_bords_rayo += 1;
424 }
425 }
426 if (ok == 0)
427 {
428 Cerr << "La condition limite de nom " << la_cl.frontiere_dis().le_nom() << " est definie comme rayonnante" << finl;
429 Cerr<< "mais n'est pas dans la liste des faces rayonnantes ou son emissivite vaut -1" << finl;
431 }
432 }
433 }
434 }
435
436 for (int i = 0; i < nb_faces_totales(); i++)
437 if (!face_rayonnante(i).ensembles_faces_bord(0).is_ok() && (face_rayonnante(i).emissivite() != -1))
438 {
439 Cerr << finl << "ATTENTION !!! ERROR !!! The boundary " << face_rayonnante(i).nom_bord_rayo_lu() << " is not associated to a radiation boundary condition !!!" << finl;
440 Cerr << "You have two options : either use a radiation BC for the boundary " << face_rayonnante(i).nom_bord_rayo() << " or specify the emissivity to -1 at this boundary ..." << finl;
441 Cerr << finl;
442 }
443
444 if (compte_nb_bords_rayo != nb_faces_rayonnantes())
445 {
446 Cerr << finl << "Error in Modele_rayo_transp::preparer_calcul -- compte_nb_bords_rayo != nb_faces_rayonnantes() !!!" << finl;
447 Cerr << "Verify the boundary conditions you use in the problem " << pb_fluide_rayo_->le_nom() << " !!!" << finl;
448 Process::exit("It is a radiation problem and it seems you are using a non-radiation BC ... \n");
449 }
450
453 else
454 {
455 if (compte_nb_bords_rayo != 0)
456 {
457 LIST(Nom) collectnoms;
458 for (int i = 0; i < nb_faces_rayonnantes(); i++)
459 if (face_rayonnante(i).ensembles_faces_bord(0).nb_faces_bord() != 0)
460 collectnoms.add(face_rayonnante(i).nom_bord_rayo_lu());
461
462 Cerr << me() << collectnoms << finl;
463
464 // on verifie que l'on a bien tous les noms
465 if (me() == 0)
467 else
469 }
470 else //tout est ok
471 {
472 Cerr << "On redimenssionne le tableau de faces de bord" << finl;
473 Cerr << " compte_nb_bords_rayo = " << compte_nb_bords_rayo << finl;
474 Cerr << " mod_rayo.nb_faces_rayonnantes() = " << nb_faces_rayonnantes() << finl;
476 }
477 }
478
479 init_matrice_rayo();
480}
481
483{
484 temps_ = temps;
487}
488
489void Modele_rayo_transp::init_matrice_rayo()
490{
491 if (je_suis_maitre())
492 {
493 // dimensionnement de la matrice de rayonnement.
494 int irayo = 0, jrayo = 0;
495
497
498 if (!lire_matrice_inv_)
499 {
500 for (int i = 0; i < nb_faces_totales_; i++)
501 {
502 for (int j = 0; j < nb_faces_totales_; j++)
503 {
504 if (les_faces_rayonnantes_[i].emissivite() != -1)
505 {
506 if ((jrayo < nb_faces_rayonnantes()))
507 {
508 if (irayo == jrayo)
509 matrice_rayo_(irayo, jrayo) = 1 - (1 - les_faces_rayonnantes_[i].emissivite()) * les_facteurs_de_forme_(irayo, jrayo);
510 else
511 matrice_rayo_(irayo, jrayo) = (les_faces_rayonnantes_[i].emissivite() - 1) * les_facteurs_de_forme_(irayo, jrayo);
512 }
513 jrayo++;
514 }
515 }
516
517 if (les_faces_rayonnantes_[i].emissivite() != -1)
518 irayo++;
519
520 jrayo = 0;
521 }
522 }
523 else
524 {
525 // Puisque l'on va lire la matrice de rayonnement inverse dans un fichier, il n'est pas necessaire de remplire matrice_rayo
526 }
527
528 Nom version("version_2beta3");
529
530 // INVERSION DE LA MATRICE UNE FOIS POUR TOUT
531 if (!lire_matrice_inv_)
532 {
533 Cerr << "Inversion de la matrice de rayonnement au debut du calcul" << finl;
534 // On commence par decomposer la matrice de rayonnement en une decomposition LU.
535 DoubleVect sol_tmp(nb_faces_rayonnantes());
536 {
537 IntVect index(nb_faces_rayonnantes());
538 DoubleTab lu_dec(nb_faces_rayonnantes(), nb_faces_rayonnantes());
539 DoubleVect secmem_tmp(nb_faces_rayonnantes());
540
541 int cvg = matrice_rayo_.decomp_LU(nb_faces_rayonnantes(), index, lu_dec);
542
543 // Puis on inverse la matrice_rayo
544 if (cvg == 1)
545 {
546 for (jrayo = 0; jrayo < nb_faces_rayonnantes(); jrayo++)
547 {
548 for (irayo = 0; irayo < nb_faces_rayonnantes(); irayo++)
549 secmem_tmp(irayo) = 0.;
550 secmem_tmp(jrayo) = 1.;
551
552 lu_dec.resoud_LU(nb_faces_rayonnantes(), index, secmem_tmp, sol_tmp);
553 // On recopie le resultat de la resolution ci-dessus dans la colonne jrayo de matrice_rayo
554 for (irayo = 0; irayo < nb_faces_rayonnantes(); irayo++)
555 matrice_rayo_(irayo, jrayo) = sol_tmp(irayo);
556 }
557 // matrice_rayo contient maintenant l'inverse de la matrice_rayo initiale
558 }
559 }
560
561 {
562 // on change la matrice;
563 les_facteurs_de_forme_ *= -1;
564 for (jrayo = 0; jrayo < nb_faces_rayonnantes(); jrayo++)
565 les_facteurs_de_forme_(jrayo, jrayo) += 1;
566
567 for (jrayo = 0; jrayo < nb_faces_rayonnantes(); jrayo++)
568 {
569 // on sauve la colonne
570 for (irayo = 0; irayo < nb_faces_rayonnantes(); irayo++)
571 sol_tmp(irayo) = matrice_rayo_(irayo, jrayo);
572 //calcul de (I-Fij)*M-1
573 for (irayo = 0; irayo < nb_faces_rayonnantes(); irayo++)
574 {
575 double res = 0.;
576 for (int krayo = 0; krayo < nb_faces_rayonnantes(); krayo++)
577 res += les_facteurs_de_forme_(irayo, krayo) * sol_tmp(krayo);
578 matrice_rayo_(irayo, jrayo) = res;
579 }
580 }
581
582 // on continue en multipliant par sigma delta_i_j emissivite(j)
583 jrayo = 0;
584 for (int j = 0; j < nb_faces_totales(); j++)
585 {
586 const Face_rayo_transp& Facej = les_faces_rayonnantes_[j];
587 if (Facej.emissivite() != -1)
588 {
589 for (irayo = 0; irayo < nb_faces_rayonnantes(); irayo++)
590 matrice_rayo_(irayo, jrayo) *= Facej.emissivite() * sigma_;
591 jrayo++;
592 }
593 }
594 }
595
596 // On a fini on peut vider Fij
597 les_facteurs_de_forme_.resize(0, 0);
598
599 // Impression "jolie" de la matrice dans un fichier nom_fic_mat_ray_inv_
600 if (nom_fic_mat_ray_inv_ != "??")
601 {
602 if (!fic_mat_ray_inv_bin_)
603 {
604 SFichier fic(nom_fic_mat_ray_inv_);
605 fic.setf(ios::scientific);
606 fic.precision(10);
607 fic << version << finl << nb_faces_rayonnantes() << finl;
608 for (irayo = 0; irayo < nb_faces_rayonnantes(); irayo++)
609 {
610 for (jrayo = 0; jrayo < nb_faces_rayonnantes(); jrayo++)
611 fic << " " << matrice_rayo_(irayo, jrayo);
612 fic << " " << finl;
613 }
614 }
615 else
616 // Ecriture le la matrice inverse en format binaire
617 {
618 SFichierBin fic_bin(nom_fic_mat_ray_inv_);
619 fic_bin << version << finl << matrice_rayo_;
620 fic_bin.flush();
621 }
622 }
623 }
624 else
625 {
626 if (!fic_mat_ray_inv_bin_)
627 {
628 Cerr << "Lecture du fichier ASCI " << nom_fic_mat_ray_inv_ << finl;
629 EFichier fic(nom_fic_mat_ray_inv_);
630
631 int i, j;
632 Cerr << "Lecture du fichier : " << nom_fic_mat_ray_inv_ << finl;
633 Nom toto;
634 fic >> toto;
635 if (toto != version)
636 {
637 Cerr << "Il faut detruire votre fichier " << nom_fic_mat_ray_inv_ << " la matrice stockee a changee." << finl;
639 }
640 fic >> ordre_mat_forme_;
641 if (ordre_mat_forme_ != nb_faces_rayonnantes())
642 {
643 Cerr << "L'ordre de la matrice inverse de rayonnement est different du nombre de faces rayonnantes" << finl;
644 Cerr << "Verifiez votre fichier " << nom_fic_mat_ray_inv_ << finl;
646 }
647 Cerr << "l'ordre de la matrice est " << ordre_mat_forme_ << finl;
648
649 for (i = 0; i < ordre_mat_forme_; i++)
650 for (j = 0; j < ordre_mat_forme_; j++)
651 fic >> matrice_rayo_(i, j);
652 }
653 else
654 {
655 Cerr << "Lecture du fichier BINAIRE " << nom_fic_mat_ray_inv_ << finl;
656 EFichierBin fic_bin(nom_fic_mat_ray_inv_);
657
658 Cerr << "Lecture du fichier : " << nom_fic_mat_ray_inv_ << finl;
659 Nom toto;
660 fic_bin >> toto;
661 if (toto != version)
662 {
663 Cerr << "Il faut detruire votre fichier " << nom_fic_mat_ray_inv_ << " la matrice stockee a changee." << finl;
665 }
666 fic_bin >> matrice_rayo_;
667 ordre_mat_forme_ = matrice_rayo_.dimension(0);
668 if (ordre_mat_forme_ != nb_faces_rayonnantes())
669 {
670 Cerr << "L'ordre de la matrice inverse de rayonnement est different du nombre de faces rayonnantes" << finl;
671 Cerr << "Verifiez votre fichier " << nom_fic_mat_ray_inv_ << finl;
673 }
674 Cerr << "l'ordre de la matrice est " << ordre_mat_forme_ << finl;
675 }
676 Cerr << "La lecture de la matrice de rayonnement inverse dans le fichier " << finl;
677 Cerr << nom_fic_mat_ray_inv_ << " est terminee. Fichier correct " << finl;
678 }
679 }
680}
classe Cond_lim_base Classe de base pour la hierarchie des classes qui representent les differentes c...
virtual bool is_bc_rayo_milieu_transp(Cond_lim_rayo_milieu_transp *&la_cl_rayo)
virtual Frontiere_dis_base & frontiere_dis()
Renvoie la frontiere discretisee a laquelle les conditions aux limites s'appliquent.
classe Domaine_Cl_dis_base Les objets Domaine_Cl_dis_base representent les conditions aux limites
int nb_cond_lim() const
Renvoie le nombre de conditions aux limites.
const Cond_lim & les_conditions_limites(int) const
Renvoie la i-ieme condition aux limites.
void lire(const Nom &, const Nom &, const Domaine &)
const Cond_lim_base & la_cl_base() const
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
virtual Domaine_Cl_dis_base & domaine_Cl_dis()
Renvoie le domaine des conditions aux limite discretisee associee a l'equation.
double T_face_rayo() const
void mettre_a_jour_flux_radiatif(double J)
const Nom & nom_bord_rayo_lu() const
const Nom & nom_bord_rayo() const
double emissivite() const
int nb_ensembles_faces() const
const Ensemble_faces_rayo_transp & ensembles_faces_bord(int j) const
int_t num_premiere_face() const
Definition Frontiere.h:67
int_t nb_faces() const
Renvoie le nombre de faces de la frontiere.
Definition Frontiere.h:59
const Frontiere & frontiere() const
Renvoie la frontiere geometrique associee.
const Nom & le_nom() const override
Renvoie le nom de la frontiere geometrique.
void associer_processeur_rayonnant(int proc)
Face_rayo_transp & face_rayonnante(int j)
double flux_radiatif(int num_face_global) const
int nb_faces_rayonnantes() const
void mettre_a_jour(double temps)
void imprimer_flux_radiatifs(Sortie &) const
void associer_pb_fluide_rayo(const Pb_Fluide_base &)
const Equation_base & equation() const
Renvoie la reference sur l'equation pointe par MorEqn::mon_equation.
Definition MorEqn.h:62
class Nom Une chaine de caractere pour nommer les objets de TRUST
Definition Nom.h:31
classe Objet_U Cette classe est la classe de base des Objets de TRUST
Definition Objet_U.h:73
static int dimension
Definition Objet_U.h:99
friend class Sortie
Definition Objet_U.h:75
const Nom & que_suis_je() const
renvoie la chaine identifiant la classe.
Definition Objet_U.cpp:104
virtual Entree & readOn(Entree &)
Lecture d'un Objet_U sur un flot d'entree Methode a surcharger.
Definition Objet_U.cpp:293
static const Nom & nom_du_cas()
Renvoie une reference constante vers le nom du cas.
Definition Objet_U.cpp:146
virtual Sortie & printOn(Sortie &) const
Ecriture de l'objet sur un flot de sortie Methode a surcharger.
Definition Objet_U.cpp:282
@ REQUIRED
Definition Param.h:115
classe Pb_Fluide_base Cette classe a pour but de disposer d une classe amont pour
const Nom & le_nom() const override
Donne le nom de l'Objet_U Methode a surcharger : renvoie "neant" dans cette implementation.
Definition Probleme_U.h:109
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
static bool is_sequential()
Definition Process.cpp:115
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
void precision(int pre) override
void setf(IOS_FORMAT code) override
Classe de base des flux de sortie.
Definition Sortie.h:52
void resize(_SIZE_ n, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)
Definition TRUSTTab.tpp:469