cloudy  trunk
pressure.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 PRESSURE_H_
5 #define PRESSURE_H_
6 
7 #include "rt.h"
8 #include "rfield.h"
9 #include "doppvel.h"
10 #include "physconst.h"
11 #include "transition.h"
12 
15 void PresTotCurrent(void);
16 
18 inline double PressureRadiationLine( const TransitionProxy &t, realnum DopplerWidth )
19 {
20  DEBUG_ENTRY( "PressureRadiationLine()" );
21 
22  /* return zero if below plasma frequency */
23  if( t.EnergyErg() / EN1RYD <= rfield.plsfrq )
24  return 0.;
25 
26  /* RT_LineWidth gets line width in terms of RT effects */
27  double width = RT_LineWidth(t, DopplerWidth);
28 
29  double PopOpc = t.Emis().PopOpc()/(*t.Lo()).g();
30  /* return zero line radiation PressureReturned if line mases or has
31  * zero opacity */
32  /* \todo 2 1e-22 is arbtrary but roughly 1/kpc. Replace with a cloud width if available? */
33  if( PopOpc*t.Emis().opacity()/ DopplerWidth <= 1.e-22 || width<=0. )
34  return 0.;
35 
36  double PressureReturned = PI8 * HPLANCK / 3. * POW4(t.EnergyWN()) *
37  ((*t.Hi()).Pop()/(*t.Hi()).g())/PopOpc * width;
38 
39  /* this prevents line radiation PressureReturned from being very large when line
40  * is not optically thick but total opacity at that energy is large
41  * due to overlapping transitions */
42  long int ipLineCenter = t.Emis().ipFine() + rfield.ipFineConVelShift;
43  if( ipLineCenter > 0 && ipLineCenter < rfield.nfine && rfield.lgOpacityFine &&
44  rfield.fine_opac_zone[ipLineCenter] > SMALLFLOAT )
45  {
46  double FractionThisLine = t.Emis().PopOpc() * t.Emis().opacity() / DopplerWidth/
47  rfield.fine_opac_zone[ipLineCenter];
48  if( FractionThisLine<1e-5 )
49  FractionThisLine = 0.;
50  /* fine opacities are only reevaluated one time per zone due
51  * to the expense - PopOpc is for the current solution - but the two
52  * may be out of step by a few percent, due to the variation in
53  * abundance from zone to zone. This prevents the change
54  * in solution from increasing the radiation pressure.
55  * This correction is mainly an order of magnitude scaler to prevent
56  * optically thin lines from appearing to be optically thick due to
57  * overlapping lines */
58  FractionThisLine = MIN2(1., FractionThisLine);
59  ASSERT( FractionThisLine >= 0. && FractionThisLine <= 1.0 );
60  PressureReturned *= FractionThisLine;
61  }
62 
63  return PressureReturned;
64 }
65 
67 struct t_pressure {
68 
75 
77 
79  double PresRamCurr;
80 
82  double PresTurbCurr;
83 
86  double PresTotlCurr,
90 
92  double PresTotlInit;
93 
99 
102 
106 
111 
117 
122  double RhoGravity;
126  vector<double> external_mass[3];
127 
133 
134  realnum
141 
143  long int ipPradMax_line;
144 
146  long int ipPradMax_nzone;
147 
149  char chLineRadPres[101];
150 
153  bool lgPradCap,
155 
158 
162 
166 
169 
176 
177  };
178 extern t_pressure pressure;
179 
180 
181 #endif /* PRESSURE_H_ */
t_pressure::PresRamCurr
double PresRamCurr
Definition: pressure.h:79
TransitionProxy::EnergyErg
realnum EnergyErg() const
Definition: transition.h:78
t_pressure::RhoGravity_external
double RhoGravity_external
Definition: pressure.h:121
t_pressure::lgPradCap
bool lgPradCap
Definition: pressure.h:153
t_rfield::plsfrq
realnum plsfrq
Definition: rfield.h:447
t_pressure::PresTurbCurr
double PresTurbCurr
Definition: pressure.h:82
rfield
t_rfield rfield
Definition: rfield.cpp:8
t_pressure::pinzon
realnum pinzon
Definition: pressure.h:110
EmissionProxy::ipFine
long int & ipFine() const
Definition: emission.h:413
t_pressure::pinzon_PresIntegElecThin
realnum pinzon_PresIntegElecThin
Definition: pressure.h:116
PI8
const UNUSED double PI8
Definition: physconst.h:38
realnum
float realnum
Definition: cddefines.h:103
rfield.h
t_pressure::lgPres_magnetic_ON
bool lgPres_magnetic_ON
Definition: pressure.h:131
t_pressure::lgSonicPoint
bool lgSonicPoint
Definition: pressure.h:168
PressureRadiationLine
double PressureRadiationLine(const TransitionProxy &t, realnum DopplerWidth)
Definition: pressure.h:18
RT_LineWidth
double RT_LineWidth(const TransitionProxy &t, realnum DopplerWidth)
Definition: rt_escprob.cpp:918
EmissionProxy::PopOpc
double & PopOpc() const
Definition: emission.h:603
t_rfield::ipFineConVelShift
long int ipFineConVelShift
Definition: rfield.h:418
PresTotCurrent
void PresTotCurrent(void)
Definition: pressure_total.cpp:34
t_pressure::PresHigh
realnum PresHigh
Definition: pressure.h:74
t_rfield::lgOpacityFine
bool lgOpacityFine
Definition: rfield.h:421
t_pressure::ipPradMax_nzone
long int ipPradMax_nzone
Definition: pressure.h:146
ASSERT
#define ASSERT(exp)
Definition: cddefines.h:578
t_pressure::RhoGravity_dark
double RhoGravity_dark
Definition: pressure.h:119
t_pressure::PresIntegElecThin
realnum PresIntegElecThin
Definition: pressure.h:115
MIN2
#define MIN2
Definition: cddefines.h:761
TransitionProxy
Definition: transition.h:23
t_pressure::RhoGravity
double RhoGravity
Definition: pressure.h:122
transition.h
t_pressure::lgPres_ram_ON
bool lgPres_ram_ON
Definition: pressure.h:132
t_pressure::lgPradDen
bool lgPradDen
Definition: pressure.h:154
TransitionProxy::Emis
EmissionList::reference Emis() const
Definition: transition.h:408
t_pressure::lgRadPresAbortOK
bool lgRadPresAbortOK
Definition: pressure.h:161
TransitionProxy::Lo
qList::iterator Lo() const
Definition: transition.h:392
t_pressure::RadBetaMax
realnum RadBetaMax
Definition: pressure.h:136
t_pressure
Definition: pressure.h:67
t_pressure::self_mass_factor
double self_mass_factor
Definition: pressure.h:125
t_pressure::PresGasCurr
double PresGasCurr
Definition: pressure.h:89
TransitionProxy::Hi
qList::iterator Hi() const
Definition: transition.h:396
t_pressure::lgStrongDLimbo
bool lgStrongDLimbo
Definition: pressure.h:175
t_pressure::PressureInitialSpecified
double PressureInitialSpecified
Definition: pressure.h:98
t_pressure::PresTotlError
double PresTotlError
Definition: pressure.h:87
t_pressure::pbeta
realnum pbeta
Definition: pressure.h:138
t_pressure::RhoGravity_self
double RhoGravity_self
Definition: pressure.h:120
t_pressure::PresTotlInit
double PresTotlInit
Definition: pressure.h:92
t_pressure::IntegRhoGravity
double IntegRhoGravity
Definition: pressure.h:123
t_pressure::pres_radiation_lines_curr
double pres_radiation_lines_curr
Definition: pressure.h:101
HPLANCK
const UNUSED double HPLANCK
Definition: physconst.h:103
t_pressure::lgContRadPresOn
bool lgContRadPresOn
Definition: pressure.h:105
t_pressure::external_mass
vector< double > external_mass[3]
Definition: pressure.h:126
t_pressure::lgPres_radiation_ON
bool lgPres_radiation_ON
Definition: pressure.h:130
doppvel.h
t_rfield::fine_opac_zone
realnum * fine_opac_zone
Definition: rfield.h:408
t_rfield::nfine
long nfine
Definition: rfield.h:402
rt.h
t_pressure::ipPradMax_line
long int ipPradMax_line
Definition: pressure.h:143
t_pressure::PresLow
realnum PresLow
Definition: pressure.h:73
TransitionProxy::EnergyWN
realnum & EnergyWN() const
Definition: transition.h:438
physconst.h
t_pressure::PresPowerlaw
realnum PresPowerlaw
Definition: pressure.h:76
t_pressure::lgSonicPointAbortOK
bool lgSonicPointAbortOK
Definition: pressure.h:165
t_pressure::PresMax
realnum PresMax
Definition: pressure.h:140
t_pressure::PresTotlCurr
double PresTotlCurr
Definition: pressure.h:86
pressure
t_pressure pressure
Definition: pressure.cpp:5
t_pressure::chLineRadPres
char chLineRadPres[101]
Definition: pressure.h:149
t_pressure::lgLineRadPresOn
bool lgLineRadPresOn
Definition: pressure.h:157
t_pressure::lgPressureInitialSpecified
bool lgPressureInitialSpecified
Definition: pressure.h:96
EmissionProxy::opacity
realnum & opacity() const
Definition: emission.h:593
EN1RYD
const UNUSED double EN1RYD
Definition: physconst.h:179
t_pressure::gravity_symmetry
int gravity_symmetry
Definition: pressure.h:124
DEBUG_ENTRY
#define DEBUG_ENTRY(funcname)
Definition: cddefines.h:684
t_pressure::PresInteg
realnum PresInteg
Definition: pressure.h:109
POW4
#define POW4
Definition: cddefines.h:943
SMALLFLOAT
const realnum SMALLFLOAT
Definition: cpu.h:191
g
static double * g
Definition: species2.cpp:28