cloudy  trunk
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
predcont.cpp
Go to the documentation of this file.
1 /* This file is part of Cloudy and is copyright (C)1978-2017 by Gary J. Ferland and
2  * others. For conditions of distribution and use see copyright notice in license.txt */
3 #include "cddefines.h"
4 #include "predcont.h"
5 #include "rfield.h"
6 
8 {
9  /* energies where diffuse continuum is to be entered into line array
10  * NB - if these numbers change, the wavelength in the printout will change
11  * too, since the wavelength is derived form this */
12  /* >>>chng 99 mar 23, adjusted energies so that wavelength line list is
13  * the same as it was in C90 - small changes were caused by going over
14  * to proper Rydberg constant */
15 
16  p_val.reserve(100);
17 
18  add(1275.,"MHz"); /* VLA */
19  add(1465.,"MHz"); /* VLA */
20  add(4535.,"MHz"); /* VLA */
21  add(4885.,"MHz"); /* VLA */
22  add(8435.,"MHz"); /* VLA */
23  add(8735.,"MHz"); /* VLA */
24  add(3.4,"cm");
25  add(14965.,"MHz"); /* VLA */
26  add(22460.,"MHz"); /* VLA */
27  add(30.,"GHz"); /* OCRA */
28  add(43340.,"MHz"); /* VLA */
29  add(7.445e-04,"Ryd");
30  add(1.498e-03,"Ryd");
31  add(2.211e-03,"Ryd");
32  add(2.952e-03,"Ryd");
33  add(3.677e-03,"Ryd");
34  add(3.7501e-03,"Ryd"); /* Ney-Allen */
35  add(3.9915e-03,"Ryd"); /* Ney-Allen */
36  add(4.2543e-03,"Ryd"); /* Ney-Allen */
37  add(4.314e-03,"Ryd");
38  add(4.6446e-03,"Ryd"); /* Ney-Allen */
39  add(5.162e-03,"Ryd");
40  add(5.2462e-03,"Ryd"); /* Ney-Allen */
41  add(5.8079e-03,"Ryd"); /* Ney-Allen */
42  add(6.240e-03,"Ryd");
43  add(7.3312e-03,"Ryd"); /* Ney-Allen */
44  add(7.9936e-03,"Ryd"); /* Ney-Allen */
45  add(8.7119e-03,"Ryd"); /* Ney-Allen */
46  add(9.6125e-03,"Ryd"); /* Ney-Allen */
47  add(9.77243e-03,"Ryd");
48  add(1.1099e-02,"Ryd"); /* Ney-Allen */
49  add(1.2022e-02,"Ryd"); /* Ney-Allen */
50  add(1.29253e-02,"Ryd");
51  add(2.2152e-02,"Ryd");
52  add(3.92044e-02,"Ryd");
53  add(5.54593e-02,"Ryd");
54  /* next two either side of n=4 edge of hydrogen, set to 1.5% off either direction*/
55  /* >>chng 00 sep 18, had been too close in energy */
56  add(6.1563e-02,"Ryd");
57  add(6.3437e-02,"Ryd");
58  add(8.1460e-02,"Ryd");
59  /* >>chng 00 sep 14, changed energies of paschen jump to be farther away as
60  * per note on BJ */
61  add(0.1094,"Ryd");
62  add(0.1128,"Ryd");
63  add(0.14675,"Ryd");
64  add(0.18653,"Ryd");
65  /* >>chng 00 sep 14, next two energies changed since they were too close to BJ
66  * and so both ended up shortward of limit*/
67  /* these two are the Balmer jump, below and above. */
68  /* continuum binning not much better than 1% so offset energies by more */
69  add(0.246,"Ryd");
70  add(0.254,"Ryd");
71  add(0.375,"Ryd"); /* peak on two photon continuum */
72  add(0.38096,"Ryd");
73  add(0.43994,"Ryd");
74  add(0.44394,"Ryd");
75  add(0.50811,"Ryd");
76  add(0.57489,"Ryd");
77  add(0.62487,"Ryd");
78  add(0.67155,"Ryd");
79  add(0.70244,"Ryd");
80  add(0.72163,"Ryd");
81  add(0.74812,"Ryd");
82  add(0.76172,"Ryd");
83  add(0.77551,"Ryd");
84  add(0.79681,"Ryd");
85  add(0.81859,"Ryd");
86  add(0.8260,"Ryd");
87  add(0.84859,"Ryd");
88  add(0.85618,"Ryd");
89  add(0.87967,"Ryd");
90  add(1000.,"A");
91  /* points on either side of Lyman jump,
92  * energies changed to be robust when energy grid changes,
93  * grid resolution is about 1%, so change from 0.99783 and 1.000
94  * to 1 +/- 1.5%
95  * >>chng 00 sep 23 change wavelength points for next two */
96  add(0.985,"Ryd");
97  add(1.015,"Ryd");
98  add(1.199,"Ryd");
99  add(1.299,"Ryd");
100  add(1.4984,"Ryd");
101  add(1.58441,"Ryd");
102  /* points on either side of Lyman jump,
103  * energies changed to be robust when energy grid changes,
104  * grid resolution is about 1%, so change from 1.80433 and 1.809
105  * to 1.807 +/- 1.5%
106  * >>chng 00 sep 23 change wavelength points for next two */
107  add(1.780,"Ryd");
108  add(1.834,"Ryd");
109  add(2.283,"Ryd");
110 }
111 
112 long t_PredCont::find(double energy, const char* unit) const
113 {
114  DEBUG_ENTRY( "t_PredCont::find()" );
115 
116  for( size_t i=0; i < p_val.size(); ++i )
117  if( fp_equal( p_val[i].get(unit), energy ) )
118  return i;
119  return -1;
120 }
121 
122 long t_PredCont::add(double energy, const char* unit)
123 {
124  DEBUG_ENTRY( "t_PredCont::add()" );
125 
126  long ind = find(energy, unit);
127  if( ind < 0 )
128  {
129  p_val.push_back( EnergyEntry(energy, unit) );
130  ind = p_val.size()-1;
131  }
132  double eRyd = p_val[ind].Ryd();
133  if( eRyd < rfield.emm() || eRyd > rfield.egamry() )
134  {
135  fprintf( ioQQQ, " The energy %g Ryd (%g %s) is not within the default Cloudy range\n",
136  eRyd, energy, unit );
137  fprintf( ioQQQ, " The energy must be between %g and %g Ryd\n",
138  rfield.emm(), rfield.egamry() );
140  }
141  return ind;
142 }
double emm() const
Definition: mesh.h:84
FILE * ioQQQ
Definition: cddefines.cpp:7
Definition: energy.h:105
bool fp_equal(sys_float x, sys_float y, int n=3)
Definition: cddefines.h:858
long find(double energy, const char *unit="Ryd") const
Definition: predcont.cpp:112
vector< EnergyEntry > p_val
Definition: predcont.h:18
double energy(const genericState &gs)
t_rfield rfield
Definition: rfield.cpp:9
#define EXIT_FAILURE
Definition: cddefines.h:168
t_PredCont()
Definition: predcont.cpp:7
#define cdEXIT(FAIL)
Definition: cddefines.h:484
#define DEBUG_ENTRY(funcname)
Definition: cddefines.h:729
double egamry() const
Definition: mesh.h:88
int fprintf(const Output &stream, const char *format,...)
Definition: service.cpp:1217
long add(double energy, const char *unit="Ryd")
Definition: predcont.cpp:122