TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Tetra_VEF.h
1/****************************************************************************
2* Copyright (c) 2026, 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#ifndef Tetra_VEF_included
17#define Tetra_VEF_included
18
19#include <Elem_VEF_base.h>
20
22{
23
24 Declare_instanciable_sans_constructeur(Tetra_VEF);
25
26public:
27 Tetra_VEF();
28 inline int nb_facette() const override
29 {
30 return 6;
31 };
32 void creer_facette_normales(const Domaine_VEF&, const IntVect& ) const override;
33 void creer_normales_facettes_Cl(DoubleTab&, int ,int ,
34 const DoubleTab& ,const DoubleVect& , const Domaine&) const override ;
35 void modif_volumes_entrelaces(int ,int ,const Domaine_VEF& ,DoubleVect& ,int ) const override ;
36 void modif_volumes_entrelaces_faces_joints(int ,int ,const Domaine_VEF& ,DoubleVect& ,int ) const override ;
37 void modif_normales_facettes_Cl(DoubleTab& ,int ,int ,int ,int, int ,int ) const override ;
38 void calcul_vc(const ArrOfInt& ,ArrOfDouble& ,const ArrOfDouble& ,
39 const DoubleTab& ,const Champ_Inc_base& ,int, const DoubleVect& ) const override ;
40 void calcul_xg(DoubleVect& ,const DoubleTab& ,const int ,int& ,
41 int& ,int& ,int& ) const override ;
42 void creer_face_normales(DoubleTab&, const IntTab& ,const IntTab&,
43 const IntTab& ,const Domaine& ) const override ;
44};
45
46KOKKOS_INLINE_FUNCTION void calcul_vc_tetra(const int* Face, double *vc, const double * vs, const double * vsom,
47 const double* vitesse,int type_cl, const double* poro)
48{
49 // Casting (justified by size) type_cl and comp to True_int to avoid nvc++ bug
50 int comp;
51 switch(type_cl)
52 {
53
54 case 0: // the tetrahedron has no Dirichlet face
55 {
56 for (comp=0; comp<3; comp++)
57 vc[comp] = 0.25*vs[comp];
58 break;
59 }
60
61 case 1: // the tetrahedron has one Dirichlet face: KEL3
62 {
63 for (comp=0; comp<3; comp++)
64 vc[comp] = vitesse[9+comp] * poro[3];
65 break;
66 }
67
68 case 2: // the tetrahedron has one Dirichlet face: KEL2
69 {
70 for (comp=0; comp<3; comp++)
71 vc[comp] = vitesse[6+comp] * poro[2];
72 break;
73 }
74
75 case 4: // the tetrahedron has one Dirichlet face: KEL1
76 {
77 for (comp=0; comp<3; comp++)
78 vc[comp] = vitesse[3+comp] * poro[1];
79 break;
80 }
81
82 case 8: // the tetrahedron has one Dirichlet face: KEL0
83 {
84 for (comp=0; comp<3; comp++)
85 vc[comp] = vitesse[comp] * poro[0];
86 break;
87 }
88
89 case 3: // the tetrahedron has two Dirichlet faces: KEL3 and KEL2
90 {
91 for (comp=0; comp<3; comp++)
92 vc[comp] = 0.5* (vsom[comp] + vsom[3+comp]);
93 break;
94 }
95
96 case 5: // the tetrahedron has two Dirichlet faces: KEL3 and KEL1
97 {
98 for (comp=0; comp<3; comp++)
99 vc[comp] = 0.5* (vsom[comp] + vsom[6+comp]);
100 break;
101 }
102
103 case 6: // the tetrahedron has two Dirichlet faces: KEL1 and KEL2
104 {
105 for (comp=0; comp<3; comp++)
106 vc[comp] = 0.5* (vsom[comp] + vsom[9+comp]);
107 break;
108 }
109
110 case 9: // the tetrahedron has two Dirichlet faces: KEL0 and KEL3
111 {
112 for (comp=0; comp<3; comp++)
113 vc[comp] = 0.5* (vsom[3+comp] + vsom[6+comp]);
114 break;
115 }
116
117 case 10: // the tetrahedron has two Dirichlet faces: KEL0 and KEL2
118 {
119 for (comp=0; comp<3; comp++)
120 vc[comp] = 0.5* (vsom[3+comp] + vsom[9+comp]);
121 break;
122 }
123
124 case 12: // the tetrahedron has two Dirichlet faces: KEL0 and KEL1
125 {
126 for (comp=0; comp<3; comp++)
127 vc[comp] = 0.5*(vsom[6+comp] + vsom[9+comp]);
128 break;
129 }
130
131 case 7: // the tetrahedron has three Dirichlet faces: KEL1, KEL2 and KEL3
132 {
133 for (comp=0; comp<3; comp++)
134 vc[comp] = vsom[comp];
135 break;
136 }
137
138 case 11: // the tetrahedron has three Dirichlet faces: KEL0, KEL2 and KEL3
139 {
140 for (comp=0; comp<3; comp++)
141 vc[comp] = vsom[3+comp];
142 break;
143 }
144
145 case 13: // the tetrahedron has three Dirichlet faces: KEL0, KEL1 and KEL3
146 {
147 for (comp=0; comp<3; comp++)
148 vc[comp] = vsom[6+comp];
149 break;
150 }
151
152 case 14: // the tetrahedron has three Dirichlet faces: KEL0, KEL1 and KEL2
153 {
154 for (comp=0; comp<3; comp++)
155 vc[comp] = vsom[9+comp];
156 break;
157 }
158
159 } // end of switch
160
161}
162
163KOKKOS_INLINE_FUNCTION void calcul_vc_tetra_views(const int* Face, double *vc, const double * vs, const double * vsom,
164 CDoubleTabView vitesse,int type_cl, CDoubleArrView porosite_face)
165{
166 // Casting (justified by size) type_cl and comp to True_int to avoid nvc++ bug
167 int comp;
168 switch(type_cl)
169 {
170
171 case 0: // the tetrahedron has no Dirichlet face
172 {
173 for (comp=0; comp<3; comp++)
174 vc[comp] = 0.25*vs[comp];
175 break;
176 }
177
178 case 1: // the tetrahedron has one Dirichlet face: KEL3
179 {
180 for (comp=0; comp<3; comp++)
181 vc[comp] = vitesse(Face[3], comp) * porosite_face(Face[3]);
182 break;
183 }
184
185 case 2: // the tetrahedron has one Dirichlet face: KEL2
186 {
187 for (comp=0; comp<3; comp++)
188 vc[comp] = vitesse(Face[2], comp) * porosite_face(Face[2]);
189 break;
190 }
191
192 case 4: // the tetrahedron has one Dirichlet face: KEL1
193 {
194 for (comp=0; comp<3; comp++)
195 vc[comp] = vitesse(Face[1], comp) * porosite_face(Face[1]);
196 break;
197 }
198
199 case 8: // the tetrahedron has one Dirichlet face: KEL0
200 {
201 for (comp=0; comp<3; comp++)
202 vc[comp] = vitesse(Face[0], comp) * porosite_face(Face[0]);
203 break;
204 }
205
206 case 3: // the tetrahedron has two Dirichlet faces: KEL3 and KEL2
207 {
208 for (comp=0; comp<3; comp++)
209 vc[comp] = 0.5* (vsom[comp] + vsom[3+comp]);
210 break;
211 }
212
213 case 5: // the tetrahedron has two Dirichlet faces: KEL3 and KEL1
214 {
215 for (comp=0; comp<3; comp++)
216 vc[comp] = 0.5* (vsom[comp] + vsom[6+comp]);
217 break;
218 }
219
220 case 6: // the tetrahedron has two Dirichlet faces: KEL1 and KEL2
221 {
222 for (comp=0; comp<3; comp++)
223 vc[comp] = 0.5* (vsom[comp] + vsom[9+comp]);
224 break;
225 }
226
227 case 9: // the tetrahedron has two Dirichlet faces: KEL0 and KEL3
228 {
229 for (comp=0; comp<3; comp++)
230 vc[comp] = 0.5* (vsom[3+comp] + vsom[6+comp]);
231 break;
232 }
233
234 case 10: // the tetrahedron has two Dirichlet faces: KEL0 and KEL2
235 {
236 for (comp=0; comp<3; comp++)
237 vc[comp] = 0.5* (vsom[3+comp] + vsom[9+comp]);
238 break;
239 }
240
241 case 12: // the tetrahedron has two Dirichlet faces: KEL0 and KEL1
242 {
243 for (comp=0; comp<3; comp++)
244 vc[comp] = 0.5*(vsom[6+comp] + vsom[9+comp]);
245 break;
246 }
247
248 case 7: // the tetrahedron has three Dirichlet faces: KEL1, KEL2 and KEL3
249 {
250 for (comp=0; comp<3; comp++)
251 vc[comp] = vsom[comp];
252 break;
253 }
254
255 case 11: // the tetrahedron has three Dirichlet faces: KEL0, KEL2 and KEL3
256 {
257 for (comp=0; comp<3; comp++)
258 vc[comp] = vsom[3+comp];
259 break;
260 }
261
262 case 13: // the tetrahedron has three Dirichlet faces: KEL0, KEL1 and KEL3
263 {
264 for (comp=0; comp<3; comp++)
265 vc[comp] = vsom[6+comp];
266 break;
267 }
268
269 case 14: // the tetrahedron has three Dirichlet faces: KEL0, KEL1 and KEL2
270 {
271 for (comp=0; comp<3; comp++)
272 vc[comp] = vsom[9+comp];
273 break;
274 }
275
276 } // end of switch
277
278}
279
280/*! @brief Computes the coordinates xg of the center of a non-standard element.
281 * Also computes idirichlet = number of Dirichlet faces of the element.
282 *
283 */
284KOKKOS_INLINE_FUNCTION
285void calcul_xg_tetra(double * xg, const double *x, const int type_elem_Cl, int& idirichlet,int& n1,int& n2,int& n3)
286{
287 // Casting (justified by size) type_elem_cl and comp to True_int to avoid nvc++ bug
288 int dim = 3;
289 switch(type_elem_Cl)
290 {
291 case 0: // the tetrahedron has no Dirichlet face. It has 6 facets
292 {
293 for (int j=0; j<dim; j++)
294 xg[j]=0.25*(x[j]+x[dim+j]+x[2*dim+j]+x[3*dim+j]);
295
296 idirichlet=0;
297 break;
298 }
299
300 case 1: // the tetrahedron has one Dirichlet face. The 'center'
301 // of the tetrahedron is at the midpoint of face 3 with vertices 0, 1, 2.
302 // It has 3 real facets: 0 at nodes 2 3 xg
303 // 1 at nodes 1 3 xg
304 // 3 at nodes 3 0 xg
305 // the 3 other facets are on face 3
306
307 {
308 for (int j=0; j<dim; j++)
309 xg[j]=(x[j]+x[dim+j]+x[2*dim+j])/3.;
310
311 idirichlet=1;
312 break;
313
314 }
315
316 case 2: // the tetrahedron has one Dirichlet face. The 'center'
317 // of the tetrahedron is at the midpoint of face 2 with vertices 0, 1, 3.
318 // It has 3 real facets: 0 at nodes 2 3 xg
319 // 2 at nodes 1 2 xg
320 // 4 at nodes 2 0 xg
321
322 {
323 for (int j=0; j<dim; j++)
324 xg[j]=(x[j]+x[dim+j]+x[3*dim+j])/3.;
325
326 idirichlet=1;
327 break;
328 }
329
330 case 4: // the tetrahedron has one Dirichlet face. The 'center'
331 // of the tetrahedron is at the midpoint of face 1 with vertices 0, 2, 3.
332 // It has 3 real facets: 1 at nodes 1 3 xg
333 // 2 at nodes 1 2 xg
334 // 5 at nodes 1 0 xg
335
336 {
337 for (int j=0; j<dim; j++)
338 xg[j]=(x[j]+x[2*dim+j]+x[3*dim+j])/3.;
339
340 idirichlet=1;
341 break;
342 }
343
344 case 8: // the tetrahedron has one Dirichlet face. The 'center'
345 // of the tetrahedron is at the midpoint of face 0 with vertices 1, 2, 3.
346 // It has 3 real facets: 3 at nodes 3 0 xg
347 // 4 at nodes 2 0 xg
348 // 5 at nodes 1 0 xg
349
350 {
351 for (int j=0; j<dim; j++)
352 xg[j]=(x[dim+j]+x[2*dim+j]+x[3*dim+j])/3.;
353
354 idirichlet=1;
355 break;
356 }
357
358 case 3: // the tetrahedron has two Dirichlet faces 2 and 3. The 'center'
359 // is at the midpoint of the edge with endpoints 0, 1.
360 // It has 1 null facet: 5
361
362 {
363 for (int j=0; j<dim; j++)
364 xg[j]= 0.5*(x[j]+x[dim+j]);
365
366 n1=5;
367 idirichlet=2;
368 break;
369 }
370
371
372 case 5: // the tetrahedron has two Dirichlet faces 3 and 1. The 'center'
373 // is at the midpoint of the edge with endpoints 0, 2.
374 // It has 1 null facet: 4
375
376 {
377 for (int j=0; j<dim; j++)
378 xg[j]= 0.5*(x[j]+x[2*dim+j]);
379
380 n1=4;
381 idirichlet=2;
382 break;
383 }
384
385 case 6: // the tetrahedron has two Dirichlet faces 1 and 2. The 'center'
386 // is at the midpoint of the edge with endpoints 0, 3.
387 // It has 1 null facet: 3
388
389 {
390 for (int j=0; j<dim; j++)
391 xg[j]= 0.5*(x[j]+x[3*dim+j]);
392
393 n1=3;
394 idirichlet=2;
395 break;
396 }
397
398 case 9: // the tetrahedron has two Dirichlet faces 0 and 3. The 'center'
399 // is at the midpoint of the edge with endpoints 1, 2.
400 // It has 1 null facet: 2
401
402 {
403 for (int j=0; j<dim; j++)
404 xg[j]= 0.5*(x[dim+j]+x[2*dim+j]);
405
406 n1=2;
407 idirichlet=2;
408 break;
409 }
410
411 case 10: // the tetrahedron has two Dirichlet faces 0 and 2. The 'center'
412 // is at the midpoint of the edge with endpoints 1, 3.
413 // It has 1 null facet: 1
414
415 {
416 for (int j=0; j<dim; j++)
417 xg[j]= 0.5*(x[dim+j]+x[3*dim+j]);
418
419 n1=1;
420 idirichlet=2;
421 break;
422 }
423
424
425 case 12: // the tetrahedron has two Dirichlet faces 0 and 1. The 'center'
426 // is at the midpoint of the edge with vertices 2, 3.
427 // It has 1 null facet
428
429 {
430 for (int j=0; j<dim; j++)
431 xg[j]= 0.5*(x[2*dim+j]+x[3*dim+j]);
432
433 n1=0;
434 idirichlet=2;
435 break;
436 }
437
438 case 7: // three Dirichlet faces: 1, 2, 3. The center is at vertex 0.
439 // There are 3 null facets: 3, 4, 5
440
441 {
442 for (int j=0; j<dim; j++)
443 xg[j]= x[j];
444
445 n1=3;
446 n2=4;
447 n3=5;
448 idirichlet=3;
449 break;
450
451 }
452
453 case 11: // three Dirichlet faces: 0, 2, 3. The center is at vertex 1.
454 // There are 3 null facets: 1, 2, 5
455
456 {
457 for (int j=0; j<dim; j++)
458 xg[j]= x[dim+j];
459
460 n1=1;
461 n2=2;
462 n3=5;
463 idirichlet=3;
464 break;
465
466 }
467
468 case 13: // three Dirichlet faces: 0, 1, 3. The center is at vertex 2.
469 // There are 3 null facets: 0, 2, 4
470
471 {
472 for (int j=0; j<dim; j++)
473 xg[j]= x[2*dim+j];
474
475 n1=0;
476 n2=2;
477 n3=4;
478 idirichlet=3;
479 break;
480
481 }
482 case 14: // three Dirichlet faces: 0, 1, 2. The center is at vertex 3.
483 // There are 3 null facets: 0, 1, 3
484
485 {
486 for (int j=0; j<dim; j++)
487 xg[j]= x[3*dim+j];
488
489 n1=0;
490 n2=1;
491 n3=3;
492 idirichlet=3;
493 break;
494
495 }
496 }
497}
498#endif
499
500
501
Class Champ_Inc_base.
class Domaine_VEF
Definition Domaine_VEF.h:53
void modif_volumes_entrelaces_faces_joints(int, int, const Domaine_VEF &, DoubleVect &, int) const override
void modif_volumes_entrelaces(int, int, const Domaine_VEF &, DoubleVect &, int) const override
void creer_normales_facettes_Cl(DoubleTab &, int, int, const DoubleTab &, const DoubleVect &, const Domaine &) const override
Fills the normales_facettes_Cl array in the Domaine_Cl_VEF for sub-facet fa7 of element num_elem.
void calcul_vc(const ArrOfInt &, ArrOfDouble &, const ArrOfDouble &, const DoubleTab &, const Champ_Inc_base &, int, const DoubleVect &) const override
Tetra_VEF()
Returns for sub-facet fa7: for j=0,j=1: the local indices of the 2 faces surrounding fa7.
Definition Tetra_VEF.cpp:40
void modif_normales_facettes_Cl(DoubleTab &, int, int, int, int, int, int) const override
int nb_facette() const override
Definition Tetra_VEF.h:28
void calcul_xg(DoubleVect &, const DoubleTab &, const int, int &, int &, int &, int &) const override
Computes the coordinates xg of the center of a non-standard element.
void creer_facette_normales(const Domaine_VEF &, const IntVect &) const override
Fills the face_normales array in the Domaine_VEF.
void creer_face_normales(DoubleTab &, const IntTab &, const IntTab &, const IntTab &, const Domaine &) const override
Definition Tetra_VEF.cpp:55