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-2022 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().VoigtLineCen() * t.Emis().PopOpc() *
32  t.Emis().opacity() / DopplerWidth;
33 
34 
35  /* find line center opacity - use fine opacity if array indices are OK */
36  if( t.Emis().ipFine()>=0 && ipLineCenter>0 && ipLineCenter<rfield.nfine && rfield.lgOpacityFine )
37  {
38  /* use fine opacities fine grid fine mesh to get optical depth
39  * to continuum source */
40  /* total line center optical depth, all overlapping lines included */
41  OpacityEffective = rfield.fine_opac_zone[ipLineCenter];
42  }
43  else
44  {
45  if( t.Emis().mult_opac() > 0. )
46  OpacityEffective = t.Emis().mult_opac();
47  else
48  OpacityEffective = OpacitySpecific;
49  }
50 
51 #if 0
52  if( rfield.anu( t.ipCont-1 ) < rfield.plsfrq )
53  {
54  /* transition is below plasma frequency - make optical depth huge */
55  dTau_total = 1.e10;
56 
57  t.Emis().TauIn() = dTau_total;
58  t.Emis().TauCon() = dTau_total;
59  t.Emis().TauTot() = dTau_total;
60  }
61  else
62 #endif
63  if( cosmology.lgDo )
64  {
65  /* dv/dr (s-1), equal to dv/dt / v */
66  /* in this case, dv/dr is just the Hubble factor */
68  EffectiveThickness = DopplerWidth / wind.dvdr;
69  dTau_total = (realnum)(OpacityEffective * EffectiveThickness);
70 
71  t.Emis().TauIn() = dTau_total;
72  t.Emis().TauCon() = dTau_total;
73  t.Emis().TauTot() = dTau_total;
74  t.Emis().TauInSpecific() = realnum( OpacitySpecific * EffectiveThickness );
75  }
76 
77  /* use cumulated fine optical depth for both d-critical and static,
78  * for d-critical speeds are only roughly sonic
79  * optical depth is computed including velocity shift */
80  else if( ! wind.lgBallistic() )
81  {
82  /* static and negative velocity solutions */
83  EffectiveThickness = radius.drad_x_fillfac;
84  dTau_total = (realnum)(OpacityEffective * EffectiveThickness);
85 
86  t.Emis().TauIn() += dTau_total;
87  t.Emis().TauCon() += dTau_total;
88  t.Emis().TauInSpecific() += realnum( OpacitySpecific * EffectiveThickness );
89  }
90 
91  else
92  {
93  /* ballistic outflowing wind
94  * effective length scale for Sobolev or LVG approximation, eqn 3 of
95  * >>refer RT wind Castor, J.I., Abbott, D.C., & Klein, R.I., 1975, ApJ, 195, 157
96  */
97 
98  /* dv/dr (s-1), equal to dv/dt / v */
100  /* depth (cm) over which wind accelerates by one velocity width
101  * include filling factor */
102  EffectiveThickness = DopplerWidth / SDIV(wind.dvdr) * geometry.FillFac;
103 
104  /* min2 is to not let the physical scale exceed the current depth */
105  EffectiveThickness = MIN2( radius.depth, EffectiveThickness );
106  dTau_total = (realnum)(OpacityEffective * EffectiveThickness);
107 
108  t.Emis().TauIn() = dTau_total;
109  t.Emis().TauCon() = dTau_total;
110  t.Emis().TauTot() = dTau_total;
111  t.Emis().TauInSpecific() = realnum( OpacitySpecific * EffectiveThickness );
112  }
113 
114  {
115  enum { DEBUG_LOC = false };
116  if( DEBUG_LOC && dTau_total > 0. )
117  {
118  fprintf( ioQQQ,
119  ">>>label= '%s'"
120  "\t nzone= %ld"
121  "\t fine_opac_zone= %.4e"
122  "\t OpacityEffective= %.4e"
123  "\t radius.drad_x_fillfac= %.4e"
124  "\t EffectiveThickness= %.4e"
125  "\t dTau_total= %.4e"
126  "\t TauIn= %.4e"
127  "\t TauTot= %.4e"
128  "\t TauCon= %.4e\n",
129  t.chLabel().c_str(),
130  nzone,
131  rfield.fine_opac_zone[ipLineCenter],
132  OpacityEffective,
134  EffectiveThickness,
135  dTau_total,
136  t.Emis().TauIn(),
137  t.Emis().TauTot(),
138  t.Emis().TauCon() );
139  }
140  }
141 
142  /* keep track of any masers */
143  if( dTau_total < rt.dTauMase )
144  {
145  rt.dTauMase = dTau_total;
146  rt.mas_species = maser_flag_species;
147  rt.mas_ion = maser_flag_ion;
148  rt.mas_hi = maser_flag_hi;
149  rt.mas_lo = maser_flag_lo;
150  if( rt.dTauMase < -1. )
151  rt.lgMaserCapHit = true;
152  }
153 
154  return;
155 }
long int & ipFine() const
Definition: emission.h:460
realnum & TauInSpecific() const
Definition: emission.h:480
double depth
Definition: radius.h:31
realnum dvdr
Definition: wind.h:21
realnum & opacity() const
Definition: emission.h:650
long int mas_species
Definition: rt.h:208
realnum & TauTot() const
Definition: emission.h:490
bool lgOpacityFine
Definition: rfield.h:404
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:803
bool lgDo
Definition: cosmology.h:44
double anu(size_t i) const
Definition: mesh.h:120
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
double & VoigtLineCen() const
Definition: emission.h:680
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:401
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:391
string chLabel() const
Definition: transition.cpp:274
long int mas_lo
Definition: rt.h:208
realnum & TauCon() const
Definition: emission.h:510
long nfine
Definition: rfield.h:387
double drad_x_fillfac
Definition: radius.h:77
double & mult_opac() const
Definition: emission.h:660
#define DEBUG_ENTRY(funcname)
Definition: cddefines.h:723
double & PopOpc() const
Definition: emission.h:670
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:1121
realnum GetHubbleFactor(realnum z)
Definition: cosmology.cpp:10
sys_float SDIV(sys_float x)
Definition: cddefines.h:1002
realnum dTauMase
Definition: rt.h:198
realnum plsfrq
Definition: rfield.h:430
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:470
t_rt rt
Definition: rt.cpp:5