Cloudy
Spectral Synthesis Code for Astrophysics
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
dense.h
Go to the documentation of this file.
1 /* This file is part of Cloudy and is copyright (C)1978-2022 by Gary J. Ferland and
2  * others. For conditions of distribution and use see copyright notice in license.txt */
3 
4 #ifndef DENSE_H_
5 #define DENSE_H_
6 
7 /* dense.h density related variables */
8 
9 #include "global.h"
10 #include "module.h"
11 #include "depth_table.h"
12 
13 class molezone;
14 
19 double dense_fabden(double radius,
20  double depth);
21 
22 /*dense_parametric_wind called by dlaw command, returns density for any density law */
23 double dense_parametric_wind(double rad);
24 
26 class t_dense : public module
27 {
28 public:
30  {
31  /* list of atomic weights, mass in AMU, used for thermal line widths */
32  /* >>refer all atomic weight Coplen, T.B. 2001, J. Phys. Chem Ref Data, 30, 701 */
33  AtomicWeight[0] = 1.00794f;
34  AtomicWeight[1] = 4.0026022f;
35  AtomicWeight[2] = 6.9412f;
36  AtomicWeight[3] = 9.0121823f;
37  AtomicWeight[4] = 10.8117f;
38  AtomicWeight[5] = 12.01078f;
39  AtomicWeight[6] = 14.00672f;
40  AtomicWeight[7] = 15.99943f;
41  AtomicWeight[8] = 18.9984032f;
42  AtomicWeight[9] = 20.17976f;
43  AtomicWeight[10] = 22.989770f;
44  AtomicWeight[11] = 24.30506f;
45  AtomicWeight[12] = 26.9815382f;
46  AtomicWeight[13] = 28.08553f;
47  AtomicWeight[14] = 30.9737612f;
48  AtomicWeight[15] = 32.0655f;
49  AtomicWeight[16] = 35.4532f;
50  AtomicWeight[17] = 39.9481f;
51  AtomicWeight[18] = 39.09831f;
52  AtomicWeight[19] = 40.0784f;
53  AtomicWeight[20] = 44.9559108f;
54  AtomicWeight[21] = 47.8671f;
55  AtomicWeight[22] = 50.94151f;
56  AtomicWeight[23] = 51.99616f;
57  AtomicWeight[24] = 54.9380499f;
58  AtomicWeight[25] = 55.8472f;
59  AtomicWeight[26] = 58.9332009f;
60  AtomicWeight[27] = 58.69342f;
61  AtomicWeight[28] = 63.5463f;
62  AtomicWeight[29] = 65.392f;
63 
64  /* smallest density to permit in any ion - if smaller then set to zero */
65  density_low_limit = max( SMALLFLOAT * 1e3, 1e-50 );
66 
67  for (long nelem=0; nelem<LIMELM; ++nelem)
68  {
69  /* turn element on if this is first call to this routine,
70  * but do not reset otherwise since would clobber how elements were set up */
71 
72  /* never turn on element if turned off on first iteration */
73  lgElmtOn[nelem] = true;
74  /* no elements yet explicitly turned off */
75  lgElmtSetOff[nelem] = false;
76 
77  /* option to set ionization with element ioniz cmnd,
78  * default (false) is to solve for ionization */
79  lgSetIoniz[nelem] = false;
80 
81  for (long ion=0; ion<LIMELM+1; ++ion)
82  {
83  // are we using Chianti for this ion?
84  lgIonChiantiOn[nelem][ion] = false;
85  lgIonStoutOn[nelem][ion] = false;
86  maxWN[nelem][ion] = 0.;
87  ionMole[nelem][ion] = NULL;
88  }
89  }
90  zero();
91  }
92 
97  void SetGasPhaseDensity( const long nelem, const realnum density );
98 
101 
102 private:
106 
107 public:
108  realnum xMolecules(long nelem)
109  {
110  return m_xMolecules[nelem];
111  }
112  void updateXMolecules();
113  void zero();
114  void comment(t_warnings&) {}
115  const char* chName() const
116  {
117  return "dense";
118  }
119 
122 
126 
129 
132 
135 
138 
142 
149  long int IonLow[LIMELM+1];
150  long int IonHigh[LIMELM+1];
151 
155  double xIonDense[LIMELM][LIMELM+1];
156 
158 
161 
164 
166  double maxWN[LIMELM][LIMELM+1];
167 
172 
185 
188 
193 
196  char chDenseLaw[5];
197 
198  /* this says keep initial density constant,
199  * so pressure from iter to iter not really const */
201 
202  // let initial pressure vary with time
204 
205  // required number is timescale for time variation
207  // optional number is index for time variation
209 
211  double DensityLaw[10];
212 
216 
219 
221  double eden;
222 
224  double EdenMax , EdenMin;
225 
229 
231  long int nzEdenBad;
232 
235 
238 
241 
243  double SqrtEden;
244 
247  double EdenHCorr;
248 
250 
252  double EdenTrue;
253 
256 
258  bool lgEdenBad;
259 
261  double edensqte;
262 
266  double cdsqte;
267 
273 
276 
280 
286 
287 };
288 extern t_dense dense;
289 
290 // test whether nuclei conservation holds
291 bool lgElemsConserved();
292 
293 class qList;
294 
295 // test whether the sum of a set of states agrees with the ion population to the requested tolerance.
296 void lgStatesConserved ( long nelem, long ionStage, qList states, long numStates, realnum err_tol, long loop_ion );
297 
298 void SumDensities();
299 
300 void ScaleAllDensities( const realnum factor );
301 void ScaleIonDensities( const long nelem, const realnum factor );
302 bool AbundChange();
303 
306 
307 #endif /* DENSE_H_ */
bool lgAsChoose[LIMELM][LIMELM]
Definition: dense.h:214
realnum den0
Definition: dense.h:272
void lgStatesConserved(long nelem, long ionStage, qList states, long numStates, realnum err_tol, long loop_ion)
Definition: dense.cpp:198
realnum EdenFraction
Definition: dense.h:240
Definition: warnings.h:11
long int nzEdenBad
Definition: dense.h:231
void SetGasPhaseDensity(const long nelem, const realnum density)
Definition: dense.cpp:106
realnum xMolecules(long nelem)
Definition: dense.h:108
realnum DensityPower
Definition: dense.h:270
double EdenMax
Definition: dense.h:224
realnum flcPhase
Definition: dense.h:285
void ScaleAllDensities(const realnum factor)
Definition: dense.cpp:56
realnum csecnd
Definition: dense.h:284
bool AbundChange()
Definition: dense.cpp:303
double EdenHCorr
Definition: dense.h:247
const realnum SMALLFLOAT
Definition: cpu.h:235
realnum SetIoniz[LIMELM][LIMELM+1]
Definition: dense.h:192
realnum xNucleiTotal
Definition: dense.h:134
long int IonHigh[LIMELM+1]
Definition: dense.h:150
void ScaleIonDensities(const long nelem, const realnum factor)
Definition: dense.cpp:90
double cdsqte
Definition: dense.h:266
realnum HCorrFac
Definition: dense.h:141
bool lgDenFlucRadius
Definition: dense.h:279
realnum scalingZoneDensity(long i)
Definition: dense.cpp:419
void comment(t_warnings &)
Definition: dense.h:114
void updateXMolecules()
Definition: dense.cpp:24
bool lgElmtSetOff[LIMELM]
Definition: dense.h:184
molezone * ionMole[LIMELM][LIMELM+1]
Definition: dense.h:157
bool lgSetIoniz[LIMELM]
Definition: dense.h:187
Definition: mole.h:407
double EdenMin
Definition: dense.h:224
Definition: dense.h:26
t_dense dense
Definition: global.cpp:15
realnum xMassDensity0
Definition: dense.h:125
bool lgIonStoutOn[LIMELM][LIMELM+1]
Definition: dense.h:163
double edensqte
Definition: dense.h:261
double xIonDense[LIMELM][LIMELM+1]
Definition: dense.h:155
t_dense()
Definition: dense.h:29
bool lgIonChiantiOn[LIMELM][LIMELM+1]
Definition: dense.h:160
long int IonLow[LIMELM+1]
Definition: dense.h:149
realnum pden
Definition: dense.h:128
Definition: quantumstate.h:35
bool lgCSChoose[LIMELM][LIMELM]
Definition: dense.h:215
bool lgPressureVaryTime
Definition: dense.h:203
double PressureVaryTimeIndex
Definition: dense.h:208
const char * chName() const
Definition: dense.h:115
double EdenTrue
Definition: dense.h:252
float realnum
Definition: cddefines.h:127
realnum m_xMolecules[LIMELM]
Definition: dense.h:105
realnum flong
Definition: dense.h:282
long max(int a, long b)
Definition: cddefines.h:821
DepthTable DLW
Definition: dense.h:218
#define NULL
Definition: cddefines.h:115
t_radius radius
Definition: radius.cpp:5
bool lgElmtOn[LIMELM]
Definition: dense.h:180
realnum gas_phase[LIMELM]
Definition: dense.h:96
realnum AbundanceLimit
Definition: dense.h:171
realnum rscale
Definition: dense.h:271
realnum wmole
Definition: dense.h:131
realnum AtomicWeight[LIMELM]
Definition: dense.h:100
bool lgElemsConserved()
Definition: dense.cpp:119
char chDenseLaw[5]
Definition: dense.h:196
double PressureVaryTimeTimescale
Definition: dense.h:206
void SumDensities()
Definition: dense.cpp:238
double density(const genericState &gs)
Definition: generic_state.cpp:27
const int LIMELM
Definition: cddefines.h:318
realnum xMassDensity
Definition: dense.h:121
realnum EdenHCorr_f
Definition: dense.h:249
bool lgDenseInitConstant
Definition: dense.h:200
double eden
Definition: dense.h:221
realnum xMassTotal
Definition: dense.h:137
bool lgEdenBad
Definition: dense.h:258
Definition: depth_table.h:7
double dense_fabden(double radius, double depth)
Definition: dense_fabden.cpp:10
bool lgDenFlucOn
Definition: dense.h:275
double maxWN[LIMELM][LIMELM+1]
Definition: dense.h:166
void zero()
Definition: dense.cpp:29
double dense_parametric_wind(double rad)
Definition: dense_parametric_wind.cpp:9
double SqrtEden
Definition: dense.h:243
double DensityLaw[10]
Definition: dense.h:211
realnum EdenSet
Definition: dense.h:234
double eden_from_metals
Definition: dense.h:255
realnum cfirst
Definition: dense.h:283
Definition: module.h:26
realnum EdenExtra
Definition: dense.h:237
realnum scalingDensity()
Definition: dense.cpp:412
double density_low_limit
Definition: dense.h:228