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-2022 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().TauInSpecific() = opac.taumin;
69 
70  t.Emis().TauTot() = TauNext;
71 
72  /* this is escape prob */
73  t.Emis().Pesc() = 0.5f*(1.f + 1.f/MAX2(1.f,t.Emis().TauTot()));
74 
75  /* this is fraction inward */
76  t.Emis().FracInwd() = MIN2(1.f,1.5f-t.Emis().Pesc());
77 
78  /* destruction probability */
79  t.Emis().Pdest() = 0.;
80  t.Emis().Pelec_esc() = 0.;
81 
82  /* optical depth to the continuum source */
83  t.Emis().TauCon() = opac.taumin;
84 
85  /* >>chng 01 sep 01, zero out some pops and energies */
86  (*t.Lo()).Pop() = 0.;
87  /* >>chng 97 jul 21, added following zero
88  * population of upper level */
89  (*t.Hi()).Pop() = 0.;
90  /* population of lower level with correction for stim emission */
91  t.Emis().PopOpc() = 0.;
92  t.Emis().mult_opac() = 0.;
93  /* following two heat exchange excitation, deexcitation */
94  t.Coll().cool() = 0.;
95  t.Coll().heat() = 0.;
96  /* intensity of line */
97  t.Emis().xIntensity() = 0.;
98  t.Emis().xObsIntensity() = 0.;
99  return;
100 }
realnum & TauInSpecific() const
Definition: emission.h:480
realnum & Pelec_esc() const
Definition: emission.h:590
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:490
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:803
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:540
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:580
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:600
qList::iterator Lo() const
Definition: transition.h:431
realnum & TauCon() const
Definition: emission.h:510
tracker & TauTrack() const
Definition: emission.h:500
CollisionProxy Coll() const
Definition: transition.h:463
double & mult_opac() const
Definition: emission.h:660
#define DEBUG_ENTRY(funcname)
Definition: cddefines.h:723
double & cool() const
Definition: collision.h:220
double & PopOpc() const
Definition: emission.h:670
t_cosmology cosmology
Definition: cosmology.cpp:8
#define MAX2(a, b)
Definition: cddefines.h:824
int fprintf(const Output &stream, const char *format,...)
Definition: service.cpp:1121
double & xObsIntensity() const
Definition: emission.h:545
realnum DoubleTau
Definition: rt.h:178
realnum & FracInwd() const
Definition: emission.h:520
void RT_line_one_tau_reset(const TransitionProxy &t)
realnum & TauIn() const
Definition: emission.h:470
realnum taumin
Definition: opacity.h:167
t_rt rt
Definition: rt.cpp:5