TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Neumann_paroi_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 <Neumann_paroi_rayo_semi_transp_VDF.h>
17#include <Pb_rayo_semi_transp.h>
18#include <Fluide_Incompressible.h>
19#include <Champ_front_uniforme.h>
20#include <Schema_Temps_base.h>
21#include <Champ_Uniforme.h>
22#include <communications.h>
23#include <Domaine_VDF.h>
24
25Implemente_instanciable(Neumann_paroi_rayo_semi_transp_VDF, "Paroi_flux_impose_rayo_semi_transp_VDF", Neumann_paroi);
26
28{
29 return os;
30}
31
33{
34 is >> le_champ_front;
35 return is;
36}
37
39{
40 const Domaine_VDF& zvdf = ref_cast(Domaine_VDF, domaine_Cl_dis().domaine_dis());
41 const IntTab& face_voisins = zvdf.face_voisins();
42 const Front_VF& front_vf = ref_cast(Front_VF, frontiere_dis());
43 int ndeb = front_vf.num_premiere_face();
44
45 int elem = face_voisins(ndeb + i, 0);
46 if (elem == -1)
47 elem = face_voisins(ndeb + i, 1);
48
49 double signe = 1;
50 const DoubleTab& flux_radiatif = pb_rayo_semi_transp().flux_radiatif(frontiere_dis().le_nom()).valeurs();
51
52 if (le_champ_front->valeurs().size() == 1)
53 return signe * le_champ_front->valeurs()(0, 0) - flux_radiatif(i, 0);
54 else if (le_champ_front->valeurs().dimension(1) == 1)
55 return signe * (le_champ_front->valeurs()(i, 0) - flux_radiatif(i, 0));
56 else
57 Cerr << "Neumann_paroi_rayo_semi_transp_VDF::flux_impose error" << finl;
58
59 return 0;
60}
61
63{
64 const Domaine_VDF& zvdf = ref_cast(Domaine_VDF, domaine_Cl_dis().domaine_dis());
65 const IntTab& face_voisins = zvdf.face_voisins();
66 const Front_VF& front_vf = ref_cast(Front_VF, frontiere_dis());
67 int ndeb = front_vf.num_premiere_face();
68
69 int elem = face_voisins(ndeb + i, 0);
70 if (elem == -1)
71 elem = face_voisins(ndeb + i, 1);
72
73 const DoubleTab& flux_radiatif = pb_rayo_semi_transp().flux_radiatif(frontiere_dis().le_nom()).valeurs();
74
75 if (le_champ_front->valeurs().dimension(0) == 1)
76 return le_champ_front->valeurs()(0, j) - flux_radiatif(i);
77 else
78 return le_champ_front->valeurs()(i, j) - flux_radiatif(i);
79}
80
82{
83 return (*this);
84}
85
87{
88 const Domaine_VDF& zvdf = ref_cast(Domaine_VDF, domaine_Cl_dis().domaine_dis());
89 const IntTab& face_voisins = zvdf.face_voisins();
90 const Milieu_base& le_milieu = mon_dom_cl_dis->equation().milieu();
91 ////const Champ_Uniforme& Lambda = ref_cast(Champ_Uniforme,le_milieu.conductivite());
92 const Front_VF& front_vf = ref_cast(Front_VF, frontiere_dis());
93 int nb_faces = front_vf.nb_faces();
94 int ndeb = front_vf.num_premiere_face();
95 const DoubleTab& rho = le_milieu.masse_volumique().valeurs();
96 const DoubleTab& Cp = le_milieu.capacite_calorifique().valeurs();
97 const DoubleTab& Lambda = le_milieu.conductivite().valeurs();
98
99 assert(le_milieu.capacite_calorifique().nb_comp() == 1);
100 assert(le_milieu.masse_volumique().nb_comp() == 1);
101 double d_Cp, d_rho, d_Lambda;
102 if (Cp.get_md_vector() || rho.get_md_vector() || Lambda.get_md_vector())
103 {
104 // One of the fields is not uniform
105 ArrOfDouble tmp(3);
106 tmp[0] = local_max_vect(Cp);
107 tmp[1] = local_max_vect(rho);
108 tmp[2] = local_max_vect(Lambda);
110 d_Cp = tmp[0];
111 d_rho = tmp[1];
112 d_Lambda = tmp[2];
113 }
114 else
115 {
116 // All fields are uniform. Shortcut because mp_max is costly
117 d_Cp = Cp(0, 0);
118 d_rho = rho(0, 0);
119 d_Lambda = Lambda(0, 0);
120 }
121
122 Schema_Temps_base& sch = mon_dom_cl_dis->equation().probleme().schema_temps();
123 double dt = sch.pas_de_temps();
124
125 // Cerr<<"Nom du bord : "<<front_vf.le_nom()<<finl;
126 ////double d_Lambda = Lambda(0,0);
127
128 const DoubleTab& T_f = mon_dom_cl_dis->equation().inconnue().valeurs();
129 DoubleTab& T_b = temperature_bord_->valeurs_au_temps(temps);
130
131 const DoubleTab& flux_radiatif = pb_rayo_semi_transp().flux_radiatif(frontiere_dis().le_nom()).valeurs();
132
133 int face = 0;
134 int num_face;
135 for (face = 0; face < nb_faces; face++)
136 {
137 num_face = face + ndeb;
138 double eF = zvdf.dist_norm_bord(num_face);
139 int elem = face_voisins(num_face, 0);
140 if (elem < 0)
141 elem = face_voisins(num_face, 1);
142 // To avoid division by zero at the first time step:
143 // double omega=1./(1.+eF*eF*d_rho*d_Cp/d_Lambda/dt);
144 double omega = d_Lambda * dt / (d_Lambda * dt + eF * eF * d_rho * d_Cp);
145 // Cerr << "omega=" << omega << finl;
146 if (sub_type(Champ_front_uniforme, le_champ_front.valeur()))
147 {
148 T_b(face, 0) = omega * (T_f(elem) + (le_champ_front->valeurs()(0, 0) - flux_radiatif(face, 0)) / (d_Lambda / eF)) + (1 - omega) * T_b(face, 0);
149 }
150 else
151 T_b(face, 0) = omega * (T_f(elem) + (le_champ_front->valeurs()(face, 0) - flux_radiatif(face, 0)) / (d_Lambda / eF)) + (1 - omega) * T_b(face, 0);
152 }
153}
154
156{
157 Motcle dom_app = eqn.domaine_application();
158 Motcle Thermique = "Thermique";
159 Motcle indetermine = "indetermine";
160 if ((dom_app == Thermique) || (dom_app == indetermine))
161 return 1;
162 else
163 {
165 return 0;
166 }
167}
168
170{
172
173 // Type and dimension the boundary field temperature_bord_
174 // const Milieu_base& mil=mon_dom_cl_dis->equation().milieu();
175 const Front_VF& front_vf = ref_cast(Front_VF, frontiere_dis());
176 int nb_comp = 1;
177 temperature_bord_.typer("Champ_front_fonc");
178 temperature_bord_->fixer_nb_comp(nb_comp);
179 DoubleTab& tab = temperature_bord_->valeurs();
180 tab.resize(front_vf.nb_faces(), nb_comp);
181
182 // Initialize the boundary temperature array to the
183 // initial temperature of the current medium
184 const Domaine_VDF& zvdf = ref_cast(Domaine_VDF, domaine_Cl_dis().domaine_dis());
185 int ndeb = front_vf.num_premiere_face();
186 const IntTab& face_voisins = zvdf.face_voisins();
187 const DoubleTab& T = mon_dom_cl_dis->equation().inconnue().valeurs();
188 int face = 0;
189 //
190 // Start of the loop over boundary faces
191 //
192
193 for (face = 0; face < front_vf.nb_faces(); face++)
194 {
195 int elem = face_voisins(face + ndeb, 0);
196 if (elem < 0)
197 elem = face_voisins(face + ndeb, 1);
198 tab(face, 0) = T(elem);
199 }
200}
DoubleTab & valeurs() override
Overrides Champ_base::valeurs() Returns the array of values.
virtual DoubleTab & valeurs()=0
virtual DoubleTab & valeurs() override
Returns the array of field values.
class Champ_front_uniforme Derived class of Champ_front_base representing
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 void completer()
DOES NOTHING must be overridden in derived classes.
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
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).
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 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 Milieu_base & milieu() const =0
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
Milieu_base This class is the base of the (physical) medium hierarchy.
Definition Milieu_base.h:50
virtual const Equation_base & equation(const std::string &nom_inc) const
virtual const Champ_Don_base & capacite_calorifique() const
Returns the heat capacity of the medium (const version).
virtual const Champ_Don_base & conductivite() const
Returns the conductivity of the medium (const version).
virtual const Champ_base & masse_volumique() const
Returns the mass density of the medium (const version).
A character string (Nom) in uppercase.
Definition Motcle.h:26
void completer() override
DOES NOTHING must be overridden in derived classes.
double flux_impose(int i) const override
Returns the value of the imposed flux on the i-th component of the field representing the flux at the...
int compatible_avec_eqn(const Equation_base &) const override
const Cond_lim_base & la_cl() const override
Classe Neumann_paroi This boundary condition corresponds to an imposed flux for the.
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 Champ_front_base & flux_radiatif(const Nom &nom_bord) const
static void mp_max_for_each_item(TRUSTArray< _TYPE_ > &x, int n=-1)
Definition Process.cpp:197
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
virtual const MD_Vector & get_md_vector() const
Definition TRUSTVect.h:123