CELIA3D  1.0
Fluid-structure interaction using cut-cells
fluide.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 <cstdlib>
28 #include <iostream>
29 #include <vector>
30 #include <fstream>
31 #include <stdio.h>
32 #include <sstream>
33 #include <cassert>
34 #include "parametres.hpp"
35 #include "solide.hpp"
36 
37 
38 #ifndef FLUIDE_HPP
39 #define FLUIDE_HPP
40 
41 using namespace std;
42 
43 
45 class Cellule {
46 
47 public :
48 
49  // Constructeur
50  Cellule();
51  Cellule(double x, double y, double z);
52  Cellule(double x, double y, double z, double dx, double dy, double dz);
53 
54  Cellule & operator=(const Cellule &cell);
55 
56  // Destructor
57  ~Cellule();
58 
59  bool is_in_cell(double x,double y, double z);
60 
61  void Affiche ();
62 
64  double x;
65  double y;
66  double z;
67 
69  int i;
70  int j;
71  int k;
72 
74  double dx;
75  double dy;
76  double dz;
77 
78  double rho;
79  double rho1;
80 
81  double u;
82  double v;
83  double w;
84 
85  double p;
86  double p1;
87 
88 
89  double impx;
90  double impy;
91  double impz;
92 
93  double impx0;
94  double impy0;
95  double impz0;
96 
97  double rhoE;
98  double rhoE0;
99  double rho0;
100 
101 
102 
103  double lambda[5];
104  double rp[5];
105  double rm[5];
106 
110  double pdtx;
111 
114  double pdty;
115 
118  double pdtz;
119 
124  double Mrho;
125 
128  double Mimpx;
129 
132  double Mimpy;
133 
136  double Mimpz;
137 
140  double MrhoE;
141 
144  double cells;
145 
148  double alpha;
149 
152  double alpha0;
153 
156  double kappai;
157 
160  double kappaj;
161 
164  double kappak;
165 
168  double kappai0;
169 
172  double kappaj0;
173 
176  double kappak0;
177 
180  int proche;
181 
184  int proche1;
185 
189  bool vide;
190 
194  double flux_modif[5];
195 
198  double delta_w[5];
199 
202  double phi_x;
203 
206  double phi_y;
207 
210  double phi_z;
211 
214  double phi_v;
215 
219  double cible_alpha;
220 
223  double cible_rho;
224 
227  double cible_impx;
228 
231  double cible_impy;
232 
235  double cible_impz;
236 
239  double cible_rhoE;
240 
241  double cible_i;
242  double cible_j;
243  double cible_k;
244 
245  double xi;
246  double yj;
247  double zk;
248 
249  double fluxi[5];
250  double fluxj[5];
251  double fluxk[5];
252 
253  double S;
254  double ve[5];
255 
256  double fex;
257  double fey;
258  double fez;
259 
260 
261  double Qci[5];
262  double Qcj[5];
263  double Qck[5];
264 
265  double dtfxi[5];
266  double dtfyj[5];
267  double dtfzk[5];
268 
269  double delw[5];
270  double delwnu[5];
271 
272  double cf2[5];
273  double cf3[5];
274  double cf4[5];
275  double cf5[5];
276  double cf6[5];
277  double cf7[5];
278  double cf8[5];
279  double cf9[5];
280  double cf10[5];
281  double cf11[5];
282 
283 
284  double psic0[5];
285  double psic1[5];
286  double psic2[5];
287  double psic3[5];
288  double psic4[5];
289 
290  double psid0[5];
291  double psid1[5];
292  double psid2[5];
293  double psid3[5];
294  double psid4[5];
295 
296  double vpr[5][5];
297 
298 
299  double psic0r[5];
300  double psic1r[5];
301  double psic2r[5];
302  double psic3r[5];
303  double psic4r[5];
304 
305  double psid0r[5];
306  double psid1r[5];
307  double psid2r[5];
308  double psid3r[5];
309  double psid4r[5];
310 
311  double psid[5];
312  double am[5];
313  double am1[5];
314 
315  int ordre;
316  double co[11];
317 
318  friend class Grille;
319 
320 };
321 
323 class Grille
324 {
325 
326  public:
327 
328  Grille();
329  Grille(int Nx0,int Ny0, int Nz0, double dx0, double x0, double dy0, double y0, double dz0, double z0);
330 
331  ~Grille();
332 
333  void affiche();
334 
335  void affiche(string r);
336 
337  Cellule cellule(int i, int j, int k);
338  Cellule in_cell(const Point_3& p);
339  void in_cell(const Point_3& p, int &i, int& j, int& k, bool& interieur);
340  void Init();
341 
342  double pas_temps(double t, double T);
343 
344  void BC();
345 
346  double Masse();
347  double Impulsionx();
348  double Impulsiony();
349  double Impulsionz();
350  double Energie();
351 
352  void Impression(int n);
353 
354  void solve_fluidx(const double dt);
355  void solve_fluidy(const double dt);
356  void solve_fluidz(const double dt);
357  void melange(const double dt);
358  void fnumx( const double sigma, double t);
359  void fnumy(const double sigma, double t);
360  void fnumz( const double sigma, double t);
361 
362 
363  void corentx(double sigma);
364  void corenty(double sigma);
365  void corentz(double sigma);
366  void Solve(const double dt, double t, int n, Solide& S);
367 
368  void Forces_fluide(Solide& S, const double dt);
369  void Modif_fnum(const double dt);
370  void Mixage();
371  void Fill_cel(Solide& S);
372  void swap_face(const Triangles& T3d_prev, const Triangles& T3d_n, const double dt, Particule & P, double & volume_test);
373  void swap_face_inexact(const Triangle_3& Tr_prev, const Triangle_3& Tr, const Triangles& T3d_prev, const Triangles& T3d_n, const double dt, Particule & P, double & volume_test);
374  void cells_intersection_face(int& in,int& jn,int& kn,int& in1,int& jn1,int& kn1, std::vector<Bbox>& box_cells, std::vector<Cellule>& Cells);
375  void Swap_2d(const double dt, Solide& S);
376  void Swap_3d(const double dt, Solide& S);
377  Cellule voisin_fluide(const Cellule &c, bool &target);
378  Cellule voisin_mixt(const Cellule &c, bool &target);
379  Cellule voisin(const Cellule &c);
380  Cellule cible(const Cellule &c, std::vector< std::vector<int> > & tab_cible );
381  void Mixage_cible();
382  bool Mixage_cible2();
383  void Parois_particles(Solide& S,double dt);
384  std::vector<Point_3> intersection(Triangle_3 t1, Triangle_3 t2);
385 //private :
386 
387  double x;
388  double y;
389  double z;
390  double dx;
391  double dy;
392  double dz;
393  vector< vector< vector<Cellule > > > grille;
394 
395 
396 };
397 
398 #endif
double yj
Definition: fluide.hpp:246
double phi_y
Flux at the interface in the y direction.
Definition: fluide.hpp:206
int proche1
Flag which is equal to 0 far from the interface and 1 near the interface at time t-dt.
Definition: fluide.hpp:184
double z
Definition: fluide.hpp:389
Definition of class Cellule.
Definition: fluide.hpp:45
double dz
Definition: fluide.hpp:392
double phi_v
Flux at the interface.
Definition: fluide.hpp:214
double cible_rhoE
Mixing term for energy in small cut-cells.
Definition: fluide.hpp:239
double kappai0
Solid occupancy ratio on the face in the x direction at time t-dt.
Definition: fluide.hpp:168
double rho1
Density in the cell at time t-dt.
Definition: fluide.hpp:79
double alpha
Solid occupancy ratio in the cell at time t.
Definition: fluide.hpp:148
int proche
Flag which is equal to 0 far from the interface and 1 near the interface.
Definition: fluide.hpp:180
double fez
Entropy flux in the z direction.
Definition: fluide.hpp:258
int ordre
Order of the approximate flux in the cell.
Definition: fluide.hpp:315
bool vide
Flag which indicates whether a cell is filled with void (true) or fluid (false)
Definition: fluide.hpp:189
double y
Definition: fluide.hpp:388
double cible_j
Definition: fluide.hpp:242
double xi
Position of the effective face center.
Definition: fluide.hpp:245
double cible_i
Index of the target mixing cell.
Definition: fluide.hpp:241
double cible_impz
Mixing term for z-momentum in small cut-cells.
Definition: fluide.hpp:235
double rhoE0
Energy density in the cell before flux computation.
Definition: fluide.hpp:98
int k
Definition: fluide.hpp:71
double phi_x
Flux at the interface in the x direction.
Definition: fluide.hpp:202
double impz
Momentum in the z direction at time t.
Definition: fluide.hpp:91
double x
(x,y,z) Position of the center of the cell.
Definition: fluide.hpp:64
double kappai
Solid occupancy ratio on the face in the x-direction.
Definition: fluide.hpp:156
double cible_impy
Mixing term for y-momentum in small cut-cells.
Definition: fluide.hpp:231
double cible_alpha
Mixing term for solid occupancy in the small cut-cells.
Definition: fluide.hpp:219
double dx
Spatial discretization step.
Definition: fluide.hpp:390
double z
Definition: fluide.hpp:66
double Mrho
Density mixing term for small cut-cells.
Definition: fluide.hpp:124
double impx0
Momentum in the x direction before flux computation.
Definition: fluide.hpp:93
double phi_z
Flux at the interface in the z direction.
Definition: fluide.hpp:210
double Mimpz
Momentum mixing term for small cut-cells.
Definition: fluide.hpp:136
double dx
(dx, dy,dz) Size of the cell.
Definition: fluide.hpp:74
std::vector< Triangle_3 > Triangles
Definition: intersections.hpp:63
CGAL::Triangle_3< Kernel > Triangle_3
Definition: intersections.hpp:60
double cells
Volume of mixing cells if the cell is a target of the mixing procedure.
Definition: fluide.hpp:144
double u
Velocity in the cell in the x direction.
Definition: fluide.hpp:81
double dy
Definition: fluide.hpp:75
double v
Velocity in the cell in the y direction.
Definition: fluide.hpp:82
double impx
Momentum in the x direction at time t.
Definition: fluide.hpp:89
double rho0
Density in the cell before flux computation.
Definition: fluide.hpp:99
double p
Pressure in the cell at time t.
Definition: fluide.hpp:85
double dy
Definition: fluide.hpp:391
double impz0
Momentum in the z direction before flux computation.
Definition: fluide.hpp:95
Kernel::Point_3 Point_3
Definition: intersections.hpp:55
double MrhoE
Energy mixing term for small cut-cells.
Definition: fluide.hpp:140
double cible_impx
Mixing term for x-momentum in small cut-cells.
Definition: fluide.hpp:227
double rhoE
Energy density in the cell at time t.
Definition: fluide.hpp:97
double pdty
Effective pressure in the y direction during the time-step.
Definition: fluide.hpp:114
double Mimpy
y-momentum mixing term for small cut-cells.
Definition: fluide.hpp:132
double x
Position of the origin of the fluid grid.
Definition: fluide.hpp:387
double zk
Definition: fluide.hpp:247
double dz
Definition: fluide.hpp:76
double cible_k
Definition: fluide.hpp:243
Parameters of the problem. The parameters specific to coupling are preceded by a "warning" sign...
double kappaj0
Solid occupancy ratio on the face in the y direction at time t-dt.
Definition: fluide.hpp:172
double rho
Density in the cell at time t.
Definition: fluide.hpp:78
double w
Velocity in the cell in the z direction.
Definition: fluide.hpp:83
Particule class.
Definition: solide.hpp:75
Solide class.
Definition: solide.hpp:195
double y
Definition: fluide.hpp:65
double impy0
Momentum in the y direction before flux computation.
Definition: fluide.hpp:94
double pdtx
Effective pressure in the x direction during the time-step.
Definition: fluide.hpp:110
double cible_rho
Mixing term for density in the small cut-cells.
Definition: fluide.hpp:223
vector< vector< vector< Cellule > > > grille
Fluid mesh.
Definition: fluide.hpp:393
double kappak0
Solid occupancy ratio on the face in the z direction at time t-dt.
Definition: fluide.hpp:176
double Mimpx
x-momentum mixing term for small cut-cells.
Definition: fluide.hpp:128
double S
Physical entropy.
Definition: fluide.hpp:253
double alpha0
Solid occupancy ratio in the cell at time t-dt.
Definition: fluide.hpp:152
double P(double x, double y, double z, double dx, double dy, double dz)
Definition: parametres.cpp:310
double pdtz
Effective pressure in the z direction during the time-step.
Definition: fluide.hpp:118
int i
(i,j,k) Index of the cell
Definition: fluide.hpp:69
double kappak
Solid occupancy ratio on the face in the z direction.
Definition: fluide.hpp:164
const double T
Total simulation time.
Definition: parametres.hpp:88
double fey
Entropy flux in the y direction.
Definition: fluide.hpp:257
Definition of solid classes. Specific coupling members are preceded by a "warning" sign...
double p1
Pressure in the cell at time t-dt.
Definition: fluide.hpp:86
double kappaj
Solid occupancy ratio on the face in the y direction.
Definition: fluide.hpp:160
double impy
Momentum in the y direction at time t.
Definition: fluide.hpp:90
Definition of class Grille.
Definition: fluide.hpp:323
double fex
Entropy flux in the x direction.
Definition: fluide.hpp:256
int j
Definition: fluide.hpp:70