TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Champ_front_contact_rayo_semi_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_semi_transp_VEF.h>
17#include <Domaine_VEF.h>
18#include <Schema_Temps_base.h>
19#include <Pb_Couple_rayo_semi_transp.h>
20#include <Pb_rayo_semi_transp.h>
21
22Implemente_instanciable(Champ_front_contact_rayo_semi_transp_VEF, "Champ_front_contact_rayo_semi_transp_VEF", Champ_front_contact_VEF);
23
25{
26 return os;
27}
28
30{
33}
34
39
46
48{
49 int nb_faces = frontiere_dis().frontiere().nb_faces();
50 flux_radiatif_.resize(nb_faces);
51 int ok = Champ_front_contact_VEF::initialiser(temps, inco);
52 return ok;
53}
54
56{
57
58 if (is_conduction) // The pb_rayo is known by the other problem
59 {
60 const Champ_front_contact_rayo_semi_transp_VEF& ch_fr_rayo = ref_cast(Champ_front_contact_rayo_semi_transp_VEF, ch_fr_autre_pb.valeur());
61 const DoubleTab& tab_fl_rad = ch_fr_rayo.pb_rayo_semi_transp().flux_radiatif(frontiere_dis().le_nom()).valeurs();
62 // Fetch it from the other problem
63 trace_face_raccord(fr_vf_autre_pb.valeur(), tab_fl_rad, flux_radiatif_);
64 }
65 else
66 {
67 int nb_faces = frontiere_dis().frontiere().nb_faces();
68 const DoubleTab& tab_fl_rad = pb_rayo_semi_transp_->flux_radiatif(frontiere_dis().le_nom()).valeurs();
69 for (int fac_front = 0; fac_front < nb_faces; fac_front++)
70 flux_radiatif_(fac_front) = tab_fl_rad(fac_front, 0);
71 }
72}
73
75{
77
78 // Computation of the damping coefficients
80}
81
83{
84 const Frontiere& la_front = la_frontiere_dis->frontiere();
85 int nb_faces = la_front.nb_faces();
86
87 // Retrieve the coefficients gradient_num_transf and gradient_fro_transf from the other problem
88 DoubleVect gradient_num_transf_autre_pb(nb_faces);
89 DoubleVect gradient_fro_transf_autre_pb(nb_faces);
90 trace_face_raccord(fr_vf_autre_pb.valeur(), ch_fr_autre_pb->get_gradient_num_transf(), gradient_num_transf_autre_pb);
91 trace_face_raccord(fr_vf_autre_pb.valeur(), ch_fr_autre_pb->get_gradient_fro_transf(), gradient_fro_transf_autre_pb);
92 double signe = -1;
93 gradient_num_transf_autre_pb *= signe;
94 gradient_fro_transf_autre_pb *= signe;
95
96 // Modify the gradients to account for the radiative flux
97 modifie_gradients_pour_rayonnement(gradient_num_transf, gradient_num_transf_autre_pb);
98
99 // Retrieve the arrays needed to compute omega, the damping factor
100 DoubleVect coeff_amort_num_autre_pb(nb_faces);
101 DoubleVect coeff_amort_denum_autre_pb(nb_faces);
102 trace_face_raccord(fr_vf_autre_pb.valeur(), ch_fr_autre_pb->get_coeff_amort_num(), coeff_amort_num_autre_pb);
103 trace_face_raccord(fr_vf_autre_pb.valeur(), ch_fr_autre_pb->get_coeff_amort_denum(), coeff_amort_denum_autre_pb);
104
105 // Computation of the wall temperature
106 DoubleTab& tab = valeurs_au_temps(temps);
107 for (int fac_front = 0; fac_front < nb_faces; fac_front++)
108 {
109 // COMPUTATION OF THE DAMPING TERM
110 Schema_Temps_base& sch = l_inconnue->equation().probleme().schema_temps();
111 double dt = sch.pas_de_temps();
112 double e = std::max(coeff_amort_num_autre_pb(fac_front), coeff_amort_num(fac_front));
113 // double e = coeff_amort_num_autre_pb(fac_front) + coeff_amort_num(fac_front);
114 double omega = dt / (dt + e / (coeff_amort_denum_autre_pb(fac_front) + coeff_amort_denum(fac_front)));
115 omega = 1.;
116 // END OF DAMPING TERM COMPUTATION
117 /*
118 Cerr<<"omega = "<<omega<<finl;
119 Cerr<<"gradient_num_local(fac_front) = "<<gradient_num_local(fac_front)<<finl;
120 Cerr<<"gradient_num_transf_autre_pb(fac_front) = "<<gradient_num_transf_autre_pb(fac_front)<<finl;
121 Cerr<<"gradient_fro_local(fac_front) = "<<gradient_fro_local(fac_front)<<finl;
122 Cerr<<"gradient_fro_transf_autre_pb(fac_front) = "<<gradient_fro_transf_autre_pb(fac_front)<<finl;
123 Cerr<<"flux_radiatif(fac_front) = "<<flux_radiatif(fac_front)<<finl;
124 */
125 double tab_past = tab(fac_front, 0);
126
127 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));
128
129 tab(fac_front, 0) = omega * tab(fac_front, 0) + (1 - omega) * tab_past;
130 }
132}
133
134void Champ_front_contact_rayo_semi_transp_VEF::modifie_gradients_pour_rayonnement(DoubleVect& tab_gradient_num_transf, DoubleVect& gradient_num_transf_autre_pb)
135{
136 const Frontiere& la_front = la_frontiere_dis->frontiere();
137 int nb_faces = la_front.nb_faces();
138
139 if (is_conduction)
140 {
141 for (int fac_front = 0; fac_front < nb_faces; fac_front++)
142 gradient_num_local(fac_front) = gradient_num_local(fac_front) + flux_radiatif_(fac_front);
143 }
144 else
145 {
146 for (int fac_front = 0; fac_front < nb_faces; fac_front++)
147 gradient_num_transf_autre_pb(fac_front) = gradient_num_transf_autre_pb(fac_front) + flux_radiatif_(fac_front);
148 }
149}
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.
virtual DoubleTab & valeurs() override
Returns the array of field values.
class Champ_front_contact_VEF Enables scalar coupling (temperature or concentration) between problems...
virtual void calcul_grads_locaux(double temps)
void verifier_scalaire_bord(double temps)
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.
int initialiser(double temps, const Champ_Inc_base &inco) override
Initialization at the beginning of calculation.
void mettre_a_jour(double temps) override
DOES NOTHING, to override.
Champ_front_base & affecter_(const Champ_front_base &ch) override
void modifie_gradients_pour_rayonnement(DoubleVect &gradient_num_transf, DoubleVect &gradient_num_transf_autre_pb)
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.
const Nom & le_nom() const override
Returns the name of the field.
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.
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
const Champ_front_base & flux_radiatif(const Nom &nom_bord) const
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
virtual void echange_espace_virtuel(IsExchangeBlocking exchange_type=IsExchangeBlocking::DefaultBlocking, const std::string kernel_name="noname")