TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Face_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 <Face_rayo_transp.h>
17#include <Domaine_VF.h>
18#include <Domaine_Cl_dis_base.h>
19#include <EcrFicPartage.h>
20
21Implemente_instanciable(Face_rayo_transp, "Face_rayo_transp", Objet_U);
22
24{
25 is >> nom_bord_rayo_lu_;
26 nom_bord_rayo_ = nom_bord_rayo_lu_;
27
28 // retrieve the boundary name (i.e. the part to the left of %)
29 const char *marq = strchr(nom_bord_rayo_lu_, '%');
30 if (marq)
31 {
32 nom_bord_rayo_.prefix(marq);
33 Cerr << nom_bord_rayo_lu_ << " associe au bord " << nom_bord_rayo_ << finl;
34 }
35 is >> surf_;
36 is >> emissivite_;
37
38 les_ensembles_faces_bord_.dimensionner(nb_ensembles_faces());
39
40 return is;
41}
42
43Sortie& Face_rayo_transp::printOn(Sortie& os) const { return os; }
44
46{
47 // special case where Ensemble_Faces coincides with a boundary: nb_ensembles_faces() = 1
48 for (int j = 0; j < nb_ensembles_faces(); j++)
49 {
51 double sum_surf = 0.;
52 double sum_T = 0.;
53
54 if (faces_j.nb_faces_bord() != 0)
55 {
56 const Frontiere& le_bord = faces_j.la_cl_base().frontiere_dis().frontiere();
57 double surf;
58 int nbfacesbord = le_bord.nb_faces();
59 const IntVect& tables_faces = faces_j.Table_faces();
60 int nbfaces_ens = tables_faces.size();
61 if ((nbfacesbord == nbfaces_ens) || (nbfaces_ens == 0))
62 {
63 for (int face = 0; face < nbfacesbord; face++)
64 {
65 surf = faces_j.surface(face);
66 sum_surf += surf;
67 sum_T += surf * pow(faces_j.teta_i(face), 4);
68 }
69 }
70 else
71 {
72 for (int face = 0; face < nbfaces_ens; face++)
73 {
74 int face2 = tables_faces(face);
75 surf = faces_j.surface(face2);
76 sum_surf += surf;
77 sum_T += surf * pow(faces_j.teta_i(face2), 4);
78 }
79 }
80 }
81 double sum_T_tot = sum_T;
82 double sum_surf_tot = sum_surf;
83 sum_surf_tot = mp_sum(sum_surf_tot);
84 // important test but interferes with Rayo validation
85 //if (!est_egal(sum_surf_tot,surf_,1e-4)) { Cerr<< " Pb surface calculee "<<sum_surf_tot<<" surfaces du fichier facesrayo "<<surf_<<finl;abort();}
86 //surf_=sum_surf_tot;
87 sum_T_tot = mp_sum(sum_T_tot);
88 double coef = sum_T_tot / sum_surf_tot;
89 T_face_rayo_ = pow(coef, 0.25);
90 }
91 return T_face_rayo_;
92}
93
95{
96
97 double flux_ = flux_radiatif_ * surface_rayo();
98 Nom espace = "\t";
99 os << nom_bord_rayo_lu() << "\t: " << flux_ << " W (temperature bord:" << T_face_rayo_ << " K)" << finl;
100 os1 << espace << flux_;
101 os2 << espace << T_face_rayo_;
102 return flux_;
103}
104
106{
107 // check whether the given nom_bord is a radiating face.
108 if (nom_bord == nom_bord_rayo_)
109 {
110 if (emissivite_ != -1)
111 return 1;
112 else
113 return -1;
114 }
115 return -1;
116}
117
119{
120 if (emissivite_ == -1)
121 return;
122
123 Nom fic(nom_bord_rayo_lu());
124 fic += "_Temp";
125 EcrFicPartage sortie(fic);
126 if (je_suis_maitre())
127 {
128 Cerr << "writing boundary temperatures to " << fic << finl;
129 sortie << "# temperatures bord du bord " << nom_bord_rayo_lu() << " emissivites " << emissivite_ << finl;
130 sortie << "# x y (z) temperature surface" << finl;
131 }
132 sortie.lockfile();
133 for (int j = 0; j < nb_ensembles_faces(); j++)
134 {
135 // hard cast due to teta_i
136 // to be cleaned up when teta_i becomes a const method...
138 double T = 0;
139 if (faces_j.nb_faces_bord() != 0)
140 {
141 const Frontiere& le_bord = faces_j.la_cl_base().frontiere_dis().frontiere();
142 const Domaine_VF& domaine_dis = ref_cast(Domaine_VF, faces_j.la_cl_base().domaine_Cl_dis().domaine_dis());
143 const DoubleTab& xv = domaine_dis.xv();
144 double surf;
145 int nbfacesbord = le_bord.nb_faces();
146 const IntVect& tables_faces = faces_j.Table_faces();
147 int nbfaces_ens = tables_faces.size();
148 if ((nbfacesbord == nbfaces_ens) || (nbfaces_ens == 0))
149 {
150 for (int face = 0; face < nbfacesbord; face++)
151 {
152 surf = faces_j.surface(face);
153 T = faces_j.teta_i(face);
154 sortie << xv(face, 0) << " " << xv(face, 1) << " ";
155 if (dimension == 3)
156 sortie << xv(face, 1) << " ";
157 sortie << T << " " << surf << finl;
158 }
159 }
160 else
161 {
162 for (int face = 0; face < nbfaces_ens; face++)
163 {
164 int face2 = tables_faces(face);
165 surf = faces_j.surface(face2);
166 T = faces_j.teta_i(face2);
167 sortie << xv(face, 0) << " " << xv(face, 1) << " ";
168 if (dimension == 3)
169 sortie << xv(face, 1) << " ";
170 sortie << T << " " << surf << finl;
171 }
172 }
173 }
174
175 }
176 sortie.unlockfile();
177 sortie.syncfile();
178}
Domaine_Cl_dis_base & domaine_Cl_dis()
Returns the domain of discretized boundary conditions to which the object belongs.
virtual Frontiere_dis_base & frontiere_dis()
Returns the discretized boundary to which the boundary conditions apply.
Domaine_dis_base & domaine_dis()
Returns a reference to the discretized domain associated with the boundary conditions.
class Domaine_VF
Definition Domaine_VF.h:44
double xv(int num_face, int k) const
Definition Domaine_VF.h:76
Sortie & unlockfile() override
Releases the critical resource for the next process.
Sortie & lockfile() override
Allows the calling process to block waiting for the common resource shared by all processes,...
Sortie & syncfile() override
Triggers writing to disk of the data accumulated on the different processors since the last call to s...
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
int chercher_ensemble_faces(const Nom &) const
double surface_rayo() const
const Nom & nom_bord_rayo_lu() const
void ecrire_temperature_bord() const
double imprimer_flux_radiatif(Sortie &, Sortie &, Sortie &) const
int nb_ensembles_faces() const
const Ensemble_faces_rayo_transp & ensembles_faces_bord(int j) const
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.
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
virtual Entree & readOn(Entree &)
Reads an Objet_U from an input stream. Virtual method to override.
Definition Objet_U.cpp:289
virtual Sortie & printOn(Sortie &) const
Writes the object to an output stream. Virtual method to override.
Definition Objet_U.cpp:278
static double mp_sum(double)
Computes the sum of x over all processors in the current group.
Definition Process.cpp:145
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
Base class for output streams.
Definition Sortie.h:52
_SIZE_ size() const
Definition TRUSTVect.tpp:45