TRUST 1.9.8
HPC thermohydraulic platform
Loading...
Searching...
No Matches
Hexa_EF.cpp
1/****************************************************************************
2* Copyright (c) 2023, 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 <Hexa_EF.h>
17#include <Domaine.h>
18
19Implemente_instanciable_sans_constructeur(Hexa_EF,"Hexa_EF",Elem_EF_base);
20
21// printOn et readOn
22
24{
25 return s << que_suis_je() << finl;
26}
27
29{
30 return s ;
31}
32
33/*! @brief KEL_(0,fa7),KEL_(1,fa7) sont les numeros locaux des 2 faces qui entourent la facette de numero local fa7
34 *
35 * le numero local de la fa7 est celui du sommet qui la porte
36 *
37 */
41
42/*! @brief remplit le tableau face_normales dans le Domaine_EF
43 *
44 */
45
46void Hexa_EF::normale(int num_Face,DoubleTab& Face_normales,
47 const IntTab& Face_sommets,
48 const IntTab& Face_voisins,
49 const IntTab& elem_faces,
50 const Domaine& domaine_geom) const
51{
52 const DoubleTab& les_coords = domaine_geom.coord_sommets();
53
54 double x1,y1,z1,x2,y2,z2;
55 double nx,ny,nz;
56 int f0,no4;
57 int elem1;
58
59 // on a les 4 sommets de la face
60 int n0 = Face_sommets(num_Face,0);
61 int n1 = Face_sommets(num_Face,1);
62 int n2 = Face_sommets(num_Face,2);
63 int n3 = Face_sommets(num_Face,3);
64
65 // on va decouper la face en deux triangles
66 // on initialise Face_normales(num_face,dimension) a 0
67 // car on va sommer les deux face_normale des triangles
68 Face_normales(num_Face,0) = 0;
69 Face_normales(num_Face,1) = 0;
70 Face_normales(num_Face,2) = 0;
71
72 // on prend les sommet S1,S2 et S4
73
74 x1 = les_coords(n0,0) - les_coords(n1,0);
75 y1 = les_coords(n0,1) - les_coords(n1,1);
76 z1 = les_coords(n0,2) - les_coords(n1,2);
77
78 x2 = les_coords(n3,0) - les_coords(n1,0);
79 y2 = les_coords(n3,1) - les_coords(n1,1);
80 z2 = les_coords(n3,2) - les_coords(n1,2);
81
82 nx = (y1*z2 - y2*z1)/2;
83 ny = (-x1*z2 + x2*z1)/2;
84 nz = (x1*y2 - x2*y1)/2;
85
86 // Orientation de la normale de elem1 vers elem2
87 // pour cela recherche du sommet de elem1 qui n'est pas sur la Face
88
89 elem1=Face_voisins(num_Face,0);
90
91 if ( (f0 = elem_faces(elem1,0)) == num_Face )
92 f0 = elem_faces(elem1,1);
93
94 if ( (no4 = Face_sommets(f0,0)) != n0 && no4 != n1
95 && no4 != n2 && no4 != n3)
96 { /* Do nothing */}
97 else if ( (no4 = Face_sommets(f0,1)) != n0 && no4 != n1
98 && no4 != n2 && no4 != n3)
99 { /* Do nothing */}
100 else if ( (no4 = Face_sommets(f0,2)) != n0 && no4 != n1
101 && no4 != n2 && no4 != n3)
102 { /* Do nothing */}
103 else
104 no4 = Face_sommets(f0,3);
105
106 x1 = les_coords(no4,0) - les_coords(n0,0);
107 y1 = les_coords(no4,1) - les_coords(n0,1);
108 z1 = les_coords(no4,2) - les_coords(n0,2);
109
110 if ( (nx*x1+ny*y1+nz*z1) > 0 )
111 {
112 Face_normales(num_Face,0) += -nx;
113 Face_normales(num_Face,1) += -ny;
114 Face_normales(num_Face,2) += -nz;
115 }
116 else
117 {
118 Face_normales(num_Face,0) += nx;
119 Face_normales(num_Face,1) += ny;
120 Face_normales(num_Face,2) += nz;
121 }
122
123 // on prend les sommet S1,S4 et S3
124
125 x1 = les_coords(n0,0) - les_coords(n2,0);
126 y1 = les_coords(n0,1) - les_coords(n2,1);
127 z1 = les_coords(n0,2) - les_coords(n2,2);
128
129 x2 = les_coords(n3,0) - les_coords(n2,0);
130 y2 = les_coords(n3,1) - les_coords(n2,1);
131 z2 = les_coords(n3,2) - les_coords(n2,2);
132
133 nx = (y1*z2 - y2*z1)/2;
134 ny = (-x1*z2 + x2*z1)/2;
135 nz = (x1*y2 - x2*y1)/2;
136
137 // Orientation de la normale de elem1 vers elem2
138 // pour cela recherche du sommet de elem1 qui n'est pas sur la Face
139
140 elem1=Face_voisins(num_Face,0);
141
142 if ( (f0 = elem_faces(elem1,0)) == num_Face )
143 f0 = elem_faces(elem1,1);
144
145 if ( (no4 = Face_sommets(f0,0)) != n0 && no4 != n1
146 && no4 != n2 && no4 != n3)
147 { /* Do nothing */}
148 else if ( (no4 = Face_sommets(f0,1)) != n0 && no4 != n1
149 && no4 != n2 && no4 != n3)
150 { /* Do nothing */}
151 else if ( (no4 = Face_sommets(f0,2)) != n0 && no4 != n1
152 && no4 != n2 && no4 != n3)
153 { /* Do nothing */}
154 else
155 no4 = Face_sommets(f0,3);
156
157 x1 = les_coords(no4,0) - les_coords(n0,0);
158 y1 = les_coords(no4,1) - les_coords(n0,1);
159 z1 = les_coords(no4,2) - les_coords(n0,2);
160
161 if ( (nx*x1+ny*y1+nz*z1) > 0 )
162 {
163 Face_normales(num_Face,0) += -nx;
164 Face_normales(num_Face,1) += -ny;
165 Face_normales(num_Face,2) += -nz;
166 }
167 else
168 {
169 Face_normales(num_Face,0) += nx;
170 Face_normales(num_Face,1) += ny;
171 Face_normales(num_Face,2) += nz;
172 }
173}
174
175
176
177/*! @brief
178 *
179 */
180void Hexa_EF::calcul_vc(const ArrOfInt& Face,ArrOfDouble& vc,
181 const ArrOfDouble& vs,const DoubleTab& vsom,
182 const Champ_Inc_base& vitesse,int type_cl) const
183{
184
185 vc[0] = vs[0]/6;
186 vc[1] = vs[1]/6;
187 vc[2] = vs[2]/6;
188}
189
190/*! @brief calcule les coord xg du centre d'un element non standard calcule aussi idirichlet=nb de faces de Dirichlet de l'element
191 *
192 * si idirichlet=2, n1 est le numero du sommet confondu avec G
193 *
194 */
195void Hexa_EF::calcul_xg(DoubleVect& xg, const DoubleTab& x,
196 const int type_elem_Cl,int& idirichlet,int& n1,int& ,int& ) const
197{
198 int j,dim=xg.size();
199 for (j=0; j<dim; j++)
200 xg[j]=(x(0,j)+x(1,j)+x(2,j)+x(3,j)+x(4,j)+x(5,j)+x(6,j)+x(7,j))*0.125;
201 idirichlet=0;
202}
203
204
Classe Champ_Inc_base.
const DoubleTab_t & coord_sommets() const
Definition Domaine.h:112
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
void calcul_xg(DoubleVect &, const DoubleTab &, const int, int &, int &, int &, int &) const override
calcule les coord xg du centre d'un element non standard calcule aussi idirichlet=nb de faces de Diri...
Definition Hexa_EF.cpp:195
void calcul_vc(const ArrOfInt &, ArrOfDouble &, const ArrOfDouble &, const DoubleTab &, const Champ_Inc_base &, int) const override
Definition Hexa_EF.cpp:180
Hexa_EF()
KEL_(0,fa7),KEL_(1,fa7) sont les numeros locaux des 2 faces qui entourent la facette de numero local ...
Definition Hexa_EF.cpp:38
void normale(int, DoubleTab &, const IntTab &, const IntTab &, const IntTab &, const Domaine &) const override
remplit le tableau face_normales dans le Domaine_EF
Definition Hexa_EF.cpp:46
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
Classe de base des flux de sortie.
Definition Sortie.h:52
_SIZE_ size() const
Definition TRUSTVect.tpp:45