TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Intersection_Interface_ijk.h
1/****************************************************************************
2* Copyright (c) 2019 - 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 Intersection_Interface_ijk_included
17#define Intersection_Interface_ijk_included
18
19#include <Objet_U.h>
20#include <IJK_Field.h>
21#include <IJK_Field_vector.h>
22#include <Domaine_IJK.h>
23#include <IJK_Field_forward.h>
24#include <IJK_subres_constants.h>
25
26/*! @brief : class Interface_ijk_face
27 *
28 * Cette classe regroupe les information concernant les mailles qui sont
29 * coupées par l'interface (leur numéro par exemple).
30 */
31
32class IJK_Interfaces;
33
35{
36 Declare_base(Intersection_Interface_ijk);
37public:
38 virtual int initialize(const Domaine_IJK& splitting,
39 const IJK_Interfaces& interfaces) = 0;
40
41 // Cette méthode permet de récupérer à partir des positions projetées sur
42 // l'interface des positions à une certaine distance, dans la direction
43 // normale. Ensuite on interpolera le field à ces positions de manière
44 // monophasique car on sera loin de l'interface (et on ne prend pas en compte
45 // le cas ou les bulles sont proches).
47 const Vecteur3& position_on_interf, const Vecteur3& normal_on_interf,
48 const double dist);
50 const DoubleTab& position_on_interf, const DoubleTab& normal_on_interf,
51 const double dist, DoubleTab& positions);
52
53 int n() const { return n_diph_; };
54
55 const DoubleTab& pos_interf() const { return positions_on_interf_; };
56 const DoubleTab& norm_interf() const { return normal_on_interf_; };
57 const DoubleTab& dist_interf() const { return dist_to_interf_; };
58
59 virtual void set_pas_a_jour() { projected_on_interface_flag_ = false; };
60 virtual bool is_a_jour() const { return projected_on_interface_flag_; };
61
62 // On projete le point bary_vap qui est localisé sur une face sur le plan
63 // passant par bary, selon la normale qui est donnee. Ce point est appelé ici
64 // bary_vap, mais ça peut très bien être bary_liqu ou n'importe quoi.
65 static void projete_interface(const Vecteur3& normale,
66 const Vecteur3& point_plan, const Vecteur3& coo,
67 Vecteur3& posit_proj);
68 static void distance_point_point(
69 const Vecteur3& point_1,
70 const Vecteur3& point_2,
71 double& distance);
73 const Vecteur3& point_1,
74 const Vecteur3& point_2,
75 const Vecteur3& normal_interf,
76 double& distance);
77
78protected:
79 // Intersection_Interface_ijk_face n'est pas propriétaire de ces objets, pas
80 // de gestion de la mémoire.
81 const IJK_Interfaces *interfaces_ = nullptr;
82 /*
83 * TODO: create pointers that point to object
84 * shared with IJK_Interfaces ?
85 */
86 const Domaine_IJK *splitting_ = nullptr;
87
88 // Le nombre de cellules diphasiques.
89 int n_diph_ = 1;
90 // La projection de chaque bary de face mouille sur l'interface
92 // La distance a l'interface
93 DoubleTab dist_to_interf_;
94 // La normale utilisée pour faire la projection
96 // Flag qui est remis a 0 a chaque maj des projections des barys des
97 // faces mouillées sur l'interface
99
100 // Ici on recupere l'interface moyenne sur une cellule telle quelle etait au debut du
101 // pas de temps.
102 void get_mean_interface_cell(const int elem, Vecteur3& normale, Vecteur3& bary) const;
103};
104
106{
107 Declare_instanciable_sans_constructeur(Intersection_Interface_ijk_face);
108public:
110 int initialize(const Domaine_IJK& splitting,
111 const IJK_Interfaces& interfaces) override;
112
113 // const int& operator()(int i_diph) const { return ijkf_interfaces_(i_diph); }
114 const int& operator()(int i, int j, int k, int dir) const
115 {
116 return idiph_ijk_[dir](i, j, k);
117 }
118
120
121protected:
122 // Le tableau qui donne pour chaque face coupée par l'interface :
123 // - les coordonnees ijk dans le field
124 // - la face correspondant dans cette maille (FACE I/J/K)
126 // Le tableau qui donne pour un triplet ijk le numéro de la cellule diphasique
127 // correspondante (-1. si la cellule n'est pas diphasique).
128 IJK_Field_vector3_int idiph_ijk_;
129
130 // Calcul les positions des points sur l'interface.
131 // Les centres de grav des faces mouillées sont projecté
132 // sur l'interface.
133 // L'interface est construite par moyenne sur les deux cellules qui
134 // correspondent à la face.
136 DoubleTab& positions, IntTab& indices, DoubleTab& normales_de_la_proj, DoubleTab& distance_barys_interface);
137
138 // La on moyenne les deux interfaces des cellules mitoyennes de la face.
139 // Cette face doit être traversée par l'interface.
140 void compute_mean_interface_face(const int i, const int j, const int k,
141 const int dir, Vecteur3& normale, Vecteur3& bary) const;
142
143};
144
146{
147 Declare_instanciable_sans_constructeur(Intersection_Interface_ijk_cell);
148public:
150 int initialize(const Domaine_IJK& splitting,
151 const IJK_Interfaces& interfaces) override;
152
153 // int& operator()(const int i,const int j,const int k);
154 // int& operator()(const int i_diph);
155 // const int& operator()(int i_diph) const { return ijk_interfaces_(i_diph); }
156 const int& operator()(int i_diph, int dir) const { return ijk_interfaces_(i_diph, dir); }
157 const int& operator()(int i, int j, int k) const { return idiph_ijk_(i, j, k); }
158 const DoubleTab& pos_pure_faces_interf() const { return positions_pure_faces_on_interf_; };
159 const DoubleTab& dist_pure_faces_interf() const { return dist_pure_faces_to_interf_; };
160 const int& get_ijk_pure_face_neighbours(int i_diph, int neighbour) const { return ijk_pure_face_neighbours_(i_diph, neighbour); };
162
164 {
165 return ijk_interfaces_.dimension(0);
166 }
168 {
169 return ijk_pure_face_to_correct_[0].size();
170 }
173
176
177 void update_interpolations_cell_centres_on_interface(const IJK_Field_double& interfaces);
178 void update_interpolations_cell_faces_on_interface(const IJK_Field_double& interfaces);
179
182
183
184protected:
185 // Le tableau qui donne pour chaque face coupée par l'interface :
186 // - les coordonnees ijk dans le field
188 /*
189 * Store the pure neighbouring cells
190 * -1 if the neighbouring cells in not pure
191 */
194 // Le tableau qui donne pour un triplet ijk le numéro de la cellule diphasique
195 // correspondante (-1. si la cellule n'est pas diphasique).
196 IJK_Field_int idiph_ijk_;
197
199
202
203 // Calcul les positions des points sur l'interface.
204 // Les centres de cellules diphasiques sont projecté
205 // sur l'interface.
206 // L'interface est construite par moyenne sur la cellule
207 void calcul_projection_centre_sur_interface_moy(const IJK_Field_double& indicatrice,
208 DoubleTab& positions, IntTab& indices,
209 DoubleTab& normales_de_la_proj,
210 DoubleTab& distance_centre_interface);
211
212 void calcul_projection_centre_faces_sur_interface_moy(const IJK_Field_double& indicatrice,
213 const IntTab& indices,
214 const DoubleTab& normale_interf,
215 DoubleTab& positions,
216 IntTab& indices_voisins,
217 FixedVector<DoubleVect, 3>& indices_faces_corrections,
218 DoubleTab& distance_centre_faces_interface) const;
219
221};
222
223#endif
This class encapsulates all the information related to the eulerian mesh for TrioIJK.
Definition Domaine_IJK.h:47
: class IJK_Interfaces
const DoubleTab & pos_pure_faces_interf() const
const DoubleTab & dist_pure_faces_interf() const
FixedVector< DoubleVect, 3 > ijk_pure_face_to_correct_
void calcul_projection_centre_faces_sur_interface_moy(const IJK_Field_double &indicatrice, const IntTab &indices, const DoubleTab &normale_interf, DoubleTab &positions, IntTab &indices_voisins, FixedVector< DoubleVect, 3 > &indices_faces_corrections, DoubleTab &distance_centre_faces_interface) const
void calcul_projection_centre_sur_interface_moy(const IJK_Field_double &indicatrice, DoubleTab &positions, IntTab &indices, DoubleTab &normales_de_la_proj, DoubleTab &distance_centre_interface)
FixedVector< DoubleVect, 3 > & get_set_ijk_pure_face_to_correct()
const int & operator()(int i_diph, int dir) const
const int & get_ijk_pure_face_neighbours(int i_diph, int neighbour) const
const int & operator()(int i, int j, int k) const
int initialize(const Domaine_IJK &splitting, const IJK_Interfaces &interfaces) override
const int & operator()(int i, int j, int k, int dir) const
void compute_mean_interface_face(const int i, const int j, const int k, const int dir, Vecteur3 &normale, Vecteur3 &bary) const
void calcul_projection_bary_face_mouillee_interface_moy(DoubleTab &positions, IntTab &indices, DoubleTab &normales_de_la_proj, DoubleTab &distance_barys_interface)
int initialize(const Domaine_IJK &splitting, const IJK_Interfaces &interfaces) override
void get_mean_interface_cell(const int elem, Vecteur3 &normale, Vecteur3 &bary) const
static void distance_point_point_signe(const Vecteur3 &point_1, const Vecteur3 &point_2, const Vecteur3 &normal_interf, double &distance)
const DoubleTab & norm_interf() const
const DoubleTab & dist_interf() const
static Vecteur3 get_position_interpolation_normal_interf(const Vecteur3 &position_on_interf, const Vecteur3 &normal_on_interf, const double dist)
virtual int initialize(const Domaine_IJK &splitting, const IJK_Interfaces &interfaces)=0
const DoubleTab & pos_interf() const
static void projete_interface(const Vecteur3 &normale, const Vecteur3 &point_plan, const Vecteur3 &coo, Vecteur3 &posit_proj)
static void distance_point_point(const Vecteur3 &point_1, const Vecteur3 &point_2, double &distance)
Objet_U()
Constructeur par defaut : attribue un numero d'identifiant unique a l'objet (object_id_),...
Definition Objet_U.cpp:55