PLUTO
4.0
Main Page
Related Pages
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
Enumerations
Macros
Pages
Src
pluto.h
Go to the documentation of this file.
1
/* ///////////////////////////////////////////////////////////////////// */
12
/* ///////////////////////////////////////////////////////////////////// */
13
#ifndef PLUTO_H
14
#define PLUTO_H
15
16
#define PLUTO_VERSION "4.0"
17
18
#include <stdio.h>
19
#include <stdarg.h>
20
#include <string.h>
21
#include <math.h>
22
#include <stdlib.h>
23
#include <time.h>
24
26
#define MAX(a,b) ( (a) >= (b) ? (a) : (b) )
27
29
#define MIN(a,b) ( (a) <= (b) ? (a) : (b) )
30
32
#define ABS_MIN(a,b) (fabs(a) < fabs(b) ? (a):(b))
33
35
#define DSIGN(x) ( (x) >= 0.0 ? (1.0) : (-1.0))
36
37
#define MINMOD(a,b) ((a)*(b) > 0.0 ? (fabs(a) < fabs(b) ? (a):(b)):0.0)
38
#define VAN_LEER(a,b) ((a)*(b) > 0.0 ? 2.0*(a)*(b)/((a)+(b)):0.0)
39
#define MC(a,b) (MINMOD(0.5*((a)+(b)), 2.0*MINMOD((a),(b))))
40
#define SWAP_VAR(x) SwapEndian(&x, sizeof(x));
41
42
#define YES 1
43
#define NO 0
44
#define DEFAULT -1
45
46
/* ---- GEOMETRY LABELS ( > 0) ---- */
47
48
#define CARTESIAN 1
49
#define AXISYM 1
/* should be the same as CARTESIAN in order
50
to avoid complications */
51
#define CYLINDRICAL 2
52
#define POLAR 3
53
#define SPHERICAL 4
54
59
#define NEW_GEOM 1
60
61
#define UNIFORM_GRID 1
62
#define STRETCHED_GRID 2
63
#define LOGARITHMIC_INC_GRID 3
64
#define LOGARITHMIC_DEC_GRID 4
65
66
/* ---- SET LABELS FOR EQUATION OF STATE (EOS) ---- */
67
68
#define IDEAL 1
69
#define TAUB 3
70
#define BAROTROPIC 4
71
#define ISOTHERMAL 5
72
73
/* ---- TIME_STEPPING LABELS ---- */
74
75
#define EULER 1
76
#define HANCOCK 2
77
#define CHARACTERISTIC_TRACING 3
78
#define RK2 5
79
#define RK3 6
80
#define RK_MIDPOINT 7
81
82
#define EXPLICIT 1
/* -- just a number different from 0 !!! -- */
83
#define SUPER_TIME_STEPPING 2
/* -- just a number different from EXPLICIT -- */
84
#define RK_CHEBYSHEV 4
85
86
/* ---- Output labels: ---- */
87
88
#define DBL_OUTPUT 1
89
#define FLT_OUTPUT 2
90
#define VTK_OUTPUT 3
91
#define DBL_H5_OUTPUT 4
92
#define FLT_H5_OUTPUT 5
93
#define TAB_OUTPUT 6
94
#define PPM_OUTPUT 7
95
#define PNG_OUTPUT 8
96
97
#define VTK_VECTOR 5
/* -- any number but NOT 1 -- */
98
104
#define MAX_OUTPUT_TYPES 11
105
106
/* ---- SET LABELS FOR COOLING ---- */
107
108
#define POWER_LAW 3
109
#define MINEq 4
110
#define SNEq 5
111
#define TABULATED 6
112
#define H2_COOL 7
113
114
/* ---- SET LABELS FOR PHYSICS MODULE ---- */
115
116
#define HD 1
117
#define RHD 2
118
#define MHD 3
119
#define RMHD 5
120
121
/* ---- SET LABELS FOR DIV.B REMOVAL ----
122
If you move them to the MHD header,
123
definitions.h (which is included before)
124
cannot correctly use them */
125
126
#define NONE 0
127
#define EIGHT_WAVES 1
128
#define DIV_CLEANING 2
129
#define CONSTRAINED_TRANSPORT 3
130
131
/* ---- SET LABELS FOR BODY_FORCE ----
132
Please do not change them since they are
133
used in bitwise operations */
134
135
#define VECTOR 4
/* corresponds to 100 in binary */
136
#define POTENTIAL 8
/* corresponds to 1000 in binary */
137
138
/* ---- SET LABELS FOR BOUNDARIES ---- */
139
140
#define OUTFLOW 1
/* any number except 0 !! */
141
#define REFLECTIVE 2
142
#define AXISYMMETRIC 3
143
#define EQTSYMMETRIC 4
144
#define PERIODIC 5
145
#define SHEARING 6
146
#define USERDEF 7
147
148
#define X1_BEG 101
149
#define X1_END 102
150
#define X2_BEG 103
151
#define X2_END 104
152
#define X3_BEG 105
153
#define X3_END 106
154
155
/* ---- LABELS FOR IMAGE SLICING ---- */
156
157
#define X12_PLANE 3
158
#define X13_PLANE 5
159
#define X23_PLANE 6
160
175
#define FLAG_MINMOD 1
176
#define FLAG_FLAT 2
177
#define FLAG_HLL 4
178
#define FLAG_ENTROPY 8
179
#define FLAG_SPLIT_CELL 16
180
#define FLAG_INTERNAL_BOUNDARY 32
183
#define FLAG_BIT7 64
184
#define FLAG_BIT8 128
185
187
#define PRS_FAIL 1
188
#define ENG_FAIL 2
189
#define RHO_FAIL 4
190
191
#define IDIR 0
/* This sequence (0,1,2) should */
192
#define JDIR 1
/* never be changed */
193
#define KDIR 2
/* */
194
#define ALL_DIR -1
195
196
/* -- location of a variable inside the cell -- */
197
198
#define CENTER 0
199
#define X1FACE 1
200
#define X2FACE 2
201
#define X3FACE 3
202
203
#define CELL_CENTER 50
/* really needed ? */
204
#define FACE_CENTER 51
205
#define EDGE_CENTER 52
206
207
/* ---- SET LABELS FOR INTERPOLATION ---- */
208
209
#define FLAT 1
210
#define LINEAR 2
211
#define CENO3 3
212
#define PARABOLIC 4
213
#define LINEAR_MULTID 5
214
#define MP5 6
215
#define LimO3 7
216
#define WENO3 8
217
218
#define WENO3_FD 103
219
#define WENO5_FD 105
220
#define WENOZ_FD 106
221
#define WENO7_FD 107
222
#define MP5_FD 125
223
#define PPM_FD 140
224
#define LIMO3_FD 300
225
226
#define ONED 1
227
#define MULTID 3
228
229
/* ---- limiter labels ---- */
230
231
#define FLAT_LIM 1
232
#define MINMOD_LIM 2
233
#define VANALBADA_LIM 3
234
#define UMIST_LIM 4
235
#define VANLEER_LIM 5
236
#define MC_LIM 6
237
#define FOURTH_ORDER_LIM 7
238
239
/*
240
241
#define FLAT_LIMIT(dv, dp, dm) dv = 0.0;
242
243
#define MINMOD_LIMIT(dv, dp, dm) dv = ((dm)*(dp) > 0.0 ? (fabs(dm) < fabs(dp) ? (dm):(dp)):0.0)
244
245
#define VANALBADA_LIMIT(dv, dp, dm)\
246
if (dp*dm > 0.0) { \
247
double _dpp= dp*dp, _dmm = dm_dm; \
248
dv = dp*(_dmm + 1.e-18) + dm*(_dpp + 1.e-18))/(_dpp + _dmm + 1.e-18); \
249
}else dv = 0.0;
250
251
#define VANLEER_LIMIT(dv, dp, dm) if (dp*dm > 0.0) dv = 2.0*dp*dm/(dp+dm);\
252
else dv = 0.0;
253
254
#define UMIST_LIMIT(dv,dp,dm)\
255
if (dp*dm > 0.0){ \
256
double _ddp = 0.25*(dp + 3.0*dm), _ddm = 0.25*(dm + 3.0*dp); \
257
double _d2 = 2.0*(fabs(dp) < fabs(dm) ? dp:dm); \
258
_d2 = (fabs(_d2) < fabs(_ddp) ? _d2:_ddp); \
259
dv = (fabs(_d2) < fabs(_ddm) ? _d2:_ddm);} else dv = 0.0;
260
261
#define MC_LIMIT(dv, dp, dm, dc) \
262
if (dp*dm > 0.0){ \
263
double _d2 = 2.0*(fabs(dp) < fabs(dm)) ? dp:dm); \
264
dv = 2.0*(fabs(dvp) < fabs(dvm) ? dvp:dvm); \
265
}else dv = 0.0;
266
*/
267
268
269
/* ###############################################################
270
271
PROBLEM-DEPENDENT DECLARATIONS
272
273
############################################################### */
274
275
#include "definitions.h"
276
277
#ifdef PARALLEL
278
#include <
al.h
>
279
#endif
280
281
/* -- include mpi.h for parallel Chombo, in order to use
282
MPI_Abort function in the QUIT_PLUTO macro -- */
283
284
#ifdef CH_MPI
285
#include <mpi.h>
286
#endif
287
288
289
/* ###################################################################
290
291
SWITCHES USED FOR DEBUGGING PURPOSES ONLY
292
293
################################################################### */
294
295
/* -- CHECK_EIGENVECTORS: used in eigenv.c in HD/, MHD/, RHD/
296
to check orthogonality and the correctness through
297
the relation the A = L*\Lambda*R -- */
298
299
#define CHECK_EIGENVECTORS NO
300
301
/* -- CHECK_ROE_MATRIX: used in HD/roe.c, MHD/roe.c to
302
check that the characteristic decomp. reproduces
303
Roe matrix -- */
304
305
#define CHECK_ROE_MATRIX NO
306
307
/* -- CHECK_CONSERVATIVE_VAR: used in RHD/mappers.c to
308
check that conservative vars are physical -- */
309
310
#define CHECK_CONSERVATIVE_VAR NO
311
312
/* -- CHECK_DIVB_CONDITION: used in MHD/CT/ct.c
313
to check if div.B = 0 -- */
314
315
#ifndef CHECK_DIVB_CONDITION
316
#define CHECK_DIVB_CONDITION NO
317
#endif
318
319
/* ###############################################################
320
321
Define precision (useless now)
322
323
############################################################### */
324
325
typedef
double
real;
326
327
/* ###############################################################
328
329
EXIT MACRO. For Chombo it is defined elsewhere.
330
331
############################################################### */
332
333
#ifdef PARALLEL
334
/* #define QUIT_PLUTO(e_code) {MPI_Finalize(); exit(e_code);} */
335
#define QUIT_PLUTO(e_code) \
336
{MPI_Abort(MPI_COMM_WORLD, e_code);MPI_Finalize(); exit(e_code);}
337
#elif (defined CH_MPI)
338
#define QUIT_PLUTO(e_code) \
339
{MPI_Abort(MPI_COMM_WORLD, e_code); exit(e_code);}
340
#else
341
#define QUIT_PLUTO(e_code) exit(e_code);
342
#endif
343
344
/* ##################################################################
345
346
MACROS TO EXPAND DIMENSION-DEPENDENT LINES
347
348
################################################################# */
349
367
#if COMPONENTS == 1
368
#define EXPAND(a,b,c) a
369
#define SELECT(a,b,c) a
370
#endif
371
372
#if COMPONENTS == 2
373
#define EXPAND(a,b,c) a b
374
#define SELECT(a,b,c) b
375
#endif
376
377
#if COMPONENTS == 3
378
#define EXPAND(a,b,c) a b c
379
#define SELECT(a,b,c) c
380
#endif
381
382
#if DIMENSIONS == 1
383
#define D_EXPAND(a,b,c) a
384
#define D_SELECT(a,b,c) a
385
#define IOFFSET 1
/* ** so we know when to loop in boundary zones ** */
386
#define JOFFSET 0
387
#define KOFFSET 0
388
#endif
389
390
#if DIMENSIONS == 2
391
#define D_EXPAND(a,b,c) a b
392
#define D_SELECT(a,b,c) b
393
#define IOFFSET 1
/* ** so we know when to loop in boundary zones ** */
394
#define JOFFSET 1
395
#define KOFFSET 0
396
#endif
397
398
#if DIMENSIONS == 3
399
#define D_EXPAND(a,b,c) a b c
400
#define D_SELECT(a,b,c) c
401
#define IOFFSET 1
/* ** so we know when to loop in boundary zones ** */
402
#define JOFFSET 1
403
#define KOFFSET 1
404
#endif
405
406
#if WARNING_MESSAGES == YES
407
#define WARNING(a) a
408
#else
409
#define WARNING(a)
410
#endif
411
412
/* #################################################################
413
414
SPATIAL LOOP MACROS
415
416
################################################################# */
417
418
#define VAR_LOOP(n) for ((n) = NVAR; (n)--; )
419
#define DIM_LOOP(d) for ((d) = 0; (d) < DIMENSIONS; (d)++)
420
430
#define IBEG_LOOP(i) for ((i) = IBEG; (i)--; )
431
#define JBEG_LOOP(j) for ((j) = JBEG; (j)--; )
432
#define KBEG_LOOP(k) for ((k) = KBEG; (k)--; )
433
434
#define IEND_LOOP(i) for ((i) = IEND + 1; (i) < NX1_TOT; (i)++)
435
#define JEND_LOOP(j) for ((j) = JEND + 1; (j) < NX2_TOT; (j)++)
436
#define KEND_LOOP(k) for ((k) = KEND + 1; (k) < NX3_TOT; (k)++)
437
438
#define IDOM_LOOP(i) for ((i) = IBEG; (i) <= IEND; (i)++)
439
#define JDOM_LOOP(j) for ((j) = JBEG; (j) <= JEND; (j)++)
440
#define KDOM_LOOP(k) for ((k) = KBEG; (k) <= KEND; (k)++)
441
442
#define ITOT_LOOP(i) for ((i) = 0; (i) < NX1_TOT; (i)++)
443
#define JTOT_LOOP(j) for ((j) = 0; (j) < NX2_TOT; (j)++)
444
#define KTOT_LOOP(k) for ((k) = 0; (k) < NX3_TOT; (k)++)
445
446
#define DOM_LOOP(k,j,i) KDOM_LOOP(k) JDOM_LOOP(j) IDOM_LOOP(i)
447
448
#define TOT_LOOP(k,j,i) KTOT_LOOP(k) JTOT_LOOP(j) ITOT_LOOP(i)
449
450
#define X1_BEG_LOOP(k,j,i) KTOT_LOOP(k) JTOT_LOOP(j) IBEG_LOOP(i)
451
#define X2_BEG_LOOP(k,j,i) KTOT_LOOP(k) JBEG_LOOP(j) ITOT_LOOP(i)
452
#define X3_BEG_LOOP(k,j,i) KBEG_LOOP(k) JTOT_LOOP(j) ITOT_LOOP(i)
453
454
#define X1_END_LOOP(k,j,i) KTOT_LOOP(k) JTOT_LOOP(j) IEND_LOOP(i)
455
#define X2_END_LOOP(k,j,i) KTOT_LOOP(k) JEND_LOOP(j) ITOT_LOOP(i)
456
#define X3_END_LOOP(k,j,i) KEND_LOOP(k) JTOT_LOOP(j) ITOT_LOOP(i)
457
458
#define TRANSVERSE_LOOP(indx, in, i,j,k) \
459
if (g_dir == IDIR) {i = ∈ j = &indx.t1; k = &indx.t2;} \
460
if (g_dir == JDIR) {j = ∈ i = &indx.t1; k = &indx.t2;} \
461
if (g_dir == KDIR) {k = ∈ i = &indx.t1; j = &indx.t2;} \
462
g_i = i; g_j = j; g_k = k;\
463
for (indx.t2 = indx.t2_beg; indx.t2 <= indx.t2_end; indx.t2++) \
464
for (indx.t1 = indx.t1_beg; indx.t1 <= indx.t1_end; indx.t1++)
465
467
/* ********************************************************************* */
475
#define BOX_LOOP(B,k,j,i) \
476
for ((B)->dk = ((k=(B)->kb) <= (B)->ke ? 1:-1); k != (B)->ke+(B)->dk; k += (B)->dk)\
477
for ((B)->dj = ((j=(B)->jb) <= (B)->je ? 1:-1); j != (B)->je+(B)->dj; j += (B)->dj)\
478
for ((B)->di = ((i=(B)->ib) <= (B)->ie ? 1:-1); i != (B)->ie+(B)->di; i += (B)->di)
479
480
481
/*
482
#define DIR_LOOP(grid,in,k,j,i) \
483
if (g_dir == IDIR) {in = &i; j = *g_j; k = *g_k;} \
484
if (g_dir == JDIR) {in = &j; i = *g_i; k = *g_k;} \
485
if (g_dir == KDIR) {in = &k; i = *g_i; j = *g_j;} \
486
for (*in = grid[g_dir].lbeg - 2; *in <= grid[g_dir].lend + 2; (*in)++)
487
*/
488
489
/* not used for now... will serve in EMF_BOUNDARY...
490
#define ISTAG_LOOP(i) for ((i) = IBEG - 1; (i) <= IEND; (i)++)
491
#define JSTAG_LOOP(j) for ((j) = JBEG - 1; (j) <= JEND; (j)++)
492
#define KSTAG_LOOP(k) for ((k) = KBEG - 1; (k) <= KEND; (k)++)
493
*/
494
495
496
/* #################################################################
497
498
VARIABLE LOOP MACROS
499
500
################################################################# */
501
502
/* ------------------------------------------------------------
503
The LRVAR_LOOP and LRFLX_LOOP will speed up computation
504
of the left/right states at a given interface by excluding
505
the normal component of magnetic field, which is usually
506
assigned at the end of the reconstruction step.
507
------------------------------------------------------------ */
508
/*
509
#ifdef STAGGERED_MHD
510
#define LR_VAR_LOOP(i) for (i = NVAR; i--; i -= (i == BXn+1))
511
#define LR_FLX_LOOP(i) for (i = NFLX; i--; i -= (i == BXn+1))
512
#else
513
#define LR_VAR_LOOP(i) for (i = NVAR; i--; )
514
#define LR_FLX_LOOP(i) for (i = NFLX; i--; )
515
#endif
516
*/
517
/* #################################################################
518
519
TIME INTEGRATOR DEFINITIONS
520
521
################################################################# */
522
523
#if (TIME_STEPPING == HANCOCK) || (TIME_STEPPING == CHARACTERISTIC_TRACING)
524
#define SINGLE_STEP 1
525
#if DIMENSIONAL_SPLITTING == NO
526
#define CTU 1
/* -- Corner Transport Upwind method of Colella -- */
527
#endif
528
#endif
529
530
/* ------------------------------------------------------------
531
the GET_MAX_DT switch determines how the time step is
532
computed. For pure advection, setting it to YES will force
533
PLUTO to compute dt in the old way, i.e., by taking the
534
maximum.
535
When set to NO, the time step is computed only during the
536
predictor step and, for UNSPLIT RK schemes, it will be
537
calculated as the average over dimensions resulting in
538
slightly larger time increments.
539
------------------------------------------------------------ */
540
541
#if ((TIME_STEPPING == RK2) || (TIME_STEPPING == RK3) || \
542
(TIME_STEPPING == RK_MIDPOINT)) && DIMENSIONAL_SPLITTING == NO
543
544
#define GET_MAX_DT NO
545
#else
546
#define GET_MAX_DT YES
547
#endif
548
549
/* ###############################################################
550
551
Check whether a separate source step has to be done
552
553
############################################################### */
554
555
#if (COOLING != NO)
556
#define INCLUDE_SPLIT_SOURCE YES
557
#else
558
#define INCLUDE_SPLIT_SOURCE NO
559
#endif
560
561
562
/* #################################################################
563
564
set to NO all undefined identifier that may appear in the code.
565
(compile with -Wundef).
566
Diffusion operators: PARABOLIC_FLUX is the bitwise OR
567
combination of all operators, each being either one of
568
NO, EXPLICIT (1st bit), STS (2nd bit).
569
It can take the following values
570
571
00 --> no diffusion operator is being used
572
01 --> there's at least one explicit diffusion operator and
573
no sts.
574
575
10 --> there's at least one sts diffusion operator and
576
no explicit one.
577
11 --> mixed: there is at least one explicit and sts operator
578
579
################################################################# */
580
581
#ifndef RESISTIVE_MHD
582
#define RESISTIVE_MHD NO
583
#endif
584
585
#ifndef THERMAL_CONDUCTION
586
#define THERMAL_CONDUCTION NO
587
#endif
588
589
#ifndef VISCOSITY
590
#define VISCOSITY NO
591
#endif
592
593
#ifndef INCLUDE_PARTICLES
594
#define INCLUDE_PARTICLES NO
595
#endif
596
597
#ifndef UPDATE_VECTOR_POTENTIAL
598
#define UPDATE_VECTOR_POTENTIAL NO
599
#endif
600
601
#ifndef BACKGROUND_FIELD
602
#define BACKGROUND_FIELD NO
603
#endif
604
605
#ifndef USE_FOUR_VELOCITY
606
#define USE_FOUR_VELOCITY NO
607
#endif
608
609
#ifndef CHAR_LIMITING
610
#define CHAR_LIMITING NO
611
#endif
612
613
#ifndef ARTIFICIAL_VISCOSITY
614
#define ARTIFICIAL_VISCOSITY NO
615
#endif
616
617
#ifndef ROTATING_FRAME
618
#define ROTATING_FRAME NO
619
#endif
620
621
#ifndef INTERNAL_BOUNDARY
622
#define INTERNAL_BOUNDARY NO
623
#endif
624
625
#define PARABOLIC_FLUX (RESISTIVE_MHD|THERMAL_CONDUCTION|VISCOSITY)
626
627
/* #################################################################
628
629
USEFUL CONSTANTS
630
631
################################################################# */
632
633
#define ACCURACY 1.e-14
/* ZERO ACCURACY */
634
641
#define CONST_PI 3.14159265358979
642
#define CONST_amu 1.66053886e-24
643
#define CONST_mp 1.67262171e-24
644
#define CONST_mn 1.67492728e-24
645
#define CONST_me 9.1093826e-28
646
#define CONST_mH 1.6733e-24
647
#define CONST_kB 1.3806505e-16
648
#define CONST_sigma 5.67051e-5
649
#define CONST_sigmaT 6.6524e-25
650
#define CONST_NA 6.0221367e23
651
#define CONST_c 2.99792458e10
652
#define CONST_Msun 2.e33
653
#define CONST_Rsun 6.96e10
654
#define CONST_Mearth 5.9736e27
655
#define CONST_Rearth 6.378136e8
656
#define CONST_G 6.6726e-8
657
#define CONST_h 6.62606876e-27
658
#define CONST_pc 3.0856775807e18
659
#define CONST_ly 0.9461e18
660
#define CONST_au 1.49597892e13
661
#define CONST_eV 1.602176463158e-12
664
/* ###############################################################
665
666
Define Structures here
667
668
############################################################### */
669
670
typedef
struct
CMD_LINE {
671
int
restart;
672
int
h5restart;
673
int
nrestart;
674
int
makegrid;
675
int
write;
676
int
maxsteps;
677
int
jet;
/* -- follow jet evolution in a given direction -- */
678
int
parallel_dim[3];
679
int
nproc[3];
/* -- user supplied number of processors -- */
680
int
show_dec;
/* -- show domain decomposition ? -- */
681
int
xres;
/* -- change the resolution via command line -- */
682
int
fill;
/* useless, it makes the struct a power of 2 */
683
} Cmd_Line;
684
685
/* ********************************************************************* */
689
typedef
struct
DATA{
690
double
****Uc;
691
double
****Vc;
696
double
****Vs;
702
double
****Vuser;
704
double
***Ax1;
705
double
***Ax2;
706
double
***Ax3;
707
unsigned
char
***
flag
;
709
int
fill;
/* useless, it makes the struct a power of 2 */
710
}
Data
;
711
712
/* ********************************************************************* */
719
typedef
struct
STATE_1D{
720
double
**
v
;
722
double
**vL;
725
double
**vR;
727
double
**vm;
728
double
**vp;
730
double
**uL;
731
double
**uR;
732
double
**um;
733
double
**up;
735
double
**flux;
736
double
**
par_flx
;
738
double
**pnt_flx;
739
double
**dff_flx;
740
741
double
***Lp, ***Rp;
742
double
**lambda;
743
double
*lmax;
744
double
*a2;
745
double
*h;
746
double
**vt;
747
double
**src;
748
double
**
par_src
;
750
double
**vh;
751
double
**rhs;
752
double
*press;
753
double
*bn;
754
double
*SL;
755
double
*SR;
756
double
q1;
757
unsigned
char
uc1;
758
unsigned
char
*flag;
759
}
State_1D
;
760
761
/* ********************************************************************* */
778
typedef
struct
GRID{
779
double
xi, xf;
780
double
*x, *x_glob;
781
double
*xr, *xr_glob;
782
double
*xl, *xl_glob;
783
double
*dx, *dx_glob;
784
double
*
xgc
;
786
double
*dV;
787
double
*A;
788
double
*r_1;
789
double
*ct;
790
double
*inv_dx;
791
double
*inv_dxi;
794
double
dl_min;
797
double
*dfg;
798
double
*df2g;
799
double
*dfR;
800
double
*dfL;
802
int
np_tot_glob;
804
int
np_int_glob;
806
int
np_tot;
808
int
np_int;
810
int
nghost;
811
int
lbound;
818
int
rbound;
819
int
gbeg;
820
int
gend;
821
int
beg;
822
int
end;
823
int
lbeg;
824
int
lend;
825
int
uniform;
/* = 1 when the grid is cartesian AND uniform everywhere */
826
int
nproc;
827
int
rank_coord;
828
int
level;
829
char
fill[84];
/* useless, just to make the structure size a power of 2 */
830
}
Grid
;
831
832
/* ********************************************************************* */
837
typedef
struct
TIME_STEP{
838
double
*cmax;
839
double
inv_dta
;
841
double
inv_dtp;
843
double
dt_cool;
844
double
cfl;
845
double
cfl_par;
846
double
rmax_par;
847
int
Nsts;
848
int
Nrkc;
849
char
fill[24];
/* useless, just to make the structure size a power of 2 */
850
}
Time_Step
;
851
852
853
/* ********************************************************************* */
856
typedef
struct
OUTPUT{
857
int
type;
858
int
nvar;
859
int
user_outs;
860
int
nfile;
861
int
dn;
862
int
*stag_var;
863
int
*dump_var;
864
char
mode[32];
865
char
**var_name;
866
char
ext[8];
867
double
dt;
868
double
dclock;
869
double
***V[64];
870
char
fill[168];
871
}
Output
;
872
873
typedef
struct
INPUT{
874
int
npoint[3];
875
int
lft_bound_side[3];
/* left boundary type */
876
int
rgt_bound_side[3];
/* right boundary type */
877
int
grid_is_uniform[3];
/* = 1 when grid is uniform, 0 otherwise */
878
int
npatch[5];
/* number of grid patches */
879
int
patch_npoint[5][16];
/* number of points per patch */
880
int
patch_type[5][16];
881
int
log_freq;
/* log frequency */
882
int
user_var;
/* number of additional user-variables being
883
held in memory and written to disk */
884
int
anl_dn;
/* number of step increment for ANALYSIS */
885
char
solv_type[64];
886
char
user_var_name[128][128];
887
Output
output[
MAX_OUTPUT_TYPES
];
888
double
patch_left_node[5][16];
/* self-expl. */
889
double
xbeg[3];
890
double
xend[3];
891
double
cfl;
/* hyperbolic cfl number */
892
double
cfl_max_var;
893
double
cfl_par;
/* (STS) parabolic cfl number */
894
double
rmax_par;
/* (STS) max ratio between current time
895
step and parabolic time step */
896
double
tstop;
897
double
first_dt;
898
double
anl_dt;
/* time step increment for ANALYSIS */
899
double
aux[32];
/* we keep aux inside this structure,
900
since in parallel execution it has
901
to be comunicated to all processors */
902
} Input;
903
904
typedef
struct
RUNTIME{
905
int
nstep;
906
int
nfile[
MAX_OUTPUT_TYPES
];
907
double
t;
908
double
dt;
909
} Runtime;
910
911
typedef
struct
RGB{
912
unsigned
char
r, g, b;
913
} RGB;
914
915
typedef
struct
IMAGE{
916
int
nrow, ncol;
/* -- image rows and columns -- */
917
int
slice_plane;
/* -- one of X12_PLANE, X13_PLANE, X23_PLANE -- */
918
int
logscale;
/* -- YES/NO for log scale -- */
919
char
*colormap;
/* -- colormap name -- */
920
char
basename[32];
/* -- image base name (no extensions) -- */
921
unsigned
char
r[256], g[256], b[256];
/* -- colortable saved here -- */
922
RGB **rgb;
/* -- rgb array containing image values -- */
923
double
max;
/* -- max image value -- */
924
double
min;
/* -- min image value -- */
925
double
slice_coord;
/* -- slice coord orthogonal to slice_plane -- */
926
} Image;
927
928
typedef
struct
FLOAT_VECT{
929
float
v1, v2, v3;
930
} Float_Vect;
931
932
typedef
struct
INDEX{
933
int
ntot, beg, end;
934
int
t1, t1_beg, t1_end;
935
int
t2, t2_beg, t2_end;
936
char
fill[28];
/* useless, just to make the structure size a power of 2 */
937
} Index;
938
939
/* ********************************************************************* */
950
typedef
struct
RBOX{
951
int
ib;
952
int
ie;
953
int
jb;
954
int
je;
955
int
kb;
956
int
ke;
957
int
di
;
959
int
dj;
961
int
dk;
963
int
vpos;
964
}
RBox
;
965
966
/* #######################################################
967
968
Recurrent function types
969
970
####################################################### */
971
972
typedef
void
Riemann_Solver (
const
State_1D
*,
int
,
int
,
double
*,
Grid
*);
973
typedef
void
Limiter (
double
*,
double
*,
double
*,
int
,
int
,
Grid
*);
974
typedef
double
Reconstruct (
double
*,
double
,
int
);
975
typedef
double
****Data_Arr;
976
977
/* -- when using Finite Difference Schemes, the "Riemann Solver"
978
function computes the fluxes with high order interpolants. -- */
979
980
/* ----------------------------------------------------------
981
Include module header files
982
---------------------------------------------------------- */
983
984
#if PHYSICS == HD
985
986
#include "HD/mod_defs.h"
987
988
#elif PHYSICS == RHD
989
990
#include "RHD/mod_defs.h"
991
992
#elif PHYSICS == MHD
993
994
#include "MHD/mod_defs.h"
995
#ifdef SHEARINGBOX
996
#include "
MHD/ShearingBox/shearingbox.h
"
997
#endif
998
999
#elif PHYSICS == RMHD
1000
1001
#include "
RMHD/mod_defs.h
"
1002
1003
#endif
1004
1005
#if COOLING == MINEq
1006
#include "Cooling/MINEq/cooling.h"
1007
#elif COOLING == SNEq
1008
#include "Cooling/SNEq/cooling.h"
1009
#elif COOLING == POWER_LAW
1010
#include "Cooling/Power_Law/cooling.h"
1011
#elif COOLING == TABULATED
1012
#include "Cooling/Tab/cooling.h"
1013
#elif COOLING == H2_COOL
1014
#include "Cooling/H2_COOL/cooling.h"
1015
#endif
1016
1017
#if THERMAL_CONDUCTION != NO
1018
#include "
Thermal_Conduction/tc.h
"
1019
#endif
1020
1021
#if VISCOSITY != NO
1022
#include "Viscosity/viscosity.h"
1023
#endif
1024
1025
#if INCLUDE_PARTICLES == YES
1026
#include "Particles/particles.h"
1027
#endif
1028
1029
#ifdef FARGO
1030
#include "
Fargo/fargo.h
"
1031
#endif
1032
1033
/* *****************************************************
1034
*****************************************************
1035
1036
GLOBAL VARIABLES
1037
1038
*****************************************************
1039
***************************************************** */
1040
1041
extern
int
SZ;
1042
extern
int
SZ_stagx;
1043
extern
int
SZ_stagy;
1044
extern
int
SZ_stagz;
1045
extern
int
SZ_char;
1046
extern
int
SZ_float;
1047
extern
int
SZ_Float_Vect;
1048
extern
int
SZ_rgb;
1049
extern
int
SZ_short;
1050
extern
int
prank
;
1051
1052
extern
long
int
IBEG
,
IEND
,
JBEG
,
JEND
,
KBEG
,
KEND
;
1053
extern
long
int
NX1
,
NX2
,
NX3
;
1054
extern
long
int
NX1_TOT
,
NX2_TOT
,
NX3_TOT
;
1055
1056
extern
long
int
NMAX_POINT
;
1057
1058
extern
int
VXn, VXt, VXb;
1059
extern
int
MXn, MXt, MXb;
1060
extern
int
BXn, BXt, BXb;
1061
1062
extern
int
*
g_i
, *
g_j
, *
g_k
;
1063
1064
extern
int
g_dir
;
1065
extern
int
g_maxRiemannIter
;
1066
extern
long
int
g_usedMem
;
1067
extern
long
int
g_stepNumber
;
1068
extern
int
g_intStage
;
1069
1070
extern
double
g_unitDensity
,
g_unitLength
,
g_unitVelocity
;
1071
1072
extern
double
g_maxCoolingRate
,
g_minCoolingTemp
;
1073
1074
extern
double
g_smallDensity
,
g_smallPressure
;
1075
1076
extern
double
g_time
,
g_dt
;
1077
extern
double
g_maxMach
;
1078
#if ROTATING_FRAME
1079
extern
double
g_OmegaZ;
1080
#endif
1081
1082
extern
double
g_domBeg
[3],
g_domEnd
[3];
1083
1084
extern
double
g_inputParam
[32];
1085
#if EOS != ISOTHERMAL
1086
extern
double
g_gamma;
1087
#elif EOS == ISOTHERMAL
1088
extern
double
g_isoSoundSpeed;
1089
#endif
1090
1091
#ifdef CH_SPACEDIM
1092
extern
double
ch_max, ch_max_loc, coeff_dl_min;
1093
extern
int
use_glm;
1094
extern
int
LEVEL;
1095
#endif
1096
1097
extern
FILE *pluto_log_file;
1098
1099
/* ----------------------------------------------------------
1100
define NX_MAX, NY_MAX, NZ_MAX as the maximum
1101
size on a patch.
1102
For the static grid of PLUTO, they simply coincide
1103
with NX1_TOT, NX2_TOT, NX3_TOT. Otherwise
1104
the grid is taken to be the maximum, according
1105
to maxGridSize.
1106
This avoids allocating and freeing memory all the times.
1107
---------------------------------------------------------- */
1108
1109
#ifdef CH_SPACEDIM
1110
#define NX_MAX NMAX_POINT
1111
#define NY_MAX NMAX_POINT
1112
#define NZ_MAX NMAX_POINT
1113
#else
1114
#define NX_MAX NX1_TOT
1115
#define NY_MAX NX2_TOT
1116
#define NZ_MAX NX3_TOT
1117
#endif
1118
1119
/* ------------------------------------------------------------------
1120
Define total number of variables to be integrated;
1121
this includes:
1122
1123
NFLX = Number of equations defining the system of
1124
conservation laws. For example, for the
1125
HD module, it consists of density, momentum and energy.
1126
It is defined in the physics module header file mod_defs.h.
1127
1128
NTRACER = Number of user-defined tracers; defined in the problem
1129
directory header file definitions.h
1130
1131
NIONS = Number of chemical species; it is defined in
1132
the cooling modules cooling.h, if present.
1133
1134
nv = 0...NFLX - 1; NFLX...NFLX+NIONS-1; TRC...TRC + NTRACER-1; ENTR;
1135
<----------> <------------------> <------------------>
1136
NFLX NIONS NTRACER
1137
1138
<---------------------------------------------->
1139
NSCL
1140
1141
------------------------------------------------------------------ */
1142
1143
#ifndef ENTROPY_SWITCH
1144
#define ENTROPY_SWITCH NO
1145
#endif
1146
1147
#ifndef NIONS
1148
#define NIONS 0
1149
#endif
1150
1151
#define TRC (NFLX + NIONS)
1152
#define TR TRC
1153
#define NSCL (NTRACER + NIONS + ENTROPY_SWITCH)
1154
1155
#if ENTROPY_SWITCH == YES
1156
#define ENTR (TRC + NTRACER)
1157
#else
1158
#if EOS != ISOTHERMAL && EOS != BAROTROPIC
1159
#define ENTR (ENG)
1160
#endif
1161
#endif
1162
1163
#define NVAR (NFLX + NSCL)
1164
1168
#define KELVIN (g_unitVelocity*g_unitVelocity*CONST_amu/CONST_kB)
1169
1170
#include "prototypes.h"
1171
#endif
/* PLUTO_H */
Generated on Fri Nov 9 2012 13:15:48 for PLUTO by
1.8.2