TrioCFD 1.9.9_beta
TrioCFD documentation
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::reading files" << 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 << "matrix_file = " << fich_mat << finl;
67
68 struct stat f, e, m;
69
70 // 3 files to check:
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 // Test whether facteur_file or emissivite_file is more recent than 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 // For now, just re-read the first two files. The last name (nom3)
97 // serves as a flag indicating that the matrix must be inverted
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 << "radiation_face_file = " << fich_faces_rayo << finl;
104 Cerr << "fij_file = " << fich_fij << finl;
105
106 LecFicDiffuse fic1(fich_faces_rayo);
107 LecFicDiffuse fic2(fich_fij);
108
109 // read the number of radiation faces and the radiation faces from fic1
110 Cerr << "Reading file: " << fich_faces_rayo << finl;
111
112 fic1 >> nb_faces_totales_ >> nb_faces_rayonnantes_;
113 Cerr << "You have defined " << nb_faces_rayonnantes_ << " radiation faces out of " << nb_faces_totales_ << " faces in total" << 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 << "Error in " << fich_faces_rayo << " !!! emissivity <0 and != -1: " << les_faces_rayonnantes_[i].emissivite() << finl;
127 }
128 if (irayo >= nb_faces_rayonnantes_)
129 {
130 Cerr << "Error in " << fich_faces_rayo << finl;
131 Cerr << " nb_faces_rayonnantes user " << nb_faces_rayonnantes_ << finl;
132 Cerr << " nb_faces_rayonnantes deduced from emissivities " << irayo + 1 << finl;
133 // G.F.
134 Cerr << "Note: emissivity = 0 does not mean no radiation ... " << finl;
135 Cerr << "You must now set emissivity to -1 to ignore certain boundaries " << finl;
137 }
138 irayo++;
139 jrayo++;
140 }
141 else
142 jrayo++;
143 }
144
145 if (irayo != nb_faces_rayonnantes_)
146 {
147 Cerr << "Error in " << fich_faces_rayo << finl;
148 Cerr << " nb_faces_rayonnantes user " << nb_faces_rayonnantes_ << finl;
149 Cerr << " nb_faces_rayonnantes deduced from emissivities " << irayo << finl;
151 }
152
153 if (!lire_matrice_inv_) // read fij file in this case !!
154 {
155 Cerr << "Reading file: " << fich_fij << finl;
156
157 fic2 >> ordre_mat_forme_;
158 if (ordre_mat_forme_ != nb_faces_totales_)
159 {
160 Cerr << "The number of faces in the view factor matrix differs from that of the radiation faces file" << finl;
161 Cerr << "Check your file " << fich_fij << finl;
163 }
164
165 Cerr << "the matrix order is " << ordre_mat_forme_ << finl;
166 // Sizing the view factor "matrix".
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 << "The view factor matrix is not read since " << finl;
196 Cerr << "the inverse matrix already computed in a previous calculation will be read directly." << finl;
197 }
198 Cerr << "Reading of the preprocessor files is complete. Files are correct." << 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 // Fill the right-hand side.
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 // matrice_rayo was inverted at the start of the computation in Modele_rayo_transp::preparer_calcul.
243 // Only the product of the right-hand side with the inverse matrix needs to be computed here.
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 // Print the radiation model
267 if (processeur_rayonnant() != -1)
268 if (pb_fluide_rayo_->schema_temps().limpr())
269 {
270 Cout << "Printing radiative fluxes on radiation boundaries" << finl;
271 Cout << "----------------------------------------------------------------" << finl;
273 }
274
275 return 1;
276}
277
279{
280 if (Process::me()) return; /* only the master process prints! */
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 // retrieve the domain and find the first radiation boundary condition
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() << "face " << nglob << " seems to be contained by radiation faces " << i << " and " << 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 // Read 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 // associate the boundary condition linked to the fluid problem
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 << "The boundary condition named " << la_cl.frontiere_dis().le_nom() << " is defined as radiating" << finl;
429 Cerr<< "but is not in the list of radiation faces or its emissivity is -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 // verify that all names are present
465 if (me() == 0)
467 else
469 }
470 else //everything is ok
471 {
472 Cerr << "Resizing the boundary face array" << 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 // size the radiation matrix.
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 // Since the inverse radiation matrix will be read from a file, there is no need to fill matrice_rayo
526 }
527
528 Nom version("version_2beta3");
529
530 // INVERT THE MATRIX ONCE AND FOR ALL
531 if (!lire_matrice_inv_)
532 {
533 Cerr << "Inverting the radiation matrix at the start of the computation" << finl;
534 // First perform an LU decomposition of the radiation matrix.
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 // Then invert the 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 // Copy the result of the above solve into column jrayo of matrice_rayo
554 for (irayo = 0; irayo < nb_faces_rayonnantes(); irayo++)
555 matrice_rayo_(irayo, jrayo) = sol_tmp(irayo);
556 }
557 // matrice_rayo now contains the inverse of the initial matrice_rayo
558 }
559 }
560
561 {
562 // modify the matrix;
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 // save the column
570 for (irayo = 0; irayo < nb_faces_rayonnantes(); irayo++)
571 sol_tmp(irayo) = matrice_rayo_(irayo, jrayo);
572 //compute (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 // continue by multiplying by sigma delta_i_j emissivity(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 // Done, Fij can be cleared
597 les_facteurs_de_forme_.resize(0, 0);
598
599 // Pretty-print the matrix to the file 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 // Write the inverse matrix in binary format
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 << "Reading ASCII file " << nom_fic_mat_ray_inv_ << finl;
629 EFichier fic(nom_fic_mat_ray_inv_);
630
631 int i, j;
632 Cerr << "Reading file: " << nom_fic_mat_ray_inv_ << finl;
633 Nom toto;
634 fic >> toto;
635 if (toto != version)
636 {
637 Cerr << "You must delete your file " << nom_fic_mat_ray_inv_ << " because the stored matrix has changed." << finl;
639 }
640 fic >> ordre_mat_forme_;
641 if (ordre_mat_forme_ != nb_faces_rayonnantes())
642 {
643 Cerr << "The order of the inverse radiation matrix differs from the number of radiation faces" << finl;
644 Cerr << "Check your file " << nom_fic_mat_ray_inv_ << finl;
646 }
647 Cerr << "the matrix order is " << 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 << "Reading BINARY file " << nom_fic_mat_ray_inv_ << finl;
656 EFichierBin fic_bin(nom_fic_mat_ray_inv_);
657
658 Cerr << "Reading file: " << nom_fic_mat_ray_inv_ << finl;
659 Nom toto;
660 fic_bin >> toto;
661 if (toto != version)
662 {
663 Cerr << "You must delete your file " << nom_fic_mat_ray_inv_ << " because the stored matrix has changed." << 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 << "The order of the inverse radiation matrix differs from the number of radiation faces" << finl;
671 Cerr << "Check your file " << nom_fic_mat_ray_inv_ << finl;
673 }
674 Cerr << "the matrix order is " << ordre_mat_forme_ << finl;
675 }
676 Cerr << "Reading of the inverse radiation matrix from file " << finl;
677 Cerr << nom_fic_mat_ray_inv_ << " is complete. File correct." << finl;
678 }
679 }
680}
class Cond_lim_base Base class for the hierarchy of classes that represent the different boundary con...
virtual bool is_bc_rayo_milieu_transp(Cond_lim_rayo_milieu_transp *&la_cl_rayo)
virtual Frontiere_dis_base & frontiere_dis()
Returns the discretized boundary to which the boundary conditions apply.
class Domaine_Cl_dis_base Domaine_Cl_dis_base objects represent discretized boundary conditions
int nb_cond_lim() const
Returns the number of boundary conditions.
const Cond_lim & les_conditions_limites(int) const
Returns the i-th boundary condition.
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()
Returns the discretized boundary condition domain associated with the 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
Returns the number of faces of the boundary.
Definition Frontiere.h:59
const Frontiere & frontiere() const
Returns the associated geometric boundary.
const Nom & le_nom() const override
Returns the name of the geometric boundary.
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
Returns the reference to the equation pointed to by MorEqn::mon_equation.
Definition MorEqn.h:62
class Nom: a character string for naming TRUST objects.
Definition Nom.h:31
Base class for TRUST objects (Objet_U).
Definition Objet_U.h:68
static int dimension
Definition Objet_U.h:94
friend class Sortie
Definition Objet_U.h:70
const Nom & que_suis_je() const
Returns the string identifying the class.
Definition Objet_U.cpp:104
virtual Entree & readOn(Entree &)
Reads an Objet_U from an input stream. Virtual method to override.
Definition Objet_U.cpp:289
static const Nom & nom_du_cas()
Returns a constant reference to the case name. This method is static.
Definition Objet_U.cpp:145
virtual Sortie & printOn(Sortie &) const
Writes the object to an output stream. Virtual method to override.
Definition Objet_U.cpp:278
@ REQUIRED
Definition Param.h:115
Pb_Fluide_base This class provides a base class for.
const Nom & le_nom() const override
Returns the name of the Objet_U. Virtual method to override: returns "neant" in this implementation.
Definition Probleme_U.h:109
static int me()
Returns the rank of the local processor in the current communication group. See Comm_Group::rank() an...
Definition Process.cpp:122
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
Definition Process.cpp:466
static int je_suis_maitre()
Returns 1 if on the master processor of the current group (i.e. me() == 0), 0 otherwise.
Definition Process.cpp:82
static bool is_sequential()
Definition Process.cpp:113
SFichier is to the C++ ofstream class what Sortie is to the C++ ostream class.
Definition SFichier.h:29
void precision(int pre) override
void setf(IOS_FORMAT code) override
Base class for output streams.
Definition Sortie.h:52
void resize(_SIZE_ n, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)
Definition TRUSTTab.tpp:469