TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Paroi_flux_impose_rayo_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 <Modele_rayo_transp.h>
17#include <Paroi_flux_impose_rayo_transp_VDF.h>
18#include <Schema_Temps_base.h>
19#include <Champ_Uniforme.h>
20#include <Probleme_base.h>
21#include <Equation_base.h>
22#include <Milieu_base.h>
23#include <Domaine_VDF.h>
24
25Implemente_instanciable(Paroi_flux_impose_rayo_transp_VDF, "Paroi_flux_impose_rayo_transp_VDF", Paroi_flux_impose_rayo_transp);
26
28
30
32{
34
35 const Domaine_VF& domaine_VDF = ref_cast(Domaine_VDF, domaine_Cl_dis().domaine_dis());
36 const DoubleTab& T_f = mon_dom_cl_dis->equation().inconnue().valeurs();
37 const Front_VF& la_frontiere_VF = ref_cast(Front_VF, frontiere_dis());
38 int ndeb = la_frontiere_VF.num_premiere_face();
39 int nb_faces_bord = la_frontiere_VF.nb_faces();
40
41 const IntTab& face_voisins = domaine_VDF.face_voisins();
42
43 for (int numfa = 0; numfa < nb_faces_bord; numfa++)
44 {
45 int elem = face_voisins(numfa + ndeb, 0);
46 if (elem < 0)
47 elem = face_voisins(numfa + ndeb, 1);
48 teta_i_(numfa) = T_f(elem);
49 }
50}
51
53{
54 const Domaine_VDF& le_dom_vdf = ref_cast(Domaine_VDF, domaine_Cl_dis().domaine_dis());
55 const Milieu_base& le_milieu = mon_dom_cl_dis->equation().milieu();
56 const DoubleTab& T_f = mon_dom_cl_dis->equation().inconnue().valeurs();
57 const Front_VF& la_frontiere_VF = ref_cast(Front_VF, frontiere_dis());
58 int ndeb = la_frontiere_VF.num_premiere_face();
59 int nb_faces_bord = la_frontiere_VF.nb_faces();
60 const Domaine_VDF& zvdf = ref_cast(Domaine_VDF, domaine_Cl_dis().domaine_dis());
61 const IntTab& face_voisins = zvdf.face_voisins();
62 int is_rho_unif = 0;
63 int is_conduc_unif = 0;
64 int is_Cp_unif = 0;
65
66 double d_rho = 0;
67 double d_Lambda = 0;
68 double d_Cp = 0;
69
70 const DoubleTab& rho = le_milieu.masse_volumique().valeurs();
71 const DoubleTab& Lambda = le_milieu.conductivite().valeurs();
72 const DoubleTab& Cp = le_milieu.capacite_calorifique().valeurs();
73
74 if (sub_type(Champ_Uniforme, le_milieu.masse_volumique()))
75 {
76 is_rho_unif = 1;
77
78 d_rho = rho(0, 0);
79 }
80 if (sub_type(Champ_Uniforme, le_milieu.conductivite()))
81 {
82 is_conduc_unif = 1;
83 d_Lambda = Lambda(0, 0);
84 }
85
86 if (sub_type(Champ_Uniforme, le_milieu.capacite_calorifique()))
87 {
88 is_Cp_unif = 1;
89 d_Cp = Cp(0, 0);
90 }
91
92 Schema_Temps_base& sch = mon_dom_cl_dis->equation().probleme().schema_temps();
93 double dt = sch.pas_de_temps();
94
95 int is_relax = 1;
96 if (le_modele_rayo_->relaxation() == 0)
97 is_relax = 0;
98
99 for (int numfa = 0; numfa < nb_faces_bord; numfa++)
100 {
101 // WHO DID THIS ?????
102 // T_f (numfa)!!!! Tf(elem) would be more sensible!!!
103 int elem = face_voisins(numfa + ndeb, 0);
104 if (elem < 0)
105 elem = face_voisins(numfa + ndeb, 1);
106
107 if (!is_conduc_unif)
108 d_Lambda = Lambda(elem);
109 double omega;
110 double e = le_dom_vdf.dist_norm_bord(numfa + ndeb);
111 if (is_relax)
112 {
113
114 if (!is_rho_unif)
115 d_rho = rho(elem);
116 if (!is_Cp_unif)
117 d_Cp = Cp(elem);
118
119 omega = d_Lambda * dt / (d_Lambda * dt + e * e * d_rho * d_Cp);
120 }
121 else
122 omega = 1.;
123
124 double flux_radia = le_modele_rayo_->flux_radiatif(numfa + ndeb);
125
126 if (le_champ_front->valeurs().size() == 1)
127 teta_i_(numfa) = omega * ((le_champ_front->valeurs()(0, 0) - flux_radia) / (d_Lambda / e) + T_f(elem)) + (1 - omega) * teta_i_(numfa);
128 else if (le_champ_front->valeurs().dimension(1) == 1)
129 teta_i_(numfa) = omega * ((le_champ_front->valeurs()(numfa, 0) - flux_radia) / (d_Lambda / e) + T_f(elem)) + (1 - omega) * teta_i_(numfa);
130 else
131 {
132 Cerr << "Paroi_flux_impose_rayo_transp::calculer_Teta_i() error" << finl;
134 }
135 }
136
137 // Printing:
138 if (zvdf.domaine().bords_a_imprimer().contient(la_frontiere_VF.le_nom()) && sch.limpr())
139 {
140 Cout << "Printing wall temperatures on boundary " << la_frontiere_VF.le_nom() << " :" << finl;
141 Cout << "---------------------------------------------------------------------" << finl;
142 for (int numfa = 0; numfa < nb_faces_bord; numfa++)
143 Cout << "T(" << numfa << ") : " << teta_i_(numfa) << " K." << finl;
144 }
145}
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.
virtual DoubleTab & valeurs()=0
Champ_Uniforme Represents a field that is constant in space and time.
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 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).
class Domaine_VF
Definition Domaine_VF.h:44
int face_voisins(int num_face, int i) const
Returns the neighbouring element of num_face in direction i.
Definition Domaine_VF.h:418
const Domaine & domaine() const
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
virtual const Milieu_base & milieu() const =0
virtual const Champ_Inc_base & inconnue() const =0
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.
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).
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
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
Definition Process.cpp:466
class Schema_Temps_base
int limpr() const
Returns 1 if there is a need to perform a print (cf dt_impr) Returns 0 otherwise.
double pas_de_temps() const
Returns the current time step (delta_t).
Base class for output streams.
Definition Sortie.h:52