root/branches/newmole/source/atmdat.h

Revision 2346, 10.4 kB (checked in by rjrw, 5 months ago)

Merged from trunk r2137:2345

  • Property svn:eol-style set to native
Line 
1/* This file is part of Cloudy and is copyright (C)1978-2008 by Gary J. Ferland and
2 * others.  For conditions of distribution and use see copyright notice in license.txt */
3
4#ifndef _ATMDAT_H_
5#define _ATMDAT_H_
6
7
8 /**
9  atmdat_2phot_shapefunction two photon emission function for all atomic and ionic species
10  \param  EbyE2nu
11  \param  ipISO
12  \param  nelem
13 */ 
14double atmdat_2phot_shapefunction( double EbyE2nu, long ipISO, long nelem );
15
16/**
17        atmdat_2phot_rate hydrogen two photon emission, including induced emission
18        \param ipZ   atomic number on c scale
19        \param ipISO  the iso sequence, must be either 0 (hydrogen) or 1 (he-like)
20 */ 
21void atmdat_2phot_rate(
22        long ipZ ,
23        long ipISO );
24
25 /**
26  atmdat_readin read in some data files, but only if this is very first call
27 */ 
28void atmdat_readin(void);
29
30 /**
31  atmdat_Chianti_readin read in data from Chianti database files
32  \param intNS
33 */ 
34void atmdat_Chianti_readin( long intNS );
35
36 /**
37  atmdat_lamda_readin read in data from LAMDA database files
38  \param intNS
39 */ 
40void atmdat_lamda_readin( long intNS );
41
42
43 /**
44  atmdat_outer_shell determine outer shell, and statistical weights of that and higher ion, for any ion
45  written by Dima Verner
46  \param [in] iz  atomic number from 1 to 30
47  \param [in] in  number of electrons from 1 to iz
48  \param [out] *imax  number of the outer shell
49  \param [out] *ig0   statistical weight of (iz,in) ground state
50  \param [out] *ig1 statistical weight of (iz,in-1) ground state
51  \author Dima Verner
52 */ 
53void atmdat_outer_shell(
54  long int iz,
55  long int in,
56  long int *imax,
57  long int *ig0,
58  long int *ig1);
59
60 /**
61  atmdat fill in the HCharExcIonOf and Rec arrays with Kingdon's fitted CT with H,
62  \param  O_HIonRate
63  \return value is rate O ionizes H
64 */ 
65void ChargTranEval( double *O_HIonRate );
66
67/**
68 sum up the charge transfer heating
69 \return
70*/ 
71double ChargTranSumHeat(void);
72
73/*ChargTranPun punch charge transfer rate coefficients */
74 /**
75  punch charge transfer rate coefficients
76  \param ipPnunit
77  \param chPunch
78 */ 
79void ChargTranPun( FILE* ipPnunit , char* chPunch );
80
81 /**
82  atmdat_dielrec_fe Dielectronic recombination rates for Fe from Arnaud & Raymond 1992
83  \param  ion
84  \param  t
85 */ 
86double atmdat_dielrec_fe(long int ion, double t);
87
88/** this initializes the arrays containing the fitting coefficients,
89 * called by OpacityCreateAll, done once per coreload */
90void atmdat_H_phot_cs(void);
91
92/**atmdat_3body derive three-body recombination coefficients */
93void atmdat_3body(void);
94
95 /**
96 general utility to read in line emissivities from the Storey & Hummer tables
97 of case B emissivities. 
98\param iHi the principal quantum numbers, .     
99\param iLo upper and lower levels in any order
100\param iZ charge of ion, only 1 and 2 for now   
101\param TempIn temperature, must lie within the range of the table, which depends on the ion charge, and is 500 - 30,000K for hydrogen
102\param DenIn the density and must lie within the range of the table
103\param chCase case - 'a' or 'b'
104 */ 
105double atmdat_HS_caseB(
106        long int iHi, long int iLo, long int iZ, double TempIn,
107        double DenIn,
108        char chCase
109        );
110
111/**atmdat_DielSupres derive scale factors for suppression of Burgess dielectronic recombination */
112void atmdat_DielSupres(void);
113
114/* these are the vectors that store the original Hummer and Storey case B
115 * line data for H and He - the declaration for the interpolator follows */
116#define NHSDIM 15 /**< used for following vectors*/
117#define NLINEHS 300  /**< dimension of array with lines*/
118#define HS_NZ 8 /**< number of elements that can be read in */
119#define NHCSTE  8 /**< number of temperature points in h_coll_str arrays */
120
121EXTERN struct t_atmdat {
122        /**
123         * ion, nelem
124         * these arrays save the charge transfer ionization and recombination
125         * rates for the heavy elements onto hydrogen.  ionization is
126         * of the heavy element, and so is a recombination for hydrogen
127         *
128         * HCharExcIonOf( ion , nelem ), HCharExcRecTo( ion , nelem )
129         * charge transfer ionization of atomic oxygen = HCharExcIonOf[ipOXYGEN][0]*hii
130         * charge transfer recombination of ionized oxygen = HCharExcRecTo[ipOXYGEN][0]*hi
131         * HCharHeatMax, HCharCoolMax are largest fractions of local heating
132         * or cooling due to ct
133         * HCharHeatOn usually 1, set to 0 with no CTHeat command
134         */
135        /** CharExcIon is ionization, */
136        /** [0] is Atom^0 + H+ => Atom+1 + H0
137         * [n] is Atom^+n + H+ => Atom^+n-1 + H0 */
138
139        /** CharExcRec is recombination */
140        /** [0] is Atom^+1 + H0 => Atom^0 + H^+
141         * [n] is Atom^+n+1 + H0 => Atom^+n + H^+ */
142        double HCharExcIonOf[LIMELM][LIMELM+1], //(cm3 s-1)
143          HCharExcRecTo[LIMELM][LIMELM+1],              //(cm3 s-1)
144          HCharHeatMax,
145          HCharCoolMax,
146          HCharHeatOn;
147
148        /* rate coefficient (cm3 s-1) for N+(3P) + H+ -> N(2D) + H+ charge transfer*/
149        double HCharExcRecTo_N0_2D;
150
151        /** this is total rate (s-1) for ct ionization and recombination of H */
152        double HCharExcIonTotal,
153          HCharExcRecTotal;
154
155        /** this is total rate (s-1) for ct ionization and recombination of He */
156        double HeCharExcIonTotal,
157          HeCharExcRecTotal;
158
159        /** this is the current ratio of ct ionization of H, relative to total dest rate*/
160        double HIonFrac;
161
162        /** this is the largest ratio of ct ionization of H, relative to total dest rate*/
163        double HIonFracMax;
164
165        /**
166         *these are the charge ionization and recombination arrays
167         *that go into the ionization balance
168         *Ion[ion] is ionization, Rec[ion] is recombination
169         *units cm3 s-1
170         */
171        double HeCharExcIonOf[LIMELM][LIMELM],
172          HeCharExcRecTo[LIMELM][LIMELM];
173
174        /** Dalgarno H charge transfer rate coefficient for high stages of ionization
175         * default is 1.92e-9 in zero, reset with 'set charge transfer' command */
176        double HCTAlex;
177
178        /** variable to turn on or off ct ionization-recombination of
179         * all elements - set off with no charge transfer command */
180        bool lgCTOn;
181
182        /** these are the density and temperature mesh points on the
183         * original Hummer & Storey data, for H[0] and He[1], */
184        double Density[2][HS_NZ][NHSDIM],
185                ElecTemp[2][HS_NZ][NHSDIM],
186                /**emiss[ipTemp][ipDens][ipLevel]*/
187                Emiss[2][HS_NZ][NHSDIM][NHSDIM][NLINEHS];
188
189        /** saves the number of density temperature mesh points for the two cases for
190         * the HS_NZ elements */
191        long int nDensity[2][HS_NZ] , ntemp[2][HS_NZ] , ncut[2][HS_NZ];
192
193        /** following will be set false if we ever stop over bounds of HS table
194         * for any element.  first index is case A [0] or case B [1] -
195         * second is element number */
196        bool lgHCaseBOK[2][HS_NZ];
197
198        /** related to highest stage of ionization needed for Cota recom */
199        long int nsbig;
200
201        /** by default, include collisional ionization, option to not include it,
202         * with "no collisional ionization" command */
203        bool lgCollIonOn;
204
205        /** wavelengths of Hummer & Storey case B lines for H - O
206         * first dimension is atomic number of C scale, H is 0
207         * next two are upper and lower configurations on physics
208         * scale - Lya is 2-1, Lyb is 3-1, Ha is 3-2, etc */
209        realnum WaveLengthCaseB[8][25][24];
210
211        /** wavelengths for HeI case b */
212        realnum *CaseBWlHeI;
213        /** number of HeI case b lines included */
214        long int nCaseBHeI;
215
216        }       atmdat;
217
218typedef enum { PHFIT_UNDEF, PHFIT95, PHFIT96 } phfit_version;
219
220class t_ADfA : public Singleton<t_ADfA>
221{
222        friend class Singleton<t_ADfA>;
223protected:
224        t_ADfA();
225private:
226        phfit_version version;
227        /* phfit.dat */
228        long int L[7];
229        long int NINN[30];
230        long int NTOT[30];
231        realnum PH1[7][30][30][6];
232        realnum PH2[30][30][7];
233        /* hpfit.dat */
234        realnum PHH[NHYDRO_MAX_LEVEL][5];
235        /* rec_lines.dat */
236        realnum P[8][110];
237        realnum ST[9][405];
238        /* rad_rec.dat */
239        realnum rrec[30][30][2];
240        realnum rnew[30][30][4];
241        realnum fe[13][3];
242        /* h_rad_rec */
243        realnum HRF[NHYDRO_MAX_LEVEL][9];
244        /* h_phot_cs.dat */
245        /** array of cross sections for photoionization of hydrogen at threshold,
246         * 0 is 1s, 1 is 2s, 2 is 2p, up to 400 */
247        realnum STH[NHYDRO_MAX_LEVEL];
248        /* coll_ion.dat */
249        double CF[30][30][5];
250        /* h_coll_str.dat */
251        /** array of EIE cross sections for hydrogen atom. 
252         * For all E1 transitions nl - n'l', with n' < n <= 5 */
253        /* >>refer      H1      cs      Anderson, H., Ballance, C.P., Badnell, N.R., & Summers, H.P.,
254         * >>refercon   2000, J Phys B, 33, 1255; erratum, 2002 */
255        double HCS[14][10][8];
256public:
257        /** set_version set version of phfit data to be used
258            \param val
259        */
260        void set_version(phfit_version val) { version = val; }
261
262        /** get_version which version of phfit data should be used? */
263        phfit_version get_version() const { return version; }
264
265        /** ph1 access elements of PH1 data block with parameters for photoionization cross section fits
266            \param i
267            \param j
268            \param k
269            \param l
270        */
271        realnum ph1(int i, int j, int k, int l) const { return PH1[i][j][k][l]; }
272
273        /** sth array of cross sections for photoionization of hydrogen at threshold,
274            0 is 1s, 1 is 2s, 2 is 2p, up to 400
275            \param i
276        */
277        realnum sth(int i) const { return STH[i]; }
278
279        /** phfit this subroutine calculates partial photoionization cross sections
280            for all ionization stages of all atoms from H to Zn (Z=30)
281            \param nz
282            \param ne
283            \param is
284            \param e
285            \author Dima Verner
286        */
287        double phfit(long int nz, long int ne, long int is, double e);
288
289        /** hpfit state specific photoionization cross sections for model hydrogen atom
290            \param iz
291            \param n
292            \param e
293            \author Dima Verner
294        */ 
295        double hpfit(long int iz, long int n, double e);
296
297        /** same as hpfit, but energy is relative to threshold
298            \param iz
299            \param n
300            \param e
301            \author Dima Verner
302        */ 
303        double hpfit_rel(long int iz, long int n, double e);
304
305        /** rec_lines effective recombination coefficients for lines of C, N, O, by D. Verner
306            \param  t
307            \param  r
308            \author Dima Verner
309        */ 
310        void rec_lines(double t, realnum r[][471]);
311
312        /** rad_rec calculates rates of radiative recombination for all ions
313            \param iz nuclear number on physics scale
314            \param in number of recombined electrons
315            \param t temperature K
316            \author Dima Verner
317        */ 
318        double rad_rec(long int iz, long int in, double t);
319
320        /** H_rad_rec calculates state-specific recombination rates for H and H-like ions
321            \param iz
322            \param n
323            \param t
324            \author Dima Verner
325        */ 
326        double H_rad_rec(long int iz, long int n, double t);
327
328        /** coll_ion D Verner's routine to compute collisional ionization rate coefficients
329            \param iz
330            \param in
331            \param t
332            \author Dima Verner
333        */
334        double coll_ion(long int iz, long int in, double t);
335
336        /** h_coll_str routine to grab H cross sections from Anderson et al. 2002.
337            \param ipLo
338            \param ipHi
339            \param ipTe
340        */
341        realnum h_coll_str( long ipLo, long ipHi, long ipTe );
342};
343
344#endif /* _ATMDAT_H_ */
Note: See TracBrowser for help on using the browser.