cloudy  trunk
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 
14 double atmdat_2phot_shapefunction( double EbyE2nu, long ipISO, long nelem );
15 
19 void atmdat_readin(void);
20 
26 void atmdat_STOUT_readin( long intNS, char *chFileName );
27 
33 void atmdat_CHIANTI_readin( long intNS, char *chFileName );
34 
40 void 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 
63 void ChargTranEval( void );
64 
69 double ChargTranSumHeat(void);
70 
71 /*ChargTranPun save charge transfer rate coefficients */
77 void ChargTranPun( FILE* ipPnunit , char* chSave );
78 
80 double CHIANTI_Upsilon(long, long, long, long,double);
81 
87 double atmdat_dielrec_fe(long int ion, double t);
88 
91 void atmdat_H_phot_cs(void);
92 
94 void atmdat_3body(void);
95 
106 double 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
113 extern double ****HS_He1_Xsectn;
114 extern double ****HS_He1_Energy;
115 
116 // arrays for TOPbase Helike cross sections and energies
117 extern double *****OP_Helike_Xsectn;
118 extern double *****OP_Helike_Energy;
119 extern 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 
129 struct t_atmdat {
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 
169  double HIonFracMax;
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 
193  bool lgHCaseBOK[2][HS_NZ];
194 
196  long int nsbig;
197 
201 
207 
209  vector<realnum> CaseBWlHeI;
210 
226  const long nChiantiCollLevels;
228  nChiantiCollLevels(50) {}
229 
239  bool lgLamdaOn;
241  bool lgStoutOn;
249  bool lgGbarOn;
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  };
274 extern t_atmdat atmdat;
275 
277 
278 class t_ADfA : public Singleton<t_ADfA>
279 {
280  friend class Singleton<t_ADfA>;
281 protected:
282  t_ADfA();
283 private:
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];
314 public:
318  void set_version(phfit_version val) { version = val; }
319 
321  phfit_version get_version() const { return version; }
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 
399 class Funct
400 {
401 public:
402  virtual void operator()( long&, long&, const char*, long&) = 0;
403  virtual ~Funct() = 0;
404 };
405 
406 inline Funct::~Funct() {};
407 
408 typedef Funct* FunctPtr;
409 
410 class FunctLAMDA : public Funct
411 {
412 public:
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  }
423 private:
424 };
425 
426 #include "h2_priv.h"
427 
428 class FunctDiatoms : public Funct
429 {
430 public:
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  }
436 private:
438 };
439 
440 void ReadCollisionRateTable( CollRateCoeffArray& coll_rate_table, FILE* io, FunctPtr GetIndices, long nMolLevs, long nTemps = -1, long nTrans = -1 );
441 
442 double InterpCollRate( const CollRateCoeffArray& rate_table, const long& ipHi, const long& ipLo, const double& ftemp);
443 
444 #endif /* ATMDAT_H_ */
t_ADfA::CF
double CF[30][30][5]
Definition: atmdat.h:307
t_atmdat::lgLamdaOn
bool lgLamdaOn
Definition: atmdat.h:239
t_atmdat::CharExcIonOf
double CharExcIonOf[NCX][LIMELM][LIMELM+1]
Definition: atmdat.h:152
FunctLAMDA
Definition: atmdat.h:410
t_ADfA::H_rad_rec
double H_rad_rec(long int iz, long int n, double t)
Definition: atmdat_adfa.cpp:712
atmdat_3body
void atmdat_3body(void)
Definition: atmdat_3body.cpp:52
t_atmdat::lgChiantiExp
bool lgChiantiExp
Definition: atmdat.h:237
PHFIT95
@ PHFIT95
Definition: atmdat.h:276
NHSDIM
#define NHSDIM
Definition: atmdat.h:123
NHYDRO_MAX_LEVEL
const int NHYDRO_MAX_LEVEL
Definition: cddefines.h:266
t_atmdat::ntemp
long int ntemp[2][HS_NZ]
Definition: atmdat.h:188
t_atmdat::HCharCoolMax
double HCharCoolMax
Definition: atmdat.h:155
FFmtRead
double FFmtRead(const char *chCard, long int *ipnt, long int last, bool *lgEOL)
Definition: service.cpp:381
t_atmdat::CharExcIonTotal
double CharExcIonTotal[NCX]
Definition: atmdat.h:162
atmdat_H_phot_cs
void atmdat_H_phot_cs(void)
FunctPtr
Funct * FunctPtr
Definition: atmdat.h:406
t_atmdat::chStoutFile
char chStoutFile[FILENAME_PATH_LENGTH]
Definition: atmdat.h:268
realnum
float realnum
Definition: cddefines.h:103
InterpCollRate
double InterpCollRate(const CollRateCoeffArray &rate_table, const long &ipHi, const long &ipLo, const double &ftemp)
Definition: atmdat.cpp:135
t_atmdat::lgHCaseBOK
bool lgHCaseBOK[2][HS_NZ]
Definition: atmdat.h:193
t_atmdat::nChiantiMaxLevelsFe
long nChiantiMaxLevelsFe
Definition: atmdat.h:212
ChargTranSumHeat
double ChargTranSumHeat(void)
Definition: atmdat_char_tran.cpp:569
t_ADfA::hpfit
double hpfit(long int iz, long int n, double e)
Definition: atmdat_adfa.cpp:394
phfit_version
phfit_version
Definition: atmdat.h:276
t_atmdat::nChiantiPhotoLevelsFe
const long nChiantiPhotoLevelsFe
Definition: atmdat.h:220
Funct::operator()
virtual void operator()(long &, long &, const char *, long &)=0
t_ADfA::NINN
long int NINN[30]
Definition: atmdat.h:287
t_atmdat::HCharHeatOn
double HCharHeatOn
Definition: atmdat.h:156
t_atmdat::ncut
long int ncut[2][HS_NZ]
Definition: atmdat.h:188
t_atmdat::collstrDefault
double collstrDefault
Definition: atmdat.h:254
t_atmdat::CollIonRC
CollIonRC
Definition: atmdat.h:259
t_ADfA::rad_rec
double rad_rec(long int iz, long int in, double t)
Definition: atmdat_adfa.cpp:637
t_atmdat::HIonFracMax
double HIonFracMax
Definition: atmdat.h:169
ASSERT
#define ASSERT(exp)
Definition: cddefines.h:578
Singleton
Definition: cddefines.h:172
t_atmdat::nDensity
long int nDensity[2][HS_NZ]
Definition: atmdat.h:188
t_atmdat::nsbig
long int nsbig
Definition: atmdat.h:196
t_atmdat::nChiantiCollLevelsFe
const long nChiantiCollLevelsFe
Definition: atmdat.h:224
diatomics::GetIndices
void GetIndices(long &ipHi, long &ipLo, const char *chLine, long &i) const
Definition: mole_h2_coll.cpp:208
atmdat_HS_caseB
double atmdat_HS_caseB(long int iHi, long int iLo, long int iZ, double TempIn, double DenIn, char chCase)
Definition: atmdat_HS_caseb.cpp:7
HS_NZ
#define HS_NZ
Definition: atmdat.h:125
FunctDiatoms::diatom_
const diatomics & diatom_
Definition: atmdat.h:437
t_ADfA::STH
realnum STH[NHYDRO_MAX_LEVEL]
Definition: atmdat.h:305
t_atmdat::chCloudyChiantiFile
char chCloudyChiantiFile[FILENAME_PATH_LENGTH]
Definition: atmdat.h:271
t_ADfA::HCS
double HCS[14][10][8]
Definition: atmdat.h:313
t_ADfA::phfit
double phfit(long int nz, long int ne, long int is, double e)
Definition: atmdat_adfa.cpp:269
t_atmdat::lgStoutOn
bool lgStoutOn
Definition: atmdat.h:241
FILENAME_PATH_LENGTH
const int FILENAME_PATH_LENGTH
Definition: cddefines.h:246
t_atmdat::lgChiantiHybrid
bool lgChiantiHybrid
Definition: atmdat.h:233
t_ADfA::coll_ion_hybrid
double coll_ion_hybrid(long int z, long int n, double t)
Definition: atmdat_adfa.cpp:866
t_ADfA::t_ADfA
t_ADfA()
Definition: atmdat_adfa.cpp:12
t_atmdat::HIonFrac
double HIonFrac
Definition: atmdat.h:166
diatomics
Definition: h2_priv.h:65
ChargTranPun
void ChargTranPun(FILE *ipPnunit, char *chSave)
Definition: atmdat_char_tran.cpp:1729
t_atmdat::lgChiantiOn
bool lgChiantiOn
Definition: atmdat.h:231
t_CollRatesArray
Definition: cddefines.h:1264
t_ADfA::set_version
void set_version(phfit_version val)
Definition: atmdat.h:318
t_atmdat::HYBRID
@ HYBRID
Definition: atmdat.h:259
t_ADfA::rnew
realnum rnew[30][30][4]
Definition: atmdat.h:298
t_ADfA::rec_lines
void rec_lines(double t, realnum r[][471])
Definition: atmdat_adfa.cpp:475
FunctLAMDA::FunctLAMDA
FunctLAMDA(void)
Definition: atmdat.h:413
t_atmdat::lgChiantiPrint
bool lgChiantiPrint
Definition: atmdat.h:235
t_ADfA::P
realnum P[8][110]
Definition: atmdat.h:294
t_atmdat::CharExcRecTotal
double CharExcRecTotal[NCX]
Definition: atmdat.h:163
PHFIT_UNDEF
@ PHFIT_UNDEF
Definition: atmdat.h:276
t_atmdat::nChiantiCollLevels
const long nChiantiCollLevels
Definition: atmdat.h:226
t_ADfA::sth
realnum sth(int i) const
Definition: atmdat.h:335
atmdat
t_atmdat atmdat
Definition: atmdat.cpp:6
t_atmdat::nChiantiPhotoLevels
const long nChiantiPhotoLevels
Definition: atmdat.h:222
t_atmdat::CaseBWlHeI
vector< realnum > CaseBWlHeI
Definition: atmdat.h:209
LIMELM
const int LIMELM
Definition: cddefines.h:258
atmdat_2phot_shapefunction
double atmdat_2phot_shapefunction(double EbyE2nu, long ipISO, long nelem)
Definition: atmdat_2photon.cpp:234
PHFIT96
@ PHFIT96
Definition: atmdat.h:276
t_atmdat::iVersionLength
static const int iVersionLength
Definition: atmdat.h:263
t_atmdat::NCX
@ NCX
Definition: atmdat.h:144
t_ADfA::fe
realnum fe[13][3]
Definition: atmdat.h:299
t_atmdat::CIRCData
CollIonRC CIRCData
Definition: atmdat.h:260
t_atmdat::HCharExcRecTo_N0_2D
double HCharExcRecTo_N0_2D
Definition: atmdat.h:159
NLINEHS
#define NLINEHS
Definition: atmdat.h:124
t_ADfA::PHH
realnum PHH[NHYDRO_MAX_LEVEL][5]
Definition: atmdat.h:292
OP_Helike_NumPts
long **** OP_Helike_NumPts
Definition: atmdat.cpp:12
t_atmdat::lgGbarOn
bool lgGbarOn
Definition: atmdat.h:249
Funct
Definition: atmdat.h:399
atmdat_readin
void atmdat_readin(void)
Definition: atmdat_readin.cpp:149
t_ADfA::h_coll_str
realnum h_coll_str(long ipLo, long ipHi, long ipTe)
Definition: atmdat_adfa.cpp:918
h2_priv.h
t_atmdat::lgChiantiLevelsSet
bool lgChiantiLevelsSet
Definition: atmdat.h:216
t_ADfA::L
long int L[7]
Definition: atmdat.h:286
t_atmdat::nChiantiMaxLevels
long nChiantiMaxLevels
Definition: atmdat.h:214
t_atmdat::HCTAlex
double HCTAlex
Definition: atmdat.h:173
t_ADfA::HRF
realnum HRF[NHYDRO_MAX_LEVEL][9]
Definition: atmdat.h:301
t_atmdat::lgCalpgmOn
bool lgCalpgmOn
Definition: atmdat.h:247
atmdat_outer_shell
void atmdat_outer_shell(long int iz, long int in, long int *imax, long int *ig0, long int *ig1)
Definition: atmdat_outer_shell.cpp:8
t_ADfA::get_version
phfit_version get_version() const
Definition: atmdat.h:321
atmdat_CHIANTI_readin
void atmdat_CHIANTI_readin(long intNS, char *chFileName)
Definition: atmdat_chianti.cpp:595
t_ADfA
Definition: atmdat.h:278
t_ADfA::coll_ion_wrapper
double coll_ion_wrapper(long int z, long int n, double t)
Definition: atmdat_adfa.cpp:814
t_atmdat::lgStoutPrint
bool lgStoutPrint
Definition: atmdat.h:245
t_atmdat::nStoutMaxLevels
long nStoutMaxLevels
Definition: atmdat.h:218
t_ADfA::coll_ion
double coll_ion(long int iz, long int in, double t)
Definition: atmdat_adfa.cpp:774
t_atmdat::lgStoutHybrid
bool lgStoutHybrid
Definition: atmdat.h:243
t_ADfA::PH2
realnum PH2[30][30][7]
Definition: atmdat.h:290
t_atmdat::ElecTemp
double ElecTemp[2][HS_NZ][NHSDIM]
Definition: atmdat.h:182
t_atmdat::Emiss
double Emiss[2][HS_NZ][NHSDIM][NHSDIM][NLINEHS]
Definition: atmdat.h:184
OP_Helike_Energy
double ***** OP_Helike_Energy
Definition: atmdat.cpp:11
t_atmdat::lgCTOn
bool lgCTOn
Definition: atmdat.h:177
CHIANTI_Upsilon
double CHIANTI_Upsilon(long, long, long, long, double)
Definition: species2.cpp:690
atmdat_dielrec_fe
double atmdat_dielrec_fe(long int ion, double t)
Definition: atmdat_dielrec_fe.cpp:9
t_ADfA::ph1
realnum ph1(int i, int j, int k, int l) const
Definition: atmdat.h:329
t_atmdat::t_atmdat
t_atmdat()
Definition: atmdat.h:227
t_ADfA::ST
realnum ST[9][405]
Definition: atmdat.h:295
t_atmdat::CharExcRecTo
double CharExcRecTo[NCX][LIMELM][LIMELM+1]
Definition: atmdat.h:153
t_ADfA::NTOT
long int NTOT[30]
Definition: atmdat.h:288
atmdat_STOUT_readin
void atmdat_STOUT_readin(long intNS, char *chFileName)
Definition: atmdat_chianti.cpp:17
t_atmdat::lgCollIonOn
bool lgCollIonOn
Definition: atmdat.h:200
t_ADfA::version
phfit_version version
Definition: atmdat.h:284
FunctDiatoms
Definition: atmdat.h:428
ChargTranEval
void ChargTranEval(void)
Definition: atmdat_char_tran.cpp:44
ReadCollisionRateTable
void ReadCollisionRateTable(CollRateCoeffArray &coll_rate_table, FILE *io, FunctPtr GetIndices, long nMolLevs, long nTemps=-1, long nTrans=-1)
Definition: atmdat.cpp:14
Funct::~Funct
virtual ~Funct()=0
Definition: atmdat.h:406
t_atmdat::WaveLengthCaseB
realnum WaveLengthCaseB[8][25][24]
Definition: atmdat.h:206
FunctDiatoms::FunctDiatoms
FunctDiatoms(const diatomics &diatom)
Definition: atmdat.h:431
t_atmdat::HCharHeatMax
double HCharHeatMax
Definition: atmdat.h:154
t_atmdat::DIMA
@ DIMA
Definition: atmdat.h:259
t_atmdat::Density
double Density[2][HS_NZ][NHSDIM]
Definition: atmdat.h:181
t_ADfA::PH1
realnum PH1[7][30][30][6]
Definition: atmdat.h:289
HS_He1_Xsectn
double **** HS_He1_Xsectn
Definition: atmdat.cpp:8
t_atmdat
Definition: atmdat.h:129
FunctLAMDA::operator()
virtual void operator()(long &ipHi, long &ipLo, const char *chLine, long &i)
Definition: atmdat.h:414
HS_He1_Energy
double **** HS_He1_Energy
Definition: atmdat.cpp:9
t_ADfA::rrec
realnum rrec[30][30][2]
Definition: atmdat.h:297
OP_Helike_Xsectn
double ***** OP_Helike_Xsectn
Definition: atmdat.cpp:10
FunctDiatoms::operator()
virtual void operator()(long &ipHi, long &ipLo, const char *chLine, long &i)
Definition: atmdat.h:432
atmdat_LAMDA_readin
void atmdat_LAMDA_readin(long intNS, char *chFileName)
Definition: atmdat_lamda.cpp:18
t_atmdat::chVersion
char chVersion[iVersionLength]
Definition: atmdat.h:265