PLUTO  4.4-patch2
cooling.h
Go to the documentation of this file.
1 /* ///////////////////////////////////////////////////////////////////// */
12 /* ///////////////////////////////////////////////////////////////////// */
13 
14 /* ********************************************************
15  The number of variables used in the cooling modules
16  must also include internal energy (RHOE) for which
17  cooling functions are best defined.
18  ******************************************************** */
19 
20 #define NVAR_COOLING (NVAR+1)
21 #define RHOE NVAR
22 
23 /* ********************************************************
24  Function prototypes
25  ******************************************************** */
26 
27 double CompEquil (double, double, double *);
28 void CoolingSource (const Data *, double, timeStep *, Grid *);
29 double GetMaxRate (double *, double *, double);
30 void Jacobian (double *, double *, double **);
31 void NormalizeIons (double *);
32 void Numerical_Jacobian (double *, double **);
33 #if COOLING == POWER_LAW
34  void PowerLawCooling (Data_Arr, double, timeStep *, Grid *);
35 #endif
36 void Radiat (double *, double *);
37 
38 double SolveODE_CK45 (double *, double *, double *, double, double, intList *);
39 double SolveODE_RKF23 (double *, double *, double *, double, intList *);
40 double SolveODE_RKF12 (double *, double *, double *, double, intList *);
41 double SolveODE_RK4 (double *, double *, double *, double, intList *);
42 double SolveODE_ROS34 (double *, double *, double *, double, double);
43 
44 /* ********************************************************
45  Cooling module specific definitions
46  ******************************************************** */
47 
48 #if COOLING == H2_COOL
49  void H2RateTables(double, double *);
50 
51  #define NIONS 3
52  #define X_HI (NFLX)
53  #define X_H2 (NFLX + 1)
54  #define X_HII (NFLX + 2)
55 
56 #elif COOLING == SNEq
57 
58  #define NIONS 1
59  #define X_HI NFLX
60 
61 #elif COOLING == MINEq
62 
63 /* ########################################################
64  Notice: the order is absolutely important and it
65  MUST NOT be changed !!!
66  ######################################################## */
67 
68  #define C_IONS 3 /* in [1,5] */
69  #define N_IONS 3 /* in [1,5] */
70  #define O_IONS 3 /* in [1,5] */
71  #define Ne_IONS 3 /* in [1,5] */
72  #define S_IONS 3 /* in [1,5] */
73  #define Fe_IONS 0 /* in [0,3] */
74 
75  #if C_IONS == 0
76  #define C_EXPAND(a,b,c,d,e)
77  #elif C_IONS == 1
78  #define C_EXPAND(a,b,c,d,e) ,a
79  #elif C_IONS == 2
80  #define C_EXPAND(a,b,c,d,e) ,a,b
81  #elif C_IONS == 3
82  #define C_EXPAND(a,b,c,d,e) ,a,b,c
83  #elif C_IONS == 4
84  #define C_EXPAND(a,b,c,d,e) ,a,b,c,d
85  #elif C_IONS == 5
86  #define C_EXPAND(a,b,c,d,e) ,a,b,c,d,e
87  #endif
88 
89  #if N_IONS == 0
90  #define N_EXPAND(a,b,c,d,e)
91  #elif N_IONS == 1
92  #define N_EXPAND(a,b,c,d,e) ,a
93  #elif N_IONS == 2
94  #define N_EXPAND(a,b,c,d,e) ,a,b
95  #elif N_IONS == 3
96  #define N_EXPAND(a,b,c,d,e) ,a,b,c
97  #elif N_IONS == 4
98  #define N_EXPAND(a,b,c,d,e) ,a,b,c,d
99  #elif N_IONS == 5
100  #define N_EXPAND(a,b,c,d,e) ,a,b,c,d,e
101  #endif
102 
103  #if O_IONS == 0
104  #define O_EXPAND(a,b,c,d,e)
105  #elif O_IONS == 1
106  #define O_EXPAND(a,b,c,d,e) ,a
107  #elif O_IONS == 2
108  #define O_EXPAND(a,b,c,d,e) ,a,b
109  #elif O_IONS == 3
110  #define O_EXPAND(a,b,c,d,e) ,a,b,c
111  #elif O_IONS == 4
112  #define O_EXPAND(a,b,c,d,e) ,a,b,c,d
113  #elif O_IONS == 5
114  #define O_EXPAND(a,b,c,d,e) ,a,b,c,d,e
115  #endif
116 
117  #if Ne_IONS == 0
118  #define Ne_EXPAND(a,b,c,d,e)
119  #elif Ne_IONS == 1
120  #define Ne_EXPAND(a,b,c,d,e) ,a
121  #elif Ne_IONS == 2
122  #define Ne_EXPAND(a,b,c,d,e) ,a,b
123  #elif Ne_IONS == 3
124  #define Ne_EXPAND(a,b,c,d,e) ,a,b,c
125  #elif Ne_IONS == 4
126  #define Ne_EXPAND(a,b,c,d,e) ,a,b,c,d
127  #elif Ne_IONS == 5
128  #define Ne_EXPAND(a,b,c,d,e) ,a,b,c,d,e
129  #endif
130 
131  #if S_IONS == 0
132  #define S_EXPAND(a,b,c,d,e)
133  #elif S_IONS == 1
134  #define S_EXPAND(a,b,c,d,e) ,a
135  #elif S_IONS == 2
136  #define S_EXPAND(a,b,c,d,e) ,a,b
137  #elif S_IONS == 3
138  #define S_EXPAND(a,b,c,d,e) ,a,b,c
139  #elif S_IONS == 4
140  #define S_EXPAND(a,b,c,d,e) ,a,b,c,d
141  #elif S_IONS == 5
142  #define S_EXPAND(a,b,c,d,e) ,a,b,c,d,e
143  #endif
144 
145  #if Fe_IONS == 0
146  #define Fe_EXPAND(a,b,c)
147  #elif Fe_IONS == 1
148  #define Fe_EXPAND(a,b,c) ,a
149  #elif Fe_IONS == 2
150  #define Fe_EXPAND(a,b,c) ,a,b
151  #elif Fe_IONS == 3
152  #define Fe_EXPAND(a,b,c) ,a,b,c
153  #endif
154 
155  /* **********************************************************************
156  Ions are labeled progressively, depending on how many ionization
157  stages are effectively included in the network through the previous
158  X_EXPAND macros.
159  Elements are ordered as {H, He, C, N, O, Ne, S, Fe} and must be
160  carefully respected everywhere in the code.
161  Hydrogen and Helium are always included.
162  ********************************************************************** */
163 
164  enum {
165  X_HI = NFLX, X_HeI, X_HeII
166  C_EXPAND(X_CI, X_CII, X_CIII, X_CIV, X_CV)
167  N_EXPAND(X_NI, X_NII, X_NIII, X_NIV, X_NV)
168  O_EXPAND(X_OI, X_OII, X_OIII, X_OIV, X_OV)
169  Ne_EXPAND(X_NeI, X_NeII, X_NeIII, X_NeIV, X_NeV)
170  S_EXPAND(X_SI, X_SII, X_SIII, X_SIV, X_SV)
171  Fe_EXPAND(X_FeI, X_FeII, X_FeIII)
172  };
173 
174  #define NIONS (3+C_IONS+N_IONS+O_IONS+Ne_IONS+S_IONS+Fe_IONS)
175 
176  double H_MassFrac (void);
177  double find_N_rho ();
178 
179 #elif COOLING == POWER_LAW
180 
181  #define NIONS 0
182 
183 #elif COOLING == TABULATED
184 
185  #define NIONS 0
186 
187 #endif
double SolveODE_RKF12(double *, double *, double *, double, intList *)
Definition: cooling_ode_solver.c:265
double SolveODE_RKF23(double *, double *, double *, double, intList *)
Definition: cooling_ode_solver.c:327
void Jacobian(double *, double *, double **)
Definition: jacobian.c:4
void PowerLawCooling(Data_Arr, double, timeStep *, Grid *)
Definition: cooling.c:50
double SolveODE_RK4(double *, double *, double *, double, intList *)
Definition: cooling_ode_solver.c:221
void Radiat(double *, double *)
Definition: radiat.c:113
Definition: structs.h:503
Definition: structs.h:124
void CoolingSource(const Data *, double, timeStep *, Grid *)
Definition: cooling_source.c:44
double H_MassFrac(void)
Definition: radiat.c:738
Definition: structs.h:514
double SolveODE_CK45(double *, double *, double *, double, double, intList *)
Definition: cooling_ode_solver.c:26
double GetMaxRate(double *, double *, double)
Definition: maxrate.c:4
void Numerical_Jacobian(double *, double **)
Definition: cooling_source.c:229
void H2RateTables(double, double *)
Definition: radiat.c:25
double CompEquil(double, double, double *)
Definition: comp_equil.c:44
Definition: structs.h:363