PLUTO
mod_defs.h
Go to the documentation of this file.
1 /* ///////////////////////////////////////////////////////////////////// */
2 /*!
3  \file
4  \brief Set labels, indexes and prototypes for the MHD module.
5 
6  Contains basic macro definitions, structure definitions and global
7  variable declarations used by the MHD module.
8 
9  \author A. Mignone (mignone@ph.unito.it)
10  \date April, 2, 2015
11 */
12 /* ///////////////////////////////////////////////////////////////////// */
13 
14 /* *********************************************************
15  Set flow variable indices.
16  Extra vector components, when not needed, point to the
17  last element (255) of the array stored by startup.c.
18  ********************************************************* */
19 
20 #define RHO 0
21 
22 #define MX1 1
23 #define MX2 (COMPONENTS >= 2 ? 2: 255)
24 #define MX3 (COMPONENTS == 3 ? 3: 255)
25 #define BX1 (COMPONENTS + 1)
26 #define BX2 (COMPONENTS >= 2 ? (BX1+1): 255)
27 #define BX3 (COMPONENTS == 3 ? (BX1+2): 255)
28 
29 #if HAVE_ENERGY
30  #define ENG (2*COMPONENTS + 1)
31  #define PRS ENG
32 #endif
33 #if DIVB_CONTROL == DIV_CLEANING
34  #define PSI_GLM (2*COMPONENTS + 1 + HAVE_ENERGY)
35 #endif
36 
37 #define VX1 MX1
38 #define VX2 MX2
39 #define VX3 MX3
40 
41 #define NFLX (1 + 2*COMPONENTS + HAVE_ENERGY + (DIVB_CONTROL == DIV_CLEANING))
42 
43 /* ****************************************************************
44  **************************************************************** */
45 
46 /* ********************************************************************* */
47 /*! Label the different waves in increasing order
48  following the number of vector components.
49 
50  \b IMPORTANT: the KPSI_GLMM & KPSI_GLMP modes are
51  present only in the MHD-GLM formulation.
52  We keep them at the END of the enumeration
53  so we can skip them in unnecessary loops.
54  Please do NOT change them !
55  ********************************************************************* */
56 
57 enum KWAVES {
59  #if HAVE_ENERGY
60  , KENTRP
61  #endif
62 
63  #if DIVB_CONTROL != DIV_CLEANING
64  , KDIVB
65  #endif
66 
67  #if COMPONENTS >= 2
68  , KSLOWM, KSLOWP
69  #if COMPONENTS == 3
70  , KALFVM, KALFVP
71  #endif
72  #endif
73 
74  #if DIVB_CONTROL == DIV_CLEANING
76  #endif
77 };
78 
79 /*! \name Vector Potential Labels
80  These may only be used in the STARTUP / INIT functions.
81  They're convenient in obtaining a discretization that preserve
82  the divergence-free condition (for staggered field) or if you simply
83  wish to initialize the magnetic field from the vector potential. */
84 /**@{ */
85 #define AX1 (NVAR + 1)
86 #define AX2 (NVAR + 2)
87 #define AX3 (NVAR + 3)
88 /**@} */
89 
90 #define AX AX1
91 #define AY AX2
92 #define AZ AX3
93 
94 /* *************************************************
95  Now define more convenient and user-friendly
96  pointer labels for geometry setting
97  ************************************************* */
98 
99 #if GEOMETRY == CARTESIAN
100  #define VX VX1
101  #define VY VX2
102  #define VZ VX3
103 
104  #define MX MX1
105  #define MY MX2
106  #define MZ MX3
107 
108  #define BX BX1
109  #define BY BX2
110  #define BZ BX3
111 #endif
112 
113 #if GEOMETRY == CYLINDRICAL
114  #define iVR VX1
115  #define iVZ VX2
116  #define iVPHI VX3
117 
118  #define iMR MX1
119  #define iMZ MX2
120  #define iMPHI MX3
121 
122  #define iBR BX1
123  #define iBZ BX2
124  #define iBPHI BX3
125 #endif
126 
127 #if GEOMETRY == POLAR
128  #define iVR VX1
129  #define iVPHI VX2
130  #define iVZ VX3
131 
132  #define iMR MX1
133  #define iMPHI MX2
134  #define iMZ MX3
135 
136  #define iBR BX1
137  #define iBPHI BX2
138  #define iBZ BX3
139 #endif
140 
141 #if GEOMETRY == SPHERICAL
142  #define iVR VX1
143  #define iVTH VX2
144  #define iVPHI VX3
145 
146  #define iMR MX1
147  #define iMTH MX2
148  #define iMPHI MX3
149 
150  #define iBR BX1
151  #define iBTH BX2
152  #define iBPHI BX3
153 #endif
154 
155 /* ***********************************************************
156  \cond REPEAT_FUNCTION_DOCUMENTATION_IN_HEADER_FILES
157  Function prototyping
158  *********************************************************** */
159 
160 void BackgroundField (double x1, double x2, double x3, double *B0);
161 
162 #if BACKGROUND_FIELD == YES
163  double **GetBackgroundField (int, int, int, Grid *);
164 #endif
165 
166 int ConsToPrim (double **, real **, int , int, unsigned char *);
167 void Eigenvalues (double **, double *, double **, int, int);
168 
169 void PrimEigenvectors (double *, double, double, double *, double **, double **);
170 void ConsEigenvectors (double *, double *, double,
171  double **, double **, double *);
172 
173 void Flux (double **, double **, double *, double **, double **,
174  double *, int, int);
175 void HLL_Speed (double **, double **, double *, double *, double **,
176  double *, double *, int, int);
177 void MaxSignalSpeed (double **, double *, double *, double *, double **, int, int);
178 void PrimToCons (double **, double **, int, int);
179 void PrimRHS (double *, double *, double, double, double *);
180 void PrimSource (const State_1D *, int, int,
181  double *, double *, double **, Grid *);
182 
183 #if DIVB_CONTROL == EIGHT_WAVES
184 
185  void Roe_DivBSource (const State_1D *, int, int, Grid *);
186  void HLL_DivBSource (const State_1D *, double **, int, int, Grid *);
187 
188 #elif DIVB_CONTROL == DIV_CLEANING
189 
190  #include "MHD/GLM/glm.h"
191 
192 #elif DIVB_CONTROL == CONSTRAINED_TRANSPORT
193 
194  #include "MHD/CT/ct.h"
195 
196 #endif
197 
201 
202 
203 #if RESISTIVITY != NO
204  #include "Resistivity/res.h"
205 #endif
206 
207 #ifdef SHEARINGBOX
209 #endif
210 /* \endcond */
void Flux(double **, double **, double *, double **, double *, int, int)
Definition: fluxes.c:23
void HLL_DivBSource(const State_1D *state, double **Uhll, int beg, int end, Grid *grid)
Definition: source.c:179
double real
Definition: pluto.h:488
void Riemann_Solver(const State_1D *, int, int, double *, Grid *)
Definition: pluto.h:489
void BackgroundField(double x1, double x2, double x3, double *B0)
Definition: init.c:79
Riemann_Solver HLLC_Solver
Definition: mod_defs.h:106
Riemann_Solver Roe_Solver
Definition: mod_defs.h:106
void PrimToCons(double **, double **, int, int)
Definition: mappers.c:26
Riemann_Solver HLL_Linde_Solver
Definition: mod_defs.h:221
KWAVES
Definition: mod_defs.h:80
Header file for GLM Divergence Cleaning.
double ** GetBackgroundField(int beg, int end, int where, Grid *grid)
Definition: bckgrnd_field.c:5
Header file for Constrained-Transport (CT) module.
int ConsToPrim(double **, double **, int, int, unsigned char *)
Definition: mappers.c:89
void Eigenvalues(double **, double *, double **, int, int)
Definition: eigenv.c:67
void HLL_Speed(double **, double **, double *, double *, double *, double *, int, int)
Definition: hll_speed.c:24
Definition: structs.h:78
void Roe_DivBSource(const State_1D *state, int is, int ie, Grid *grid)
Definition: source.c:39
void ConsEigenvectors(double *, double *, double, double **, double **, double *)
Definition: eigenv.c:279
void PrimSource(const State_1D *, int, int, double *, double *, double **, Grid *)
Definition: prim_eqn.c:71
Riemann_Solver HLLD_Solver
Definition: mod_defs.h:221
Shearing-Box module header file.
void MaxSignalSpeed(double **, double *, double *, double *, int, int)
Definition: eigenv.c:34
Riemann_Solver HLL_Solver
Definition: mod_defs.h:106
Resistive MHD module header file.
Riemann_Solver LF_Solver
Definition: mod_defs.h:106
void PrimRHS(double *, double *, double, double, double *)
Definition: prim_eqn.c:31
void PrimEigenvectors(double *, double, double, double *, double **, double **)
Definition: eigenv.c:91