cloudy  trunk
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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)
154  HCharHeatMax,
155  HCharCoolMax,
156  HCharHeatOn;
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],
182  ElecTemp[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_ */
virtual void operator()(long &ipHi, long &ipLo, const char *chLine, long &i)
Definition: atmdat.h:432
realnum WaveLengthCaseB[8][25][24]
Definition: atmdat.h:206
t_atmdat atmdat
Definition: atmdat.cpp:6
double HCharHeatMax
Definition: atmdat.h:152
bool lgStoutHybrid
Definition: atmdat.h:243
bool lgChiantiLevelsSet
Definition: atmdat.h:216
double HCharHeatOn
Definition: atmdat.h:152
char chStoutFile[FILENAME_PATH_LENGTH]
Definition: atmdat.h:268
#define NHSDIM
Definition: atmdat.h:123
realnum h_coll_str(long ipLo, long ipHi, long ipTe)
realnum ph1(int i, int j, int k, int l) const
Definition: atmdat.h:329
bool lgStoutOn
Definition: atmdat.h:241
realnum fe[13][3]
Definition: atmdat.h:299
realnum PHH[NHYDRO_MAX_LEVEL][5]
Definition: atmdat.h:292
realnum sth(int i) const
Definition: atmdat.h:335
const long nChiantiCollLevelsFe
Definition: atmdat.h:224
double CHIANTI_Upsilon(long, long, long, long, double)
Definition: species2.cpp:690
double ChargTranSumHeat(void)
realnum HRF[NHYDRO_MAX_LEVEL][9]
Definition: atmdat.h:301
double HCharCoolMax
Definition: atmdat.h:152
long int ncut[2][HS_NZ]
Definition: atmdat.h:188
const long nChiantiPhotoLevelsFe
Definition: atmdat.h:220
double coll_ion_wrapper(long int z, long int n, double t)
void atmdat_STOUT_readin(long intNS, char *chFileName)
CollIonRC CIRCData
Definition: atmdat.h:260
Funct * FunctPtr
Definition: atmdat.h:406
bool lgChiantiPrint
Definition: atmdat.h:235
bool lgCollIonOn
Definition: atmdat.h:200
bool lgHCaseBOK[2][HS_NZ]
Definition: atmdat.h:193
realnum PH2[30][30][7]
Definition: atmdat.h:290
long int L[7]
Definition: atmdat.h:286
long int nsbig
Definition: atmdat.h:196
bool lgGbarOn
Definition: atmdat.h:249
double HIonFracMax
Definition: atmdat.h:169
void GetIndices(long &ipHi, long &ipLo, const char *chLine, long &i) const
const diatomics & diatom_
Definition: atmdat.h:437
long int NTOT[30]
Definition: atmdat.h:288
FunctDiatoms(const diatomics &diatom)
Definition: atmdat.h:431
double coll_ion(long int iz, long int in, double t)
phfit_version version
Definition: atmdat.h:284
Definition: atmdat.h:278
char chVersion[iVersionLength]
Definition: atmdat.h:265
long int ntemp[2][HS_NZ]
Definition: atmdat.h:188
#define NLINEHS
Definition: atmdat.h:124
CollIonRC
Definition: atmdat.h:259
double CharExcRecTotal[NCX]
Definition: atmdat.h:162
double CharExcIonTotal[NCX]
Definition: atmdat.h:162
virtual ~Funct()=0
Definition: atmdat.h:406
Definition: atmdat.h:399
virtual void operator()(long &, long &, const char *, long &)=0
bool lgChiantiHybrid
Definition: atmdat.h:233
realnum ST[9][405]
Definition: atmdat.h:295
long int nDensity[2][HS_NZ]
Definition: atmdat.h:188
bool lgChiantiOn
Definition: atmdat.h:231
bool lgCalpgmOn
Definition: atmdat.h:247
void atmdat_H_phot_cs(void)
double **** HS_He1_Xsectn
Definition: atmdat.cpp:8
double atmdat_dielrec_fe(long int ion, double t)
char chCloudyChiantiFile[FILENAME_PATH_LENGTH]
Definition: atmdat.h:271
phfit_version get_version() const
Definition: atmdat.h:321
realnum PH1[7][30][30][6]
Definition: atmdat.h:289
virtual void operator()(long &ipHi, long &ipLo, const char *chLine, long &i)
Definition: atmdat.h:414
double HCharExcRecTo_N0_2D
Definition: atmdat.h:159
double InterpCollRate(const CollRateCoeffArray &rate_table, const long &ipHi, const long &ipLo, const double &ftemp)
Definition: atmdat.cpp:135
double collstrDefault
Definition: atmdat.h:254
long nStoutMaxLevels
Definition: atmdat.h:218
realnum rrec[30][30][2]
Definition: atmdat.h:297
float realnum
Definition: cddefines.h:107
double ***** OP_Helike_Xsectn
Definition: atmdat.cpp:10
phfit_version
Definition: atmdat.h:276
double CF[30][30][5]
Definition: atmdat.h:307
double H_rad_rec(long int iz, long int n, double t)
double Density[2][HS_NZ][NHSDIM]
Definition: atmdat.h:181
double Emiss[2][HS_NZ][NHSDIM][NHSDIM][NLINEHS]
Definition: atmdat.h:181
double atmdat_HS_caseB(long int iHi, long int iLo, long int iZ, double TempIn, double DenIn, char chCase)
long nChiantiMaxLevels
Definition: atmdat.h:214
void atmdat_outer_shell(long int iz, long int in, long int *imax, long int *ig0, long int *ig1)
long int NINN[30]
Definition: atmdat.h:287
#define HS_NZ
Definition: atmdat.h:125
const long nChiantiCollLevels
Definition: atmdat.h:226
#define ASSERT(exp)
Definition: cddefines.h:582
const long nChiantiPhotoLevels
Definition: atmdat.h:222
void ChargTranPun(FILE *ipPnunit, char *chSave)
const int LIMELM
Definition: cddefines.h:262
double rad_rec(long int iz, long int in, double t)
double **** HS_He1_Energy
Definition: atmdat.cpp:9
t_atmdat()
Definition: atmdat.h:227
void atmdat_LAMDA_readin(long intNS, char *chFileName)
double hpfit(long int iz, long int n, double e)
double ***** OP_Helike_Energy
Definition: atmdat.cpp:11
long **** OP_Helike_NumPts
Definition: atmdat.cpp:12
double HIonFrac
Definition: atmdat.h:166
const int FILENAME_PATH_LENGTH
Definition: cddefines.h:250
bool lgStoutPrint
Definition: atmdat.h:245
void atmdat_readin(void)
void atmdat_CHIANTI_readin(long intNS, char *chFileName)
bool lgCTOn
Definition: atmdat.h:177
vector< realnum > CaseBWlHeI
Definition: atmdat.h:209
double HCS[14][10][8]
Definition: atmdat.h:313
double coll_ion_hybrid(long int z, long int n, double t)
double HCTAlex
Definition: atmdat.h:173
bool lgLamdaOn
Definition: atmdat.h:239
void ChargTranEval(void)
double CharExcIonOf[NCX][LIMELM][LIMELM+1]
Definition: atmdat.h:152
void ReadCollisionRateTable(CollRateCoeffArray &coll_rate_table, FILE *io, FunctPtr GetIndices, long nMolLevs, long nTemps, long nTrans)
Definition: atmdat.cpp:14
long nChiantiMaxLevelsFe
Definition: atmdat.h:212
realnum STH[NHYDRO_MAX_LEVEL]
Definition: atmdat.h:305
void atmdat_3body(void)
bool lgChiantiExp
Definition: atmdat.h:237
double CharExcRecTo[NCX][LIMELM][LIMELM+1]
Definition: atmdat.h:152
realnum rnew[30][30][4]
Definition: atmdat.h:298
void set_version(phfit_version val)
Definition: atmdat.h:318
double phfit(long int nz, long int ne, long int is, double e)
const int NHYDRO_MAX_LEVEL
Definition: cddefines.h:270
double atmdat_2phot_shapefunction(double EbyE2nu, long ipISO, long nelem)
void rec_lines(double t, realnum r[][471])
FunctLAMDA(void)
Definition: atmdat.h:413
static const int iVersionLength
Definition: atmdat.h:263
double ElecTemp[2][HS_NZ][NHSDIM]
Definition: atmdat.h:181
realnum P[8][110]
Definition: atmdat.h:294
double FFmtRead(const char *chCard, long int *ipnt, long int last, bool *lgEOL)
Definition: service.cpp:381