TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Echange_contact_rayo_semi_transp_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 <Echange_contact_rayo_semi_transp_VDF.h>
17#include <Pb_Conduction.h>
18#include <Pb_rayo_semi_transp.h>
19#include <Champ_front_calc.h>
20#include <Milieu_base.h>
21#include <Domaine_VDF.h>
22
23Implemente_instanciable(Echange_contact_rayo_semi_transp_VDF, "Paroi_echange_contact_rayo_semi_transp_VDF", Echange_contact_VDF);
24
26{
27 return os;
28}
29
31{
33}
34
36{
37 return (*this);
38}
39
40/*! @brief Returns the boundary temperature champ_front.
41 *
42 */
47
48/*! @brief The mettre_a_jour(temps) method fills the T_ext array with wall temperatures.
49 *
50 * These wall temperatures are used to impose the boundary condition of the
51 * radiation problem.
52 * Wall temperatures are computed taking into account the radiating
53 * character of the wall.
54 *
55 *
56 */
58{
59 if (T_autre_pb().valeurs_au_temps(temps).size() == 0)
60 {
63 Nom nom_racc1 = frontiere_dis().frontiere().le_nom();
64 if (domaine_dis1.domaine().raccord(nom_racc1)->que_suis_je() != "Raccord_distant_homogene")
66 }
67
68 int is_pb_fluide = 0;
69 DoubleTab& mon_h = h_imp_->valeurs();
70
71 int opt = 0;
72 assert(h_paroi != 0.);
73 double invhparoi = 1. / h_paroi;
74 calculer_h_autre_pb(autre_h, invhparoi, opt);
75 calculer_h_mon_pb(mon_h, 0., opt);
76
77 calculer_Teta_paroi(T_paroi->valeurs_au_temps(temps), mon_h, autre_h, is_pb_fluide, temps);
78}
79
80/*! @brief The mettre_a_jour(temps) method fills the T_ext array with wall temperatures.
81 *
82 * T_ext is used to compute the imposed flux at the boundary of each domain of the
83 * coupled problem.
84 * Wall temperatures are computed taking into account the radiating
85 * character of the wall.
86 * Calls the method Echange_externe_impose::mettre_a_jour(temps).
87 *
88 *
89 * @param temps current time
90 */
92{
93 // Cerr<<"Echange_contact_rayo_semi_transp_VDF::mettre_a_jour : Debut"<<finl;
94
96 const Milieu_base& le_milieu = ch.milieu();
97 int nb_comp = le_milieu.conductivite().nb_comp();
98
100 {
101 Cerr << "end of construction in " << que_suis_je() << finl;
103 // determine which is the fluid problem
104 const Equation_base *eqn = nullptr;
105 const Equation_base& mon_eqn = domaine_Cl_dis().equation();
106
107 const Champ_front_calc& chcal = ref_cast(Champ_front_calc, T_autre_pb());
108 const Equation_base& autre_eqn = chcal.inconnue().equation();
109 int m = 0;
110 if (mon_eqn.probleme().milieu().is_rayo_semi_transp())
111 {
112 // we are on the fluid side
113 eqn = &mon_eqn;
114 m++;
115 }
116
117 if (autre_eqn.probleme().milieu().is_rayo_semi_transp())
118 {
119 eqn = &autre_eqn;
120 m++;
121
122 }
123 if (m != 1)
124 {
125 Cerr << "big problem in " << que_suis_je() << finl;
126 assert(0);
128 }
129
130 const Front_VF& frontvf = ref_cast(Front_VF, eqn->domaine_dis().frontiere_dis(frontiere_dis().le_nom()));
132
133 Domaine_dis_base& domaine_dis1 = domaine_Cl_dis().domaine_dis();
134 Nom nom_racc1 = frontiere_dis().frontiere().le_nom();
135 if (domaine_dis1.domaine().raccord(nom_racc1)->que_suis_je() != "Raccord_distant_homogene")
137 }
138
139 T_autre_pb().mettre_a_jour(temps);
140 assert(nb_comp == 1);
141
142 DoubleTab& mon_h = h_imp_->valeurs();
143
144 int opt = 0;
145 assert(h_paroi != 0.);
146 double invhparoi = 1. / h_paroi;
147 calculer_h_autre_pb(autre_h, invhparoi, opt);
148 calculer_h_mon_pb(mon_h, 0., opt);
149
150 int is_pb_fluide = 0;
151 calculer_Teta_equiv(T_ext().valeurs_au_temps(temps), mon_h, autre_h, is_pb_fluide, temps);
152
153 // T_ext has been computed; now compute heq in himp (= mon_h)
154 int taille = mon_h.dimension(0);
155 for (int ii = 0; ii < taille; ii++)
156 for (int jj = 0; jj < nb_comp; jj++)
157 {
158 mon_h(ii, jj) = 1. / (1. / autre_h(ii, jj) + 1. / mon_h(ii, jj));
159 }
160
162}
163
165{
166 Motcle dom_app = eqn.domaine_application();
167 Motcle Thermique = "Thermique";
168 Motcle indetermine = "indetermine";
169 if ((dom_app == Thermique) || (dom_app == indetermine))
170 return 1;
171 else
172 {
174 return 0;
175 }
176}
177
179{
181
182 // Dimension the champ_front T_ext which will hold wall temperatures
183 int nb_comp = 1;
184
185 // T_ext and Tp are not the same; type T_paroi
186 T_paroi.typer("Champ_front_fonc");
187 T_paroi->fixer_nb_comp(nb_comp);
188}
189
190void Echange_contact_rayo_semi_transp_VDF::calculer_Teta_paroi(DoubleTab& Teta_p, const DoubleTab& mon_h, const DoubleTab& lautre_h, int i, double temps)
191{
192 // i will be used in the radiation step
193 //
194 //mon_h(monT-Tw)=autre_h*(Tw-Tautre)
195 // Tautre=Text;
196 // Tw=(autr_h*Tautre+mon_h*monT)/(autr_h+mon_h)
197 const Equation_base& mon_eqn = domaine_Cl_dis().equation();
198 const DoubleTab& mon_inco = mon_eqn.inconnue().valeurs();
199 const Domaine_VDF& ma_zvdf = ref_cast(Domaine_VDF, domaine_Cl_dis().domaine_dis());
200 const Front_VF& ma_front_vf = ref_cast(Front_VF, frontiere_dis());
201
202 //DoubleTab& mon_h=h_imp_->valeurs();
203 int ndeb = ma_front_vf.num_premiere_face();
204 //int ndeb2 = l_autre_front_vf.num_premiere_face();
205 int nb_faces_bord = ma_front_vf.nb_faces();
206 int ind_fac, elem;
207 //DoubleTab& Teta_i=T_ext().valeurs();
208 Teta_p.resize(nb_faces_bord, 1);
209 DoubleTab& t_autre = T_autre_pb().valeurs_au_temps(temps);
210
211 const Pb_rayo_semi_transp& le_pb_rayo = pb_rayo_semi_transp();
212 const DoubleTab& flux_radiatif = le_pb_rayo.flux_radiatif(frontiere_dis().le_nom()).valeurs();
213 for (int numfa = 0; numfa < nb_faces_bord; numfa++)
214 {
215 ind_fac = numfa + ndeb;
216 if (ma_zvdf.face_voisins(ind_fac, 0) != -1)
217 elem = ma_zvdf.face_voisins(ind_fac, 0);
218 else
219 elem = ma_zvdf.face_voisins(ind_fac, 1);
220
221 double flux_radia = flux_radiatif(numfa, 0);
222 Teta_p(numfa, 0) = (mon_h(numfa, 0) * mon_inco(elem) + lautre_h(numfa, 0) * t_autre(numfa, 0) - flux_radia) / (mon_h(numfa, 0) + lautre_h(numfa, 0));
223
224 }
225
226 const Probleme_base& pb = mon_dom_cl_dis->equation().probleme();
227 if (sub_type(Pb_Conduction, pb))
228 {
229 Cerr << "The boundary temperature should not need to be computed for the solid problem" << finl;
230 Cerr << "solid " << finl;
232 }
233}
234
235void Echange_contact_rayo_semi_transp_VDF::calculer_Teta_equiv(DoubleTab& Teta_eq, const DoubleTab& mon_h, const DoubleTab& lautre_h, int i, double temps)
236{
237 // cannot be simpler!!
238 // Teta_equiv=T_autre_pb
239
240 // i will be used in the radiation step
241 //
242 // mon_h(monT-Tw)=autre_h*(Tw-Tautre)
243 // Tautre=Text;
244 // Tw=(autr_h*Tautre+mon_h*monT)/(autr_h+mon_h)
245 const Front_VF& ma_front_vf = ref_cast(Front_VF, frontiere_dis());
246 int nb_faces_bord = ma_front_vf.nb_faces();
247
248 assert(Teta_eq.dimension(0) == nb_faces_bord);
249 assert(Teta_eq.dimension(1) == 1);
250 const Pb_rayo_semi_transp& le_pb_rayo = pb_rayo_semi_transp();
251 const DoubleTab& flux_radiatif = le_pb_rayo.flux_radiatif(frontiere_dis().le_nom()).valeurs();
252 DoubleTab& t_autre = T_autre_pb().valeurs_au_temps(temps);
253 for (int numfa = 0; numfa < nb_faces_bord; numfa++)
254 Teta_eq(numfa, 0) = t_autre(numfa, 0) - (1 / lautre_h(numfa, 0)) * flux_radiatif(numfa, 0);
255
256 Teta_eq.echange_espace_virtuel();
257
258}
259
260/*! @brief Returns the BC carried by the problem on the other side of the boundary.
261 *
262 * @return Reference to the opposite Echange_contact_rayo_semi_transp_VDF boundary condition.
263 */
265{
267 const Domaine_Cl_dis_base& zcld = ch.domaine_Cl_dis();
268 for (int i = 0; i < zcld.nb_cond_lim(); i++)
269 {
270 const Cond_lim& lacl = zcld.les_conditions_limites(i);
271 if (lacl->frontiere_dis().le_nom() == frontiere_dis().le_nom())
272 return ref_cast_non_const(Echange_contact_rayo_semi_transp_VDF, lacl.valeur());
273 }
274
275 Cerr << "Error while searching for the opposite boundary condition." << finl;
277
278 // For the compiler
279 return *this;
280}
281
DoubleTab & valeurs() override
Returns the array of field values at the current time.
class Champ_front_base Base class for the hierarchy of boundary fields.
virtual void associer_fr_dis_base(const Frontiere_dis_base &)
Associates a discretized boundary with the field.
virtual DoubleTab & valeurs() override
Returns the array of field values.
virtual DoubleTab & valeurs_au_temps(double temps)=0
virtual void mettre_a_jour(double temps)
DOES NOTHING, to override.
class Champ_front_calc Derived class of Champ_front_var representing
const Domaine_Cl_dis_base & domaine_Cl_dis() const
Returns the domain of discretized boundary conditions carried by the equation carrying the unknown fi...
const Champ_Inc_base & inconnue() const
Returns the associated unknown field.
const Milieu_base & milieu() const
Returns the medium associated with the equation carrying the unknown field whose trace is taken.
class Cond_lim_base Base class for the hierarchy of classes that represent the different boundary con...
void err_pas_compatible(const Equation_base &) const
This method is called when the boundary condition is not compatible with the equation on which we try...
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.
const Pb_rayo_semi_transp & pb_rayo_semi_transp() const
virtual void associer_pb_rayo_semi_transp(const Pb_rayo_semi_transp &)
class Cond_lim Generic class used to represent any class
Definition Cond_lim.h:31
Raccord_t & raccord(int i)
Definition Domaine.h:248
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.
Domaine_dis_base & domaine_dis()
Returns a reference to the discretized domain associated with the boundary conditions.
const Cond_lim & les_conditions_limites(int) const
Returns the i-th boundary condition.
class Domaine_VDF
Definition Domaine_VDF.h:61
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 Domaine_dis_base This class is the base of the hierarchy of discretized domains.
const Frontiere_dis_base & frontiere_dis(const Nom &) const
Returns the boundary of Name nom.
const Domaine & domaine() const
void completer() override
DOES NOTHING must be overridden in derived classes.
void calculer_h_autre_pb(DoubleTab &tab, double invhparoi, int opt)
virtual Champ_front_base & T_autre_pb()
void calculer_h_mon_pb(DoubleTab &, double, int)
class Echange_contact_rayo_semi_transp_VDF
void calculer_Teta_equiv(DoubleTab &Teta_eq, const DoubleTab &mon_h, const DoubleTab &autre_h, int i, double temps) override
Fills Teta_eq using T_autre_pb at the time passed as parameter.
Echange_contact_rayo_semi_transp_VDF & la_Cl_opposee()
Returns the BC carried by the problem on the other side of the boundary.
int compatible_avec_eqn(const Equation_base &) const override
void completer() override
DOES NOTHING must be overridden in derived classes.
void mettre_a_jour(double temps) override
The mettre_a_jour(temps) method fills the T_ext array with wall temperatures.
void calculer_Teta_paroi(DoubleTab &Teta_p, const DoubleTab &mon_h, const DoubleTab &autre_h, int i, double temps) override
Fills Teta_p using T_autre_pb at the time passed as parameter.
void calculer_temperature_bord(double temps)
The mettre_a_jour(temps) method fills the T_ext array with wall temperatures.
Champ_front_base & temperature_bord()
Returns the boundary temperature champ_front.
void mettre_a_jour(double temps) override
Performs a time update of the boundary condition.
virtual Champ_front_base & T_ext()
Returns the T_ext field of temperature imposed at the boundary.
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
class Equation_base The role of an equation is the calculation of one or more fields....
virtual const Champ_Inc_base & inconnue() const =0
Probleme_base & probleme()
Returns the problem associated with the equation.
Domaine_dis_base & domaine_dis()
Returns the discretized domain associated with the equation.
virtual const Motcle & domaine_application() const
Returns "indeterminate" Navier_Stokes_standard for example overrides this method.
virtual int nb_comp() const
Definition Field_base.h:56
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 Objet_U. Virtual method to override: returns "neant" in this implementation.
Definition Frontiere.h:49
const Frontiere & frontiere() const
Returns the associated geometric boundary.
Milieu_base This class is the base of the (physical) medium hierarchy.
Definition Milieu_base.h:50
virtual const Champ_Don_base & conductivite() const
Returns the conductivity of the medium (const version).
virtual bool is_rayo_semi_transp() const
Definition Milieu_base.h:82
const Equation_base & equation() const
Returns the reference to the equation pointed to by MorEqn::mon_equation.
Definition MorEqn.h:62
A character string (Nom) in uppercase.
Definition Motcle.h:26
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
Class Pb_Conduction: represents a heat conduction problem with non-uniform rho and Cp:
Semi-transparent radiation problem. Pb_rayo_semi_transp is a Probleme_base with 4 specific features:
const Champ_front_base & flux_radiatif(const Nom &nom_bord) const
class Probleme_base It is a Probleme_U that is not a coupling.
virtual const Milieu_base & milieu() const
Returns the physical medium associated with the problem (const version).
virtual const Equation_base & equation(int) const =0
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
Definition Process.cpp:466
Base class for output streams.
Definition Sortie.h:52
void resize(_SIZE_ n, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)
Definition TRUSTTab.tpp:469
_SIZE_ dimension(int d) const
Definition TRUSTTab.tpp:133
virtual void echange_espace_virtuel(IsExchangeBlocking exchange_type=IsExchangeBlocking::DefaultBlocking, const std::string kernel_name="noname")