TrioCFD 1.9.8
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
Renvoie le tableau des valeurs du champ au temps courant.
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
classe Domaine_Cl_dis_base Les objets Domaine_Cl_dis_base representent les conditions aux limites
class Domaine_VEF
Definition Domaine_VEF.h:54
class Domaine_VF
Definition Domaine_VF.h:44
int face_voisins(int num_face, int i) const
renvoie l'element voisin de numface dans la direction i.
Definition Domaine_VF.h:418
classe Domaine_dis_base Cette classe est la base de la hierarchie des domaines discretisees.
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
const Discretisation_base & discretisation() const
Renvoie la discretisation associee a l'equation.
virtual const Champ_Inc_base & inconnue() const =0
Classe Matrice_Morse Represente une matrice M (creuse), non necessairement carree.
const Equation_base & equation() const
Renvoie la reference sur l'equation pointe par MorEqn::mon_equation.
Definition MorEqn.h:62
class Nom Une chaine de caractere pour nommer les objets de TRUST
Definition Nom.h:31
const Nom & le_nom() const override
Renvoie *this;.
Definition Nom.cpp:563
const Nom & que_suis_je() const
renvoie la chaine identifiant la classe.
Definition Objet_U.cpp:104
virtual Entree & readOn(Entree &)
Lecture d'un Objet_U sur un flot d'entree Methode a surcharger.
Definition Objet_U.cpp:293
virtual Sortie & printOn(Sortie &) const
Ecriture de l'objet sur un flot de sortie Methode a surcharger.
Definition Objet_U.cpp:282
@ REQUIRED
Definition Param.h:115
Classe de base des flux de sortie.
Definition Sortie.h:52
classe Source_base Un objet Source_base est un terme apparaissant au second membre d'une
Definition Source_base.h:42
void set_fichier(const Nom &)
DoubleVect & bilan()
Definition Source_base.h:88
virtual int initialiser(double temps)
Contrairement aux methodes mettre_a_jour, les methodes initialiser des sources ne peuvent pas dependr...
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
Contrairement aux methodes mettre_a_jour, les methodes initialiser des sources ne peuvent pas dependr...
void contribuer_a_avec(const DoubleTab &, Matrice_Morse &) const override
contribution a la matrice implicite des termes sources par defaut pas de contribution