NasCar
Loading...
Searching...
No Matches
struct.h
Go to the documentation of this file.
1
14#define RESET "\033[0m"
15#define BLACK "\033[30m" /* Black */
16#define RED "\033[31m" /* Red */
17#define GREEN "\033[32m" /* Green */
18#define YELLOW "\033[33m" /* Yellow */
19#define BLUE "\033[34m" /* Blue */
20#define MAGENTA "\033[35m" /* Magenta */
21#define CYAN "\033[36m" /* Cyan */
22#define WHITE "\033[37m" /* White */
23#define BOLDBLACK "\033[1m" /* Bold Black */
24#define BOLDRED "\033[1m\033[31m" /* Bold Red */
25#define BOLDGREEN "\033[1m\033[32m" /* Bold Green */
26#define BOLDYELLOW "\033[1m\033[33m" /* Bold Yellow */
27#define BOLDBLUE "\033[1m\033[34m" /* Bold Blue */
28#define BOLDMAGENTA "\033[1m\033[35m" /* Bold Magenta */
29#define BOLDCYAN "\033[1m\033[36m" /* Bold Cyan */
30#define BOLDWHITE "\033[1m\033[37m" /* Bold White */
31
32
33/*-------------------------------------*/
34/* Structures that store the variables */
35/*-------------------------------------*/
36
37
38
42typedef struct {
44 PetscMPIInt size;
46 PetscMPIInt rank;
48 int xs;
50 int ys;
52 int zs;
54 int xm;
56 int ym;
58 int zm;
60 int gxs;
62 int gys;
64 int gzs;
66 int gxm;
68 int gym;
70 int gzm;
71} Proc;
72
76typedef struct {
78 DM da;
80 int nx;
82 int ny;
84 int nz;
86 double dx;
88 double dy;
90 double dz;
92 double xmin;
94 double xmax;
96 double ymin;
98 double ymax;
100 double zmin;
102 double zmax;
104 PetscBool xperiodic;
106 PetscBool yperiodic;
108 PetscBool zperiodic;
110 int ip;
112 int jp;
114 int kp;
116 double epsilon;
117} Grid;
118
122typedef struct {
124 int ni;
125 int kk,carac;
131 int fluid; /* 1 or 2 for viscous implit */
132 double mu1,rho1,mu2,rho2,dt,dtelast,lambda,cfl,time,timeac,timeac2,g,volume,st;
134 double Cc;
136 double Cv;
138 double Cg;
140 double Cs;
141 double E,rhoe,mue;
143 double hsurf;
145 PetscBool force_exa;
147 PetscBool force_ext1;
149 PetscBool force_ext2;
151 PetscBool bi_fluid;
153 PetscBool redist;
155 int test;
156} Simu;
157
161typedef struct {
163 int nb;
165 int nbe;
167 int ib;
169 int *no;
171 int *ns;
173 int *ne;
174 int nexp,nexp2,nexp3;
176 int *choice;
179 int test,*nst;
180 char OBJ_FILE[30][PETSC_MAX_PATH_LEN];
181
182 double *xtail,*ytail,*ztail,*xhead,*yhead,*zhead,xfood,yfood,zfood,thetafood;
183 double *St,*St_swim; /* the surface of the body (in 2D) */
184
188 struct {
189 double **u,**v;
191 double ***Ub;
193 double ***Vb;
195 double ***Wb;
197 double Uin;
199 double Vin;
201 double Win;
203 double Vref;
205 double *ubar;
207 double *vbar;
209 double *wbar;
211 double *xbar;
213 double *ybar;
215 double *zbar;
216 double *cp;
217 double **Omega;
218 double **Omegat;
220 double **Theta;
222 double **Theta_def;
224 double **Thetai;
225 double rpm,theta;
226 double a,f;
227 }mouv;
228
232 struct {
233 int *is, *js, *ks, *ie, *je, *ke;
234 int *is1,*js1,*ks1,*ie1,*je1,*ke1;
235 int *is2,*js2,*ks2,*ie2,*je2,*ke2;
236 int *ist,*jst,*kst,*iet,*jet,*ket;
238 double *Cx;
240 double *Cy;
242 double *Cz;
244 double *Cxt;
246 double *Cyt;
248 double *Czt;
250 double ***Cp,***Cpt;
251 double ***Cs,***Cst;
252 double ***C_useful,***Ct_useful,***C_useless,***Ct_useless,***C_other,***Ct_other,***C_total,***Ct_total,*Cn,Mn_exa,Mn_ext,*eta,*etas;
254 double *Mx;
256 double *My;
258 double *Mz;
260 double *Mxt;
262 double *Myt;
264 double *Mzt;
265 double *Power,*Powert,*Power_useful,*Powert_useful,*Power_useless,*Powert_useless,*Power_other,*Powert_other;
266 double *W_total,*W_useful,*W_useless,*W_other,**P_total,**P_useful,**P_useless,**P_other;
267 double P,Pm,Pt,Pc,Pct,Pv,Pvt,Pb,Pbt,Pext,Pextt,Ec,Ect,Ecm1,Ecm1t;
269 double **Fx;
271 double **Fy;
273 double **Fz;
275 double **Fxt;
277 double **Fyt;
279 double **Fzt;
280 double ***Fxx,***Fxxt,***Fyy,***Fyyt,***Fzz,***Fzzt;
281 double ***dist,***distt,***distm1;
282 int ***distk,***distkt;
283 }coef;
284
288 struct {
289 int nbarres[100];
291 int *nb_normal;
293 int *nb_triangle;
295 int *nb_quad;
297 int *nb_vertex;
299 int *nb_texture;
300 int ***ind_vertex_q,***ind_vertex_t,***ind_texture_q,***ind_texture_t,***ind_normal_q,***ind_normal_t;
301 double **vx,**vy,**vz,**nx,**ny,**nz,**tx,**ty,**tz;
303 double *xi;
305 double *yi;
307 double *zi;
309 double ***x;
311 double ***y;
313 double ***z;
315 double ***xm1;
317 double ***ym1;
319 double ***zm1;
320 double ***xs,***ys,***zs;
321 double ***x0,***y0,***z0,***x0m1,***y0m1,***z0m1;
322 double ***x1,***y1,***z1;
324 double **xb;
326 double **yb;
328 double **zb;
329 double **xb_m1,**yb_m1,**zb_m1,**ub,**vb,**wb;
330 double **xbs,**ybs,**zbs;
331
333 double ***Jinv;
334
336 double ***Jxyz;
337
339 double ***Jxyzm1;
341 double ***n;
343 double *length;
345 double *V;
347 double *Vt;
349 double *Vs;
351 double *S;
353 double *St;
355 double *rho;
356 double *Amax;
357 double *Amin;
359 double *xg;
361 double *yg;
363 double *zg;
364 double *xgd,*ygd,*zgd,*xgs,*ygs,*zgs,*xg1,*yg1,*zg1,*xg2,*yg2,*zg2;
365 double *xmin,*xmax,*ymin,*ymax,*zmin,*zmax;
366
368 double **theta;
370 double **theta_m1;
372 double **theta_m2;
373 double re,ri,rc,yt,ym,yc,yl,r1,r2,m1,m2,rh,h;
374
375 }geom;
376
380 struct {
381 int n[100]; // nombre de barres
382 double **x,**y,**xm1,**ym1,**xm2,**ym2; //
383 double **a,**b,**e;
384 double **xc,**yc,**l;
385 double **Wx,**Wy,**Wxt,**Wyt;
386 double **m,**S,**In;
387 double **phi,**phim1,**phim2,**dphi,**d2phi,**curv,**Aibphi;
388 double **ce,**se,**cem1,**cem2,**sem1,**sem2,**d2ce,**d2se;
389 double *E,*mu;
390 double ***A,***A2,***Ap,***Hc,***Hs,***Gc,***Gs,***Jn,***Aphi;
391 double ***GcAp,***GcApHc,***GsAp,***GsApHs,***GsApHc,***GcApHs;
392 double **Mm,**Mmt,**bphi;
393 double distance,dist;
394 double *Cx,*Cy;
395 }elast;
396
397 //double *regul2;
398
399} Obs;
400
404typedef struct {
406 Vec U;
408 Vec lU;
410 Vec Uf;
412 Vec lUf;
414 Vec V;
416 Vec lV;
418 Vec Vf;
420 Vec lVf;
422 Vec W;
424 Vec lW;
426 Vec Wf;
428 Vec lWf;
430 Vec lP;
432 Vec ldPdy;
434 Vec lLS;
438 Vec PHI;
440 Vec lPHI;
442 Vec lOx;
444 Vec lOy;
446 Vec lOz;
448 Vec lOn;
450 Vec lQ;
452 Vec lPSI;
454 Vec lD;
456 Vec lH;
458 Vec DIV;
460 Vec DU;
462 Vec lDU;
464 Vec Yx;
466 Vec lYx;
468 Vec Yy;
470 Vec lYy;
472 Vec Yz;
474 Vec lYz;
476 Vec lnx;
478 Vec lny;
480 Vec lnz;
481 Vec a,la;
482 Vec an,lan;
483 Vec as,las;
484} Vectors;
485
489typedef struct {
496 Vectors m;
499 Vectors t;
500 Vectors i[10],k[10],l[10],im1[10],it[10],el[10],elm1[10],elt[10],mat[6][3][3];
501} Fields;
502
506typedef struct {
507 int ***LSind;
509 double ***U;
511 double ***V;
513 double ***W;
515 double ***P;
517 double ***dPdy;
519 double ***Uf;
521 double ***Vf;
523 double ***Wf;
525 double ***PHI;
527 double ***LS;
529 double ***Ox;
531 double ***Oy;
533 double ***Oz;
535 double ***On;
537 double ***Q;
539 double ***PSI;
541 double ***D;
543 double ***H;
545 double ***Yx;
547 double ***Yy;
549 double ***Yz;
551 double ***nx;
553 double ***ny;
555 double ***nz;
556 double ***a,***as,***an;
558 double ***DU;
560 double ***DIV;
561} Pointers;
562
566typedef struct {
573 Pointers m;
576 Pointers t,k[10],l[10],i[10],im1[10],it[10],cl,el[10],elm1[10],elt[10],mat[6][3][3];
577} Arrays;
578
579
580
584typedef struct {
585 // Matrices
587 Mat Ap;
589 Mat Au;
590 // Right Hand Sides
594 struct {
596 Vec Bp;
598 Vec Bu;
600 Vec Bv;
602 Vec Bw;
603 }vec;
607 struct {
609 double ***Bp;
611 double ***Bu;
613 double ***Bv;
615 double ***Bw;
616 }arr;
617 // KSP Solvers
619 KSP kspp;
621 KSP kspu;
623 int itp;
625 int itu;
627 int itv;
629 int itw;
631 MatNullSpace nullsp;
632} Linear;
633
634
635
636
637/*-------------------------------------*/
Vec lW
Definition: struct.h:424
Pointers e
Definition: struct.h:575
Vec lOy
Definition: struct.h:444
int gxs
Definition: struct.h:60
double Cc
Definition: struct.h:134
Vec lH
Definition: struct.h:456
Vec lYx
Definition: struct.h:466
int gzs
Definition: struct.h:64
PetscBool force_ext2
Definition: struct.h:149
PetscBool zperiodic
Definition: struct.h:108
Vec lLSind
Definition: struct.h:436
int ym
Definition: struct.h:56
double dx
Definition: struct.h:86
double dz
Definition: struct.h:90
double ymax
Definition: struct.h:98
int * file_format
Definition: struct.h:178
double *** D
Definition: struct.h:541
PetscBool force_ext1
Definition: struct.h:147
int cscheme
Definition: struct.h:129
KSP kspu
Definition: struct.h:621
int xm
Definition: struct.h:54
Vec lV
Definition: struct.h:416
Vec lQ
Definition: struct.h:450
double hsurf
Definition: struct.h:143
double *** DU
Definition: struct.h:558
int ny
Definition: struct.h:82
int gys
Definition: struct.h:62
Vec PHI
Definition: struct.h:438
double *** U
Definition: struct.h:509
double *** On
Definition: struct.h:535
double *** Yy
Definition: struct.h:547
int ip
Definition: struct.h:110
double *** nz
Definition: struct.h:555
Vec ldPdy
Definition: struct.h:432
PetscBool yperiodic
Definition: struct.h:106
Vec Yx
Definition: struct.h:464
Vec lOz
Definition: struct.h:446
double *** Uf
Definition: struct.h:519
int itv
Definition: struct.h:627
PetscBool bi_fluid
Definition: struct.h:151
int zs
Definition: struct.h:52
int ys
Definition: struct.h:50
Vec Uf
Definition: struct.h:410
double *** Oy
Definition: struct.h:531
Vec lPHI
Definition: struct.h:440
double *** H
Definition: struct.h:543
int nb
Definition: struct.h:163
double *** Wf
Definition: struct.h:523
double *** P
Definition: struct.h:515
int itp
Definition: struct.h:623
double *** W
Definition: struct.h:513
Vec U
Definition: struct.h:406
double *** V
Definition: struct.h:511
int ischeme
Definition: struct.h:127
Vec Wf
Definition: struct.h:426
Vec lnx
Definition: struct.h:476
Vec W
Definition: struct.h:422
int * ns
Definition: struct.h:171
int nz
Definition: struct.h:84
Pointers n
Definition: struct.h:568
double Cg
Definition: struct.h:138
double *** ny
Definition: struct.h:553
DM da
Definition: struct.h:78
PetscBool redist
Definition: struct.h:153
double Cs
Definition: struct.h:140
Mat Au
Definition: struct.h:589
Vectors n
Definition: struct.h:491
int gym
Definition: struct.h:68
PetscMPIInt size
Definition: struct.h:44
Vec lny
Definition: struct.h:478
int nx
Definition: struct.h:80
Vec lOn
Definition: struct.h:448
double zmax
Definition: struct.h:102
double *** dPdy
Definition: struct.h:517
double ymin
Definition: struct.h:96
Vec Vf
Definition: struct.h:418
Vec Yy
Definition: struct.h:468
int xs
Definition: struct.h:48
Vec lWf
Definition: struct.h:428
Vec lnz
Definition: struct.h:480
Vec lYz
Definition: struct.h:474
Vec lUf
Definition: struct.h:412
Mat Ap
Definition: struct.h:587
Vec lPSI
Definition: struct.h:452
PetscBool force_exa
Definition: struct.h:145
Vec lLS
Definition: struct.h:434
MatNullSpace nullsp
Definition: struct.h:631
double *** Ox
Definition: struct.h:529
int ni
Definition: struct.h:124
int * ne
Definition: struct.h:173
double epsilon
Definition: struct.h:116
Vec Yz
Definition: struct.h:472
int fluid
Definition: struct.h:131
Vec lU
Definition: struct.h:408
PetscMPIInt rank
Definition: struct.h:46
double xmax
Definition: struct.h:94
double zmin
Definition: struct.h:100
int itw
Definition: struct.h:629
double *** Yx
Definition: struct.h:545
int gxm
Definition: struct.h:66
Vectors nm1
Definition: struct.h:495
double *** Oz
Definition: struct.h:533
KSP kspp
Definition: struct.h:619
double dy
Definition: struct.h:88
Vec lP
Definition: struct.h:430
Vec lDU
Definition: struct.h:462
int nbe
Definition: struct.h:165
double *** LS
Definition: struct.h:527
int ib
Definition: struct.h:167
Pointers nm1
Definition: struct.h:572
double *** PHI
Definition: struct.h:525
double Cv
Definition: struct.h:136
double *** PSI
Definition: struct.h:539
double *** Vf
Definition: struct.h:521
double *** Q
Definition: struct.h:537
Vec lD
Definition: struct.h:454
PetscBool xperiodic
Definition: struct.h:104
Vec DIV
Definition: struct.h:458
int gzm
Definition: struct.h:70
Vec lYy
Definition: struct.h:470
double *** nx
Definition: struct.h:551
int kp
Definition: struct.h:114
Vec lOx
Definition: struct.h:442
int * choice
Definition: struct.h:176
int test
Definition: struct.h:155
Vectors np1
Definition: struct.h:493
double xmin
Definition: struct.h:92
int zm
Definition: struct.h:58
Vec V
Definition: struct.h:414
double *** Yz
Definition: struct.h:549
Vec lVf
Definition: struct.h:420
double *** DIV
Definition: struct.h:560
Pointers np1
Definition: struct.h:570
int * no
Definition: struct.h:169
Vec DU
Definition: struct.h:460
Vectors e
Definition: struct.h:498
int itu
Definition: struct.h:625
int jp
Definition: struct.h:112
Arrays fields (at iteration, n, n+1, ...)
Definition: struct.h:566
Vector fields (at iteration, n, n+1, ...)
Definition: struct.h:489
Grid information.
Definition: struct.h:76
Vector and matrices for linear systems.
Definition: struct.h:584
Osbtacles parameters.
Definition: struct.h:161
The arrays associated to the petsc vectors.
Definition: struct.h:506
Processors information.
Definition: struct.h:42
Simulation parameters.
Definition: struct.h:122
Petsc Vectors.
Definition: struct.h:404