Cloudy
Spectral Synthesis Code for Astrophysics
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
grainvar.h
Go to the documentation of this file.
1 /* This file is part of Cloudy and is copyright (C)1978-2023 by Gary J. Ferland and
2  * others. For conditions of distribution and use see copyright notice in license.txt */
3 
4 #ifndef GRAINVAR_H_
5 #define GRAINVAR_H_
6 
7 /* grainvar.h */
8 
9 #include "container_classes.h"
10 
13 const bool ENABLE_QUANTUM_HEATING=false;
14 
16 const int NDEMS = 200;
17 
19 const double GRAIN_TMIN = 1.e-3;
20 const double GRAIN_TMID = 5.e3;
21 const double GRAIN_TMAX = 1.2e9;
22 
24 const int NCHS = 50;
27 const int NCHU = NCHS/5;
29 const int NCHRG_DEFAULT= 2;
30 
34 const int NQGRID = 10000;
35 
37 const double CONSERV_TOL = 1.e-3;
38 
40 typedef enum {
44 } df_type;
45 
47 typedef enum {
55 } enth_type;
56 
58 typedef enum {
61 } zmin_type;
62 
64 typedef enum {
67 } pot_type;
68 
70 typedef enum {
73 } ial_type;
74 
76 typedef enum {
79 } pe_type;
80 
82 typedef enum {
85 } strg_type;
86 
88 typedef enum {
97 } H2_type;
98 
102 typedef enum {
115 } mat_type;
116 
117 struct GrainPar {
118  double dep;
121  lgGreyGrain,
123 };
124 
126 {
127  void p_clear0();
128  void p_clear1();
129 
130 public:
132  {
133  p_clear1();
134  }
135  void clear()
136  {
137  p_clear0();
138  p_clear1();
139  }
140 
141  long nelem;
142  long ns;
143  double ionPot;
144  long ipLo;
147  long nData;
148  vector<double> AvNr;
149  vector<double> Ener;
150  vector< flex_arr<realnum> > y01A;
151 };
152 
157 class AEInfo
158 {
159  void p_clear0();
160  void p_clear1();
161 
162 public:
164  {
165  p_clear1();
166  }
167  void clear()
168  {
169  p_clear0();
170  p_clear1();
171  }
172 
173  unsigned int nSubShell;
174  vector<unsigned int> nData;
175  vector<double> IonThres;
176  vector< vector<double> > AvNumber;
178  vector< vector<double> > Energy;
179 };
180 
196 {
197  void p_clear0();
198  void p_clear1();
199 
200 public:
202  {
203  p_clear1();
204  }
205  void clear()
206  {
207  p_clear0();
208  p_clear1();
209  }
210 
212  long DustZ,
213  ipThresInf,
214  ipThresInfVal,
215  nfill;
216  double FracPop,
217  Emin,
218  EminInc,
219  PotSurf,
220  PotSurfInc,
221  ThresInf,
222  ThresInfInc,
223  ThresInfVal,
224  ThresSurf,
225  ThresSurfInc,
226  ThresSurfVal,
227  ThermRate;
235  double eta[LIMELM+2],
236  xi[LIMELM+2];
238  double RSum1;
239  double RSum2;
240  double ESum1a;
241  double ESum1b;
242  double ESum2;
246  double hcon1;
247  double hots1;
248  double bolflux1;
249  double pe1;
257  double BolFlux,
258  GrainHeat,
259  GrainHeatColl,
261  GasHeatTherm,
263  ChemEnIon,
264  ChemEnH2;
267  double HeatingRate2;
268 };
269 
284 class GrainBin
285 {
286  void p_clear0();
287  void p_clear1();
288 
289  vector<ChargeBin> pool;
290 public:
292  {
293  p_clear1();
294  }
295  void clear()
296  {
297  p_clear0();
298  p_clear1();
299  }
300 
304  bool lgIterStart;
307  char chDstLab[13];
308  double eec;
309  double eyc;
310  realnum dustp[5],
312  AvRadius,
313  AvArea,
314  AvVol,
315  IntRadius,
316  IntArea,
317  IntVol,
318  elmAbund[LIMELM],
319  atomWeight,
320  Tsublimat,
321  DustWorkFcn,
322  BandGap,
323  ThermEff,
324  avDGRatio;
336  dstAbund,
337  GrnDpth;
339  double cnv_H_pGR,
340  cnv_H_pCM3,
341  cnv_CM3_pGR,
342  cnv_CM3_pH,
343  cnv_GR_pH,
344  cnv_GR_pCM3;
347  double RSFCheck;
351  vector<double> dstab1;
352  vector<double> pure_sc1;
353  vector<double> asym;
354  vector<double> dstab1_x_anu;
357  double dstems[NDEMS],
358  dstslp[NDEMS],
359  dstslp2[NDEMS];
363  TeGrainMax,
364  avdust;
372  long LowestZg;
373  long nfill;
374  vector<ShellData> sd;
375  vector<realnum> y0b06;
376  double AveDustZ;
377  long ZloSave;
378  double Capacity;
379  double dstpot,
380  RateUp,
381  RateDn,
382  StickElecNeg,
383  StickElecPos;
385  le_thres;
386  vector<realnum> inv_att_len;
387  double AccomCoef[LIMELM];
390  double BolFlux,
393  GrainHeat,
394  GrainHeatColl,
395  GrainGasCool,
396  ChemEn,
397  ChemEnH2,
398  thermionic;
401  bool lgQHeat,
402  lgUseQHeat,
403  lgEverQHeat,
404  lgQHTooWide;
406  qnflux,
407  qnflux2;
408  double qtmin;
409  double qtmin_zone1;
410  double HeatingRate1;
411  double DustEnth[NDEMS],
412  EnthSlp[NDEMS],
413  EnthSlp2[NDEMS];
425  avdft;
427  long nChrgOrg;
428  long nChrg;
429  long ichrg[NCHS];
430  ChargeBin& chrg(long nz) { return pool[ichrg[nz]]; }
431  const ChargeBin& chrg(long nz) const { return pool[ichrg[nz]]; }
432 };
433 
442 class GrainVar
443 {
444  void p_clear0();
445  void p_clear1();
446 
447 public:
449  {
450  p_clear1();
451  }
452  void clear()
453  {
454  p_clear0();
455  p_clear1();
456  }
457 
459  bool lgDustOn() const
460  {
461  return ( bin.size() > 0 );
462  }
463  bool lgWD01,
464  lgReevaluate,
468  lgAnyDustVary,
470  bool lgNegGrnDrg;
473  bool lgDHetOn,
474  lgQHeatOn;
478  bool lgDColOn;
483 
486  vector<string> ReadRecord;
510  long nzone;
511  vector<double> dstab;
512  vector<double> dstsc;
515  double TotalEden;
519  double GrnRecomTe;
528 
530  double GasCoolColl,
532  GasHeatTherm,
533  GasHeatNet,
534  GrainHeatSum,
535  GrainHeatLya,
536  GrainHeatDif,
537  GrainHeatInc,
539  GrainHeatChem;
541  double dHeatdT;
546  dphmax,
547  dclmax;
550  double dsttmp[NDEMS];
555  bool lgQHeatAll;
556  bool lgQHPunLast;
557  FILE *QHSaveFile;
564  vector<realnum> GrainEmission;
565  vector<realnum> GraphiteEmission;
566  vector<realnum> SilicateEmission;
569  vector<GrainBin> bin;
570 };
571 
572 extern GrainVar gv;
573 
574 #endif /* GRAINVAR_H_ */
long qnflux2
Definition: grainvar.h:405
Definition: grainvar.h:125
Definition: grainvar.h:54
Definition: grainvar.h:103
vector< realnum > y0b06
Definition: grainvar.h:375
Definition: grainvar.h:105
ChargeBin()
Definition: grainvar.h:201
Definition: grainvar.h:65
bool lgBakesPAH_heat
Definition: grainvar.h:463
realnum tedust
Definition: grainvar.h:245
double PotSurf
Definition: grainvar.h:216
vector< double > dstab
Definition: grainvar.h:511
double ionPot
Definition: grainvar.h:143
double bolflux1
Definition: grainvar.h:248
long QHeatFailures
Definition: grainvar.h:405
double GrainHeatLya
Definition: grainvar.h:530
double EnthSlp2[NDEMS]
Definition: grainvar.h:411
Definition: grainvar.h:77
flex_arr< realnum > ehat
Definition: grainvar.h:230
long ZloSave
Definition: grainvar.h:377
double cnv_GR_pH
Definition: grainvar.h:339
realnum atomWeight
Definition: grainvar.h:311
double rate_h2_form_grains_used
Definition: grainvar.h:420
FILE * QHSaveFile
Definition: grainvar.h:557
bool lgUseQHeat
Definition: grainvar.h:401
flex_arr< double > cs_pdt
Definition: grainvar.h:231
double GrainHeatSum
Definition: grainvar.h:530
bool lgGrainElectrons
Definition: grainvar.h:482
vector< ShellData > sd
Definition: grainvar.h:374
double dstems[NDEMS]
Definition: grainvar.h:357
realnum dclmax
Definition: grainvar.h:545
realnum le_thres
Definition: grainvar.h:384
Definition: grainvar.h:78
double cnv_H_pGR
Definition: grainvar.h:339
double StickElecNeg
Definition: grainvar.h:379
Definition: grainvar.h:284
vector< ChargeBin > pool
Definition: grainvar.h:289
double cnv_CM3_pGR
Definition: grainvar.h:339
long qnflux
Definition: grainvar.h:405
double GrainHeat
Definition: grainvar.h:257
long nData
Definition: grainvar.h:147
const double GRAIN_TMAX
Definition: grainvar.h:21
double GrainHeatColl
Definition: grainvar.h:257
double ESum1b
Definition: grainvar.h:241
double dstslp2[NDEMS]
Definition: grainvar.h:357
double GasCoolColl
Definition: grainvar.h:530
long LowestZg
Definition: grainvar.h:372
strg_type
Definition: grainvar.h:82
double ThresSurfInc
Definition: grainvar.h:216
long nelem
Definition: grainvar.h:141
bool lgQHeat
Definition: grainvar.h:401
bool lgAnyDustVary
Definition: grainvar.h:463
realnum tedust
Definition: grainvar.h:362
Definition: grainvar.h:59
vector< realnum > inv_att_len
Definition: grainvar.h:386
realnum BandGap
Definition: grainvar.h:311
double thermionic
Definition: grainvar.h:390
double EminInc
Definition: grainvar.h:216
double dsttmp[NDEMS]
Definition: grainvar.h:550
AEInfo()
Definition: grainvar.h:163
double GrainCoolTherm
Definition: grainvar.h:390
Definition: grainvar.h:42
realnum elmAbund[LIMELM]
Definition: grainvar.h:311
zmin_type
Definition: grainvar.h:58
double HeatingRate2
Definition: grainvar.h:267
double xi[LIMELM+2]
Definition: grainvar.h:235
vector< double > dstab1
Definition: grainvar.h:351
df_type
Definition: grainvar.h:40
df_type nDustFunc
Definition: grainvar.h:302
flex_arr< realnum > yhat_primary
Definition: grainvar.h:229
bool lgQHeatAll
Definition: grainvar.h:555
double dep
Definition: grainvar.h:118
Definition: grainvar.h:106
Definition: grainvar.h:66
bool lgReevaluate
Definition: grainvar.h:463
double GrainHeatColl
Definition: grainvar.h:390
long ipLo
Definition: grainvar.h:144
double Emin
Definition: grainvar.h:216
Definition: grainvar.h:41
Definition: grainvar.h:60
pe_type which_pe[MAT_TOP]
Definition: grainvar.h:505
ChargeBin & chrg(long nz)
Definition: grainvar.h:430
void p_clear0()
Definition: grainvar.cpp:26
realnum avdust
Definition: grainvar.h:362
bool lgQHeatOn
Definition: grainvar.h:473
realnum Tsublimat
Definition: grainvar.h:311
realnum elmSumAbund[LIMELM]
Definition: grainvar.h:496
double dHeatdT
Definition: grainvar.h:541
void clear()
Definition: grainvar.h:205
Definition: grainvar.h:91
double GrainHeatCollSum
Definition: grainvar.h:530
bool lgQHPunLast
Definition: grainvar.h:556
Definition: grainvar.h:50
Definition: grainvar.h:53
Definition: grainvar.h:108
realnum avDGRatio
Definition: grainvar.h:311
pe_type
Definition: grainvar.h:76
Definition: grainvar.h:89
void p_clear0()
Definition: grainvar.cpp:143
vector< vector< double > > AvNumber
Definition: grainvar.h:176
void p_clear1()
Definition: grainvar.cpp:17
long ichrg[NCHS]
Definition: grainvar.h:429
vector< double > asym
Definition: grainvar.h:353
double cnv_GR_pCM3
Definition: grainvar.h:339
df_type nDustFunc
Definition: grainvar.h:119
double RSFCheck
Definition: grainvar.h:347
double RSum1
Definition: grainvar.h:238
void p_clear0()
Definition: grainvar.cpp:8
double FracPop
Definition: grainvar.h:216
vector< realnum > GraphiteEmission
Definition: grainvar.h:565
mat_type
Definition: grainvar.h:102
realnum GrnElecDonateMax
Definition: grainvar.h:517
realnum TeGrainMax
Definition: grainvar.h:362
flex_arr< realnum > yhat
Definition: grainvar.h:228
H2_type which_H2distr[MAT_TOP]
Definition: grainvar.h:507
double hots1
Definition: grainvar.h:247
long DustZ
Definition: grainvar.h:212
vector< double > dstsc
Definition: grainvar.h:512
bool lgNegGrnDrg
Definition: grainvar.h:470
flex_arr< realnum > p
Definition: grainvar.h:145
double RateUp
Definition: grainvar.h:379
Definition: grainvar.h:71
bool lgIterStart
Definition: grainvar.h:304
vector< vector< double > > Energy
Definition: grainvar.h:178
char chDstLab[13]
Definition: grainvar.h:307
Definition: grainvar.h:48
double GrainCoolTherm
Definition: grainvar.h:257
vector< double > dstab1_x_anu
Definition: grainvar.h:354
double TotalEden
Definition: grainvar.h:515
realnum dustp[5]
Definition: grainvar.h:311
double qtmin_zone1
Definition: grainvar.h:409
bool lgGreyGrain
Definition: grainvar.h:120
realnum dstAbundThresholdNear
Definition: grainvar.h:553
Definition: grainvar.h:83
const bool ENABLE_QUANTUM_HEATING
Definition: grainvar.h:13
vector< realnum > GrainEmission
Definition: grainvar.h:564
double ThresInfVal
Definition: grainvar.h:216
double DustEnth[NDEMS]
Definition: grainvar.h:411
strg_type which_strg[MAT_TOP]
Definition: grainvar.h:506
long nChrg
Definition: grainvar.h:428
long ipThresInf
Definition: grainvar.h:212
double GasHeatTherm
Definition: grainvar.h:530
realnum AvArea
Definition: grainvar.h:311
pot_type which_pot[MAT_TOP]
Definition: grainvar.h:503
long ns
Definition: grainvar.h:142
GrainVar()
Definition: grainvar.h:448
void p_clear1()
Definition: grainvar.cpp:156
double dstpot
Definition: grainvar.h:379
realnum dstAbundThresholdFar
Definition: grainvar.h:554
realnum dstfactor
Definition: grainvar.h:335
double ThresInfInc
Definition: grainvar.h:216
Definition: grainvar.h:96
Definition: grainvar.h:195
double StickElecPos
Definition: grainvar.h:379
double HeatingRate1
Definition: grainvar.h:410
const int NCHU
Definition: grainvar.h:27
enth_type which_enth[MAT_TOP]
Definition: grainvar.h:501
bool lgTdustConverged
Definition: grainvar.h:361
bool lgRequestQHeating
Definition: grainvar.h:120
float realnum
Definition: cddefines.h:127
Definition: grainvar.h:43
void p_clear1()
Definition: grainvar.cpp:49
ShellData()
Definition: grainvar.h:131
double GrainHeatDif
Definition: grainvar.h:530
Definition: grainvar.h:51
pot_type
Definition: grainvar.h:64
double rate_h2_form_grains_CT02
Definition: grainvar.h:417
Definition: grainvar.h:84
void clear()
Definition: grainvar.h:295
enth_type
Definition: grainvar.h:47
double rate_h2_form_grains_ELRD
Definition: grainvar.h:418
bool lgGrainPhysicsOn
Definition: grainvar.h:463
double hcon1
Definition: grainvar.h:246
void p_clear0()
Definition: grainvar.cpp:39
double PotSurfInc
Definition: grainvar.h:216
double ChemEnIon
Definition: grainvar.h:257
bool lgForbidQHeating
Definition: grainvar.h:120
double ThermRate
Definition: grainvar.h:216
void p_clear0()
Definition: grainvar.cpp:57
Definition: grainvar.h:52
double rate_h2_form_grains_HM79
Definition: grainvar.h:416
long nChrgOrg
Definition: grainvar.h:427
double ESum2
Definition: grainvar.h:242
ial_type
Definition: grainvar.h:70
AEInfo AugerData[LIMELM]
Definition: grainvar.h:522
H2_type
Definition: grainvar.h:88
Definition: grainvar.h:107
double GasHeatPhotoEl
Definition: grainvar.h:390
double GasHeatPhotoEl
Definition: grainvar.h:530
void clear()
Definition: grainvar.h:135
const int NCHRG_DEFAULT
Definition: grainvar.h:29
const double GRAIN_TMID
Definition: grainvar.h:20
realnum IntVol
Definition: grainvar.h:311
realnum avdpot
Definition: grainvar.h:384
double BolFlux
Definition: grainvar.h:390
void clear()
Definition: grainvar.h:452
Definition: grainvar.h:72
bool lgWD01
Definition: grainvar.h:463
const double GRAIN_TMIN
Definition: grainvar.h:19
double ThresInf
Definition: grainvar.h:216
flex_arr< double > fac2
Definition: grainvar.h:251
Definition: grainvar.h:104
ial_type which_ial[MAT_TOP]
Definition: grainvar.h:504
vector< flex_arr< realnum > > y01A
Definition: grainvar.h:150
Definition: grainvar.h:109
long nfill
Definition: grainvar.h:212
void clear()
Definition: grainvar.h:167
double GasHeatTherm
Definition: grainvar.h:257
zmin_type which_zmin[MAT_TOP]
Definition: grainvar.h:502
bool lgDHetOn
Definition: grainvar.h:473
realnum ChemEn[LIMELM][LIMELM+1]
Definition: grainvar.h:254
double GasHeatPhotoEl
Definition: grainvar.h:257
long ipThresInfVal
Definition: grainvar.h:212
realnum DustWorkFcn
Definition: grainvar.h:311
const int LIMELM
Definition: cddefines.h:318
long nChrgRequested
Definition: grainvar.h:520
double cnv_CM3_pH
Definition: grainvar.h:339
vector< double > pure_sc1
Definition: grainvar.h:352
double ESum1a
Definition: grainvar.h:240
Definition: grainvar.h:110
bool lgQHTooWide
Definition: grainvar.h:401
const int NDEMS
Definition: grainvar.h:16
realnum GrnDpth
Definition: grainvar.h:335
realnum RecomEn[LIMELM][LIMELM+1]
Definition: grainvar.h:253
vector< double > AvNr
Definition: grainvar.h:148
realnum GrainHeatScaleFactor
Definition: grainvar.h:543
double eta[LIMELM+2]
Definition: grainvar.h:235
long nCalledGrainDrive
Definition: grainvar.h:484
vector< double > Ener
Definition: grainvar.h:149
realnum ThermEff
Definition: grainvar.h:311
realnum GrainMetal
Definition: grainvar.h:496
double ChemEnH2
Definition: grainvar.h:390
long RecomZ0[LIMELM][LIMELM+1]
Definition: grainvar.h:233
long nfill
Definition: grainvar.h:373
vector< double > IonThres
Definition: grainvar.h:175
flex_arr< double > fac1
Definition: grainvar.h:250
double GrnRecomTe
Definition: grainvar.h:519
double GrainHeat
Definition: grainvar.h:390
realnum IntRadius
Definition: grainvar.h:311
double eec
Definition: grainvar.h:308
double BolFlux
Definition: grainvar.h:257
const int NQGRID
Definition: grainvar.h:34
const double CONSERV_TOL
Definition: grainvar.h:37
vector< GrainBin > bin
Definition: grainvar.h:569
Definition: grainvar.h:49
double EnthSlp[NDEMS]
Definition: grainvar.h:411
realnum GrnElecHoldMax
Definition: grainvar.h:518
string chPAH_abundance
Definition: grainvar.h:488
double qtmin
Definition: grainvar.h:408
double pe1
Definition: grainvar.h:249
long nzone
Definition: grainvar.h:510
double Capacity
Definition: grainvar.h:378
double ChemEnH2
Definition: grainvar.h:257
Definition: grainvar.h:90
vector< unsigned int > nData
Definition: grainvar.h:174
Definition: grainvar.h:442
vector< realnum > SilicateEmission
Definition: grainvar.h:566
bool lgEverQHeat
Definition: grainvar.h:401
vector< string > ReadRecord
Definition: grainvar.h:486
double RateDn
Definition: grainvar.h:379
Definition: grainvar.h:114
Definition: grainvar.h:157
realnum TotalDustHeat
Definition: grainvar.h:545
double cnv_H_pCM3
Definition: grainvar.h:339
const ChargeBin & chrg(long nz) const
Definition: grainvar.h:431
realnum dphmax
Definition: grainvar.h:545
realnum dstAbund
Definition: grainvar.h:335
realnum AvVol
Definition: grainvar.h:311
bool lgDustOn() const
Definition: grainvar.h:459
double RSum2
Definition: grainvar.h:239
Definition: grainvar.h:117
realnum GrainChTrRate[LIMELM][LIMELM+1][LIMELM+1]
Definition: grainvar.h:527
realnum avdft
Definition: grainvar.h:424
double ThresSurf
Definition: grainvar.h:216
bool lgPAHsInIonizedRegion
Definition: grainvar.h:303
double eyc
Definition: grainvar.h:309
realnum AvRadius
Definition: grainvar.h:311
double GrainHeatChem
Definition: grainvar.h:530
double AccomCoef[LIMELM]
Definition: grainvar.h:387
void p_clear1()
Definition: grainvar.cpp:34
double GrainGasCool
Definition: grainvar.h:390
void p_clear1()
Definition: grainvar.cpp:69
GrainVar gv
Definition: grainvar.cpp:6
double AveDustZ
Definition: grainvar.h:376
double dstslp[NDEMS]
Definition: grainvar.h:357
flex_arr< realnum > y01
Definition: grainvar.h:146
double GrainHeatInc
Definition: grainvar.h:530
realnum DustDftVel
Definition: grainvar.h:424
realnum IntArea
Definition: grainvar.h:311
double rate_h2_form_grains_used_total
Definition: grainvar.h:560
double ChemEn
Definition: grainvar.h:390
unsigned int nSubShell
Definition: grainvar.h:173
const int NCHS
Definition: grainvar.h:24
bool lgDColOn
Definition: grainvar.h:478
double GasHeatNet
Definition: grainvar.h:530
GrainBin()
Definition: grainvar.h:291
mat_type matType
Definition: grainvar.h:325
double ThresSurfVal
Definition: grainvar.h:216