cloudy  trunk
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
rt_line_one_tauinc.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 /*RT_line_one_tauinc increment optical depths for all heavy element lines, zone by zone,
4  * mainly called by RT_tau_inc, but also by FeII */
5 #include "cddefines.h"
6 #include "geometry.h"
7 #include "rfield.h"
8 #include "radius.h"
9 #include "wind.h"
10 #include "rt.h"
11 #include "cosmology.h"
12 #include "transition.h"
13 
15  /* following four are flags to generate info if some species has extreme maser */
16  long int maser_flag_species,
17  long int maser_flag_ion,
18  long int maser_flag_hi,
19  long int maser_flag_lo,
20  realnum DopplerWidth )
21 {
22  DEBUG_ENTRY( "RT_line_one_tauinc()" );
23 
24  /* routine increments optical depths for static or expanding atmosphere */
25 
26  /* this is line center frequency, including bulk motion of gas */
27  long int ipLineCenter = t.Emis().ipFine() + rfield.ipFineConVelShift;
28  double OpacityEffective, EffectiveThickness;
29  realnum dTau_total;
30 
31  double OpacitySpecific = t.Emis().PopOpc() * t.Emis().opacity() / DopplerWidth;
32 
33  /* find line center opacity - use fine opacity if array indices are OK */
34  if( t.Emis().ipFine()>=0 && ipLineCenter>0 && ipLineCenter<rfield.nfine && rfield.lgOpacityFine )
35  {
36  /* use fine opacities fine grid fine mesh to get optical depth
37  * to continuum source */
38  /* total line center optical depth, all overlapping lines included */
39  OpacityEffective = rfield.fine_opac_zone[ipLineCenter];
40  }
41  else
42  {
43  if( t.Emis().mult_opac() > 0. )
44  OpacityEffective = t.Emis().mult_opac();
45  else
46  OpacityEffective = OpacitySpecific;
47  }
48 
49 #if 0
50  if( rfield.anu( t.ipCont-1 ) < rfield.plsfrq )
51  {
52  /* transition is below plasma frequency - make optical depth huge */
53  dTau_total = 1.e10;
54 
55  t.Emis().TauIn() = dTau_total;
56  t.Emis().TauCon() = dTau_total;
57  t.Emis().TauTot() = dTau_total;
58  }
59  else
60 #endif
61  if( cosmology.lgDo )
62  {
63  /* dv/dr (s-1), equal to dv/dt / v */
64  /* in this case, dv/dr is just the Hubble factor */
66  EffectiveThickness = DopplerWidth / wind.dvdr;
67  dTau_total = (realnum)(OpacityEffective * EffectiveThickness);
68 
69  t.Emis().TauIn() = dTau_total;
70  t.Emis().TauCon() = dTau_total;
71  t.Emis().TauTot() = dTau_total;
72  t.Emis().TauInSpecific() = realnum( OpacitySpecific * EffectiveThickness );
73  }
74 
75  /* use cumulated fine optical depth for both d-critical and static,
76  * for d-critical speeds are only roughly sonic
77  * optical depth is computed including velocity shift */
78  else if( ! wind.lgBallistic() )
79  {
80  /* static and negative velocity solutions */
81  EffectiveThickness = radius.drad_x_fillfac;
82  dTau_total = (realnum)(OpacityEffective * EffectiveThickness);
83 
84  t.Emis().TauIn() += dTau_total;
85  t.Emis().TauCon() += dTau_total;
86  t.Emis().TauInSpecific() += realnum( OpacitySpecific * EffectiveThickness );
87  }
88 
89  else
90  {
91  /* ballistic outflowing wind
92  * effective length scale for Sobolev or LVG approximation, eqn 3 of
93  * >>refer RT wind Castor, J.I., Abbott, D.C., & Klein, R.I., 1975, ApJ, 195, 157
94  */
95 
96  /* dv/dr (s-1), equal to dv/dt / v */
98  /* depth (cm) over which wind accelerates by one velocity width
99  * include filling factor */
100  EffectiveThickness = DopplerWidth / SDIV(wind.dvdr) * geometry.FillFac;
101 
102  /* min2 is to not let the physical scale exceed the current depth */
103  EffectiveThickness = MIN2( radius.depth, EffectiveThickness );
104  dTau_total = (realnum)(OpacityEffective * EffectiveThickness);
105 
106  t.Emis().TauIn() = dTau_total;
107  t.Emis().TauCon() = dTau_total;
108  t.Emis().TauTot() = dTau_total;
109  t.Emis().TauInSpecific() = realnum( OpacitySpecific * EffectiveThickness );
110  }
111 
112  {
113  enum { DEBUG_LOC = false };
114  if( DEBUG_LOC && dTau_total > 0. )
115  {
116  fprintf( ioQQQ,
117  ">>>label= '%s'"
118  "\t nzone= %ld"
119  "\t fine_opac_zone= %.4e"
120  "\t OpacityEffective= %.4e"
121  "\t radius.drad_x_fillfac= %.4e"
122  "\t EffectiveThickness= %.4e"
123  "\t dTau_total= %.4e"
124  "\t TauIn= %.4e"
125  "\t TauTot= %.4e"
126  "\t TauCon= %.4e\n",
127  t.chLabel().c_str(),
128  nzone,
129  rfield.fine_opac_zone[ipLineCenter],
130  OpacityEffective,
132  EffectiveThickness,
133  dTau_total,
134  t.Emis().TauIn(),
135  t.Emis().TauTot(),
136  t.Emis().TauCon() );
137  }
138  }
139 
140  /* keep track of any masers */
141  if( dTau_total < rt.dTauMase )
142  {
143  rt.dTauMase = dTau_total;
144  rt.mas_species = maser_flag_species;
145  rt.mas_ion = maser_flag_ion;
146  rt.mas_hi = maser_flag_hi;
147  rt.mas_lo = maser_flag_lo;
148  if( rt.dTauMase < -1. )
149  rt.lgMaserCapHit = true;
150  }
151 
152  return;
153 }
long int & ipFine() const
Definition: emission.h:448
realnum & TauInSpecific() const
Definition: emission.h:468
double depth
Definition: radius.h:31
realnum dvdr
Definition: wind.h:21
realnum & opacity() const
Definition: emission.h:638
long int mas_species
Definition: rt.h:208
realnum & TauTot() const
Definition: emission.h:478
bool lgOpacityFine
Definition: rfield.h:402
FILE * ioQQQ
Definition: cddefines.cpp:7
realnum FillFac
Definition: geometry.h:29
long int nzone
Definition: cddefines.cpp:14
#define MIN2(a, b)
Definition: cddefines.h:807
bool lgDo
Definition: cosmology.h:44
double anu(size_t i) const
Definition: mesh.h:111
Wind wind
Definition: wind.cpp:5
bool lgBallistic(void) const
Definition: wind.h:31
realnum AccelGravity
Definition: wind.h:49
t_geometry geometry
Definition: geometry.cpp:5
realnum redshift_current
Definition: cosmology.h:26
EmissionList::reference Emis() const
Definition: transition.h:447
t_rfield rfield
Definition: rfield.cpp:9
long & ipCont() const
Definition: transition.h:489
float realnum
Definition: cddefines.h:124
realnum AccelTotalOutward
Definition: wind.h:52
long int ipFineConVelShift
Definition: rfield.h:399
void RT_line_one_tauinc(const TransitionProxy &t, long int mas_species, long int mas_ion, long int mas_hi, long int mas_lo, realnum DopplerWidth)
t_radius radius
Definition: radius.cpp:5
realnum * fine_opac_zone
Definition: rfield.h:389
string chLabel() const
Definition: transition.cpp:271
long int mas_lo
Definition: rt.h:208
realnum & TauCon() const
Definition: emission.h:498
long nfine
Definition: rfield.h:385
double drad_x_fillfac
Definition: radius.h:76
double & mult_opac() const
Definition: emission.h:648
#define DEBUG_ENTRY(funcname)
Definition: cddefines.h:729
double & PopOpc() const
Definition: emission.h:658
t_cosmology cosmology
Definition: cosmology.cpp:8
long int mas_hi
Definition: rt.h:208
int fprintf(const Output &stream, const char *format,...)
Definition: service.cpp:1217
realnum GetHubbleFactor(realnum z)
Definition: cosmology.cpp:10
sys_float SDIV(sys_float x)
Definition: cddefines.h:1006
realnum dTauMase
Definition: rt.h:198
realnum plsfrq
Definition: rfield.h:428
bool lgMaserCapHit
Definition: rt.h:205
long int mas_ion
Definition: rt.h:208
realnum windv
Definition: wind.h:18
realnum & TauIn() const
Definition: emission.h:458
t_rt rt
Definition: rt.cpp:5