TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Flux_radiatif_VDF.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 <Frontiere_ouverte_temperature_imposee_rayo_semi_transp.h>
17#include <Echange_externe_impose_rayo_semi_transp.h>
18#include <Echange_global_impose_rayo_semi_transp.h>
19#include <Echange_contact_rayo_semi_transp_VDF.h>
20#include <Frontiere_ouverte_rayo_semi_transp.h>
21#include <Neumann_paroi_rayo_semi_transp_VDF.h>
22#include <Champ_front_uniforme.h>
23#include <Eq_rayo_semi_transp.h>
24#include <Pb_rayo_semi_transp.h>
25#include <Flux_radiatif_VDF.h>
26#include <Schema_Temps_base.h>
27#include <Champ_Uniforme.h>
28#include <Fluide_base.h>
29#include <Domaine_VDF.h>
30#include <Debog.h>
31
32Implemente_instanciable(Flux_radiatif_VDF, "Flux_radiatif_VDF", Flux_radiatif_base);
33
34Sortie& Flux_radiatif_VDF::printOn(Sortie& s) const { return s << que_suis_je() << finl; }
36
38 const Champ_Don_base& indice, const Domaine_VF& zvf,
39 const double sigma, double temps)
40{
41 const DoubleTab& l_rayo = longueur_rayo.valeurs();
42 const DoubleTab& n = indice.valeurs();
43 const DoubleTab& epsilon = emissivite().valeurs();
44 const DoubleTab& kappa = coeff_abs.valeurs();
45
46 const Domaine_VDF& zvdf = ref_cast(Domaine_VDF, zvf);
47 const Front_VF& le_bord = ref_cast(Front_VF, frontiere_dis());
48 const IntTab& face_voisins = zvdf.face_voisins();
49
50 // Dimension le_champ_front
51 assert(le_champ_front->nb_comp() == 1);
52 DoubleTab& tab = le_champ_front->valeurs_au_temps(temps);
53 tab.resize(le_bord.nb_faces(), le_champ_front->nb_comp());
54
55 assert(indice.nb_comp() == 1);
56 assert(longueur_rayo.nb_comp() == 1);
57 assert(coeff_abs.nb_comp() == 1);
58 assert(Tb.nb_comp() == 1);
59 assert(emissivite().nb_comp() == 1);
60
61 const int ndeb = le_bord.num_premiere_face();
62 const int nfin = ndeb + le_bord.nb_faces();
63 double nn = -123., k = -123., l_r = -123.;
64 double epsi = -123., T = -123.;
65
66 // Loop over the faces of le_bord
67 for (int face = ndeb; face < nfin; face++)
68 {
69 int elem = face_voisins(face, 0);
70
71 const double eF = zvdf.dist_norm_bord(face);
72
73 if (sub_type(Champ_Uniforme, indice))
74 nn = n(0, 0);
75 else
76 nn = n(elem, 0);
77
78 if (sub_type(Champ_Uniforme, longueur_rayo))
79 l_r = l_rayo(0, 0);
80 else
81 l_r = l_rayo(elem, 0);
82
83 if (sub_type(Champ_Uniforme, coeff_abs))
84 k = kappa(0, 0);
85 else
86 k = kappa(elem, 0);
87
88 // Determination of the wall temperature as a function of the face considered
89 if (sub_type(Champ_front_uniforme, Tb))
90 T = Tb.valeurs()(0, 0);
91 else
92 T = Tb.valeurs_au_temps(temps)(face - ndeb, 0);
93
94 // Determination of the wall emissivity as a function of the face considered
95 if (sub_type(Champ_front_uniforme, emissivite()))
96 epsi = epsilon(0, 0);
97 else
98 epsi = epsilon(face - ndeb, 0);
99
100 // Filling the boundary condition for the radiation equation
101 double numer_coeff = l_r;
102 numer_coeff *= 4 * nn * nn * sigma * pow(T, 4);
103
104 double denum_coeff = 3 * k * epsi;
105 denum_coeff = 1 / denum_coeff;
106 denum_coeff *= A_ * (2 - epsi);
107 denum_coeff = denum_coeff + eF;
108
109 if (epsi < DMINFLOAT)
110 tab(face - ndeb, 0) = 0.;
111 else
112 tab(face - ndeb, 0) = numer_coeff / denum_coeff;
113 }
114
116}
117
119{
120 // Retrieve the boundary temperature
121 const Front_VF& le_bord = ref_cast(Front_VF, frontiere_dis());
122 const int nb_faces = le_bord.nb_faces();
123 const Conds_lim& les_cl_temp = eq_temp.domaine_Cl_dis().les_conditions_limites();
124 OBS_PTR(Champ_front_base) Tb;
125
126 int test_nom = 0;
127 for (int num_cl_temp = 0; num_cl_temp < les_cl_temp.size(); num_cl_temp++)
128 {
129 const Cond_lim& la_cl_temp = eq_temp.domaine_Cl_dis().les_conditions_limites(num_cl_temp);
130 Nom nom_cl_temp = la_cl_temp->frontiere_dis().le_nom();
131 if (nom_cl_temp == frontiere_dis().le_nom())
132 {
133 test_nom = 1;
134 if (sub_type(Neumann_paroi_rayo_semi_transp_VDF, la_cl_temp.valeur()))
135 {
136 const Neumann_paroi_rayo_semi_transp_VDF& la_cl_temper = ref_cast(Neumann_paroi_rayo_semi_transp_VDF, la_cl_temp.valeur());
137 Tb = la_cl_temper.temperature_bord();
138 }
139 else if (sub_type(Echange_contact_rayo_semi_transp_VDF, la_cl_temp.valeur()))
140 {
141 Echange_contact_rayo_semi_transp_VDF& la_cl_temper = ref_cast_non_const(Echange_contact_rayo_semi_transp_VDF, la_cl_temp.valeur());
142 Tb = la_cl_temper.temperature_bord();
143 }
144 else if (sub_type(Echange_externe_impose_rayo_semi_transp, la_cl_temp.valeur()))
145 {
146 Echange_externe_impose_rayo_semi_transp& la_cl_temper = ref_cast_non_const(Echange_externe_impose_rayo_semi_transp, la_cl_temp.valeur());
147 Tb = la_cl_temper.temperature_bord();
148 }
149 else if (sub_type(Frontiere_ouverte_temperature_imposee_rayo_semi_transp, la_cl_temp.valeur()))
150 {
152 Tb = la_cl_temper.temperature_bord();
153 }
154 else if (sub_type(Frontiere_ouverte_rayo_semi_transp, la_cl_temp.valeur()))
155 {
156 const Frontiere_ouverte_rayo_semi_transp& la_cl_temper = ref_cast(Frontiere_ouverte_rayo_semi_transp, la_cl_temp.valeur());
157 Tb = la_cl_temper.temperature_bord();
158 }
159 else if (sub_type(Echange_global_impose_rayo_semi_transp, la_cl_temp.valeur()))
160 {
161 Echange_global_impose_rayo_semi_transp& la_cl_temper = ref_cast_non_const(Echange_global_impose_rayo_semi_transp, la_cl_temp.valeur());
162 Tb = la_cl_temper.temperature_bord();
163 }
164 else
165 {
166 Cerr << "Implementation needed for other boundary conditions of the temperature equation 1 " << finl;
168 }
169 }
170 }
171 if (test_nom == 0)
172 {
173 Cerr << "Error: there is no boundary condition on a boundary named: " << le_nom() << finl;
175 }
176
177 // Tb contains the boundary temperatures
178 // Compute the radiative flux
179 DoubleTab& Flux = flux_radiatif_->valeurs();
180 Flux.resize(le_bord.nb_faces(), 1);
181 const Eq_rayo_semi_transp& eq_rayo = ref_cast(Eq_rayo_semi_transp, domaine_Cl_dis().equation());
182 const Fluide_base& fluide = eq_rayo.fluide();
183 const DoubleTab& kappa = fluide.kappa().valeurs();
184 const DoubleTab& indice = fluide.indice().valeurs();
185 const DoubleTab& irradiance = eq_rayo.inconnue().valeurs();
186
187 const Domaine_VDF& zvdf = ref_cast(Domaine_VDF, domaine_Cl_dis().domaine_dis());
188 const IntTab& face_voisins = zvdf.face_voisins();
189 const DoubleVect& face_surfaces = zvdf.face_surfaces();
190 const double sigma = eq_rayo.pb_rayo_semi_transp().valeur_sigma();
191
192 assert(fluide.kappa().nb_comp() == 1);
193 assert(emissivite().nb_comp() == 1);
194 assert(fluide.indice().nb_comp() == 1);
195 assert(Tb->nb_comp() == 1);
196
197 double bilan_flux = 0.;
198 const int ndeb = le_bord.num_premiere_face();
199 double kappa_F = -123., epsi = -123.;
200 double Tbord = -123., n = -123.;
201
202 // Loop over the faces
203 for (int face = 0; face < nb_faces; face++)
204 {
205 int elem = face_voisins(face + ndeb, 0);
206 if (elem < 0)
207 elem = face_voisins(face + ndeb, 1);
208
209 if (sub_type(Champ_Uniforme, fluide.kappa()))
210 kappa_F = kappa(0, 0);
211 else
212 kappa_F = kappa(elem, 0);
213
214 if (sub_type(Champ_front_uniforme, emissivite()))
215 epsi = emissivite().valeurs()(0, 0);
216 else
217 epsi = emissivite().valeurs()(face, 0);
218
219 if (sub_type(Champ_Uniforme, fluide.indice()))
220 n = indice(0, 0);
221 else
222 n = indice(elem, 0);
223
224 if (sub_type(Champ_front_uniforme, Tb.valeur()))
225 Tbord = Tb->valeurs()(0, 0);
226 else
227 Tbord = Tb->valeurs()(face, 0);
228
229 const double G_F = irradiance(elem);
230 const double eF = zvdf.dist_norm_bord(face + ndeb);
231
232 double denum = A_ * (2 - epsi);
233 denum /= 3 * kappa_F * epsi;
234 denum += eF;
235
236 const double numer = G_F - 4 * n * n * sigma * pow(Tbord, 4);
237 double grad_G = numer / denum;
238
239 if (epsi < DMINFLOAT)
240 Flux(face, 0) = 0;
241 else
242 Flux(face, 0) = -grad_G / (3 * kappa_F);
243
244 bilan_flux += face_surfaces(face + ndeb) * Flux(face, 0);
245 }
246
247 Debog::verifier_bord(" Flux_radiatif_VDF::calculer_flux_radiatif_Flux ", Flux, ndeb);
248
249 if (eq_rayo.schema_temps().limpr())
250 Cout << "Radiative flux on the boundary " << le_bord.le_nom() << ": " << bilan_flux << finl;
251}
class Champ_Don_base base class of Given Fields (not calculated)
DoubleTab & valeurs() override
Overrides Champ_base::valeurs() Returns the array of values.
DoubleTab & valeurs() override
Returns the array of field values at the current time.
Champ_Uniforme Represents a field that is constant in space and time.
class Champ_front_base Base class for the hierarchy of boundary fields.
virtual DoubleTab & valeurs() override
Returns the array of field values.
virtual DoubleTab & valeurs_au_temps(double temps)=0
class Champ_front_uniforme Derived class of Champ_front_base representing
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.
class Cond_lim Generic class used to represent any class
Definition Cond_lim.h:31
class Conds_lim This class represents a vector of boundary conditions.
Definition Conds_lim.h:32
static void verifier_bord(const char *const msg, const DoubleVect &arr, int num_deb)
Definition Debog.cpp:33
const Cond_lim & les_conditions_limites(int) const
Returns the i-th boundary condition.
class Domaine_VDF
Definition Domaine_VDF.h:61
double dist_norm_bord(int num_face) const override
Returns the normal distance for a boundary face (Cartesian coordinates).
class Domaine_VF
Definition Domaine_VF.h:44
virtual const DoubleVect & face_surfaces() const
Definition Domaine_VF.h:51
int face_voisins(int num_face, int i) const
Returns the neighbouring element of num_face in direction i.
Definition Domaine_VF.h:418
class Echange_contact_rayo_semi_transp_VDF
Champ_front_base & temperature_bord()
Returns the boundary temperature champ_front.
class Echange_externe_impose_rayo_semi_transp
class Echange_global_impose_rayo_semi_transp
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
const Pb_rayo_semi_transp & pb_rayo_semi_transp() const
const Champ_Inc_base & inconnue() const override
class Equation_base The role of an equation is the calculation of one or more fields....
virtual Domaine_Cl_dis_base & domaine_Cl_dis()
Returns the discretized boundary condition domain associated with the equation.
Schema_Temps_base & schema_temps()
Returns the time scheme associated with the equation.
virtual int nb_comp() const
Definition Field_base.h:56
Base class for an incompressible fluid and its properties:
Definition Fluide_base.h:36
Champ_Don_base & kappa()
Definition Fluide_base.h:68
Champ_Don_base & indice()
Definition Fluide_base.h:73
void calculer_flux_radiatif(const Equation_base &eq_temp) override
void evaluer_cl_rayonnement(Champ_front_base &Tb, const Champ_Don_base &, const Champ_Don_base &, const Champ_Don_base &, const Domaine_VF &, const double, double)
Champ_front_base & emissivite()
class Front_VF
Definition Front_VF.h:36
int nb_faces() const
Definition Front_VF.h:53
int num_premiere_face() const
Definition Front_VF.h:63
const Nom & le_nom() const override
Returns the name of the geometric boundary.
class Nom: a character string for naming TRUST objects.
Definition Nom.h:31
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
virtual const Nom & le_nom() const
Returns the name of the Objet_U. Virtual method to override: returns "neant" in this implementation.
Definition Objet_U.cpp:317
virtual Sortie & printOn(Sortie &) const
Writes the object to an output stream. Virtual method to override.
Definition Objet_U.cpp:278
const double & valeur_sigma() const
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
Definition Process.cpp:466
int limpr() const
Returns 1 if there is a need to perform a print (cf dt_impr) Returns 0 otherwise.
Base class for output streams.
Definition Sortie.h:52
void resize(_SIZE_ n, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)
Definition TRUSTTab.tpp:469
virtual void echange_espace_virtuel(IsExchangeBlocking exchange_type=IsExchangeBlocking::DefaultBlocking, const std::string kernel_name="noname")