00001
00002
00003
00004 #ifndef ATMDAT_H_
00005 #define ATMDAT_H_
00006
00007
00014 double atmdat_2phot_shapefunction( double EbyE2nu, long ipISO, long nelem );
00015
00019 void atmdat_readin(void);
00020
00026 void atmdat_STOUT_readin( long intNS, char *chFileName );
00027
00033 void atmdat_CHIANTI_readin( long intNS, char *chFileName );
00034
00040 void atmdat_LAMDA_readin( long intNS, char *chFileName );
00041
00042
00053 void atmdat_outer_shell(
00054 long int iz,
00055 long int in,
00056 long int *imax,
00057 long int *ig0,
00058 long int *ig1);
00059
00063 void ChargTranEval( void );
00064
00069 double ChargTranSumHeat(void);
00070
00071
00077 void ChargTranPun( FILE* ipPnunit , char* chSave );
00078
00080 double CHIANTI_Upsilon(long, long, long, long,double);
00081
00087 double atmdat_dielrec_fe(long int ion, double t);
00088
00091 void atmdat_H_phot_cs(void);
00092
00094 void atmdat_3body(void);
00095
00106 double atmdat_HS_caseB(
00107 long int iHi, long int iLo, long int iZ, double TempIn,
00108 double DenIn,
00109 char chCase
00110 );
00111
00112
00113 extern double ****HS_He1_Xsectn;
00114 extern double ****HS_He1_Energy;
00115
00116
00117 extern double *****OP_Helike_Xsectn;
00118 extern double *****OP_Helike_Energy;
00119 extern long ****OP_Helike_NumPts;
00120
00121
00122
00123 #define NHSDIM 15
00124 #define NLINEHS 300
00125 #define HS_NZ 8
00126 #define NHCSTE 8
00127 #define NUM_HS98_DATA_POINTS 811
00128
00129 struct t_atmdat {
00150 double HCharExcIonOf[LIMELM][LIMELM+1],
00151 HCharExcRecTo[LIMELM][LIMELM+1],
00152 HCharHeatMax,
00153 HCharCoolMax,
00154 HCharHeatOn;
00155
00156
00157 double HCharExcRecTo_N0_2D;
00158
00160 double HCharExcIonTotal,
00161 HCharExcRecTotal;
00162
00164 double HeCharExcIonTotal,
00165 HeCharExcRecTotal;
00166
00168 double HIonFrac;
00169
00171 double HIonFracMax;
00172
00179 double HeCharExcIonOf[LIMELM][LIMELM],
00180 HeCharExcRecTo[LIMELM][LIMELM];
00181
00184 double HCTAlex;
00185
00188 bool lgCTOn;
00189
00192 double Density[2][HS_NZ][NHSDIM],
00193 ElecTemp[2][HS_NZ][NHSDIM],
00195 Emiss[2][HS_NZ][NHSDIM][NHSDIM][NLINEHS];
00196
00199 long int nDensity[2][HS_NZ] , ntemp[2][HS_NZ] , ncut[2][HS_NZ];
00200
00204 bool lgHCaseBOK[2][HS_NZ];
00205
00207 long int nsbig;
00208
00211 bool lgCollIonOn;
00212
00217 realnum WaveLengthCaseB[8][25][24];
00218
00220 vector<realnum> CaseBWlHeI;
00221
00223 long nChiantiMaxLevelsFe;
00225 long nChiantiMaxLevels;
00227 bool lgChiantiLevelsSet;
00229 long nStoutMaxLevels;
00231 const long nChiantiPhotoLevelsFe;
00233 const long nChiantiPhotoLevels;
00235 const long nChiantiCollLevelsFe;
00237 const long nChiantiCollLevels;
00238 t_atmdat() : nChiantiPhotoLevelsFe(25), nChiantiPhotoLevels(15), nChiantiCollLevelsFe(100),
00239 nChiantiCollLevels(50) {}
00240
00242 bool lgChiantiOn;
00244 bool lgChiantiHybrid;
00246 bool lgChiantiPrint;
00248 bool lgChiantiExp;
00250 bool lgLamdaOn;
00252 bool lgStoutOn;
00254 bool lgStoutHybrid;
00256 bool lgStoutPrint;
00258 bool lgCalpgmOn;
00260 bool lgGbarOn;
00262 double GbarAulLimit;
00263
00267 double collstrDefault;
00268
00269
00270
00271
00272 typedef enum { DIMA, HYBRID } CollIonRC;
00273 CollIonRC CIRCData;
00274
00276 static const int iVersionLength = 10;
00278 char chVersion[iVersionLength];
00279
00281 char chStoutFile[FILENAME_PATH_LENGTH];
00282
00284 char chCloudyChiantiFile[FILENAME_PATH_LENGTH];
00285
00286 };
00287 extern t_atmdat atmdat;
00288
00289 typedef enum { PHFIT_UNDEF, PHFIT95, PHFIT96 } phfit_version;
00290
00291 class t_ADfA : public Singleton<t_ADfA>
00292 {
00293 friend class Singleton<t_ADfA>;
00294 protected:
00295 t_ADfA();
00296 private:
00297 phfit_version version;
00298
00299 long int L[7];
00300 long int NINN[30];
00301 long int NTOT[30];
00302 realnum PH1[7][30][30][6];
00303 realnum PH2[30][30][7];
00304
00305 realnum PHH[NHYDRO_MAX_LEVEL][5];
00306
00307 realnum P[8][110];
00308 realnum ST[9][405];
00309
00310 realnum rrec[30][30][2];
00311 realnum rnew[30][30][4];
00312 realnum fe[13][3];
00313
00314 realnum HRF[NHYDRO_MAX_LEVEL][9];
00315
00318 realnum STH[NHYDRO_MAX_LEVEL];
00319
00320 double CF[30][30][5];
00321
00324
00325
00326 double HCS[14][10][8];
00327 public:
00331 void set_version(phfit_version val) { version = val; }
00332
00334 phfit_version get_version() const { return version; }
00335
00342 realnum ph1(int i, int j, int k, int l) const { return PH1[i][j][k][l]; }
00343
00348 realnum sth(int i) const { return STH[i]; }
00349
00358 double phfit(long int nz, long int ne, long int is, double e);
00359
00366 double hpfit(long int iz, long int n, double e);
00367
00373 void rec_lines(double t, realnum r[][471]);
00374
00381 double rad_rec(long int iz, long int in, double t);
00382
00389 double H_rad_rec(long int iz, long int n, double t);
00390
00397 double coll_ion(long int iz, long int in, double t);
00398
00399 double coll_ion_wrapper(long int z, long int n, double t);
00400
00401
00402 double coll_ion_hybrid( long int z, long int n, double t);
00403
00409 realnum h_coll_str( long ipLo, long ipHi, long ipTe );
00410 };
00411
00412 class Funct
00413 {
00414 public:
00415 virtual void operator()( long&, long&, const char*, long&) = 0;
00416 virtual ~Funct() = 0;
00417 };
00418
00419 inline Funct::~Funct() {};
00420
00421 typedef Funct* FunctPtr;
00422
00423 class FunctLAMDA : public Funct
00424 {
00425 public:
00426 explicit FunctLAMDA(void) { }
00427 virtual void operator()( long& ipHi, long& ipLo, const char* chLine, long& i)
00428 {
00429 bool lgEOL;
00430 long index = (long)FFmtRead( chLine, &i, strlen(chLine), &lgEOL );
00431 ASSERT( index > 0 );
00432 ipHi = (long)FFmtRead( chLine, &i, strlen(chLine), &lgEOL ) - 1;
00433 ipLo = (long)FFmtRead( chLine, &i, strlen(chLine), &lgEOL ) - 1;
00434 return;
00435 }
00436 private:
00437 };
00438
00439 #include "h2_priv.h"
00440
00441 class FunctDiatoms : public Funct
00442 {
00443 public:
00444 explicit FunctDiatoms(const diatomics& diatom) : diatom_(diatom) { }
00445 virtual void operator()( long& ipHi, long& ipLo, const char* chLine, long& i)
00446 {
00447 diatom_.GetIndices( ipHi, ipLo, chLine, i );
00448 }
00449 private:
00450 const diatomics& diatom_;
00451 };
00452
00453 void ReadCollisionRateTable( CollRateCoeffArray& coll_rate_table, FILE* io, FunctPtr GetIndices, long nMolLevs, long nTemps = -1, long nTrans = -1 );
00454
00455 double InterpCollRate( const CollRateCoeffArray& rate_table, const long& ipHi, const long& ipLo, const double& ftemp);
00456
00457 #endif