cloudy  trunk
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
rt_line_one_tau_reset.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_tau_reset computes average of old and new optical depths for new scale at end of iter,
4  * called by update, also FeIILevelPops */
5 #include "cddefines.h"
6 #include "opacity.h"
7 #include "geometry.h"
8 #include "transition.h"
9 #include "prt.h"
10 #include "rt.h"
11 #include "cosmology.h"
12 
14 {
15  DEBUG_ENTRY( "RT_line_one_tau_reset()" );
16 
17  if( cosmology.lgDo )
18  return;
19 
20  if( t.ipCont() <= 0 )
21  {
22  return;
23  }
24 
25  /* option to print masing lines, set with print maser */
26  if( prt.lgPrtMaser &&
27  ( t.Emis().TauTot() < -0.01 || t.Emis().TauIn() < -0.01 ) )
28  {
29  fprintf( ioQQQ, " Masing line:%10.10s t(in, out)=%10.2e%10.2e\n",
30  chLineLbl(t).c_str(), t.Emis().TauIn(), t.Emis().TauTot() );
31  }
32 
33  realnum TauNext;
34 
35  /* lgStatic is false by default, set true with command sphere SPHERE STATIC */
37  {
38  /* static sphere, both sides interact */
39  TauNext = t.Emis().TauIn();
40  }
41  else
42  {
43  /* end of iteration, the next estimate of total optical depth
44  * is now the inward optical depth - set T(ipLnTauTot) to T(1)
45  * DoubleTau normally 1, set to 2 by DoubleTau command in order
46  * to simulate two-sided photoionization */
47  TauNext = rt.DoubleTau*t.Emis().TauIn();
48  }
49 
50  if( 0 && iteration > 1 )
51  {
52  fprintf(ioQQQ,"DEBUG %s ",chLineLbl(t).c_str());
53  fprintf(ioQQQ," %13.6e %13.6e %13.6e\n",t.Emis().TauTot(),TauNext,
54  (t.Emis().TauTot()-TauNext)/(t.Emis().TauTot()+TauNext));
55  }
56 
57  /* iteration is 1 when this routine is called at end of first iteration
58  * estimate is bad when starting first iteration, so don't track that one */
59  /* don't track the 2nd iteration either since that one may also be quite poor */
61  TauNext = t.Emis().TauTrack().next_val( t.Emis().TauTot(), TauNext );
62 
64  t.Emis().TauIn() = TauNext/2.f;
65  else
66  t.Emis().TauIn() = opac.taumin;
67 
68  t.Emis().TauTot() = TauNext;
69 
70  /* this is escape prob */
71  t.Emis().Pesc() = 0.5f*(1.f + 1.f/MAX2(1.f,t.Emis().TauTot()));
72 
73  /* this is fraction inward */
74  t.Emis().FracInwd() = MIN2(1.f,1.5f-t.Emis().Pesc());
75 
76  /* destruction probability */
77  t.Emis().Pdest() = 0.;
78  t.Emis().Pelec_esc() = 0.;
79 
80  /* optical depth to the continuum source */
81  t.Emis().TauCon() = opac.taumin;
82 
83  /* >>chng 01 sep 01, zero out some pops and energies */
84  (*t.Lo()).Pop() = 0.;
85  /* >>chng 97 jul 21, added following zero
86  * population of upper level */
87  (*t.Hi()).Pop() = 0.;
88  /* population of lower level with correction for stim emission */
89  t.Emis().PopOpc() = 0.;
90  t.Emis().mult_opac() = 0.;
91  /* following two heat exchange excitation, deexcitation */
92  t.Coll().cool() = 0.;
93  t.Coll().heat() = 0.;
94  /* intensity of line */
95  t.Emis().xIntensity() = 0.;
96  t.Emis().xObsIntensity() = 0.;
97  return;
98 }
realnum & Pelec_esc() const
Definition: emission.h:578
string chLineLbl(const TransitionProxy &t)
Definition: transition.h:599
t_opac opac
Definition: opacity.cpp:5
bool lgPrtMaser
Definition: prt.h:168
realnum & TauTot() const
Definition: emission.h:478
FILE * ioQQQ
Definition: cddefines.cpp:7
realnum next_val(realnum current, realnum next_est)
Definition: iter_track.cpp:19
#define MIN2(a, b)
Definition: cddefines.h:807
bool lgDo
Definition: cosmology.h:44
bool lgSphere
Definition: geometry.h:34
long int iteration
Definition: cddefines.cpp:16
static const int PREV_ITER
Definition: iter_track.h:289
t_geometry geometry
Definition: geometry.cpp:5
double & heat() const
Definition: collision.h:224
double & xIntensity() const
Definition: emission.h:528
EmissionList::reference Emis() const
Definition: transition.h:447
long & ipCont() const
Definition: transition.h:489
float realnum
Definition: cddefines.h:124
realnum & Pesc() const
Definition: emission.h:568
bool lgStatic
Definition: geometry.h:64
qList::iterator Hi() const
Definition: transition.h:435
t_prt prt
Definition: prt.cpp:14
realnum & Pdest() const
Definition: emission.h:588
qList::iterator Lo() const
Definition: transition.h:431
realnum & TauCon() const
Definition: emission.h:498
tracker & TauTrack() const
Definition: emission.h:488
CollisionProxy Coll() const
Definition: transition.h:463
double & mult_opac() const
Definition: emission.h:648
#define DEBUG_ENTRY(funcname)
Definition: cddefines.h:729
double & cool() const
Definition: collision.h:220
double & PopOpc() const
Definition: emission.h:658
t_cosmology cosmology
Definition: cosmology.cpp:8
#define MAX2(a, b)
Definition: cddefines.h:828
int fprintf(const Output &stream, const char *format,...)
Definition: service.cpp:1217
double & xObsIntensity() const
Definition: emission.h:533
realnum DoubleTau
Definition: rt.h:178
realnum & FracInwd() const
Definition: emission.h:508
void RT_line_one_tau_reset(const TransitionProxy &t)
realnum & TauIn() const
Definition: emission.h:458
realnum taumin
Definition: opacity.h:166
t_rt rt
Definition: rt.cpp:5