CELIA3D  1.0
Fluid-structure interaction using cut-cells
solide.hpp
Go to the documentation of this file.
1 //Copyright 2017 Laurent Monasse
2 
3 /*
4  This file is part of CELIA3D.
5 
6  CELIA3D is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  CELIA3D is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with CELIA3D. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
27 #include "intersections.hpp"
28 #ifndef SOLIDE_HPP
29 #define SOLIDE_HPP
30 
32 class Vertex
33 {
34 public:
35  Vertex();
36  Vertex(const Point_3 p, std::vector<int> & parts);
37  Vertex & operator=(const Vertex &V);
39  int num;
40 
41  int size(){
42  return particules.size();
43  }
44  std::vector<int> particules;
45 };
46 
48 class Face
49 {
50 public:
51  Face();
52  Face(std::vector<Vertex> & v, int part);
53  Face(std::vector<Vertex> & v, int part, double dist);
54  Face & operator=(const Face &F);
55  int size(){
56  return vertex.size();
57  }
58  void compFaceIntegrals(double &Fa, double &Fb, double &Fc, double &Faa, double &Fbb, double &Fcc, double &Faaa, double &Fbbb, double &Fccc, double &Faab, double &Fbbc, double &Fcca, double na,double nb, double nc, int a, int b, int c);
59  void compProjectionIntegrals(double &P1, double &Pa, double &Pb, double &Paa, double &Pab, double &Pbb, double &Paaa, double &Paab, double &Pabb, double &Pbbb, int a, int b, int c);
60  void Inertie();
63  double S; //Face area
64  double Is;
65  double It;
68  std::vector<Vertex> vertex;
69  int voisin;
70  double D0;
71 };
72 
73 
75 class Particule
76 {
77 
78 public:
79 
80  Particule();
81 
82  Particule(const double x_min, const double y_min, const double z_min,
83  const double x_max, const double y_max,const double z_max);
84 
85  Particule(Point_3 c, const double x_min, const double y_min, const double z_min,
86  const double x_max, const double y_max,const double z_max,
87  std::vector<Face> & F);
88  ~Particule();
89  Particule & operator=(const Particule &P);
90  void Affiche();
91  double volume();
92  void CompVolumeIntegrals(double &T1, double &Tx, double &Ty, double &Tz, double &Txx, double &Tyy, double &Tzz, double &Txy, double &Tyz, double &Tzx);
93  void Inertie();
94  void Volume_libre();
95  void solve_position(double dt);
96  void solve_vitesse(double dt);
97  Vector_3 vitesse_parois(const Point_3& X_f);
98  Vector_3 vitesse_parois_prev(const Point_3& X_f);
99  bool cube;
101 
102  std::vector<Face> faces;
103 
104  std::vector<Point_3> vertices;
105 
107 
109 
110  std::vector<Vector_3> normales;
111 
112  std::vector<Vector_3> normales_prev;
113 
117  std::vector<bool> vide;
118 
121  std::vector<bool> fluide;
122 
126  std::vector<bool> fluide_prev;
127 
130  std::vector< std::vector<Point_3> > Points_interface;
131 
135  std::vector< std::vector<Point_3> > Points_interface_prev;
136 
139  std::vector< std::vector<Triangle_3> > Triangles_interface;
140 
144  std::vector< std::vector< std::vector<int> > > Position_Triangles_interface;
145 
149  std::vector< std::vector<Triangle_3> > Triangles_interface_prev;
150 
154  std::vector< std::vector<std::vector<int> > > Position_Triangles_interface_prev;
155 
156  int fixe;
157  double m;
158  double V;
159  double Vl;
160  double epsilon;
161  double I[3];
162  double rotref[3][3];
167 
171 
176 
180 
192 };
193 
195 class Solide
196 {
197 
198 public:
199 
200  Solide();
201  Solide(std::vector<Particule> & Part);
202  ~Solide();
203  Solide & operator=(const Solide &S);
204  void Affiche();
205  int size(){
206  return solide.size();
207  }
208  void Impression(int n);
209  void Init(const char* s);
210  void Solve_position(double dt);
211  void Solve_vitesse(double dt);
212  void Forces_internes();
213  void update_triangles();
214  void breaking_criterion();
215  double Energie();
216  double Energie_potentielle();
217  double Energie_cinetique();
218  double pas_temps(double t, double T);
219  // private :
220  std::vector<Particule> solide;
221 };
222 
223 bool inside_box(const Bbox& cell, const Point_3& P);
224 bool box_inside_convex_polygon(const Particule& S, const Bbox& cell);
225 bool inside_convex_polygon(const Particule& S, const Point_3& P);
226 double Error(Solide& S1, Solide& S2);
227 void Copy_f_m(Solide& S1, Solide& S2);
228 bool box_inside_tetra(const Tetrahedron &tetra, const Bbox& cell);
229 bool inside_tetra(const Tetrahedron &tetra, const Point_3& P);
230 #endif
std::vector< Vertex > vertex
List of the face vertices.
Definition: solide.hpp:68
std::vector< std::vector< Point_3 > > Points_interface_prev
List of intersection points of Particule.triangles_prev with the fluid grid at time t-dt...
Definition: solide.hpp:135
bool inside_tetra(const Tetrahedron &tetra, const Point_3 &P)
Definition: intersections.hpp:236
Vector_3 Dxprev
Displacement of the particle center at time t-dt.
Definition: solide.hpp:165
Vector_3 u_half
Particle velocity at time t-dt/2.
Definition: solide.hpp:185
Point_3 pos
Vertex coordinates.
Definition: solide.hpp:38
bool box_inside_tetra(const Tetrahedron &tetra, const Bbox &cell)
Check whether cell is fully contained in tetra.
Definition: solide.cpp:2477
std::vector< std::vector< std::vector< int > > > Position_Triangles_interface_prev
Index of the cell where Triangles_interface is located at time t-dt.
Definition: solide.hpp:154
std::vector< bool > fluide
=true if Particule.triangles is in contact with fluid
Definition: solide.hpp:121
int size()
Definition: solide.hpp:55
Aff_transformation_3 mvt_t
Affine transformation associated with the rigid body movement of the particle at time t...
Definition: solide.hpp:190
std::vector< std::vector< Triangle_3 > > Triangles_interface_prev
Triangulation of Particule.triangles_prev at time t-dt.
Definition: solide.hpp:149
double Error(Solide &S1, Solide &S2)
Compute the error for the semi-implicit scheme.
Definition: solide.cpp:2339
Vertex & operator=(const Vertex &V)
operator = overload.
Definition: solide.cpp:58
int size()
Definition: solide.hpp:41
Vector_3 Ff
Fluid forces applied on the solid between times t and t+dt/2.
Definition: solide.hpp:170
double S
Definition: solide.hpp:63
double V
Particle volume.
Definition: solide.hpp:158
Point_3 x0
Position of the particle center at t=0.
Definition: solide.hpp:163
Point_3 centre
Face center.
Definition: solide.hpp:61
Vector_3 u
Particle velocity at time t.
Definition: solide.hpp:184
Vertex()
Default constructor.
Definition: solide.cpp:36
Vector_3 Mf
Fluid torques applied on the solid between times t and t+dt/2.
Definition: solide.hpp:179
Vector_3 Ffprev
Fluid forces applied on the solide between times t-dt/2 and t.
Definition: solide.hpp:174
Triangles triangles_prev
Triangulation of the particle faces at time t-dt.
Definition: solide.hpp:108
double It
Second inertia moment of the face.
Definition: solide.hpp:65
std::vector< Vector_3 > normales
Exterior normals to Particule.triangles.
Definition: solide.hpp:110
Vector_3 Mi
Interior torques of the solid.
Definition: solide.hpp:175
CGAL::Aff_transformation_3< Kernel > Aff_transformation_3
Definition: intersections.hpp:73
bool inside_box(const Bbox &cell, const Point_3 &P)
Check whether point P is in the Bbox cell.
Definition: solide.cpp:2379
std::vector< std::vector< std::vector< int > > > Position_Triangles_interface
Index of the cell where Triangles_interface is located at time t.
Definition: solide.hpp:144
std::vector< Triangle_3 > Triangles
Definition: intersections.hpp:63
int num
Index of the vertex in the construction mesh.
Definition: solide.hpp:39
std::vector< int > particules
List of particles sharing the vertex.
Definition: solide.hpp:44
Aff_transformation_3 mvt_tprev
Affine transformation associated with the rigid body movement of the particle at time t-dt...
Definition: solide.hpp:191
Vector_3 eprev
Rotation vector at time t-dt.
Definition: solide.hpp:189
void Copy_f_m(Solide &S1, Solide &S2)
Copy values of fluid forces Ff and torques Mf from S2 to S1.
Definition: solide.cpp:2364
std::vector< bool > fluide_prev
=true if Particule.triangles_prev is in contact with fluid
Definition: solide.hpp:126
int size()
Definition: solide.hpp:205
bool cube
= true if the particle is a cube, false otherwise
Definition: solide.hpp:99
Vector_3 omega_half
Angular velocity at time t-dt/2.
Definition: solide.hpp:187
Kernel::Point_3 Point_3
Definition: intersections.hpp:55
double Is
First inertia moment of the face.
Definition: solide.hpp:64
Vector_3 Dx
Displacement of the particle center at time t.
Definition: solide.hpp:164
double D0
Equilibrium distance with the neighbouring particle.
Definition: solide.hpp:70
double m
Particle mass.
Definition: solide.hpp:157
std::vector< bool > vide
=true if Particule.triangles is in contact with void
Definition: solide.hpp:117
Vector_3 s
Eigenvector associated with the first inertia moment of the face.
Definition: solide.hpp:66
int voisin
Index of the neighbouring particle. The index takes the value -1 if there is no solid neighbour (poss...
Definition: solide.hpp:69
std::vector< Vector_3 > normales_prev
Exterior normals to Particule.triangles_prev.
Definition: solide.hpp:112
double epsilon
Volumetric deformation of the particle.
Definition: solide.hpp:160
CGAL::Bbox_3 Bbox
Definition: intersections.hpp:68
bool box_inside_convex_polygon(const Particule &S, const Bbox &cell)
Check whether cell is fully contained in S.
Definition: solide.cpp:2420
double V(double x, double y, double z)
Definition: parametres.cpp:282
Inclusion of files and definition of types from the CGAL library.
Particule class.
Definition: solide.hpp:75
std::vector< std::vector< Triangle_3 > > Triangles_interface
Triangulation of Particule.triangles at time t.
Definition: solide.hpp:139
Solide class.
Definition: solide.hpp:195
Vector_3 e
Rotation vector at time t.
Definition: solide.hpp:188
double Vl
Free Volume of the particle (for the computation of epsilon)
Definition: solide.hpp:159
Kernel::Vector_3 Vector_3
Definition: intersections.hpp:57
bool inside_convex_polygon(const Particule &S, const Point_3 &P)
Check whether point P is inside the convex polygon S.
Definition: solide.cpp:2391
Bbox bbox
Bounding box of the particle.
Definition: solide.hpp:100
CGAL::Tetrahedron_3< Kernel > Tetrahedron
Definition: intersections.hpp:64
std::vector< std::vector< Point_3 > > Points_interface
Listof intersection points of Particule.triangles with the fluid grid at time t.
Definition: solide.hpp:130
Vector_3 t
Eigenvector associated with the second inertia moment of the face.
Definition: solide.hpp:67
double P(double x, double y, double z, double dx, double dy, double dz)
Definition: parametres.cpp:310
std::vector< Point_3 > vertices
List of the particle&#39;s vertices.
Definition: solide.hpp:104
Vector_3 Fi
Solid internal forces.
Definition: solide.hpp:166
int fixe
=1 if the particle is fixed, 0 otherwise
Definition: solide.hpp:156
Vector_3 omega
Angular velocity at time t.
Definition: solide.hpp:186
Triangles triangles
Triangulation of the particle faces at time t.
Definition: solide.hpp:106
const double T
Total simulation time.
Definition: parametres.hpp:88
std::vector< Particule > solide
Solid mesh.
Definition: solide.hpp:220
Face class.
Definition: solide.hpp:48
Vector_3 Mfprev
FLuid torques applied on the solid between times t-dt/2 and t.
Definition: solide.hpp:183
Vertex class.
Definition: solide.hpp:32
Vector_3 normale
Face exterior normal.
Definition: solide.hpp:62
std::vector< Face > faces
List of the particle&#39;s faces.
Definition: solide.hpp:102