TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Flux_radiatif_VEF.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 <Temperature_imposee_paroi_rayo_semi_transp.h>
18#include <Neumann_paroi_rayo_semi_transp_VEF.h>
19#include <Frontiere_ouverte_rayo_semi_transp.h>
20#include <Champ_front_uniforme.h>
21#include <Eq_rayo_semi_transp.h>
22#include <Pb_rayo_semi_transp.h>
23#include <Flux_radiatif_VEF.h>
24#include <Schema_Temps_base.h>
25#include <Champ_Uniforme.h>
26#include <Fluide_base.h>
27#include <Domaine_VEF.h>
28#include <TRUST_Ref.h>
29#include <Debog.h>
30
31Implemente_instanciable(Flux_radiatif_VEF, "Flux_radiatif_VEF", Flux_radiatif_base);
32
33Sortie& Flux_radiatif_VEF::printOn(Sortie& s) const { return s << que_suis_je() << finl; }
35
37 const Champ_Don_base& indice, const Domaine_VF& zvf,
38 const double sigma, double temps)
39{
40 const DoubleTab& n = indice.valeurs();
41 const DoubleTab& epsilon = emissivite().valeurs();
42 const Front_VF& le_bord = ref_cast(Front_VF, frontiere_dis());
43
44 // Size the DoubleTab associated with le_champ_front
45 assert(le_champ_front->nb_comp() == 1);
46 DoubleTab& tab = le_champ_front->valeurs_au_temps(temps);
47
48 assert(emissivite().nb_comp() == 1);
49 assert(indice.nb_comp() == 1);
50 assert(Tb.nb_comp() == 1);
51
52 const int ndeb = le_bord.num_premiere_face();
53 const int nfin = ndeb + le_bord.nb_faces();
54 double epsi = -123., nn = -123., T = -123.;
55
56 // Loop over the faces of le_bord
57 for (int face = ndeb; face < nfin; face++)
58 {
59 if (sub_type(Champ_front_uniforme, emissivite()))
60 epsi = epsilon(0, 0);
61 else
62 epsi = epsilon(face - ndeb, 0);
63
64 if (sub_type(Champ_Uniforme, indice))
65 nn = n(0, 0);
66 else
67 nn = n(face, 0);
68
69 if (sub_type(Champ_front_uniforme, Tb))
70 T = Tb.valeurs()(0, 0);
71 else
72 T = Tb.valeurs_au_temps(temps)(face - ndeb, 0);
73
74 const double numer_coeff = 4 * nn * nn * sigma * pow(T, 4) * epsi;
75 const double denum_coeff = A_ * (2 - epsi);
76
77 tab(face - ndeb, 0) = numer_coeff / denum_coeff;
78 }
79
81}
82
84{
85 // We need to retrieve the wall temperature
86 const Front_VF& le_bord = ref_cast(Front_VF, frontiere_dis());
87 const int nb_faces = le_bord.nb_faces();
88 const Conds_lim& les_cl_temp = eq_temp.domaine_Cl_dis().les_conditions_limites();
89 OBS_PTR(Champ_front_base) Tb;
90
91 int test_nom = 0;
92 for (int num_cl_temp = 0; num_cl_temp < les_cl_temp.size(); num_cl_temp++)
93 {
94 const Cond_lim& la_cl_temp = eq_temp.domaine_Cl_dis().les_conditions_limites(num_cl_temp);
95 Nom nom_cl_temp = la_cl_temp->frontiere_dis().le_nom();
96 if (nom_cl_temp == frontiere_dis().le_nom())
97 {
98 test_nom = 1;
99 if (sub_type(Neumann_paroi_rayo_semi_transp_VEF, la_cl_temp.valeur()))
100 {
101 Neumann_paroi_rayo_semi_transp_VEF& la_cl_temper = ref_cast_non_const(Neumann_paroi_rayo_semi_transp_VEF, la_cl_temp.valeur());
102 Tb = la_cl_temper.temperature_bord();
103 }
104 else if (sub_type(Temperature_imposee_paroi_rayo_semi_transp, la_cl_temp.valeur()))
105 {
106 Temperature_imposee_paroi_rayo_semi_transp& la_cl_temper = ref_cast_non_const(Temperature_imposee_paroi_rayo_semi_transp, la_cl_temp.valeur());
107 Tb = la_cl_temper.temperature_bord();
108 }
109 else if (sub_type(Frontiere_ouverte_temperature_imposee_rayo_semi_transp, la_cl_temp.valeur()))
110 {
112 Tb = la_cl_temper.temperature_bord();
113 }
114 else if (sub_type(Frontiere_ouverte_rayo_semi_transp, la_cl_temp.valeur()))
115 {
116 const Frontiere_ouverte_rayo_semi_transp& la_cl_temper = ref_cast(Frontiere_ouverte_rayo_semi_transp, la_cl_temp.valeur());
117 Tb = la_cl_temper.temperature_bord();
118 }
119 else
120 {
121 Cerr << "To be implemented for other boundary conditions of the temperature equation 1 " << finl;
123 }
124 }
125 }
126 if (test_nom == 0)
127 {
128 Cerr << "Error: there is no boundary condition on a boundary with the name: " << frontiere_dis().le_nom() << finl;
130 }
131
132 // Tb contains the wall temperatures
133 // Computation of the radiative flux
134 DoubleTab& Flux = flux_radiatif().valeurs();
135 Flux.resize(le_bord.nb_faces(), 1);
136 const Eq_rayo_semi_transp& eq_rayo = ref_cast(Eq_rayo_semi_transp, domaine_Cl_dis().equation());
137 const Fluide_base& fluide = eq_rayo.fluide();
138 const DoubleTab& indice = fluide.indice().valeurs();
139 const DoubleTab& irradiance = eq_rayo.inconnue().valeurs();
140
141 const Domaine_VEF& zvef = ref_cast(Domaine_VEF, domaine_Cl_dis().domaine_dis());
142 const DoubleTab& face_normales = zvef.face_normales();
143 const double sigma = eq_rayo.pb_rayo_semi_transp().valeur_sigma();
144
145 assert(emissivite().nb_comp() == 1);
146 assert(fluide.indice().nb_comp() == 1);
147 assert(Tb->nb_comp() == 1);
148
149 double bilan_flux = 0.;
150 const int ndeb = le_bord.num_premiere_face();
151 double epsi = -123., Tbord = -123., n = -123.;
152
153 // Loop over the faces
154 for (int face = 0; face < nb_faces; face++)
155 {
156 if (sub_type(Champ_front_uniforme, emissivite()))
157 epsi = emissivite().valeurs()(0, 0);
158 else
159 epsi = emissivite().valeurs()(face, 0);
160
161 if (sub_type(Champ_Uniforme, fluide.indice()))
162 n = indice(0, 0);
163 else
164 n = indice(face + ndeb, 0);
165
166 if (sub_type(Champ_front_uniforme, Tb.valeur()))
167 Tbord = Tb->valeurs()(0, 0);
168 else
169 Tbord = Tb->valeurs()(face, 0);
170
171 const double irra = irradiance(face + ndeb);
172
173 const double denum = A_ * (2 - epsi);
174 const double numer = epsi * (irra - 4 * n * n * sigma * pow(Tbord, 4));
175 Flux(face, 0) = -numer / denum;
176
177 // Compute the balance
178 double surface = 0.;
179 for (int i = 0; i < dimension; i++)
180 surface += (face_normales(face + ndeb, i) * face_normales(face + ndeb, i));
181
182 surface = sqrt(surface);
183 bilan_flux += surface * Flux(face, 0);
184 }
185
186 Debog::verifier_bord(" Flux_radiatif_VEF::calculer_flux_radiatif_Flux ", Flux, ndeb);
187
188 if (eq_rayo.schema_temps().limpr())
189 Cout << "Radiative flux on boundary " << le_bord.le_nom() << " : " << bilan_flux << finl;
190}
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_VEF
Definition Domaine_VEF.h:53
class Domaine_VF
Definition Domaine_VF.h:44
virtual double face_normales(int face, int comp) const
Definition Domaine_VF.h:47
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 & 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 & flux_radiatif()
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
static int dimension
Definition Objet_U.h:94
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")
Temperature_imposee_paroi_rayo_semi_transp class: used to impose a wall temperature.