TRUST 1.9.8
HPC thermohydraulic platform
Loading...
Searching...
No Matches
Echange_interne_global_impose.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 <Echange_interne_global_impose.h>
17#include <Equation_base.h>
18#include <Champ_front_calc_interne.h>
19#include <Probleme_base.h>
20#include <Domaine_Cl_dis_base.h>
21#include <Domaine_VF.h>
22#include <DomaineAxi1d.h>
23
24
25Implemente_instanciable(Echange_interne_global_impose,"Paroi_echange_interne_global_impose",Echange_global_impose);
26// XD Echange_interne_global_impose condlim_base Paroi_echange_interne_global_impose INHERITS_BRACE Internal heat
27// XD_CONT exchange boundary condition with global exchange coefficient.
28// XD attr h_imp chaine h_imp REQ Global exchange coefficient value. The global exchange coefficient value is expressed
29// XD_CONT in W.m-2.K-1.
30// XD attr ch front_field_base ch REQ Boundary field type.
31
32/*! @brief Ecrit le type de l'objet sur un flot de sortie
33 *
34 * @param (Sortie& s) un flot de sortie
35 * @return (Sortie&) le flot de sortie modifie
36 */
38{
39 return s << que_suis_je() << finl;
40}
41
42/*! @brief Simple appel a Echange_impose_base::readOn(Entree&) Lit les specifications des conditions aux limites
43 *
44 * a partir d'un flot d'entree.
45 *
46 * @param (Entree& s) un flot d'entree
47 * @return (Entree&) le flot de sortie modifie
48 */
50{
51 if (app_domains.size() == 0) app_domains = { Motcle("Thermique"), Motcle("Neutronique"), Motcle("fraction_massique"), Motcle("indetermine") };
52
53 Motcle motlu;
54 Motcle motcle("h_gap");
55
56 s >> motlu;
57 if (motlu ==motcle)
58 s >> h_imp_;
59 else
60 {
61 Cerr << "Error when reading boundary condition with type Echange_interne_global_impose " << finl;
62 Cerr << "We expected " << motcle << " instead of " << motlu << finl;
63 exit();
64 }
65
66 init();
67
68 return s;
69}
70
72{
73 le_champ_front.typer("Champ_front_calc_interne"); // preparation de T_ext
74}
75
76// Override to skip verification - we know we will always be dealing with temperature, and we define ourselves the T_ext with
77// a Champ_front_calc_interne.
81
82
83// Finish building the champ_front_calc_interne
85{
86 Nom nom_pb(domaine_Cl_dis().equation().probleme().le_nom());
87 Nom nom_bord(frontiere_dis().le_nom());
89
90 t_ext.creer(nom_pb, nom_bord, "temperature");
91
93
94 const Front_VF& fvf = ref_cast(Front_VF, frontiere_dis());
95 const Domaine_VF& zvf = ref_cast(Domaine_VF, domaine_Cl_dis().domaine_dis());
96
97 frontiere_dis().frontiere().creer_tableau_faces(surface_gap_, RESIZE_OPTIONS::NOCOPY_NOINIT);
98
99
100 if (zvf.domaine().axi1d())
101 {
102 const DomaineAxi1d& domax = ref_cast(DomaineAxi1d,zvf.domaine());
103 const IntTab& face_voisins = zvf.face_voisins();
104 const DoubleTab& xv = zvf.xv();
105 const IntVect& fmap = t_ext.face_map();
106 for (int i=0; i<fvf.nb_faces(); i++)
107 {
108 int iopp = fmap(i);
109 int face = fvf.num_face(i);
110 int face_opp = fvf.num_face(iopp);
111 int elem = face_voisins(face,0)==-1 ? face_voisins(face,1) : face_voisins(face,0);
112 double x0 = domax.origine_repere(elem,0);
113 double y0 = domax.origine_repere(elem,1);
114 double x1 = xv(face,0);
115 double y1 = xv(face,1);
116 double x2 = xv(face_opp,0);
117 double y2 = xv(face_opp,1);
118 double r1 = sqrt((x1-x0)*(x1-x0)+(y1-y0)*(y1-y0));
119 double r2 = sqrt((x2-x0)*(x2-x0)+(y2-y0)*(y2-y0));
120 surface_gap_(i) = M_PI*(r1+r2);
121 }
122 }
123 else
124 {
125 for (int i=0; i<fvf.nb_faces(); i++)
126 {
127 int face = fvf.num_face(i);
128 surface_gap_(i) = zvf.surface(face);
129 }
130 }
131}
classe Champ_front_calc_interne Classe derivee de Champ_front_calc qui represente
const IntVect & face_map() const
void creer(const Nom &, const Nom &, const Motcle &)
Cree l'objet Champ_front_calc representant la trace d'un champ inconnue sur une frontiere a partir de...
Domaine_Cl_dis_base & domaine_Cl_dis()
Renvoie le domaine des conditions aux limites discretisee dont l'objet fait partie.
std::vector< Motcle > app_domains
virtual Frontiere_dis_base & frontiere_dis()
Renvoie la frontiere discretisee a laquelle les conditions aux limites s'appliquent.
const DoubleTab_t & origine_repere()
class Domaine_VF
Definition Domaine_VF.h:44
double xv(int num_face, int k) const
Definition Domaine_VF.h:76
virtual double surface(int i) const
Definition Domaine_VF.h:53
int face_voisins(int num_face, int i) const
renvoie l'element voisin de numface dans la direction i.
Definition Domaine_VF.h:418
bool axi1d() const
const Domaine & domaine() const
Classe Echange_global_impose Cette classe represente le cas particulier de la classe.
void completer() override
NE FAIT RIEN A surcharger dans les classes derivees.
virtual Champ_front_base & T_ext()
Renvoie le champ T_ext de temperature imposee a la frontiere.
Classe Echange_interne_global_impose: Cette classe represente le cas particulier de la classe.
void verifie_ch_init_nb_comp() const override
Appel la verification du champ lu par l intermediaire de l equation pour laquelle on considere la con...
void completer() override
NE FAIT RIEN A surcharger dans les classes derivees.
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
class Front_VF
Definition Front_VF.h:36
int nb_faces() const
Definition Front_VF.h:53
int num_face(const int) const
Definition Front_VF.h:68
virtual void creer_tableau_faces(Array_base &, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT) const
Cree un tableau ayant une "ligne" par face de cette frontiere Voir MD_Vector_tools::creer_tableau_dis...
const Frontiere & frontiere() const
Renvoie la frontiere geometrique associee.
class Nom Une chaine de caractere pour nommer les objets de TRUST
Definition Nom.h:31
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 const Nom & le_nom() const
Donne le nom de l'Objet_U Methode a surcharger : renvoie "neant" dans cette implementation.
Definition Objet_U.cpp:319
virtual Sortie & printOn(Sortie &) const
Ecriture de l'objet sur un flot de sortie Methode a surcharger.
Definition Objet_U.cpp:282
static void exit(int exit_code=-1)
Routine de sortie de TRUST dans une region Kokkos.
Definition Process.cpp:455
Classe de base des flux de sortie.
Definition Sortie.h:52