TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Champ_front_contact_rayo_transp_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 <Champ_front_contact_rayo_transp_VEF.h>
17#include <Schema_Temps_base.h>
18#include <Pb_Fluide_base.h>
19#include <Champ_Inc_base.h>
20#include <Pb_Conduction.h>
21#include <Equation_base.h>
22#include <Domaine_VEF.h>
23
24Implemente_instanciable(Champ_front_contact_rayo_transp_VEF, "Champ_front_contact_rayo_transp_VEF", Champ_front_contact_VEF);
25
27
29{
32}
33
35{
36 assert (!le_modele_rayo_);
37
38 // retrieve the rayo model ... but we need the right problem !
39 // XXX not yet entered Champ_front_contact_VEF::initialiser ... so some things must be done manually here ...
41 if (pb1.milieu().is_rayo_transp()) // good, we are on the fluid side !!
42 {
43 assert (sub_type(Pb_Fluide_base, pb1));
44 le_modele_rayo_ =ref_cast(Pb_Fluide_base, pb1).get_mod_rayo_transp();
45 }
46 else // the other problem...
47 {
49 if (pb2.milieu().is_rayo_transp()) // pb fluide trouve !!
50 {
51 assert (sub_type(Pb_Fluide_base, pb2));
52 le_modele_rayo_ =ref_cast(Pb_Fluide_base, pb2).get_mod_rayo_transp();
53 }
54 else
55 {
56 Cerr << finl << "Big issue in Champ_front_contact_rayo_transp_VEF::initialiser !!!" << finl;
57 Cerr << "It seems that you defined a radiation contact BC between the boundaries " << nom_bord1 << " and " << nom_bord2 << finl;
58 Cerr << "of problems " << nom_pb1 << " and " << nom_pb2 << " , but neither is a fluid radiation problem !!!" << finl;
59 Process::exit("Please fix your data file and use a classical paroi_contact BC for these boundaries ... \n");
60 }
61 }
62
63 int nb_faces = frontiere_dis().frontiere().nb_faces();
64 flux_radiatif_.resize(nb_faces);
65 return Champ_front_contact_VEF::initialiser(temps, inco);
66}
67
72
74{
75 if (is_conduction) // The model is known by the other problem
76 {
77 // Computation of the radiative flux on the boundary of the other problem
78 DoubleTab flux_radiatif_autre_pb;
79 int nb_faces = fr_vf_autre_pb->frontiere().nb_faces();
80 int ndeb = fr_vf_autre_pb->frontiere().num_premiere_face();
81 flux_radiatif_autre_pb.resize(nb_faces);
82 for (int fac_front = 0; fac_front < nb_faces; fac_front++)
83 flux_radiatif_autre_pb(fac_front) = le_modele_rayo_->flux_radiatif(fac_front + ndeb);
84 // Fetch it from the other problem
85 trace_face_raccord(fr_vf_autre_pb.valeur(), flux_radiatif_autre_pb, flux_radiatif_);
86 }
87 else
88 {
89 int nb_faces = frontiere_dis().frontiere().nb_faces();
91 flux_radiatif_.resize(nb_faces);
92 for (int fac_front = 0; fac_front < nb_faces; fac_front++)
93 flux_radiatif_(fac_front) = le_modele_rayo_->flux_radiatif(fac_front + ndeb);
94 }
95}
96
101
103{
105
106 // verify that the coupling is indeed radiative
107 const Nom& nom_pb_rayonnant = le_modele_rayo_->nom_pb_rayonnant();
108
109 // the radiating problem is neither of the 2 problems: the coupling is non-radiative
110 if ((nom_pb_rayonnant != nom_pb1) && (nom_pb_rayonnant != nom_pb2))
111 Process::exit("Error in Champ_front_contact_rayo_transp_VEF::calculer_coeffs_echange !! You should not be here since the problem is not a radiation problem !!!");
112
113 // Computation and storage of the radiative flux
115 // Modify the gradients to account for the radiative flux
116 DoubleVect gradient_num_transf_autre_pb(gradient_num_transf);
117 modifie_gradients_pour_rayonnement(gradient_num_transf, gradient_num_transf_autre_pb);
118}
119
121{
122 // coding close to Champ_front_contact_VEF::mettre_a_jour
123 const Frontiere& la_front = la_frontiere_dis->frontiere();
124 int nb_faces = la_front.nb_faces();
125
126 // Retrieve the coefficients gradient_num_transf and gradient_fro_transf from the other problem
127 DoubleVect gradient_num_transf_autre_pb(nb_faces);
128 DoubleVect gradient_fro_transf_autre_pb(nb_faces);
129 trace_face_raccord(fr_vf_autre_pb.valeur(), ch_fr_autre_pb->get_gradient_num_transf(), gradient_num_transf_autre_pb);
130 trace_face_raccord(fr_vf_autre_pb.valeur(), ch_fr_autre_pb->get_gradient_fro_transf(), gradient_fro_transf_autre_pb);
131
132 // Computation and storage of the radiative flux
133
134 // Retrieve the arrays used to compute omega, the damping factor
135 DoubleVect coeff_amort_num_autre_pb(nb_faces);
136 DoubleVect coeff_amort_denum_autre_pb(nb_faces);
137 trace_face_raccord(fr_vf_autre_pb.valeur(), ch_fr_autre_pb->get_coeff_amort_num(), coeff_amort_num_autre_pb);
138 trace_face_raccord(fr_vf_autre_pb.valeur(), ch_fr_autre_pb->get_coeff_amort_denum(), coeff_amort_denum_autre_pb);
139
140 // Computation of the wall temperature
141 DoubleTab& tab = valeurs_au_temps(temps);
142 for (int fac_front = 0; fac_front < nb_faces; fac_front++)
143 {
144 // COMPUTATION OF THE DAMPING TERM
145 Schema_Temps_base& sch = l_inconnue->equation().probleme().schema_temps();
146 double dt = sch.pas_de_temps();
147 double e = coeff_amort_num_autre_pb(fac_front) + coeff_amort_num(fac_front);
148 double omega = dt / (dt + e / (coeff_amort_denum_autre_pb(fac_front) + coeff_amort_denum(fac_front)));
149 // For now, omega is hard-coded to 1
150 omega = 1;
151 // END OF DAMPING TERM COMPUTATION
152
153 double tab_past = tab(fac_front, 0);
154
155 tab(fac_front, 0) = -(gradient_num_local(fac_front) + gradient_num_transf_autre_pb(fac_front)) / (gradient_fro_transf_autre_pb(fac_front) + gradient_fro_local(fac_front));
156
157 tab(fac_front, 0) = omega * tab(fac_front, 0) + (1 - omega) * tab_past;
158 }
159}
160
162{
164
165 // Computation of the damping coefficients
167}
168
169void Champ_front_contact_rayo_transp_VEF::modifie_gradients_pour_rayonnement(DoubleVect& tab_gradient_num_transf, DoubleVect& gradient_num_transf_autre_pb)
170{
171 const Frontiere& la_front = la_frontiere_dis->frontiere();
172 const int nb_faces = la_front.nb_faces();
173
174 if (is_conduction)
175 {
176 for (int fac_front = 0; fac_front < nb_faces; fac_front++)
177 gradient_num_local(fac_front) = gradient_num_local(fac_front) + flux_radiatif_(fac_front);
178 }
179 else
180 {
181 for (int fac_front = 0; fac_front < nb_faces; fac_front++)
182 gradient_num_transf_autre_pb(fac_front) = gradient_num_transf_autre_pb(fac_front) - flux_radiatif_(fac_front);
183 }
184}
Class Champ_Inc_base.
class Champ_front_base Base class for the hierarchy of boundary fields.
virtual const Frontiere_dis_base & frontiere_dis() const
Returns the discretized boundary associated with the field.
class Champ_front_contact_VEF Enables scalar coupling (temperature or concentration) between problems...
void calculer_coeffs_echange(double temps) override
DOES NOTHING, to override. This method can calculate and store useful data for the.
virtual void calcul_grads_locaux(double temps)
void mettre_a_jour(double temps) override
DOES NOTHING, to override.
DoubleVect & trace_face_raccord(const Front_VF &fr_vf, const DoubleVect &y, DoubleVect &x)
int initialiser(double temps, const Champ_Inc_base &inco) override
Initialization at the beginning of calculation.
void modifie_gradients_pour_rayonnement(DoubleVect &gradient_num_transf, DoubleVect &gradient_num_transf_autre_pb)
Champ_front_base & affecter_(const Champ_front_base &ch) override
void mettre_a_jour(double temps) override
DOES NOTHING, to override.
int initialiser(double temps, const Champ_Inc_base &inco) override
Initialization at the beginning of calculation.
void calculer_coeffs_echange(double temps) override
DOES NOTHING, to override. This method can calculate and store useful data for the.
DoubleTab & valeurs_au_temps(double temps) override
Returns the values at the desired time.
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
virtual void fixer_nb_comp(int i)
Sets the number of components of the field.
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.
static Objet_U & objet(const Nom &)
See Interprete_bloc::objet_global(). BM: the Interprete class is not the best place for this.
virtual bool is_rayo_transp() const
Definition Milieu_base.h:83
class Nom: a character string for naming TRUST objects.
Definition Nom.h:31
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
Pb_Fluide_base This class provides a base class for.
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).
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
Definition Process.cpp:466
class Schema_Temps_base
double pas_de_temps() const
Returns the current time step (delta_t).
Base class for output streams.
Definition Sortie.h:52
void resize(_SIZE_ n, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)
Definition TRUSTTab.tpp:469