cloudy  trunk
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
pressure.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 "pressure.h"
5 #include "rfield.h"
6 #include "transition.h"
7 #include "rt_escprob.h"
8 
10 
12 {
13  DEBUG_ENTRY( "t_pressure::zero()" );
14  /* pressure related variables */
15 
16  RhoGravity_dark = 0.;
17  RhoGravity_self = 0.;
19  RhoGravity = 0.;
20  IntegRhoGravity = 0.;
21  gravity_symmetry = -1;
22  self_mass_factor = 1.;
23 
24  PresRamCurr = 0.;
26  lgPradCap = false;
27  lgPradDen = false;
28  lgLineRadPresOn = true;
29  /* normally abort when radiation pressure exceeds gas pressure in const pres mod,
30  * this is option to keep going, set with NO ABORT on constant pressure command */
31  lgRadPresAbortOK = true;
32  /* Ditto for whether to stop at sonic point, this gets set to false
33  * for some of the dynamics pressure modes (strongd, shock, antishock)*/
34  lgSonicPointAbortOK = true;
35  /* this flag will say we hit the sonic point */
36  lgSonicPoint = false;
37  /* True when no physical solution for desired pressure in strong D fronts */
38  lgStrongDLimbo = false;
39 
40  RadBetaMax = 0.;
41  ipPradMax_nzone = -1;
42  PresMax = 0.;
43 
44  /* initial and current pressures */
45  PresTotlInit = 0.;
46  PresTotlCurr = 0.;
47 
48 }
49 
50 double PressureRadiationLine( const TransitionProxy &t, realnum DopplerWidth )
51 {
52  DEBUG_ENTRY( "PressureRadiationLine()" );
53 
54  /* return zero if below plasma frequency */
55  if( t.EnergyErg() / EN1RYD <= rfield.plsfrq )
56  return 0.;
57 
58  /* RT_LineWidth gets line width in terms of RT effects */
59  double width = RT_LineWidth(t, DopplerWidth);
60 
61  double PopOpc = t.Emis().PopOpc()/(*t.Lo()).g();
62  /* return zero line radiation PressureReturned if line mases or has
63  * zero opacity */
64  /* \todo 2 1e-22 is arbtrary but roughly 1/kpc. Replace with a cloud width if available? */
65  if( PopOpc*t.Emis().opacity()/ DopplerWidth <= 1.e-22 || width<=0. )
66  return 0.;
67 
68  double PressureReturned = PI8 * HPLANCK / 3. * POW4(t.EnergyWN()) *
69  ((*t.Hi()).Pop()/(*t.Hi()).g())/PopOpc * width;
70 
71  /* this prevents line radiation PressureReturned from being very large when line
72  * is not optically thick but total opacity at that energy is large
73  * due to overlapping transitions */
74  long int ipLineCenter = t.Emis().ipFine() + rfield.ipFineConVelShift;
75  if( ipLineCenter > 0 && ipLineCenter < rfield.nfine && rfield.lgOpacityFine &&
76  rfield.fine_opac_zone[ipLineCenter] > SMALLFLOAT )
77  {
78  double FractionThisLine = t.Emis().PopOpc() * t.Emis().opacity() / DopplerWidth/
79  rfield.fine_opac_zone[ipLineCenter];
80  if( FractionThisLine<1e-5 )
81  FractionThisLine = 0.;
82  /* fine opacities are only reevaluated one time per zone due
83  * to the expense - PopOpc is for the current solution - but the two
84  * may be out of step by a few percent, due to the variation in
85  * abundance from zone to zone. This prevents the change
86  * in solution from increasing the radiation pressure.
87  * This correction is mainly an order of magnitude scaler to prevent
88  * optically thin lines from appearing to be optically thick due to
89  * overlapping lines */
90  FractionThisLine = MIN2(1., FractionThisLine);
91  ASSERT( FractionThisLine >= 0. && FractionThisLine <= 1.0 );
92  PressureReturned *= FractionThisLine;
93  }
94 
95  return PressureReturned;
96 }
double PresTotlInit
Definition: pressure.h:52
long int & ipFine() const
Definition: emission.h:448
realnum & opacity() const
Definition: emission.h:638
realnum EnergyErg() const
Definition: transition.h:90
bool lgSonicPointAbortOK
Definition: pressure.h:125
const realnum SMALLFLOAT
Definition: cpu.h:246
double RhoGravity_dark
Definition: pressure.h:79
long int ipPradMax_nzone
Definition: pressure.h:106
double PresRamCurr
Definition: pressure.h:39
double IntegRhoGravity
Definition: pressure.h:83
realnum PresMax
Definition: pressure.h:96
bool lgOpacityFine
Definition: rfield.h:402
bool lgPradDen
Definition: pressure.h:113
#define MIN2(a, b)
Definition: cddefines.h:807
double PresTotlCurr
Definition: pressure.h:46
double pres_radiation_lines_curr
Definition: pressure.h:61
realnum & EnergyWN() const
Definition: transition.h:477
double RhoGravity
Definition: pressure.h:82
bool lgStrongDLimbo
Definition: pressure.h:135
EmissionList::reference Emis() const
Definition: transition.h:447
double PressureRadiationLine(const TransitionProxy &t, realnum DopplerWidth)
Definition: pressure.cpp:50
t_pressure pressure
Definition: pressure.cpp:9
t_rfield rfield
Definition: rfield.cpp:9
float realnum
Definition: cddefines.h:124
long int ipFineConVelShift
Definition: rfield.h:399
qList::iterator Hi() const
Definition: transition.h:435
realnum RadBetaMax
Definition: pressure.h:96
int gravity_symmetry
Definition: pressure.h:84
bool lgPradCap
Definition: pressure.h:113
bool lgRadPresAbortOK
Definition: pressure.h:121
realnum * fine_opac_zone
Definition: rfield.h:389
#define ASSERT(exp)
Definition: cddefines.h:617
qList::iterator Lo() const
Definition: transition.h:431
long nfine
Definition: rfield.h:385
bool lgLineRadPresOn
Definition: pressure.h:117
#define DEBUG_ENTRY(funcname)
Definition: cddefines.h:729
double & PopOpc() const
Definition: emission.h:658
bool lgSonicPoint
Definition: pressure.h:128
double RhoGravity_external
Definition: pressure.h:81
double self_mass_factor
Definition: pressure.h:85
double RhoGravity_self
Definition: pressure.h:80
void zero()
Definition: pressure.cpp:11
realnum plsfrq
Definition: rfield.h:428
double RT_LineWidth(const TransitionProxy &t, realnum DopplerWidth)
Definition: rt_escprob.cpp:898
#define POW4
Definition: cddefines.h:997