TrioCFD 1.9.9_beta
TrioCFD documentation
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 Writes the object type to an output stream.
33 *
34 * @param s Output stream.
35 * @return The modified output stream.
36 */
38{
39 return s << que_suis_je() << finl;
40}
41
42/*! @brief Simple delegation to Echange_impose_base::readOn(Entree&). Reads the boundary condition specifications from an input stream.
43 *
44 * @param s Input stream.
45 * @return The modified input stream.
46 */
48{
49 if (app_domains.size() == 0) app_domains = { Motcle("Thermique"), Motcle("Neutronique"), Motcle("fraction_massique"), Motcle("indetermine") };
50
51 Motcle motlu;
52 Motcle motcle("h_gap");
53
54 s >> motlu;
55 if (motlu ==motcle)
56 s >> h_imp_;
57 else
58 {
59 Cerr << "Error when reading boundary condition with type Echange_interne_global_impose " << finl;
60 Cerr << "We expected " << motcle << " instead of " << motlu << finl;
61 exit();
62 }
63
64 init();
65
66 return s;
67}
68
70{
71 le_champ_front.typer("Champ_front_calc_interne"); // preparation de T_ext
72}
73
74// Override to skip verification - we know we will always be dealing with temperature, and we define ourselves the T_ext with
75// a Champ_front_calc_interne.
79
80
81// Finish building the champ_front_calc_interne
83{
84 Nom nom_pb(domaine_Cl_dis().equation().probleme().le_nom());
85 Nom nom_bord(frontiere_dis().le_nom());
87
88 t_ext.creer(nom_pb, nom_bord, "temperature");
89
91
92 const Front_VF& fvf = ref_cast(Front_VF, frontiere_dis());
93 const Domaine_VF& zvf = ref_cast(Domaine_VF, domaine_Cl_dis().domaine_dis());
94
95 frontiere_dis().frontiere().creer_tableau_faces(surface_gap_, RESIZE_OPTIONS::NOCOPY_NOINIT);
96
97
98 if (zvf.domaine().axi1d())
99 {
100 const DomaineAxi1d& domax = ref_cast(DomaineAxi1d,zvf.domaine());
101 const IntTab& face_voisins = zvf.face_voisins();
102 const DoubleTab& xv = zvf.xv();
103 const IntVect& fmap = t_ext.face_map();
104 for (int i=0; i<fvf.nb_faces(); i++)
105 {
106 int iopp = fmap(i);
107 int face = fvf.num_face(i);
108 int face_opp = fvf.num_face(iopp);
109 int elem = face_voisins(face,0)==-1 ? face_voisins(face,1) : face_voisins(face,0);
110 double x0 = domax.origine_repere(elem,0);
111 double y0 = domax.origine_repere(elem,1);
112 double x1 = xv(face,0);
113 double y1 = xv(face,1);
114 double x2 = xv(face_opp,0);
115 double y2 = xv(face_opp,1);
116 double r1 = sqrt((x1-x0)*(x1-x0)+(y1-y0)*(y1-y0));
117 double r2 = sqrt((x2-x0)*(x2-x0)+(y2-y0)*(y2-y0));
118 surface_gap_(i) = M_PI*(r1+r2);
119 }
120 }
121 else
122 {
123 for (int i=0; i<fvf.nb_faces(); i++)
124 {
125 int face = fvf.num_face(i);
126 surface_gap_(i) = zvf.surface(face);
127 }
128 }
129}
class Champ_front_calc_interne Derived class of Champ_front_calc representing
const IntVect & face_map() const
void creer(const Nom &, const Nom &, const Motcle &)
Create the Champ_front_calc object representing the trace of an unknown field on a boundary from name...
Domaine_Cl_dis_base & domaine_Cl_dis()
Returns the domain of discretized boundary conditions to which the object belongs.
std::vector< Motcle > app_domains
virtual Frontiere_dis_base & frontiere_dis()
Returns the discretized boundary to which the boundary conditions apply.
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
Returns the neighbouring element of num_face in direction i.
Definition Domaine_VF.h:418
bool axi1d() const
const Domaine & domaine() const
Classe Echange_global_impose This class represents the special case of the class.
void completer() override
DOES NOTHING must be overridden in derived classes.
virtual Champ_front_base & T_ext()
Returns the T_ext field of temperature imposed at the boundary.
Class Echange_interne_global_impose: This class represents the special case of.
void verifie_ch_init_nb_comp() const override
Calls the verification of the field read through the equation for which the boundary condition is con...
void completer() override
DOES NOTHING must be overridden in derived classes.
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
Creates an array with one "row" per face of this boundary.
const Frontiere & frontiere() const
Returns the associated geometric boundary.
class Nom: a character string for naming TRUST objects.
Definition Nom.h:31
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 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
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
Definition Process.cpp:466
Base class for output streams.
Definition Sortie.h:52