PLUTO  4.4-patch2
mod_defs.h
Go to the documentation of this file.
1 /* ///////////////////////////////////////////////////////////////////// */
13 /* ///////////////////////////////////////////////////////////////////// */
14 
15 #ifndef ResRMHD_RESISTIVITY
16  #define ResRMHD_RESISTIVITY IMEX
17 #endif
18 
19 /* *********************************************************
20  Set flow variable indices.
21  Extra vector components, when not needed, point to the
22  last element (255) of the array stored by startup.c.
23  ********************************************************* */
24 
25 #define RHO 0
26 #define MX1 1
27 #define MX2 2
28 #define MX3 3
29 #define BX1 4
30 #define BX2 5
31 #define BX3 6
32 
33 #if HAVE_ENERGY
34  #define ENG 7
35  #define PRS ENG
36 #endif
37 
38 #define EX1 8
39 #define EX2 9
40 #define EX3 10
41 #if DIVB_CONTROL != CONSTRAINED_TRANSPORT
42 #define CRG 11
43 #endif
44 
45 
46 #if DIVB_CONTROL == DIV_CLEANING
47  #define PSI_GLM (CRG + 1)
48  #define PHI_GLM (CRG + 2)
49  #define DIV_COMP 2
50 #else
51  #define DIV_COMP 0
52 #endif
53 
54 #define VX1 MX1
55 #define VX2 MX2
56 #define VX3 MX3
57 
58 #ifdef CRG
59 #define NFLX (10 + DIV_COMP + HAVE_ENERGY + 1) /* 1 = density, charge */
60 #else
61 #define NFLX (10 + DIV_COMP + HAVE_ENERGY) /* 1 = density, charge */
62 #endif
63 
64 /* *********************************************************
65  Label the different waves in increasing order
66  following the number of vector components.
67 
68  IMPORTANT: the KPSI_GLMM & KPSI_GLMP modes are
69  present only in the MHD-GLM formulation.
70  We keep them at the END of the enumeration
71  so we can skip them in unnecessary loops.
72  Please do NOT change them !
73  ********************************************************* */
74 
75 enum KWAVES {
76  KFASTM, KFASTP, KENTRP
77 
78  #if DIVB_CONTROL != DIV_CLEANING
79  , KDIVB
80  #endif
81 
82  , KSLOWM, KSLOWP, KALFVM, KALFVP
83 
84  #if DIVB_CONTROL == DIV_CLEANING
85  , KPSI_GLMM, KPSI_GLMP
86  #endif
87 };
88 
89 
90 /* ********************************************************************* */
101 typedef struct Map_Param_{
102  double D;
103  double sigma_c;
104  double E;
105  double m2;
106  double S;
107  double S2;
108  double B2;
110  double rho;
111  double W;
112  double lor;
113  double prs;
114  double *u;
115 } Map_param;
116 
117 /* ******************************************************
118  Vector potential: these labels are and MUST only
119  be used in the STARTUP / INIT functions;
120  they're convenient in obtaining a discretization
121  that preserve divB since the beginning.
122  ****************************************************** */
123 
124 #define AX1 (NVAR + 1)
125 #define AX2 (NVAR + 2)
126 #define AX3 (NVAR + 3)
127 
128 #define AX AX1 /* backward compatibility */
129 #define AY AX2
130 #define AZ AX3
131 
132 /* ***********************************************************
133  \cond REPEAT_FUNCTION_DOCUMENTATION_IN_HEADER_FILES
134  Function prototyping
135  *********************************************************** */
136 
137 void ComputeCurrent(double *, double *);
138 void ComputeElectricField(double *, double *);
139 
140 int ConsToPrim (double **, double **, int, int, uint16_t *);
141 void ConvertTo4vel (double **, int, int);
142 void ConvertTo3vel (double **, int, int);
143 
144 void Flux (const State *, int, int);
145 
146 void HLL_Speed (const State *, const State *, double *, double *, int, int);
147 void HLL_Speed_RHD (const State *, const State *stateR,
148  double *, double *SR, int beg, int end);
149 void HLL_Speed_RMHD (const State *, const State *, double *, double *, int, int);
150 
151 int Magnetosonic (double *, double, double, double *);
152 int MaxSignalSpeed (const State *, double *, double *, int, int);
153 void MaxSignalSpeed_RHD (const State *, double *, double *, int, int);
154 
155 void IMEXImplicitUpdate (Data *d, double, Data_Arr, Data_Arr, Grid *);
156 
157 int PressureFix (double *, double *, double *);
158 void PrimToCons (double **, double **, int, int);
159 double Resistive_eta(double *, double, double, double);
160 
161 Riemann_Solver FluxSplitting_LF_Solver, LF_Solver, HLL_Solver;
162 Riemann_Solver GMUSTA1_Solver, MHLL_Solver, MHLLC_Solver;
163 
165 int RHD_EnergySolve (double *, double *);
166 int RHD_EntropySolve (double *, double *);
167 int RHD_PressureFix (double *, double *);
168 void VelocityLimiter (double *, double *, double *);
169 
170 /* ********************************************************
171  CHARGE_SCHEME selects how electric field evolution and
172  charge should be coupled.
173 
174  0: Charge is evolved and Lagrangian multiplier make sure
175  div(E) = q is enforce by GLM;
176 
177  1: Charge is evolved but never used in the definition of J.
178  Instead div(E) is used where E is given by the fluxes
179  of the scalar multiplier.
180 
181  2: Same as scheme 0, but source terms for E and phi_glm
182  are all included during the IMEX step.
183  ******************************************************** */
184 #ifndef CHARGE_SCHEME
185  #define CHARGE_SCHEME 0
186 #endif
187 
188 #ifndef RMHD_REDUCED_ENERGY
189  #define RMHD_REDUCED_ENERGY NO
192 #endif
193 
194 #ifndef USE_NEWTON_BROYDEN // YES /NO
195  #define USE_NEWTON_BROYDEN YES
196 #endif
197 
198 #if DIVB_CONTROL == EIGHT_WAVES
199  void POWELL_DIVB_SOURCE(const Sweep *, int, int, Grid *);
200  void HLL_DIVB_SOURCE (const Sweep *, double **, int, int, Grid *);
201 #elif DIVB_CONTROL == DIV_CLEANING
202  #include "MHD/GLM/glm.h"
203 #elif DIVB_CONTROL == CONSTRAINED_TRANSPORT
204  #include "MHD/CT/ct.h"
205 #endif
206 
207 /* \endcond */
int RMHD_EnergySolve(Map_param *)
Definition: rmhd_energy_solve.c:28
double W
Definition: mod_defs.h:111
double m2
Definition: mod_defs.h:105
void HLL_Speed_RHD(const State *stateL, const State *stateR, double *SL, double *SR, int beg, int end)
Definition: hll_speed.c:68
void VelocityLimiter(double *, double *, double *)
Definition: vel_limiter.c:16
double S2
Definition: mod_defs.h:107
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
int RHD_PressureFix(double *, double *)
Definition: rhd_pressure_fix.c:28
void IMEXImplicitUpdate(Data *data, double dt1, Data_Arr S, Data_Arr Jf, Grid *grid)
Definition: imex_source.c:27
void PrimToCons(double **, double **, int, int)
Definition: mappers.c:26
double * u
Definition: mod_defs.h:114
Definition: structs.h:124
double lor
Definition: mod_defs.h:112
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.
int RHD_EntropySolve(double *, double *)
Definition: rhd_entropy_solve.c:21
double rho
Definition: mod_defs.h:110
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
double sigma_c
Definition: mod_defs.h:103
Definition: structs.h:514
double D
Definition: mod_defs.h:102
double B2
Definition: mod_defs.h:108
Definition: structs.h:261
int RHD_EnergySolve(double *, double *)
Definition: rhd_energy_solve.c:25
double prs
Definition: mod_defs.h:113
double S
Definition: mod_defs.h:106
void Resistive_eta(double *v, double x1, double x2, double x3, double *J, double *eta)
Definition: res_eta.c:17
double E
Definition: mod_defs.h:104
Definition: structs.h:289