cloudy  trunk
 All Data Structures 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-2008 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 "lines_service.h"
9 #include "prt.h"
10 #include "rt.h"
11 
13  double WeightNew)
14 {
15  char chSave[11];
16 
17  DEBUG_ENTRY( "RT_line_one_tau_reset()" );
18 
19  if( t->ipCont <= 0 )
20  {
21  return;
22  }
23 
24  /* option to print masing lines, set with print maser */
25  if( prt.lgPrtMaser &&
26  ( t->Emis->TauTot < -0.01 || t->Emis->TauIn < -0.01) )
27  {
28  strcpy( chSave, chLineLbl(t) );
29  fprintf( ioQQQ, " Masing line:%10.10s t(in, out)=%10.2e%10.2e\n",
30  chSave, t->Emis->TauIn, t->Emis->TauTot );
31  }
32 
33  /* iteration is 1 when this routine is called at end of first iteration
34  * lgStatic is false by default, set true with command sphere SPHERE STATIC */
35  if( iteration == 1 && (!geometry.lgStatic) )
36  {
37  /* end of first iteration, first estimate of total optical depth
38  * is now the inward optical depth - set T(ipLnTauTot) to T(1)
39  * DoubleTau normally 1, set to 2 by DoubleTau command in order
40  * to simulate two-sided photoionization */
41  t->Emis->TauTot = t->Emis->TauIn*rt.DoubleTau;
42  t->Emis->TauIn = MIN2(opac.taumin,t->Emis->TauTot/2.f);
43  }
44  else if( geometry.lgSphere && geometry.lgStatic )
45  {
46  /* static sphere, both sides interact */
47  if( iteration == 1 )
48  {
49  /* on first iteration TauIn was 0 for first zone */
50  t->Emis->TauTot = 2.f*t->Emis->TauIn;
51  }
52  else
53  {
54  t->Emis->TauTot = (realnum)(t->Emis->TauIn*WeightNew + t->Emis->TauTot*
55  (1. - WeightNew));
56  }
57  t->Emis->TauIn = t->Emis->TauTot/2.f;
58  }
59  else
60  {
61  /* take some sort of mean of old and new limiting optical depths */
62  if( t->Emis->TauIn > 0. && t->Emis->TauTot > 0. )
63  {
64  /* this is case where no maser occurs */
65  /* >>chng 03 nov 06, try taking linear average */
66  t->Emis->TauTot = (realnum)(t->Emis->TauTot*(1. - WeightNew) +
67  t->Emis->TauIn*rt.DoubleTau*WeightNew);
68  t->Emis->TauIn = MIN2(opac.taumin,t->Emis->TauTot/ 2.f);
69  }
70  else
71  {
72  /* case where maser did occr */
73  t->Emis->TauTot = (t->Emis->TauIn*rt.DoubleTau + t->Emis->TauTot)/2.f;
74  t->Emis->TauIn = MIN2(opac.taumin,t->Emis->TauTot/2.f);
75  }
76  }
77 
78  /* this is escape prob */
79  t->Emis->Pesc = 0.5f*(1.f + 1.f/MAX2(1.f,t->Emis->TauTot));
80 
81  /* this is fraction inward */
82  t->Emis->FracInwd = MIN2(1.f,1.5f-t->Emis->Pesc);
83 
84  /* this is destruction probability
85  * >>chng 96 sep 4, was not here, needed to add since now taking
86  * mean of old and new dest prob */
87  t->Emis->Pdest = 0.;
88  t->Emis->Pelec_esc = 0.;
89 
90  /* optical depth to the continuum source */
91  t->Emis->TauCon = opac.taumin;
92 
93  /* >>chng 01 sep 01, zero out some pops and energies */
94  t->Lo->Pop = 0.;
95  /* >>chng 97 jul 21, added following zero
96  * population of upper level */
97  t->Hi->Pop = 0.;
98  /* population of lower level with correction for stim emission */
99  t->Emis->PopOpc = 0.;
100  /* following two heat exchange excitation, deexcitation */
101  t->Coll.cool = 0.;
102  t->Coll.heat = 0.;
103  /* intensity of line */
104  t->Emis->xIntensity = 0.;
105  /* number of photons emitted in line */
106  t->Emis->phots = 0.;
107  return;
108 }

Generated for cloudy by doxygen 1.8.1.2