cloudy trunk
Loading...
Searching...
No Matches
atmdat.h
Go to the documentation of this file.
1/* This file is part of Cloudy and is copyright (C)1978-2013 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
14double atmdat_2phot_shapefunction( double EbyE2nu, long ipISO, long nelem );
15
19void atmdat_readin(void);
20
26void atmdat_STOUT_readin( long intNS, char *chFileName );
27
33void atmdat_CHIANTI_readin( long intNS, char *chFileName );
34
40void atmdat_LAMDA_readin( long intNS, char *chFileName );
41
42
54 long int iz,
55 long int in,
56 long int *imax,
57 long int *ig0,
58 long int *ig1);
59
63void ChargTranEval( void );
64
69double ChargTranSumHeat(void);
70
71/*ChargTranPun save charge transfer rate coefficients */
77void ChargTranPun( FILE* ipPnunit , char* chSave );
78
80double CHIANTI_Upsilon(long, long, long, long,double);
81
87double atmdat_dielrec_fe(long int ion, double t);
88
92
94void atmdat_3body(void);
95
106double atmdat_HS_caseB(
107 long int iHi, long int iLo, long int iZ, double TempIn,
108 double DenIn,
109 char chCase
110 );
111
112// arrays for Hummer & Storey 98 He1 cross sections and energies
113extern double ****HS_He1_Xsectn;
114extern double ****HS_He1_Energy;
115
116// arrays for TOPbase Helike cross sections and energies
117extern double *****OP_Helike_Xsectn;
118extern double *****OP_Helike_Energy;
119extern long ****OP_Helike_NumPts;
120
121/* these are the vectors that store the original Hummer and Storey case B
122 * line data for H and He - the declaration for the interpolator follows */
123#define NHSDIM 15
124#define NLINEHS 300
125#define HS_NZ 8
126#define NHCSTE 8
127#define NUM_HS98_DATA_POINTS 811
128
129struct t_atmdat {
143
144 enum {NCX=2};
145
152 double CharExcIonOf[NCX][LIMELM][LIMELM+1], //(cm3 s-1)
153 CharExcRecTo[NCX][LIMELM][LIMELM+1], //(cm3 s-1)
157
158 /* rate coefficient (cm3 s-1) for N+(3P) + H+ -> N(2D) + H+ charge transfer*/
160
164
166 double HIonFrac;
167
170
173 double HCTAlex;
174
177 bool lgCTOn;
178
181 double Density[2][HS_NZ][NHSDIM],
185
188 long int nDensity[2][HS_NZ] , ntemp[2][HS_NZ] , ncut[2][HS_NZ];
189
194
196 long int nsbig;
197
201
207
209 vector<realnum> CaseBWlHeI;
210
229
250
255
256 /* type and enum for determining what collisional ionization rate coefficient data to use.
257 * Dima: Cloudy original data from Voronov97
258 * Hybrid: Dima version scaled by the ratio of Dere07 to Dima */
259 typedef enum { DIMA, HYBRID } CollIonRC;
261
263 static const int iVersionLength = 10;
266
269
272
273 };
274extern t_atmdat atmdat;
275
277
278class t_ADfA : public Singleton<t_ADfA>
279{
280 friend class Singleton<t_ADfA>;
281protected:
282 t_ADfA();
283private:
285 /* phfit.dat */
286 long int L[7];
287 long int NINN[30];
288 long int NTOT[30];
289 realnum PH1[7][30][30][6];
290 realnum PH2[30][30][7];
291 /* hpfit.dat */
293 /* rec_lines.dat */
294 realnum P[8][110];
295 realnum ST[9][405];
296 /* rad_rec.dat */
297 realnum rrec[30][30][2];
298 realnum rnew[30][30][4];
299 realnum fe[13][3];
300 /* h_rad_rec */
302 /* h_phot_cs.dat */
306 /* coll_ion.dat */
307 double CF[30][30][5];
308 /* h_coll_str.dat */
311 /* >>refer H1 cs Anderson, H., Ballance, C.P., Badnell, N.R., & Summers, H.P.,
312 * >>refercon 2000, J Phys B, 33, 1255; erratum, 2002 */
313 double HCS[14][10][8];
314public:
318 void set_version(phfit_version val) { version = val; }
319
322
329 realnum ph1(int i, int j, int k, int l) const { return PH1[i][j][k][l]; }
330
335 realnum sth(int i) const { return STH[i]; }
336
345 double phfit(long int nz, long int ne, long int is, double e);
346
353 double hpfit(long int iz, long int n, double e);
354
360 void rec_lines(double t, realnum r[][471]);
361
368 double rad_rec(long int iz, long int in, double t);
369
376 double H_rad_rec(long int iz, long int n, double t);
377
384 double coll_ion(long int iz, long int in, double t);
385
386 double coll_ion_wrapper(long int z, long int n, double t);
387
388 /* coll_ion_hybrid computes hybrid collisional ionization rates */
389 double coll_ion_hybrid( long int z, long int n, double t);
390
396 realnum h_coll_str( long ipLo, long ipHi, long ipTe );
397};
398
399class Funct
400{
401public:
402 virtual void operator()( long&, long&, const char*, long&) = 0;
403 virtual ~Funct() = 0;
404};
405
406inline Funct::~Funct() {};
407
409
410class FunctLAMDA : public Funct
411{
412public:
413 explicit FunctLAMDA(void) { }
414 virtual void operator()( long& ipHi, long& ipLo, const char* chLine, long& i)
415 {
416 bool lgEOL;
417 long index = (long)FFmtRead( chLine, &i, strlen(chLine), &lgEOL );
418 ASSERT( index > 0 );
419 ipHi = (long)FFmtRead( chLine, &i, strlen(chLine), &lgEOL ) - 1;
420 ipLo = (long)FFmtRead( chLine, &i, strlen(chLine), &lgEOL ) - 1;
421 return;
422 }
423private:
424};
425
426#include "h2_priv.h"
427
428class FunctDiatoms : public Funct
429{
430public:
431 explicit FunctDiatoms(const diatomics& diatom) : diatom_(diatom) { }
432 virtual void operator()( long& ipHi, long& ipLo, const char* chLine, long& i)
433 {
434 diatom_.GetIndices( ipHi, ipLo, chLine, i );
435 }
436private:
438};
439
440void ReadCollisionRateTable( CollRateCoeffArray& coll_rate_table, FILE* io, FunctPtr GetIndices, long nMolLevs, long nTemps = -1, long nTrans = -1 );
441
442double InterpCollRate( const CollRateCoeffArray& rate_table, const long& ipHi, const long& ipLo, const double& ftemp);
443
444#endif /* ATMDAT_H_ */
double ***** OP_Helike_Xsectn
Definition atmdat.cpp:10
double **** HS_He1_Xsectn
Definition atmdat.cpp:8
double **** HS_He1_Energy
Definition atmdat.cpp:9
long **** OP_Helike_NumPts
Definition atmdat.cpp:12
t_atmdat atmdat
Definition atmdat.cpp:6
double ***** OP_Helike_Energy
Definition atmdat.cpp:11
void atmdat_readin(void)
void atmdat_outer_shell(long int iz, long int in, long int *imax, long int *ig0, long int *ig1)
double InterpCollRate(const CollRateCoeffArray &rate_table, const long &ipHi, const long &ipLo, const double &ftemp)
Definition atmdat.cpp:135
double ChargTranSumHeat(void)
void ReadCollisionRateTable(CollRateCoeffArray &coll_rate_table, FILE *io, FunctPtr GetIndices, long nMolLevs, long nTemps=-1, long nTrans=-1)
Definition atmdat.cpp:14
#define NLINEHS
Definition atmdat.h:124
double atmdat_dielrec_fe(long int ion, double t)
void atmdat_STOUT_readin(long intNS, char *chFileName)
void ChargTranPun(FILE *ipPnunit, char *chSave)
phfit_version
Definition atmdat.h:276
@ PHFIT96
Definition atmdat.h:276
@ PHFIT95
Definition atmdat.h:276
@ PHFIT_UNDEF
Definition atmdat.h:276
void ChargTranEval(void)
void atmdat_CHIANTI_readin(long intNS, char *chFileName)
double atmdat_2phot_shapefunction(double EbyE2nu, long ipISO, long nelem)
#define NHSDIM
Definition atmdat.h:123
double atmdat_HS_caseB(long int iHi, long int iLo, long int iZ, double TempIn, double DenIn, char chCase)
void atmdat_3body(void)
#define HS_NZ
Definition atmdat.h:125
void atmdat_LAMDA_readin(long intNS, char *chFileName)
Funct * FunctPtr
Definition atmdat.h:408
double CHIANTI_Upsilon(long, long, long, long, double)
Definition species2.cpp:690
void atmdat_H_phot_cs(void)
const int FILENAME_PATH_LENGTH
Definition cddefines.h:246
#define ASSERT(exp)
Definition cddefines.h:578
const int NHYDRO_MAX_LEVEL
Definition cddefines.h:266
struct t_CollRatesArray CollRateCoeffArray
const int LIMELM
Definition cddefines.h:258
double FFmtRead(const char *chCard, long int *ipnt, long int last, bool *lgEOL)
Definition service.cpp:381
float realnum
Definition cddefines.h:103
const diatomics & diatom_
Definition atmdat.h:437
virtual void operator()(long &ipHi, long &ipLo, const char *chLine, long &i)
Definition atmdat.h:432
FunctDiatoms(const diatomics &diatom)
Definition atmdat.h:431
virtual ~Funct()=0
Definition atmdat.h:406
virtual void operator()(long &, long &, const char *, long &)=0
virtual void operator()(long &ipHi, long &ipLo, const char *chLine, long &i)
Definition atmdat.h:414
FunctLAMDA(void)
Definition atmdat.h:413
realnum fe[13][3]
Definition atmdat.h:299
long int NTOT[30]
Definition atmdat.h:288
realnum ST[9][405]
Definition atmdat.h:295
realnum PH2[30][30][7]
Definition atmdat.h:290
realnum PHH[NHYDRO_MAX_LEVEL][5]
Definition atmdat.h:292
double phfit(long int nz, long int ne, long int is, double e)
void rec_lines(double t, realnum r[][471])
realnum ph1(int i, int j, int k, int l) const
Definition atmdat.h:329
double coll_ion_wrapper(long int z, long int n, double t)
double HCS[14][10][8]
Definition atmdat.h:313
double rad_rec(long int iz, long int in, double t)
double coll_ion_hybrid(long int z, long int n, double t)
realnum STH[NHYDRO_MAX_LEVEL]
Definition atmdat.h:305
realnum h_coll_str(long ipLo, long ipHi, long ipTe)
phfit_version get_version() const
Definition atmdat.h:321
realnum sth(int i) const
Definition atmdat.h:335
long int L[7]
Definition atmdat.h:286
double CF[30][30][5]
Definition atmdat.h:307
double H_rad_rec(long int iz, long int n, double t)
phfit_version version
Definition atmdat.h:284
realnum P[8][110]
Definition atmdat.h:294
realnum HRF[NHYDRO_MAX_LEVEL][9]
Definition atmdat.h:301
realnum rnew[30][30][4]
Definition atmdat.h:298
double hpfit(long int iz, long int n, double e)
long int NINN[30]
Definition atmdat.h:287
void set_version(phfit_version val)
Definition atmdat.h:318
double coll_ion(long int iz, long int in, double t)
realnum PH1[7][30][30][6]
Definition atmdat.h:289
realnum rrec[30][30][2]
Definition atmdat.h:297
bool lgChiantiHybrid
Definition atmdat.h:233
bool lgCTOn
Definition atmdat.h:177
const long nChiantiPhotoLevelsFe
Definition atmdat.h:220
long nChiantiMaxLevels
Definition atmdat.h:214
bool lgHCaseBOK[2][HS_NZ]
Definition atmdat.h:193
double ElecTemp[2][HS_NZ][NHSDIM]
Definition atmdat.h:182
double CharExcRecTo[NCX][LIMELM][LIMELM+1]
Definition atmdat.h:153
bool lgStoutHybrid
Definition atmdat.h:243
long nChiantiMaxLevelsFe
Definition atmdat.h:212
long int nDensity[2][HS_NZ]
Definition atmdat.h:188
bool lgLamdaOn
Definition atmdat.h:239
double CharExcIonOf[NCX][LIMELM][LIMELM+1]
Definition atmdat.h:152
char chStoutFile[FILENAME_PATH_LENGTH]
Definition atmdat.h:268
double HCharHeatMax
Definition atmdat.h:154
@ HYBRID
Definition atmdat.h:259
bool lgGbarOn
Definition atmdat.h:249
static const int iVersionLength
Definition atmdat.h:263
double HCharCoolMax
Definition atmdat.h:155
double CharExcRecTotal[NCX]
Definition atmdat.h:163
long int nsbig
Definition atmdat.h:196
const long nChiantiCollLevelsFe
Definition atmdat.h:224
double HCharExcRecTo_N0_2D
Definition atmdat.h:159
double HIonFracMax
Definition atmdat.h:169
char chCloudyChiantiFile[FILENAME_PATH_LENGTH]
Definition atmdat.h:271
double CharExcIonTotal[NCX]
Definition atmdat.h:162
const long nChiantiCollLevels
Definition atmdat.h:226
bool lgStoutOn
Definition atmdat.h:241
t_atmdat()
Definition atmdat.h:227
const long nChiantiPhotoLevels
Definition atmdat.h:222
double Emiss[2][HS_NZ][NHSDIM][NHSDIM][NLINEHS]
Definition atmdat.h:184
vector< realnum > CaseBWlHeI
Definition atmdat.h:209
long int ntemp[2][HS_NZ]
Definition atmdat.h:188
bool lgChiantiExp
Definition atmdat.h:237
bool lgCollIonOn
Definition atmdat.h:200
bool lgChiantiOn
Definition atmdat.h:231
double collstrDefault
Definition atmdat.h:254
double HCTAlex
Definition atmdat.h:173
long int ncut[2][HS_NZ]
Definition atmdat.h:188
bool lgCalpgmOn
Definition atmdat.h:247
double HIonFrac
Definition atmdat.h:166
CollIonRC CIRCData
Definition atmdat.h:260
long nStoutMaxLevels
Definition atmdat.h:218
double Density[2][HS_NZ][NHSDIM]
Definition atmdat.h:181
bool lgChiantiLevelsSet
Definition atmdat.h:216
bool lgChiantiPrint
Definition atmdat.h:235
realnum WaveLengthCaseB[8][25][24]
Definition atmdat.h:206
bool lgStoutPrint
Definition atmdat.h:245
char chVersion[iVersionLength]
Definition atmdat.h:265
double HCharHeatOn
Definition atmdat.h:156