TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Terme_Puissance_Thermique_Echange_Impose_VEF_Face.cpp
1/****************************************************************************
2* Copyright (c) 2024, 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 <Terme_Puissance_Thermique_Echange_Impose_VEF_Face.h>
17#include <Fluide_Incompressible.h>
18#include <Discretisation_base.h>
19#include <Probleme_base.h>
20#include <Domaine_VEF.h>
21#include <Champ_P1NC.h>
22#include <Param.h>
23
24Implemente_instanciable_sans_constructeur(Terme_Puissance_Thermique_Echange_Impose_VEF_Face,"Terme_Puissance_Thermique_Echange_Impose_VEF_P1NC",Source_base);
25
27{
28 return s << que_suis_je();
29}
30
32{
33 Param param(que_suis_je());
34 param.ajouter("himp",&himp_,Param::REQUIRED);
35 param.ajouter("Text",&Text_,Param::REQUIRED);
36 param.lire_avec_accolades_depuis(s);
37 set_fichier("Terme_Puissance_Thermique_Echange_Impose");
38 set_description("Power (W)");
39 return s ;
40}
41
43{
44 int nb_faces = le_dom_VEF->nb_faces();
45 const Domaine_VEF& domaine = ref_cast(Domaine_VEF, le_dom_VEF.valeur());
46 const IntTab& face_voisins = domaine.face_voisins();
47 const DoubleVect& volumes_entrelaces = domaine.volumes_entrelaces();
48 const DoubleTab& himp = himp_->valeurs();
49 const DoubleTab& Text = Text_->valeurs();
50 const DoubleTab& T = equation().inconnue().valeurs();
51 const DoubleVect& volumes_elements = domaine.volumes();
52
53 bilan()(0) = 0;
54
55 for (int num_face = 0; num_face < nb_faces; num_face++)
56 {
57 const double vol = volumes_entrelaces(num_face);
58
59
60 const int elem0 = face_voisins(num_face,0);
61 const int elem1 = face_voisins(num_face,1);
62 double h0 = 0, h1 = 0, text0 = 0, text1 = 0, vol0 = 0, vol1 = 0;
63 if (elem0 >= 0)
64 {
65 h0 = himp.addr()[elem0 * (himp.dimension(0) > 1)];
66 text0 = Text.addr()[elem0 * (Text.dimension(0) > 1)];
67 vol0 = volumes_elements(elem0);
68 }
69 if (elem1 >= 0)
70 {
71 h1 = himp.addr()[elem1 * (himp.dimension(0) > 1)];
72 text1 = Text.addr()[elem1 * (Text.dimension(0) > 1)];
73 vol1 = volumes_elements(elem1);
74 }
75 double hm = (h0 * vol0 + h1 * vol1) / (vol0 + vol1);
76 double htextm = (h0 * text0 * vol0 + h1 * text1 * vol1) / (vol0 + vol1);
77
78 double c = (domaine.faces_doubles()[num_face]==1) ? 0.5 : 1 ;
79 bilan()(0) -= c * (hm*T(num_face)-htextm) * vol;
80
81 }
82 himp_->mettre_a_jour(temps);
83 Text_->mettre_a_jour(temps);
84}
85
87 const Domaine_Cl_dis_base& domaine_Cl_dis)
88{
89 Cerr << " Terme_Puissance_Thermique_Echange_Impose_VEF_Face::associer_domaines " << finl ;
90 le_dom_VEF = ref_cast(Domaine_VEF, domaine_dis);
91 le_dom_Cl_VEF = ref_cast(Domaine_Cl_VEF, domaine_Cl_dis);
92}
93
94
96{
97 int nb_faces=le_dom_VEF->nb_faces();
98 const Domaine_VF& domaine = le_dom_VEF.valeur();
99 const IntTab& face_voisins = domaine.face_voisins();
100 const DoubleVect& volumes_entrelaces = domaine.volumes_entrelaces();
101 const DoubleTab& himp = himp_->valeurs();
102 const DoubleTab& Text = Text_->valeurs();
103
104 const DoubleTab& T = equation().inconnue().valeurs();
105 const DoubleVect& volumes_elements = domaine.volumes();
106
107 for (int num_face=0; num_face<nb_faces; num_face++)
108 {
109 const double vol = volumes_entrelaces(num_face);
110
111
112 const int elem0 = face_voisins(num_face,0);
113 const int elem1 = face_voisins(num_face,1);
114 double h0 = 0, h1 = 0, text0=0, text1=0,vol0 = 0, vol1 = 0;
115 if (elem0 >= 0)
116 {
117 h0 = himp.addr()[elem0 * (himp.dimension(0) > 1)];
118 text0 = Text.addr()[elem0 * (Text.dimension(0) > 1)];
119 vol0 = volumes_elements(elem0);
120 }
121 if (elem1 >= 0)
122 {
123 h1 = himp.addr()[elem1 * (himp.dimension(0) > 1)];
124 text1 = Text.addr()[elem1 * (Text.dimension(0) > 1)];
125 vol1 = volumes_elements(elem1);
126 }
127 double hm = (h0 * vol0 + h1 * vol1) / (vol0 + vol1);
128 double htextm = (h0 * text0 * vol0 + h1 * text1 * vol1) / (vol0 + vol1);
129
130 resu(num_face) -= (hm*T(num_face)-htextm) * vol;
131
132 }
133
134
135 return resu;
136}
138{
139 resu=0;
140 ajouter(resu);
141 return resu;
142}
144{
145
146
147 int nb_faces=le_dom_VEF->nb_faces();
148 const Domaine_VF& domaine = le_dom_VEF.valeur();
149 const IntTab& face_voisins = domaine.face_voisins();
150 const DoubleVect& volumes_entrelaces = domaine.volumes_entrelaces();
151 const DoubleTab& himp = himp_->valeurs();
152 // const DoubleTab& Text = Text_->valeurs();
153 // const DoubleTab& T = equation().inconnue().valeurs();
154 const DoubleVect& volumes_elements = domaine.volumes();
155
156
157
158
159 for (int num_face=0; num_face<nb_faces; num_face++)
160 {
161 const double vol = volumes_entrelaces(num_face);
162
163
164 const int elem0 = face_voisins(num_face,0);
165 const int elem1 = face_voisins(num_face,1);
166 double h0 = 0, h1 = 0,vol0 = 0, vol1 = 0;
167 if (elem0 >= 0)
168 {
169 h0 = himp.addr()[elem0 * (himp.dimension(0) > 1)];
170 // text0 = text(elem0);
171 vol0 = volumes_elements(elem0);
172 }
173 if (elem1 >= 0)
174 {
175 h1 = himp.addr()[elem1 * (himp.dimension(0) > 1)];
176 // text1 = text(elem0);
177 vol1 = volumes_elements(elem1);
178 }
179 double hm = (h0 * vol0 + h1 * vol1) / (vol0 + vol1);
180 // double textm = (text0 * vol0 + text1 * vol1) / (vol0 + vol1);
181
182 matrice(num_face,num_face) += hm* vol;
183
184 }
185}
186
188{
189 Nom nom_Himp = himp_->le_nom() != "??" ? himp_->le_nom() : "Himp";
190 equation().discretisation().nommer_completer_champ_physique(equation().domaine_dis(), nom_Himp, "", himp_.valeur(), equation().probleme());
191 Nom nom_Text = Text_->le_nom() != "??" ? Text_->le_nom() : "Text";
192 equation().discretisation().nommer_completer_champ_physique(equation().domaine_dis(), nom_Text, "", Text_.valeur(), equation().probleme());
193 himp_->initialiser(temps);
194 Text_->initialiser(temps);
195 return Source_base::initialiser(temps);
196}
DoubleTab & valeurs() override
Returns the array of field values at the current time.
void nommer_completer_champ_physique(const Domaine_dis_base &domaine_vdf, const Nom &nom_champ, const Nom &unite, Champ_base &champ, const Probleme_base &pbi) const
class Domaine_Cl_dis_base Domaine_Cl_dis_base objects represent discretized boundary conditions
class Domaine_VEF
Definition Domaine_VEF.h:53
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
class Domaine_dis_base This class is the base of the hierarchy of discretized domains.
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
const Discretisation_base & discretisation() const
Returns the discretization associated with the equation.
virtual const Champ_Inc_base & inconnue() const =0
Matrice_Morse class - Represents a (sparse) matrix M, not necessarily square,.
const Equation_base & equation() const
Returns the reference to the equation pointed to by MorEqn::mon_equation.
Definition MorEqn.h:62
class Nom: a character string for naming TRUST objects.
Definition Nom.h:31
const Nom & le_nom() const override
Returns *this.
Definition Nom.cpp:555
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 Sortie & printOn(Sortie &) const
Writes the object to an output stream. Virtual method to override.
Definition Objet_U.cpp:278
@ REQUIRED
Definition Param.h:115
Base class for output streams.
Definition Sortie.h:52
Source_base A Source_base object is a term appearing on the right-hand side of an.
Definition Source_base.h:42
void set_fichier(const Nom &)
DoubleVect & bilan()
Definition Source_base.h:88
virtual int initialiser(double temps)
Unlike the mettre_a_jour methods, the initializer methods of sources cannot depend on the outside.
void set_description(const Nom &nom)
Definition Source_base.h:83
_TYPE_ * addr()
_SIZE_ dimension(int d) const
Definition TRUSTTab.tpp:133
void associer_domaines(const Domaine_dis_base &, const Domaine_Cl_dis_base &) override
void mettre_a_jour(double) override
DOES NOTHING - to override in derived classes.
int initialiser(double temps) override
Unlike the mettre_a_jour methods, the initializer methods of sources cannot depend on the outside.
void contribuer_a_avec(const DoubleTab &, Matrice_Morse &) const override
contribution to the implicit matrix of source terms, by default no contribution