TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Domaine_VDF.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 Domaine_VDF_included
17#define Domaine_VDF_included
18
19
20#include <math.h>
21#include <map>
22#include <array>
23#include <Domaine_VF.h>
24#include <Domaine.h>
25class Geometrie;
26
27/*! @brief class Domaine_VDF
28 *
29 * @brief Instantiable class derived from Domaine_VF.
30 * This class contains the geometric information required by the
31 * Finite Difference Volume (VDF) method.
32 * The class holds a number of face-related data.
33 * All faces are numbered as follows:
34 * - faces on a Domaine_joint appear first
35 * (in the order of the les_joints vector)
36 * - faces on a Domaine_bord appear next
37 * (in the order of the les_bords vector)
38 * - internal faces appear last
39 * Each face is associated with an integer indicating its orientation.
40 * Within each face family (boundary, joint, internal) it is assumed that:
41 * - the block of faces with equation x = const (orientation 0) comes first
42 * - the block of faces with equation y = const (orientation 1) comes next
43 * - the block of faces with equation z = const (orientation 2) comes last
44 * For the boundary face block, sub-blocks corresponding to each boundary are preserved.
45 * No particular element numbering is required.
46 * The notion of edge is introduced for computing diffusive and convective fluxes
47 * in the momentum conservation equation.
48 * The Qdm array contains the edge/face connectivity. In this array,
49 * edges appear in the following order:
50 * - block of joint edges
51 * - block of boundary edges
52 * - block of mixed edges
53 * - block of internal edges
54 * Within each block, edges appear in the order: XY edges, XZ edges, YZ edges.
55 *
56 *
57 *
58 */
59
60class Domaine_VDF : public Domaine_VF
61{
62
63 Declare_instanciable(Domaine_VDF);
64
65public :
66
67 void discretiser() override;
68 Faces* creer_faces() override;
69 inline int nb_faces_X() const;
70 inline int nb_faces_Y() const;
71 inline int nb_faces_Z() const;
72 inline int nb_aretes() const;
73 inline int nb_aretes_joint() const;
74 inline int nb_aretes_coin() const;
75 inline int premiere_arete_coin() const;
76 inline int nb_aretes_bord() const;
77 inline int premiere_arete_bord() const;
78 inline int nb_aretes_mixtes() const;
79 inline int premiere_arete_mixte() const;
80 inline int nb_aretes_internes() const;
81 inline int premiere_arete_interne() const;
82 inline double h_x() const;
83 inline double h_y() const;
84 inline double h_z() const;
85
86 inline int Qdm(int num_arete,int ) const;
87 //inline double porosite_face(int ) const;
88 //inline double porosite_elem(int i) const;
90 inline double face_normales(int , int ) const override;
91 inline int orientation(int ) const override;
92 inline double dist_face(int , int , int k) const;
93 inline double dist_norm(int num_face) const override;
94 inline double dist_norm_bord(int num_face) const override;
95 inline double dist_face_elem0(int ,int ) const override;
96 inline double dist_face_elem1(int ,int ) const override;
97 inline double dist_face_axi(int , int , int k) const;
98 inline double dist_face_period(int , int , int ) const;
99 inline double dist_norm_period(int ,double ) const;
100 inline double dist_face_elem0_period(int ,int ,double ) const override;
101 inline double dist_face_elem1_period(int ,int ,double ) const override;
102 inline double dist_norm_axi(int num_face) const ;
103 inline double dist_norm_bord_axi(int num_face) const;
104 inline double dist_face_elem0_axi(int ,int ) const;
105 inline double dist_face_elem1_axi(int ,int ) const;
106 inline double distance_face(int , int , int k) const;
107 inline double distance_normale(int num_face) const;
108 inline double dist_elem(int ,int ,int ) const;
109 inline double dist_elem_period(int ,int ,int ) const;
110 inline double dim_elem(int ,int ) const;
111 inline double dim_face(int ,int ) const;
112 inline double delta_C(int ) const;
113 inline int amont_amont(int, int ) const;
114 inline int face_amont_princ(int ,int ) const;
115 inline int face_amont_conj(int ,int ,int ) const;
116 inline int face_bord_amont(int ,int ,int ) const;
117 inline int elem_voisin(int , int , int ) const;
118
119 inline IntVect& orientation();
120 inline const IntVect& orientation() const override;
121
122 // inline DoubleVect& porosite_face();
123 // inline const DoubleVect& porosite_face() const;
124 // inline DoubleVect& porosite_elem();
125 // inline const DoubleVect& porosite_elem() const;
126
127 inline IntTab& Qdm();
128 inline const IntTab& Qdm() const;
130 void modifier_pour_Cl(const Conds_lim& cl) override;
131 void creer_elements_fictifs(const Domaine_Cl_dis_base& ) override;
132 DoubleVect& dist_norm_bord(DoubleVect& , const Nom& nom_bord) const;
133
134 //std::map to retrieve the (proc, local item) pair associated with a virtual item for mdv_elem
135 void init_virt_e_map() const;
136 mutable std::map<std::array<int, 2>, int> virt_e_map;
137
138protected:
139 void prepare_elem_non_std(Faces&) override;
140 void compute_sort_key(Faces&, IntTab& sort_key) override;
141 void renumber_faces(Faces& les_faces, IntTab& sort_key) override;
142
143private:
144
145 IntVect orientation_; // face orientation
146 // 0 if face perpendicular to the X axis
147 // 1 if face perpendicular to the Y axis
148 // 2 if face perpendicular to the Z axis
149 int nb_faces_X_ = -1; // number of faces perpendicular to the X axis
150 int nb_faces_Y_ = -1; // number of faces perpendicular to the Y axis
151 int nb_faces_Z_ = -1; // number of faces perpendicular to the Z axis
152 int nb_aretes_ = -1; // total number of edges of all types
153 int nb_aretes_joint_ = -1; // number of joint edges
154 int nb_aretes_coin_ = -1; // number of corner edges
155 int nb_aretes_bord_ = -1; // number of boundary edges
156 int nb_aretes_mixtes_ = -1; // number of mixed edges
157 int nb_aretes_internes_ = -1; // number of internal edges
158 IntTab Qdm_; // edge/face connectivity
159 // DoubleVect porosite_elem_; // volumetric porosities for mass control volumes
160 // DoubleVect porosite_face_; // surface porosities for mass and volumetric momentum control
161 double h_x_ = 1.e30 , h_y_ = 1.e30 ,h_z_ = 1.e30; // mesh step sizes in the three spatial directions
162 // h_x_ (resp. h_y_) is the smallest distance between two face centers
163 // with equation X = const (resp. Y = const)
164
165 // void calculer_porosites();
166 void genere_aretes();
167 void calcul_h();
168 void remplir_face_normales();
169};
170
171// Inline functions
172
173/*! @brief
174 *
175 */
176inline IntTab& Domaine_VDF::Qdm()
177{
178 return Qdm_;
179}
180
181inline double Domaine_VDF::face_normales(int num_face,int k) const
182{
183 int ori = orientation(num_face);
184 double surf=0;
185 if (ori == k)
186 surf=face_surfaces(num_face);
187 return surf;
188}
189
190/*! @brief
191 *
192 */
193inline const IntTab& Domaine_VDF::Qdm() const
194{
195 return Qdm_;
196}
197
198/*! @brief
199 *
200 */
201inline int Domaine_VDF::nb_faces_X() const
202{
203 return nb_faces_X_;
204}
205
206/*! @brief
207 *
208 */
209inline int Domaine_VDF::nb_faces_Y() const
210{
211 return nb_faces_Y_;
212}
213
214/*! @brief
215 *
216 */
217inline int Domaine_VDF::nb_faces_Z() const
218{
219 return nb_faces_Z_;
220}
221
222/*! @brief
223 *
224 */
225inline int Domaine_VDF::Qdm(int num_arete,int i) const
226{
227 return Qdm_(num_arete,i);
228}
229
230/*! @brief inline double Domaine_VDF::porosite_face(int i) const {
231 *
232 * return porosite_face_[i];
233 * }
234 *
235 */
236
237/*! @brief
238 *
239 */
241{
242 return orientation_;
243}
244
245/*! @brief
246 *
247 */
248inline const IntVect& Domaine_VDF::orientation() const
249{
250 return orientation_;
251}
252
253/*! @brief inline DoubleVect& Domaine_VDF::porosite_face() {
254 *
255 * return porosite_face_;
256 * }
257 *
258 */
259
260/*! @brief inline const DoubleVect& Domaine_VDF::porosite_face() const {
261 *
262 * return porosite_face_;
263 * }
264 *
265 */
266
267/*! @brief inline DoubleVect& Domaine_VDF::porosite_elem() {
268 *
269 * return porosite_elem_;
270 * }
271 *
272 */
273
274/*! @brief inline const DoubleVect& Domaine_VDF::porosite_elem() const {
275 *
276 * return porosite_elem_;
277 * }
278 *
279 */
280
281/*! @brief inline double Domaine_VDF::porosite_elem(int i) const {
282 *
283 * return porosite_elem_[i];
284 * }
285 *
286 */
287
288/*! @brief
289 *
290 */
291inline int Domaine_VDF::orientation(int i) const
292{
293 return orientation_[i];
294}
295
296// Compute function usable only in Cartesian coordinates:
297// distance between the centers of 2 faces in direction k.
298
299/*! @brief Returns the distance between two face centers in direction k (Cartesian only).
300 *
301 * @param fac1 Index of the first face.
302 * @param fac2 Index of the second face.
303 * @param k Direction index.
304 * @return Distance xv(fac2,k) - xv(fac1,k).
305 */
306inline double Domaine_VDF::dist_face(int fac1, int fac2, int k) const
307{
308 // Note: this method is no longer called by dist_face in
309 // Eval_Diff_VDF_Multi_inco_const.cpp and Eval_Diff_VDF_const.cpp for evaluator optimization
310 return xv_(fac2,k) - xv_(fac1,k);
311}
312
313// Compute function usable only in cylindrical coordinates:
314// distance between the centers of 2 faces in direction k.
315
316/*! @brief Returns the distance between two face centers in direction k (cylindrical coordinates).
317 *
318 * @param fac1 Index of the first face.
319 * @param fac2 Index of the second face.
320 * @param k Direction index.
321 * @return Arc-length distance (in direction k) between the two face centers.
322 */
323inline double Domaine_VDF::dist_face_axi(int fac1, int fac2, int k) const
324{
325 if (k != 1)
326 return xv_(fac2,k) - xv_(fac1,k);
327 else
328 {
329 double d_teta = xv_(fac2,1) - xv_(fac1,1);
330 if (d_teta < 0)
331 d_teta += 2.0*M_PI;
332 return d_teta*xv_(fac1,0);
333 }
334}
335
336// Compute function usable only in Cartesian coordinates:
337// normal distance for an internal face.
338// For an internal face the normal distance equals the distance between
339// the centers of the two neighboring cells.
340
341/*! @brief Returns the normal distance for an internal face (Cartesian coordinates).
342 *
343 * @param num_face Face index.
344 * @return Distance between the centers of the two neighboring cells.
345 */
346inline double Domaine_VDF::dist_norm(int num_face) const
347{
348 int n1 = face_voisins_(num_face,0);
349 int n2 = face_voisins_(num_face,1);
350 int k = orientation_[num_face];
351 return (xp_(n2,k) - xp_(n1,k));
352}
353
354// Compute function usable only in cylindrical coordinates:
355// normal distance for an internal face.
356
357/*! @brief Returns the normal distance for an internal face (cylindrical coordinates).
358 *
359 * @param num_face Face index.
360 * @return Arc-length normal distance between the two neighboring cell centers.
361 */
362inline double Domaine_VDF::dist_norm_axi(int num_face) const
363{
364 int n1 = face_voisins_(num_face,0);
365 int n2 = face_voisins_(num_face,1);
366 int k = orientation_[num_face];
367 double dist;
368 if (k != 1)
369 dist = xp_(n2,k) - xp_(n1,k);
370 else
371 {
372 double d_teta = xp_(n2,1) - xp_(n1,1);
373 if (d_teta < 0)
374 d_teta += 2.0*M_PI;
375 dist = d_teta*xp_(n1,0);
376 }
377 return dist;
378}
379
380// Compute function usable only in Cartesian coordinates:
381// normal distance for a boundary face.
382// For a boundary face the normal distance equals the distance between
383// the center of the neighboring cell and the boundary.
384
385/*! @brief Returns the normal distance for a boundary face (Cartesian coordinates).
386 *
387 * @param num_face Face index.
388 * @return Distance between the neighboring cell center and the boundary face.
389 */
390inline double Domaine_VDF::dist_norm_bord(int num_face) const
391{
392 int n1 = face_voisins_(num_face,0);
393 int n2 = face_voisins_(num_face,1);
394 assert(num_face<nb_faces_bord() || n1==-1 || n2==-1); // Check that num_face is a real or virtual boundary face
395 int k = orientation_[num_face];
396 if (n1!=-1)
397 return (xv_(num_face,k) - xp_(n1,k));
398 else
399 return (xp_(n2,k) - xv_(num_face,k));
400}
401
402// Compute function usable only in cylindrical coordinates:
403// normal distance for a boundary face.
404
405/*! @brief Returns the normal distance for a boundary face (cylindrical coordinates).
406 *
407 * @param num_face Face index.
408 * @return Arc-length normal distance between the neighboring cell center and the boundary face.
409 */
410inline double Domaine_VDF::dist_norm_bord_axi(int num_face) const
411{
412 int n1 = face_voisins_(num_face,0);
413 int n2 = face_voisins_(num_face,1);
414 assert(num_face<nb_faces_bord() || n1==-1 || n2==-1); // Check that num_face is a real or virtual boundary face
415 int k = orientation_[num_face];
416 double dist;
417 if (n1!=-1)
418 if (k != 1)
419 dist = xv_(num_face,k) - xp_(n1,k);
420 else
421 {
422 double d_teta = xv_(num_face,1) - xp_(n1,1);
423 if (d_teta < 0)
424 d_teta += 2.0*M_PI;
425 dist = d_teta*xp_(n1,0);
426 }
427 else if (k != 1)
428 dist = xp_(n2,k) - xv_(num_face,k);
429 else
430 {
431 double d_teta = xp_(n2,1) - xv_(num_face,1);
432 if (d_teta < 0)
433 d_teta += 2.0*M_PI;
434 dist = d_teta*xp_(n2,0);
435 }
436 return dist;
437}
438
439// Compute function for the distance between the centers of 2 faces
440// of the same orientation, usable in cylindrical and Cartesian coordinates.
441
442/*! @brief Returns the distance between the centers of two same-orientation faces.
443 *
444 * @param n1 Index of the first face.
445 * @param n2 Index of the second face.
446 * @param k Direction index.
447 * @return Distance between the two face centers (arc-length in cylindrical, Euclidean in Cartesian).
448 */
449inline double Domaine_VDF::distance_face(int n1, int n2, int k) const
450{
451 double dist,d_teta;
452 assert ( (orientation_[n1]==orientation_[n2]) );
453 if ( (axi!=1) || (k!=1) )
454 dist = xv_(n2,k) - xv_(n1,k);
455 else
456 {
457 d_teta = xv_(n2,1) - xv_(n1,1);
458 if (d_teta < 0)
459 d_teta += 2.0*M_PI;
460 dist = d_teta*xv_(n1,0);
461 }
462 return dist;
463}
464
465// Compute function for the normal distance for any face,
466// usable in cylindrical and Cartesian coordinates.
467
468/*! @brief Returns the normal distance for any face (cylindrical or Cartesian coordinates).
469 *
470 * @param num_face Face index.
471 * @return Normal distance between the two neighboring cell centers, or between a cell center and the boundary.
472 */
473inline double Domaine_VDF::distance_normale(int num_face) const
474{
475
476 double dist,d_teta;
477 int n1 = face_voisins_(num_face,0);
478 int n2 = face_voisins_(num_face,1);
479 int k = orientation_[num_face];
480 if ((n1!=-1) && (n2!=-1))
481 {
482 if ( (k!=1) || (axi!=1) )
483 dist = xp_(n2,k) - xp_(n1,k);
484 else
485 {
486 d_teta = xp_(n2,1) - xp_(n1,1);
487 if (d_teta < 0)
488 d_teta += 2.0*M_PI;
489 dist = d_teta*xp_(n1,0);
490 }
491 }
492 else if (n1!=-1)
493 {
494 if ( (k!=1) || (axi!=1) )
495 dist = (xv_(num_face,k) - xp_(n1,k));
496 else
497 {
498 d_teta = xv_(num_face,1) - xp_(n1,1);
499 if (d_teta < 0)
500 d_teta += 2.0*M_PI;
501 dist = d_teta*xp_(n1,0);
502 }
503 }
504 else
505 {
506 if ( (k!=1) || (axi!=1) )
507 dist = (xp_(n2,k) - xv_(num_face,k));
508 else
509 {
510 d_teta = xp_(n2,1) - xv_(num_face,1);
511 if (d_teta < 0)
512 d_teta += 2.0*M_PI;
513 dist = d_teta*xp_(n2,0);
514 }
515 }
516 return dist;
517}
518
519/*! @brief
520 *
521 */
523{
524 return nb_aretes_joint_;
525}
526
527/*! @brief
528 *
529 */
531{
532 return nb_aretes_coin_;
533}
534
535/*! @brief
536 *
537 */
539{
540 return nb_aretes_joint_;
541}
542
543/*! @brief
544 *
545 */
547{
548 return nb_aretes_bord_;
549}
550
551/*! @brief
552 *
553 */
555{
556 return nb_aretes_joint_+ nb_aretes_coin_;
557}
558
559/*! @brief
560 *
561 */
563{
564 return nb_aretes_mixtes_;
565}
566
567/*! @brief
568 *
569 */
571{
572 return nb_aretes_ - nb_aretes_mixtes_ - nb_aretes_internes_;
573}
574
575/*! @brief
576 *
577 */
579{
580 return nb_aretes_internes_;
581}
582
583/*! @brief
584 *
585 */
586inline int Domaine_VDF::nb_aretes() const
587{
588 return nb_aretes_;
589}
590
591/*! @brief
592 *
593 */
595{
596 return nb_aretes_ - nb_aretes_internes_;
597}
598
599/*! @brief
600 *
601 */
602inline double Domaine_VDF::h_x() const
603{
604 return h_x_;
605}
606
607/*! @brief
608 *
609 */
610inline double Domaine_VDF::h_y() const
611{
612 return h_y_;
613}
614
615/*! @brief
616 *
617 */
618inline double Domaine_VDF::h_z() const
619{
620 return h_z_;
621}
622
623/*! @brief
624 *
625 */
626inline double Domaine_VDF::dist_elem(int n1, int n2, int k) const
627{
628 return xp_(n2,k)-xp_(n1,k);
629}
630
631/*! @brief
632 *
633 */
634inline double Domaine_VDF::dist_elem_period(int n1, int n2, int k) const
635{
636 return xp_(n2,k) - xv_(elem_faces(n2,k),k)
637 + xv_(elem_faces(n1,k+dimension),k) - xp_(n1,k);
638}
639
640/*! @brief
641 *
642 */
643inline double Domaine_VDF::dim_elem(int n1, int k) const
644{
645 return xv_(elem_faces_(n1,k+dimension),k)-xv_(elem_faces_(n1,k),k);
646}
647
648/*! @brief
649 *
650 */
651inline double Domaine_VDF::dim_face(int n1, int k) const
652{
653 int elem = std::max(face_voisins_(n1,0), face_voisins_(n1,1));
654 return dim_elem(elem, k);
655}
656
657/*! @brief
658 *
659 */
660inline double Domaine_VDF::delta_C(int elem) const
661{
662 double dist= 1;
663 for (int i=0; i<dimension; i++)
664 dist *= dim_elem(elem,i);
665 return pow(dist,1./3.);
666}
667
668/*! @brief
669 *
670 */
671inline int Domaine_VDF::amont_amont(int num_face, int i) const
672{
673 int k=orientation_[num_face];
674 int num_elem = face_voisins_(num_face,i);
675 int face = elem_faces_(num_elem,k+i*dimension);
676 return face_voisins_(face,i);
677}
678
679/*! @brief
680 *
681 */
682inline int Domaine_VDF::face_amont_princ(int num_face, int i) const
683{
684 int ori=orientation(num_face);
685 int elem=face_voisins_(num_face,i);
686 if(elem !=-1)
687 elem=elem_faces_(elem,ori+i*dimension);
688 return elem;
689}
690
691/*! @brief
692 *
693 */
694inline int Domaine_VDF::face_amont_conj(int num_face, int k, int i) const
695{
696 int ori = orientation(num_face);
697 int elem = face_voisins_(num_face,1);
698 int face_conj=-2,face,elem_bis=-2;
699
700 if(elem != -1)
701 {
702 face = elem_faces_(elem, k+i*dimension);
703 elem_bis = face_voisins_(face,i);
704 if (elem_bis != -1)
705 face_conj = elem_faces_(elem_bis, ori);
706 else
707 face_conj = -1;
708 }
709 if ((elem==-1) || (elem_bis==-1))
710 {
711 elem = face_voisins_(num_face,0);
712 if(elem != -1)
713 {
714 face = elem_faces_(elem, k+i*dimension);
715 elem_bis = face_voisins_(face,i);
716 if (elem_bis != -1)
717 face_conj = elem_faces_(elem_bis, ori+dimension);
718 else
719 face_conj = -1;
720 }
721 }
722 assert(face_conj!=-2);
723 return face_conj;
724}
725
726/*! @brief Returns the neighboring face, accounting for the possibility that it may be a boundary face.
727 *
728 * @param num_face Face index.
729 * @param k Direction index of the conjugate face.
730 * @param i Side index (0 or 1).
731 * @return Index of the neighboring face element.
732 */
733inline int Domaine_VDF::face_bord_amont(int num_face, int k, int i) const
734{
735 int ori = orientation(num_face);
736 int elem = face_voisins_(num_face,1);
737 if(elem != -1)
738 {
739 int face = elem_faces_(elem, k+i*dimension);
740 int elem_bis = face_voisins_(face,i);
741 if (elem_bis != -1)
742 elem = elem_faces_(elem_bis, ori);
743 else
744 elem = -1;
745 }
746 if (elem == -1)
747 {
748 elem = face_voisins_(num_face,0);
749 if(elem != -1)
750 {
751 int face = elem_faces_(elem, k+i*dimension);
752 int elem_bis = face_voisins_(face,i);
753 if (elem_bis != -1)
754 elem = elem_faces_(elem_bis, ori+dimension);
755 else
756 elem = -1;
757 }
758 }
759 return elem;
760}
761
762/*! @brief
763 *
764 */
765inline int Domaine_VDF::elem_voisin(int elem, int face , int indic) const
766{
767 int ori = orientation_(face);
768 return face_voisins_(elem_faces_(elem,ori+indic*dimension),indic);
769}
770
771/*! @brief Returns the distance between the center of a face and the center of face_voisins(face,0) (Cartesian coordinates only).
772 *
773 * @param num_face Face index.
774 * @param n0 Index of the element on side 0.
775 * @return Distance from the face center to the element center.
776 */
777inline double Domaine_VDF::dist_face_elem0(int num_face,int n0) const
778
779{
780 int ori = orientation_[num_face];
781 return xv_(num_face,ori) - xp_(n0,ori);
782}
783
784/*! @brief Returns the distance between the center of a face and the center of face_voisins(face,1) (Cartesian coordinates only).
785 *
786 * @param num_face Face index.
787 * @param n1 Index of the element on side 1.
788 * @return Distance from the element center to the face center.
789 */
790inline double Domaine_VDF::dist_face_elem1(int num_face,int n1) const
791{
792 int ori = orientation_[num_face];
793 return xp_(n1,ori) - xv_(num_face,ori);
794}
795
796/*! @brief Returns the distance between the center of a face and the center of face_voisins(face,0) (cylindrical coordinates only).
797 *
798 * @param num_face Face index.
799 * @param n0 Index of the element on side 0.
800 * @return Arc-length or Euclidean distance from the face center to the element center.
801 */
802inline double Domaine_VDF::dist_face_elem0_axi(int num_face,int n0) const
803{
804 int ori = orientation_[num_face];
805 double dist;
806 if (ori!=1)
807 dist = xv_(num_face,ori) - xp_(n0,ori);
808 else
809 {
810 double d_teta = xv_(num_face,1) - xp_(n0,1);
811 if (d_teta < 0)
812 d_teta += 2.0*M_PI;
813 dist = d_teta*xp_(n0,0);
814 }
815 return dist;
816}
817
818/*! @brief Returns the distance between the center of a face and the center of face_voisins(face,1) (cylindrical coordinates only).
819 *
820 * @param num_face Face index.
821 * @param n1 Index of the element on side 1.
822 * @return Arc-length or Euclidean distance from the element center to the face center.
823 */
824inline double Domaine_VDF::dist_face_elem1_axi(int num_face,int n1) const
825{
826 int ori = orientation_[num_face];
827 double dist;
828 if (ori!=1)
829 dist = xp_(n1,ori) - xv_(num_face,ori);
830 else
831 {
832 double d_teta = xp_(n1,1) - xv_(num_face,1);
833 if (d_teta < 0)
834 d_teta += 2.0*M_PI;
835 dist = d_teta*xp_(n1,0);
836 }
837 return dist;
838}
839
840inline double Domaine_VDF::dist_norm_period(int num_face,double l) const
841{
842 int n1 = face_voisins_(num_face,0);
843 int n2 = face_voisins_(num_face,1);
844 int k = orientation_[num_face];
845 return (xp_(n2,k) + l - xp_(n1,k));
846}
847
848inline double Domaine_VDF::dist_face_elem0_period(int num_face,int n0,double l) const
849{
850 int ori = orientation_[num_face];
851 double dist = xv_(num_face,ori) - xp_(n0,ori);
852 if (dist > 0)
853 return dist;
854 else
855 return dist + l;
856}
857
858inline double Domaine_VDF::dist_face_elem1_period(int num_face,int n1,double l) const
859{
860 int ori = orientation_[num_face];
861 double dist = xp_(n1,ori) - xv_(num_face,ori);
862 if (dist > 0)
863 return dist;
864 else
865 return dist + l;
866}
867
868inline double Domaine_VDF::dist_face_period(int fac1 , int fac2, int k) const
869{
870 const Domaine& le_domaine = domaine();
871 const DoubleTab& coord_sommets = le_domaine.coord_sommets();
872 double dist= std::fabs(coord_sommets(face_sommets(fac1,1),k)-xv_(fac1,k));
873 dist += std::fabs(xv_(fac2,k) - coord_sommets(face_sommets(fac2,0),k));
874 return dist;
875
876}
877
878#endif
879
880
881
882
class Conds_lim This class represents a vector of boundary conditions.
Definition Conds_lim.h:32
const DoubleTab_t & coord_sommets() const
Definition Domaine.h:112
class Domaine_Cl_dis_base Domaine_Cl_dis_base objects represent discretized boundary conditions
class Domaine_VDF
Definition Domaine_VDF.h:61
double h_y() const
int nb_aretes_coin() const
void compute_sort_key(Faces &, IntTab &sort_key) override
Override. Compute sorting key so that internal faces are sorted by their orientation first (X,...
double dist_norm(int num_face) const override
Returns the normal distance for an internal face (Cartesian coordinates).
double dist_norm_bord_axi(int num_face) const
Returns the normal distance for a boundary face (cylindrical coordinates).
IntVect & orientation()
inline double Domaine_VDF::porosite_face(int i) const {
double delta_C(int) const
Faces * creer_faces() override
Returns a newly allocated Faces_VDF object.
int nb_aretes_joint() const
void prepare_elem_non_std(Faces &) override
double dist_face_period(int, int, int) const
int nb_faces_Z() const
int nb_aretes() const
double dim_elem(int, int) const
int nb_faces_Y() const
std::map< std::array< int, 2 >, int > virt_e_map
void creer_elements_fictifs(const Domaine_Cl_dis_base &) override
Fills the face_voisins_fictifs_ array. Does NOT create fictitious elements.
int premiere_arete_bord() const
double distance_face(int, int, int k) const
Returns the distance between the centers of two same-orientation faces.
void discretiser() override
Calls Domaine_VF::discretiser(), computes element gravity centers,.
double h_x() const
double h_z() const
int premiere_arete_coin() const
int face_bord_amont(int, int, int) const
Returns the neighboring face, accounting for the possibility that it may be a boundary face.
double dist_face_elem1_period(int, int, double) const override
double dist_face_elem0(int, int) const override
Returns the distance between the center of a face and the center of face_voisins(face,...
int nb_aretes_internes() const
int premiere_arete_interne() const
double dist_face_elem1_axi(int, int) const
Returns the distance between the center of a face and the center of face_voisins(face,...
int nb_aretes_bord() const
int nb_aretes_mixtes() const
double dim_face(int, int) const
void modifier_pour_Cl(const Conds_lim &cl) override
int nb_faces_X() const
double dist_face(int, int, int k) const
Returns the distance between two face centers in direction k (Cartesian only).
double dist_face_elem0_axi(int, int) const
Returns the distance between the center of a face and the center of face_voisins(face,...
double dist_elem_period(int, int, int) const
double dist_norm_period(int, double) const
int amont_amont(int, int) const
double dist_face_axi(int, int, int k) const
Returns the distance between two face centers in direction k (cylindrical coordinates).
IntTab & Qdm()
int face_amont_conj(int, int, int) const
void init_virt_e_map() const
void renumber_faces(Faces &les_faces, IntTab &sort_key) override
Override to also renumber orientation_ member.
int premiere_arete_mixte() const
double dist_norm_axi(int num_face) const
Returns the normal distance for an internal face (cylindrical coordinates).
double dist_face_elem1(int, int) const override
Returns the distance between the center of a face and the center of face_voisins(face,...
double distance_normale(int num_face) const
Returns the normal distance for any face (cylindrical or Cartesian coordinates).
void calculer_volumes_entrelaces()
Fills the staggered volumes (volumes entrelaces).
int elem_voisin(int, int, int) const
double dist_norm_bord(int num_face) const override
Returns the normal distance for a boundary face (Cartesian coordinates).
double dist_face_elem0_period(int, int, double) const override
int face_amont_princ(int, int) const
virtual DoubleTab & face_normales()
Definition Domaine_VF.h:48
double dist_elem(int, int, int) const
class Domaine_VF
Definition Domaine_VF.h:44
virtual const DoubleVect & face_surfaces() const
Definition Domaine_VF.h:51
DoubleTab xp_
Definition Domaine_VF.h:218
IntTab & face_sommets() override
Returns the face/vertex connectivity array.
Definition Domaine_VF.h:590
DoubleTab xv_
Definition Domaine_VF.h:219
virtual double face_normales(int face, int comp) const
Definition Domaine_VF.h:47
IntTab & elem_faces()
Returns the element/face connectivity array.
Definition Domaine_VF.h:550
IntTab face_voisins_
Definition Domaine_VF.h:216
IntTab elem_faces_
Definition Domaine_VF.h:222
int nb_faces_bord() const
Returns the number of faces on which boundary conditions are applied:
Definition Domaine_VF.h:512
const Domaine & domaine() const
class Nom: a character string for naming TRUST objects.
Definition Nom.h:31
static int dimension
Definition Objet_U.h:94
static int axi
Definition Objet_U.h:96