PLUTO  4.0
 All Data Structures Files Functions Variables Enumerations Macros Pages
cooling_defs.h
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 {
112  int nlev, nTom, isMAP, isCV, isH, isCHEB;
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