PLUTO  4.4-patch2
mod_defs.h
Go to the documentation of this file.
1 /* ///////////////////////////////////////////////////////////////////// */
14 /* ///////////////////////////////////////////////////////////////////// */
15 
16 #if RADIATION
18 #endif
19 
20 /* *********************************************************
21  Set flow variable indices.
22  Extra vector components, when not needed, point to the
23  last element (255) of the array stored by startup.c.
24  ********************************************************* */
25 
26 #define RHO 0
27 #define MX1 1
28 #define MX2 2
29 #define MX3 3
30 #define BX1 4
31 #define BX2 5
32 #define BX3 6
33 
34 #if HAVE_ENERGY
35  #define ENG 7
36  #define PRS ENG
37 #endif
38 
39 #if DIVB_CONTROL == DIV_CLEANING
40  #define PSI_GLM (ENG + 1)
41  #define DIV_COMP 1
42 #else
43  #define DIV_COMP 0
44 #endif
45 
46 #define VX1 MX1
47 #define VX2 MX2
48 #define VX3 MX3
49 
50 #if RADIATION
51  #define ENR (7 + DIV_COMP + HAVE_ENERGY)
52  #define FR1 (ENR + 1)
53  #define FR2 (ENR + 2)
54  #define FR3 (ENR + 3)
55  #define NFLX (11 + DIV_COMP + HAVE_ENERGY)
56 #else
57  #define NFLX (7 + DIV_COMP + HAVE_ENERGY)
58 #endif
59 
60 /* *********************************************************
61  Label the different waves in increasing order
62  following the number of vector components.
63 
64  IMPORTANT: the KPSI_GLMM & KPSI_GLMP modes are
65  present only in the MHD-GLM formulation.
66  We keep them at the END of the enumeration
67  so we can skip them in unnecessary loops.
68  Please do NOT change them !
69  ********************************************************* */
70 
71 enum KWAVES {
72  KFASTM, KFASTP, KENTRP
73 
74  #if DIVB_CONTROL != DIV_CLEANING
75  , KDIVB
76  #endif
77 
78  , KSLOWM, KSLOWP, KALFVM, KALFVP
79 
80  #if DIVB_CONTROL == DIV_CLEANING
81  , KPSI_GLMM, KPSI_GLMP
82  #endif
83 };
84 
85 /* ********************************************************************* */
95 typedef struct Mao_param_{
96  double D;
97  double sigma_c;
98  double E;
99  double m2;
100  double S;
101  double S2;
102  double B2;
104  double rho;
105  double W;
106  double lor;
107  double prs;
108 } Map_param;
109 
110 /* ******************************************************
111  Vector potential: these labels are and MUST only
112  be used in the STARTUP / INIT functions;
113  they're convenient in obtaining a discretization
114  that preserve divB since the beginning.
115  ****************************************************** */
116 
117 #define AX1 (NVAR + 1)
118 #define AX2 (NVAR + 2)
119 #define AX3 (NVAR + 3)
120 
121 #define AX AX1 /* backward compatibility */
122 #define AY AX2
123 #define AZ AX3
124 
125 /* *************************************************
126  Now define more convenient and user-friendly
127  pointer labels for geometry setting
128  ************************************************* */
129 
130 #if GEOMETRY == CYLINDRICAL
131 
132  #define iVR VX1
133  #define iVZ VX2
134  #define iVPHI VX3
135 
136  #define iMR MX1
137  #define iMZ MX2
138  #define iMPHI MX3
139 
140  #define iBR BX1
141  #define iBZ BX2
142  #define iBPHI BX3
143 
144 #endif
145 
146 #if GEOMETRY == POLAR
147 
148  #define iVR VX1
149  #define iVPHI VX2
150  #define iVZ VX3
151 
152  #define iMR MX1
153  #define iMPHI MX2
154  #define iMZ MX3
155 
156  #define iBR BX1
157  #define iBPHI BX2
158  #define iBZ BX3
159 
160 #endif
161 
162 #if GEOMETRY == SPHERICAL
163 
164  #define iVR VX1
165  #define iVTH VX2
166  #define iVPHI VX3
167 
168  #define iMR MX1
169  #define iMTH MX2
170  #define iMPHI MX3
171 
172  #define iBR BX1
173  #define iBTH BX2
174  #define iBPHI BX3
175 
176 #endif
177 
178 /* ******************************************************************
179  Module-specific symbolic constants (switches)
180  ****************************************************************** */
181 
182 #ifndef RMHD_FAST_EIGENVALUES
183  #define RMHD_FAST_EIGENVALUES NO
190 #endif
191 
192 #ifndef RMHD_REDUCED_ENERGY
193  #define RMHD_REDUCED_ENERGY YES
196 #endif
197 
198 
200 /* ---- Function prototyping ---- */
201 
202 int ApproximateFastWaves (double *, double, double, double *);
203 int ConsToPrim (double **, double **, int, int, uint16_t *);
204 void ConvertTo4vel (double **, int, int);
205 void ConvertTo3vel (double **, int, int);
206 void PrimEigenvectors (double *, double, double, double *, double **, double **);
207 
208 void Flux (const State *, int, int);
209 void HLL_Speed (const State *, const State *, double *, double *, int, int);
210 int MaxSignalSpeed (const State *, double *, double *, int, int);
211 
212 void PrimToCons (double **, double **, int, int);
213 void VelocityLimiter (double *, double *, double *);
214 
215 int Magnetosonic (double *vp, double cs2, double h, double *lambda);
216 
217 Riemann_Solver LF_Solver, HLL_Solver, HLLC_Solver, HLLD_Solver, HLLEM_Solver;
218 Riemann_Solver HLL_Linde_Solver, GMUSTA1_Solver;
219 Riemann_Solver GFORCE_Solver;
220 
221 int RMHD_EntropySolve (Map_param *);
224 
225 #if DIVB_CONTROL == EIGHT_WAVES
226  void POWELL_DIVB_SOURCE(const Sweep *, int, int, Grid *);
227  void HLL_DIVB_SOURCE (const Sweep *, double **, int, int, Grid *);
228 #elif DIVB_CONTROL == DIV_CLEANING
229  #include "MHD/GLM/glm.h"
230 #elif DIVB_CONTROL == CONSTRAINED_TRANSPORT
231  #include "MHD/CT/ct.h"
232 #endif
233 
234 #ifndef NEW_RMHD_FLUXES
235  #define NEW_RMHD_FLUXES NO
236 #endif
int RMHD_EnergySolve(Map_param *)
Definition: rmhd_energy_solve.c:28
void VelocityLimiter(double *, double *, double *)
Definition: vel_limiter.c:16
void MaxSignalSpeed(const State *, double *, double *, int, int)
Definition: eigenv.c:34
int ConsToPrim(double **, double **, int, int, uint16_t *)
Definition: mappers.c:88
void HLL_DIVB_SOURCE(const Sweep *, double **, int, int, Grid *)
Definition: source.c:94
Header file for the radiation module.
void PrimToCons(double **, double **, int, int)
Definition: mappers.c:26
Definition: structs.h:124
void Flux(const State *, int, int)
Definition: fluxes.c:23
void HLL_Speed(const State *, const State *, double *, double *, int, int)
Definition: hll_speed.c:24
Header file for GLM Divergence Cleaning.
Definition: mod_defs.h:101
Header file for Constrained-Transport (CT) module.
int Magnetosonic(double *vp, double cs2, double h, double *lambda)
Definition: eigenv.c:68
int ApproximateFastWaves(double *, double, double, double *)
Definition: eigenv.c:266
void PrimEigenvectors(const State *, int, int)
Definition: eigenv.c:92
Definition: structs.h:261
Riemann_Solver HLLD_Solver
Definition: mod_defs.h:225
int RMHD_PressureFix(Map_param *)
Definition: rmhd_pressure_fix.c:23
Definition: structs.h:289