PLUTO  4.0
 All Data Structures Files Functions Variables Enumerations Macros Pages
mod_defs.h
Go to the documentation of this file.
1 /* ///////////////////////////////////////////////////////////////////// */
14 /* ///////////////////////////////////////////////////////////////////// */
15 
16 #ifndef RESISTIVE_RMHD
17  #define RESISTIVE_RMHD NO
18 #endif
19 
20 /* Set variable name labels.
21  We make extra vector components, when not needed, point
22  to the last element (255) of the array stored by startup.c. */
23 
24 enum {
25 
26  #if COMPONENTS == 1
27 
28  RHO, MX1, BX1, ENG, PRS = ENG,
29  #if MHD_FORMULATION == DIV_CLEANING
30  PSI_GLM,
31  #endif
32  MX2 = 255, BX2 = 255, MX3 = 255, BX3 = 255,
33 
34  #elif COMPONENTS == 2
35 
36  RHO, MX1, MX2, BX1, BX2, ENG, PRS = ENG,
37  #if MHD_FORMULATION == DIV_CLEANING
38  PSI_GLM,
39  #endif
40  MX3 = 255, BX3 = 255,
41 
42  #elif COMPONENTS == 3
43 
44  RHO, MX1, MX2, MX3, BX1, BX2, BX3, ENG, PRS = ENG,
45  #if MHD_FORMULATION == DIV_CLEANING
46  PSI_GLM,
47  #endif
48 
49  #endif
50 
51  VX1 = MX1, VX2 = MX2, VX3 = MX3,
52 
53 /* -- backward compatibility -- */
54 
55  DN = RHO, PR = PRS, EN = ENG,
56  VX = VX1, VY = VX2, VZ = VX3,
57  MX = MX1, MY = MX2, MZ = MX3,
58  BX = BX1, BY = BX2, BZ = BX3
59 
60 };
61 
62 
63 /* **************************************
64  add the PSI_GLM label if necessary
65  ************************************** */
66 /*
67 #if MHD_FORMULATION == DIV_CLEANING
68  #define PSI_GLM (2 + 2*COMPONENTS)
69  #define NFLX (2 + 2*COMPONENTS + 1)
70 #else
71  #define NFLX (2 + 2*COMPONENTS)
72 #endif
73 */
74 
75 #define NFLX (2 + 2*COMPONENTS + (MHD_FORMULATION==DIV_CLEANING))
76 
77 /* *********************************************************
78  Label the different waves in increasing order
79  following the number of vector components.
80 
81  IMPORTANT: the KPSI_GLMM & KPSI_GLMP modes are
82  present only in the MHD-GLM formulation.
83  We keep them at the END of the enumeration
84  so we can skip them in unnecessary loops.
85  Please do NOT change them !
86  ********************************************************* */
87 
88 enum KWAVES {
89  KFASTM, KFASTP, KENTRP
90 
91  #if MHD_FORMULATION != DIV_CLEANING
92  , KDIVB
93  #endif
94 
95  #if COMPONENTS >= 2
96  , KSLOWM, KSLOWP
97  #if COMPONENTS == 3
98  , KALFVM, KALFVP
99  #endif
100  #endif
101 
102  #if MHD_FORMULATION == DIV_CLEANING
103  , KPSI_GLMM, KPSI_GLMP
104  #endif
105 };
106 
107 
108 #define SUBTRACT_DENSITY YES
112 /* ********************************************************************* */
113 
123 typedef struct MAP_PARAM{
124  double D;
125  double sigma_c;
126  double E;
127  double m2;
128  double S;
129  double S2;
130  double B2;
132  double rho;
133  double W;
134  double lor;
135  double prs;
136 } Map_param;
137 
138 /* ******************************************************
139  Vector potential: these labels are and MUST only
140  be used in the STARTUP / INIT functions;
141  they're convenient in obtaining a discretization
142  that preserve divB since the beginning.
143  ****************************************************** */
144 
145 #define AX1 (NVAR + 1)
146 #define AX2 (NVAR + 2)
147 #define AX3 (NVAR + 3)
148 
149 #define AX AX1 /* backward compatibility */
150 #define AY AX2
151 #define AZ AX3
152 
153 /* *************************************************
154  Now define more convenient and user-friendly
155  pointer labels for geometry setting
156  ************************************************* */
157 
158 #if GEOMETRY == CYLINDRICAL
159 
160  #define iVR VX
161  #define iVZ VY
162  #define iVPHI VZ
163 
164  #define iMR MX
165  #define iMZ MY
166  #define iMPHI MZ
167 
168  #define iBR BX
169  #define iBZ BY
170  #define iBPHI BZ
171 
172 #endif
173 
174 #if GEOMETRY == POLAR
175 
176  #define iVR VX
177  #define iVPHI VY
178  #define iVZ VZ
179 
180  #define iMR MX
181  #define iMPHI MY
182  #define iMZ MZ
183 
184  #define iBR BX
185  #define iBPHI BY
186  #define iBZ BZ
187 
188 #endif
189 
190 #if GEOMETRY == SPHERICAL
191 
192  #define iVR VX
193  #define iVTH VY
194  #define iVPHI VZ
195 
196  #define iMR MX
197  #define iMTH MY
198  #define iMPHI MZ
199 
200  #define iBR BX
201  #define iBTH BY
202  #define iBPHI BZ
203 
204 #endif
205 
206 /* Prototyping goes here */
207 
208 int ConsToPrim (double **, double **, int, int, unsigned char *);
209 void PRIM_EIGENVECTORS (double *, double, double, double *, double **, double **);
210 
211 void Enthalpy (double **, double *, int, int);
212 void Entropy (double **, double *, int, int);
213 
214 /*
215 int EnergySolve (double *, double *);
216 int EntropySolve (double *, double *);
217 int PressureFix (double *, double *);
218 */
219 
220 int EntropySolve (Map_param *);
221 int EnergySolve (Map_param *);
222 int PressureFix (Map_param *);
223 
224 
225 void Flux (double **, double **, double *, double **, double *, int, int);
226 void HLL_Speed (double **, double **, double *, double *, double *, double *,
227  double *, double *, int, int);
228 int MaxSignalSpeed (double **, double *, double *, double *, double *, int, int);
229 
230 void PrimToCons (double **, double **, int, int);
231 void VelocityLimiter (double *, double *, double *);
232 
233 int Magnetosonic (double *vp, double cs2, double h, double *lambda);
234 int QuarticSolve (double, double, double, double, double *);
235 int CubicSolve (double, double, double, double *);
236 
237 Riemann_Solver LF_Solver, HLL_Solver, HLLC_Solver, HLLD_Solver;
238 
239 #if MHD_FORMULATION == EIGHT_WAVES
240 
241  void POWELL_DIVB_SOURCE(const State_1D *, int, int, Grid *);
242  void HLL_DIVB_SOURCE (const State_1D *, double **, int, int, Grid *);
243 
244 #elif MHD_FORMULATION == DIV_CLEANING
245 
246  #include "MHD/GLM/glm.h"
247 
248 #elif MHD_FORMULATION == CONSTRAINED_TRANSPORT
249 
250  #include "MHD/CT/ct.h"
251 
252 #endif