PLUTO
cooling_defs.h
Go to the documentation of this file.
1 /* ############################################################
2 
3  FILE: cooling_defs.h
4 
5  PURPOSE: contains shared definitions with scope
6  limited to the cooling module ONLY
7 
8  ############################################################ */
9 
10 /* ##############################################################
11 
12  P R O T O T Y P I N G
13 
14  ############################################################## */
15 
16 void Check_Species (double *);
17 void Find_Rates(double T, double Ne, double N, double *v);
18 double find_N_rho ();
19 int Create_Ion_Coeff_Tables(double ***);
20 int Create_Losses_Tables(double ***, int *, int *);
21 
22 /* ############################################################################
23 
24  New structures
25 
26  ############################################################################ */
27 
28 typedef struct COOLING_COEFFICIENTS
29 {
30  double Lrate[NIONS]; /* Abundance increase rates. This is to be multiplied with N(x-1) - it's the ionization from x-1 to x */
31  double Crate[NIONS]; /* Abundance decrease rates. This is to be multiplied with N(x) - it's the ionization/recombination from x */
32  double Rrate[NIONS]; /* Abundance increase rates. This is to be multiplied with N(x+1) - it's the recombination from x+1 to x */
33  double N; /* Total number density */
34  double Ne; /* Electron number density ( cm^{-3} ) */
35  double T; /* Temperature (K) */
36  double La[NIONS]; /* The coefficient of N_el in Lrate */
37  double Lb[NIONS]; /* The coefficient of X_H in Lrate */
38  double Lc[NIONS]; /* The coefficient of X_He in Lrate */
39  double Ca[NIONS]; /* The coefficient of N_el in Crate */
40  double Cb[NIONS]; /* The coefficient of X_H in Crate */
41  double Cc[NIONS]; /* The coefficient of X_He in Crate */
42  double Ra[NIONS]; /* The coefficient of N_el in Rrate */
43  double Rb[NIONS]; /* The coefficient of X_H in Rrate */
44  double Rc[NIONS]; /* The coefficient of X_He in Rrate */
45  double muN, muD; /* The numerator and denominator of the mean molecular weight - used for d\mu computations */
46  double de[NIONS]; /* The radiative losses read from cooling tables, interpolated for T and N_el */
47  double de_dne[NIONS]; /* The slope coefficient in the radiative losses interpolation function of N_el */
48 
49 /* -------- NEW ENTRIES -------- */
50 
51  double dnel_dX[NIONS];
52  double fCH, fRH;
53  double dmuN_dX[NIONS];
54  double dmuD_dX[NIONS];
55  double dLIR_dX[NIONS];
56 
57 } COOL_COEFF;
58 
59 
60 /* **********************************************************************
61  Macros
62  ********************************************************************** */
63 
64 #define dEtoA(x) (12375./(x))
65 #define to_ev(T) (1.38/1.602*1.e-4*(T))
66 
67 /* **********************************************************************
68  label elements and ions
69  ********************************************************************** */
70 
71 #define el_H 0
72 #define el_He 1
73 #define el_C 2
74 #define el_N 3
75 #define el_O 4
76 #define el_Ne 5
77 #define el_S 6
78 #define el_Fe 7
79 
80 /* ############################################################################
81 
82  Global variable declaration. They are defined in radiat.c
83 
84  ############################################################################ */
85 
86 extern const double elem_ab[8]; /* Number fractions */
87 extern double elem_ab_sol[7]; /* Number fractions, Solar */
88 extern double elem_ab_uni[7]; /* Number fractions, Universe */
89 extern const double elem_mass[8]; /* Atomic mass, in a.m.u. */
90 extern const int elem_part[31];
91 extern const double rad_rec_z[31];
92 extern const double coll_ion_dE[31];
93 extern COOL_COEFF CoolCoeffs;
94 
95 /* ****************************************************
96  First, the definitions for the
97  Radiative Losses Tables computation
98  **************************************************** */
99 
100 
101 /* ****************************************************
102  nlev = number of levels involved
103  A = transition probabilities in sec^(-1)
104  wgth = statistical weights
105  dE = energy of the transition in eV
106  N = Abundance of the ion;
107  Ni = populations of the level;
108  notice that we must have \sum Ni = N
109  **************************************************** */
110 
111 typedef struct ION {
113  double N;
114  double wght[16]; /* max number of levels in a ion is 16 */
115  double Ni[16];
116  double **A, **dE;
117  double ***omega, Tom[8];
118 } Ion;
119 
120 /* Lagrange interpolation function */
121 double lagrange (double *x, double *y, double xp, int n, int ii, int jj);
122 
123 /* Linear system solver */
124 void Solve_System (Ion *X, double Ne, double T);
125 void Symmetrize_Coeff (Ion *X);
126 
127 /* Emission lines definitions */
128 void INIT_ATOM(Ion *, int);
129 void HI_INIT (Ion *HIv);
130 void HeI_INIT (Ion *HeIv);
131 void HeII_INIT (Ion *HeIIv);
132 void CI_INIT (Ion *CIv);
133 void CII_INIT (Ion *CIIv);
134 void CIII_INIT (Ion *CIIv);
135 void CIV_INIT (Ion *CIIv);
136 void CV_INIT (Ion *CIIv);
137 void NI_INIT (Ion *NIv);
138 void NII_INIT (Ion *NIIv);
139 void NIII_INIT (Ion *NIIIv);
140 void NIV_INIT (Ion *NIIIv);
141 void NV_INIT (Ion *NIIIv);
142 void OI_INIT (Ion *OIv);
143 void OII_INIT (Ion *OIIv);
144 void OIII_INIT (Ion *OIIIv);
145 void OIV_INIT (Ion *OIVv);
146 void OV_INIT (Ion *OVv);
147 void NeI_INIT (Ion *NeIv);
148 void NeII_INIT (Ion *NeIIv);
149 void NeIII_INIT (Ion *NeIIIv);
150 void NeIV_INIT (Ion *NeIIIv);
151 void NeV_INIT (Ion *NeIIIv);
152 void SI_INIT (Ion *SIIv);
153 void SII_INIT (Ion *SIIv);
154 void SIII_INIT (Ion *SIIv);
155 void SIV_INIT (Ion *SIIv);
156 void SV_INIT (Ion *SIIv);
157 void FeI_INIT (Ion *FeIv);
158 void FeII_INIT (Ion *FeIIv);
159 void FeIII_INIT (Ion *FeIIIv);
160 
161 /* -----------------------------------------------
162  Configure ionization tables parameters here:
163  start temperature, temperature step,
164  number of steps, number of ion species
165  ----------------------------------------------- */
166 
167 #define kB 8.617343e-5
168 
169 #define I_g_stepNumber 40000
170 #define I_TSTEP 10.0
171 #define I_TBEG 500.0
172 #define I_TEND (I_TBEG+(I_g_stepNumber-1)*I_TSTEP)
173 
174 /* --------------------------------------------------------
175  Configure cooling tables parameters here:
176  electron number density range (C_NeMIN to C_NeMAX),
177  -------------------------------------------------------- */
178 
179 #define C_NeMIN 1.0e-2
180 #define C_NeMAX 1.0e+8
181 #define C_NeSTEP 0.12
182 
183 #define C_TMIN 2000.0
184 #define C_TMAX 2.0e+5
185 #define C_TSTEP 0.025
186 
187 
188 
189 
190 
191 
double dnel_dX[NIONS]
Definition: cooling_defs.h:51
void CIV_INIT(Ion *CIIv)
Definition: ion_init.c:945
double lagrange(double *x, double *y, double xp, int n, int ii, int jj)
Definition: make_tables.c:161
tuple T
Definition: Sph_disk.py:33
double dLIR_dX[NIONS]
Definition: cooling_defs.h:55
double Crate[NIONS]
Definition: cooling_defs.h:31
double de_dne[NIONS]
Definition: cooling_defs.h:47
double Cc[NIONS]
Definition: cooling_defs.h:41
void OIII_INIT(Ion *OIIIv)
Definition: ion_init.c:2021
double Rb[NIONS]
Definition: cooling_defs.h:43
static int n
Definition: analysis.c:3
int nlev
Definition: cooling_defs.h:112
int isCHEB
Definition: cooling_defs.h:112
const double elem_ab[8]
Definition: radiat.c:9
void CI_INIT(Ion *CIv)
Definition: ion_init.c:468
void FeII_INIT(Ion *FeIIv)
Definition: ion_init.c:3488
void HeII_INIT(Ion *HeIIv)
Definition: ion_init.c:400
const double rad_rec_z[31]
Definition: radiat.c:24
COOL_COEFF CoolCoeffs
Definition: radiat.c:38
double de[NIONS]
Definition: cooling_defs.h:46
double Lrate[NIONS]
Definition: cooling_defs.h:30
const double elem_mass[8]
Definition: radiat.c:14
int nTom
Definition: cooling_defs.h:112
double Tom[8]
Definition: cooling_defs.h:117
double Lb[NIONS]
Definition: cooling_defs.h:37
void SIII_INIT(Ion *SIIv)
Definition: ion_init.c:3077
void FeIII_INIT(Ion *FeIIIv)
Definition: ion_init.c:3817
const double coll_ion_dE[31]
Definition: radiat.c:31
double find_N_rho()
Definition: radiat.c:694
void CII_INIT(Ion *CIIv)
Definition: ion_init.c:656
void NV_INIT(Ion *NIIIv)
Definition: ion_init.c:1711
int isH
Definition: cooling_defs.h:112
double La[NIONS]
Definition: cooling_defs.h:36
void Check_Species(double *)
void NeI_INIT(Ion *NeIv)
Definition: ion_init.c:2350
#define X
double N
Definition: cooling_defs.h:113
double dmuN_dX[NIONS]
Definition: cooling_defs.h:53
#define NIONS
Definition: cooling.h:28
void OIV_INIT(Ion *OIVv)
Definition: ion_init.c:2136
double ** dE
Definition: cooling_defs.h:116
double Ni[16]
Definition: cooling_defs.h:115
void OII_INIT(Ion *OIIv)
Definition: ion_init.c:1907
const int elem_part[31]
Definition: radiat.c:16
void SII_INIT(Ion *SIIv)
Definition: ion_init.c:2914
void NeII_INIT(Ion *NeIIv)
Definition: ion_init.c:2404
double Rrate[NIONS]
Definition: cooling_defs.h:32
void OV_INIT(Ion *OVv)
Definition: ion_init.c:2233
double Rc[NIONS]
Definition: cooling_defs.h:44
void NI_INIT(Ion *NIv)
Definition: ion_init.c:1092
double dmuD_dX[NIONS]
Definition: cooling_defs.h:54
void NeIV_INIT(Ion *NeIIIv)
Definition: ion_init.c:2567
double elem_ab_sol[7]
Definition: radiat.c:12
double ** A
Definition: cooling_defs.h:116
void NeV_INIT(Ion *NeIIIv)
Definition: ion_init.c:2682
struct ION Ion
int isMAP
Definition: cooling_defs.h:112
double Ra[NIONS]
Definition: cooling_defs.h:42
void NIV_INIT(Ion *NIIIv)
Definition: ion_init.c:1619
void SI_INIT(Ion *SIIv)
Definition: ion_init.c:2792
void HI_INIT(Ion *HIv)
Definition: ion_init.c:83
void INIT_ATOM(Ion *, int)
Definition: ion_init.c:25
void Find_Rates(double T, double Ne, double N, double *v)
Definition: radiat.c:413
void OI_INIT(Ion *OIv)
Definition: ion_init.c:1767
double Lc[NIONS]
Definition: cooling_defs.h:38
void CV_INIT(Ion *CIIv)
Definition: ion_init.c:1007
int isCV
Definition: cooling_defs.h:112
void FeI_INIT(Ion *FeIv)
Definition: ion_init.c:3434
void HeI_INIT(Ion *HeIv)
Definition: ion_init.c:286
double Ca[NIONS]
Definition: cooling_defs.h:39
double *** omega
Definition: cooling_defs.h:117
int Create_Losses_Tables(double ***, int *, int *)
Definition: make_tables.c:841
double wght[16]
Definition: cooling_defs.h:114
void NIII_INIT(Ion *NIIIv)
Definition: ion_init.c:1409
void Symmetrize_Coeff(Ion *X)
Definition: make_tables.c:97
int Create_Ion_Coeff_Tables(double ***)
Definition: make_tables.c:200
double elem_ab_uni[7]
Definition: radiat.c:13
double Cb[NIONS]
Definition: cooling_defs.h:40
void CIII_INIT(Ion *CIIv)
Definition: ion_init.c:824
void SV_INIT(Ion *SIIv)
Definition: ion_init.c:3319
void NeIII_INIT(Ion *NeIIIv)
Definition: ion_init.c:2458
void NII_INIT(Ion *NIIv)
Definition: ion_init.c:1234
void SIV_INIT(Ion *SIIv)
Definition: ion_init.c:3187
void Solve_System(Ion *X, double Ne, double T)
Definition: make_tables.c:5
struct COOLING_COEFFICIENTS COOL_COEFF