PLUTO  4.0
 All Data Structures Files Functions Variables Enumerations Macros Pages
mod_defs.h
Go to the documentation of this file.
1 /* ///////////////////////////////////////////////////////////////////// */
12 /* ///////////////////////////////////////////////////////////////////// */
13 
14 
15 /* ****************************************************************
16  We make extra vector components, when not needed, point
17  to the last element (255) of the array stored by startup.c.
18  **************************************************************** */
19 
20 enum {
21 
22  #if COMPONENTS == 1
23 
24  RHO, MX1, BX1,
25  #if EOS == IDEAL
26  ENG, PRS = ENG,
27  #endif
28  #if MHD_FORMULATION == DIV_CLEANING
29  PSI_GLM,
30  #endif
31  MX2 = 255, BX2 = 255, MX3 = 255, BX3 = 255,
32 
33  #elif COMPONENTS == 2
34 
35  RHO, MX1, MX2, BX1, BX2,
36  #if EOS == IDEAL
37  ENG, PRS = ENG,
38  #endif
39  #if MHD_FORMULATION == DIV_CLEANING
40  PSI_GLM,
41  #endif
42  MX3 = 255, BX3 = 255,
43 
44  #elif COMPONENTS == 3
45 
46  RHO, MX1, MX2, MX3, BX1, BX2, BX3,
47  #if EOS == IDEAL
48  ENG, PRS = ENG,
49  #endif
50  #if MHD_FORMULATION == DIV_CLEANING
51  PSI_GLM,
52  #endif
53 
54  #endif
55 
56  VX1 = MX1, VX2 = MX2, VX3 = MX3,
57 
58 /* -- backward compatibility -- */
59 
60  DN = RHO,
61  #if EOS == IDEAL
62  PR = PRS, EN = ENG,
63  #endif
64  VX = VX1, VY = VX2, VZ = VX3,
65  MX = MX1, MY = MX2, MZ = MX3,
66  BX = BX1, BY = BX2, BZ = BX3
67 
68 };
69 
70 /* **************************************
71  add the PSI_GLM label if necessary
72  ************************************** */
73 
74 /*
75 #if MHD_FORMULATION == DIV_CLEANING
76  #if EOS == IDEAL
77  #define PSI_GLM (2*COMPONENTS + 2)
78  #elif EOS == ISOTHERMAL
79  #define PSI_GLM (2*COMPONENTS + 1)
80  #endif
81 #endif
82 */
83 
84 #define NFLX (2*COMPONENTS + (EOS == IDEAL ? 2:1) + (MHD_FORMULATION == DIV_CLEANING))
85 
86 /* ********************************************************************* */
97 enum KWAVES {
98  KFASTM, KFASTP
99 
100  #if EOS == IDEAL
101  , KENTRP
102  #endif
103 
104  #if MHD_FORMULATION != DIV_CLEANING
105  , KDIVB
106  #endif
107 
108  #if COMPONENTS >= 2
109  , KSLOWM, KSLOWP
110  #if COMPONENTS == 3
111  , KALFVM, KALFVP
112  #endif
113  #endif
114 
115  #if MHD_FORMULATION == DIV_CLEANING
116  , KPSI_GLMM, KPSI_GLMP
117  #endif
118 };
119 
126 #define AX1 (NVAR + 1)
127 #define AX2 (NVAR + 2)
128 #define AX3 (NVAR + 3)
129 
131 #define AX AX1
132 #define AY AX2
133 #define AZ AX3
134 
135 /* *************************************************
136  Now define more convenient and user-friendly
137  pointer labels for geometry setting
138  ************************************************* */
139 
140 #if GEOMETRY == CYLINDRICAL
141 
142  #define iVR VX
143  #define iVZ VY
144  #define iVPHI VZ
145 
146  #define iMR MX
147  #define iMZ MY
148  #define iMPHI MZ
149 
150  #define iBR BX
151  #define iBZ BY
152  #define iBPHI BZ
153 
154 #endif
155 
156 #if GEOMETRY == POLAR
157 
158  #define iVR VX
159  #define iVPHI VY
160  #define iVZ VZ
161 
162  #define iMR MX
163  #define iMPHI MY
164  #define iMZ MZ
165 
166  #define iBR BX
167  #define iBPHI BY
168  #define iBZ BZ
169 
170 #endif
171 
172 #if GEOMETRY == SPHERICAL
173 
174  #define iVR VX
175  #define iVTH VY
176  #define iVPHI VZ
177 
178  #define iMR MX
179  #define iMTH MY
180  #define iMPHI MZ
181 
182  #define iBR BX
183  #define iBTH BY
184  #define iBPHI BZ
185 
186 #endif
187 
188 /* ************************************************
189  Prototyping goes here
190  ************************************************ */
191 
192 void BackgroundField (double x1, double x2, double x3, double *B0);
193 
194 #if BACKGROUND_FIELD == YES
195  double **GetBackgroundField (int, int, int, Grid *);
196 #endif
197 
198 int ConsToPrim (double **, real **, int , int, unsigned char *);
199 void Eigenvalues (double **, double *, double **, int, int);
200 
201 void PrimEigenvectors (double *, double, double, double *, double **, double **);
202 void ConsEigenvectors (double *, double *, double,
203  double **, double **, double *);
204 
205 void Enthalpy (double **, double *, int, int );
206 void Entropy (double **, double *, int, int );
207 
208 void Flux (double **, double **, double *, double **, double **,
209  double *, int, int);
210 void HLL_Speed (double **, double **, double *, double *, double **,
211  double *, double *, int, int);
212 void MaxSignalSpeed (double **, double *, double *, double *, double **, int, int);
213 void PrimToCons (double **, double **, int, int);
214 void PrimRHS (double *, double *, double, double, double *);
215 void PrimSource (const State_1D *, int, int,
216  double *, double *, double **, Grid *);
217 
218 #if MHD_FORMULATION == EIGHT_WAVES
219 
220  void ROE_DIVB_SOURCE (const State_1D *, int, int, Grid *);
221  void HLL_DIVB_SOURCE (const State_1D *, double **, int, int, Grid *);
222 
223 #elif MHD_FORMULATION == DIV_CLEANING
224 
225  #include "MHD/GLM/glm.h"
226 
227 #elif MHD_FORMULATION == CONSTRAINED_TRANSPORT
228 
229  #include "MHD/CT/ct.h"
230 
231 #endif
232 
233 Riemann_Solver HLL_Solver, HLLC_Solver, HLLD_Solver;
234 Riemann_Solver LF_Solver, Roe_Solver;
235 
236 #if RESISTIVE_MHD != NO
237  #include "Resistive/res.h"
238 #endif
239 
240 #ifdef SHEARINGBOX
242 #endif