cloudy  trunk
prt_alltau.cpp
Go to the documentation of this file.
1 /* This file is part of Cloudy and is copyright (C)1978-2013 by Gary J. Ferland and
2  * others. For conditions of distribution and use see copyright notice in license.txt */
3 /*PrtAllTau master routine controlling printout of optical depths at end of calculation */
4 #include "cddefines.h"
5 #include "taulines.h"
6 #include "iso.h"
7 #include "opacity.h"
8 #include "dense.h"
9 #include "colden.h"
10 #include "elementnames.h"
11 #include "geometry.h"
12 #include "prt.h"
13 
14 /*PrtAllTau master routine controlling printout of optical depths at end of calculation */
15 void PrtAllTau(void)
16 {
17  long int i,
18  n,
19  nelem;
20  realnum fcon,
21  flin;
22 
23  DEBUG_ENTRY( "PrtAllTau()" );
24 
25  /* optical depths used by code are total through model,
26  * when sphere is set, this is twice optical depth through
27  * computed structure */
28  if( geometry.lgSphere )
29  {
30  fcon = 2.;
31  if( geometry.lgStatic )
32  {
33  flin = 2.;
34  }
35  else
36  {
37  flin = 1.;
38  }
39  }
40  else
41  {
42  fcon = 1.;
43  flin = 1.;
44  }
45 
46  /* continuum optical depths and column densities */
47  fprintf( ioQQQ, "\n Contin Optical Depths: COMP:");
48 
49  fprintf( ioQQQ,PrintEfmt("%9.2e", opac.telec));
50  fprintf( ioQQQ, " H-:");
51  fprintf( ioQQQ,PrintEfmt("%9.2e",opac.thmin ));
52 
53  /* R(1300) is Rayleigh scattering */
54  fprintf( ioQQQ, " R(1300):");
55  fprintf( ioQQQ,PrintEfmt("%9.2e", colden.colden[ipCOL_H0]*6.71e-24));
56 
57  fprintf( ioQQQ, " H2+:");
58  fprintf( ioQQQ,PrintEfmt("%9.2e", colden.colden[ipCOL_H2p]*7e-18));
59 
60  fprintf( ioQQQ, " Bra:");
61  if( iso_sp[ipH_LIKE][ipHYDROGEN].n_HighestResolved_local >= 5 )
62  {
63  long ip5p = iso_sp[ipH_LIKE][ipHYDROGEN].QuantumNumbers2Index[5][1][2];
64  ASSERT( iso_sp[ipH_LIKE][ipHYDROGEN].trans(ip5p,ipH4s).ipCont() > 0 );
66  }
67  else
68  {
69  PrintE82( ioQQQ , 0.);
70  }
71  fprintf( ioQQQ, "\n" );
72 
73  fprintf( ioQQQ, " Pa:");
74 
75  if( iso_sp[ipH_LIKE][ipHYDROGEN].numLevels_local > ipH4p )
76  {
77  fprintf( ioQQQ,PrintEfmt("%9.2e", opac.TauTotalGeo[0][iso_sp[ipH_LIKE][ipHYDROGEN].trans(ipH4p,ipH3s).ipCont()-1]/fcon));
78  }
79  else
80  {
81  PrintE82( ioQQQ , 0.);
82  }
83 
84  fprintf( ioQQQ, " Ba:");
85 
86  if( iso_sp[ipH_LIKE][ipHYDROGEN].numLevels_local > 3 )
87  {
88  fprintf( ioQQQ,PrintEfmt("%9.2e", opac.TauTotalGeo[0][iso_sp[ipH_LIKE][ipHYDROGEN].trans(ipH3p,ipH2s).ipCont()-1]/fcon));
89  }
90  else
91  {
92  PrintE82( ioQQQ , 0.);
93  }
94 
95  fprintf( ioQQQ, " Hb:");
96 
97  if( iso_sp[ipH_LIKE][ipHYDROGEN].numLevels_local > 4 )
98  {
99  fprintf( ioQQQ,PrintEfmt("%9.2e", opac.TauTotalGeo[0][iso_sp[ipH_LIKE][ipHYDROGEN].trans(ipH4p,ipH2s).ipCont()-1]/fcon));
100  }
101  else
102  {
103  PrintE82( ioQQQ , 0.);
104  }
105 
106  fprintf( ioQQQ, " La:");
107  fprintf( ioQQQ,PrintEfmt("%9.2e", opac.TauTotalGeo[0][iso_sp[ipH_LIKE][ipHYDROGEN].trans(ipH2p,ipH1s).ipCont()-1]/fcon));
108 
109  fprintf( ioQQQ, " 1r:");
110  PrintE93( ioQQQ , opac.TauTotalGeo[0][iso_sp[ipH_LIKE][ipHYDROGEN].fb[ipH1s].ipIsoLevNIonCon-1]/fcon);
111 
112  fprintf( ioQQQ, " 1.8:");
113  PrintE82( ioQQQ , opac.TauTotalGeo[0][iso_sp[ipHE_LIKE][ipHELIUM].fb[0].ipIsoLevNIonCon-1]/fcon);
114 
115  fprintf( ioQQQ, " 4.:");
116  PrintE93( ioQQQ , opac.TauTotalGeo[0][iso_sp[ipH_LIKE][1].fb[ipH1s].ipIsoLevNIonCon-1]/fcon);
117  fprintf( ioQQQ, "\n");
118 
119  /* print optical depths of some metal lines */
120  prtmet();
121 
122  /* print H-like H, He+ optical depths */
123  for( nelem=ipHYDROGEN; nelem<=ipHELIUM; ++nelem )
124  {
125  /* helium may be turned off */
126  if( dense.lgElmtOn[nelem] )
127  {
128 # define NUMB_PER_LINE 8
129  fprintf( ioQQQ, "\n Old, new %s%2li continuum optical depths:\n",
130  elementnames.chElementSym[nelem] ,
131  nelem+1);
132  /* absorption continuum optical depths are energies of the h-like ion continua
133  * loop over old, then new optical depths */
134  for( i=1; i>=0; --i )
135  {
136  /* print ground, skip t2, then do 2p */
137  for( n=ipH1s; n < iso_sp[ipH_LIKE][nelem].numLevels_max - iso_sp[ipH_LIKE][nelem].nCollapsed_max; n++ )
138  {
139  if( n==ipH2s )
140  continue;
141  if( n%NUMB_PER_LINE ==1)
142  fprintf(ioQQQ,"\n");
143  /* this, combined with "continue" above, ensures that we print
144  * 1 (1s), 2(tot 2), then 3 */
145  fprintf( ioQQQ , "%6ld",MAX2(1,n));
146  fprintf( ioQQQ,PrintEfmt("%9.2e", opac.TauAbsGeo[i][iso_sp[ipH_LIKE][nelem].fb[n].ipIsoLevNIonCon-1]/fcon));
147  }
148  fprintf( ioQQQ, "\n" );
149  }
150 
151  /* now do h-like line optical depths */
152  fprintf( ioQQQ, "\n Old, new %s%2li mean line optical depths:\n",
153  elementnames.chElementSym[nelem] ,
154  nelem+1);
155  /* Lya is a special case due to 2s-2p resolution - explicitly print it first */
156  fprintf( ioQQQ, "%3i-%2i",2, 1 );
157  fprintf( ioQQQ,PrintEfmt("%9.2e", iso_sp[ipH_LIKE][nelem].trans(ipH2p,ipH1s).Emis().TauTot()*SQRTPI/flin ));
158  /* total optical depth in 3-2s and 3-2p, is total of both so 2-1 is correct for 3-2*/
159  /* 06 aug 28, from numLevels_max to _local. */
160  for( n=3; n <= iso_sp[ipH_LIKE][nelem].n_HighestResolved_local; n++ )
161  {
162  if( n%NUMB_PER_LINE ==1)
163  fprintf(ioQQQ,"\n");
164  fprintf( ioQQQ, "%3ld-%2ld",n, n-1 );
165  fprintf( ioQQQ,PrintEfmt("%9.2e",
166  /* just do nP - n'S,
167  *>>chng 12 jul25, from line center to mean line optical depths */
168  iso_sp[ipH_LIKE][nelem].trans( iso_sp[ipH_LIKE][nelem].QuantumNumbers2Index[n][1][2],
169  iso_sp[ipH_LIKE][nelem].QuantumNumbers2Index[n-1][0][2] ).Emis().TauTot()*SQRTPI/flin ));
170  }
171  if( prt.lgPrnIsoCollapsed )
172  {
173  /* above flag set with print line iso collapsed command
174  * not done by default */
175  for( n=iso_sp[ipH_LIKE][nelem].numLevels_local - iso_sp[ipH_LIKE][nelem].nCollapsed_local; n < iso_sp[ipH_LIKE][nelem].numLevels_local; n++ )
176  {
177  if( iso_sp[ipH_LIKE][nelem].st[n].n() % NUMB_PER_LINE ==1)
178  fprintf(ioQQQ,"\n");
179  fprintf( ioQQQ, "%3ld-%2ld", iso_sp[ipH_LIKE][nelem].st[n].n(), iso_sp[ipH_LIKE][nelem].st[n-1].n() );
180  fprintf( ioQQQ,PrintEfmt("%9.2e", iso_sp[ipH_LIKE][nelem].trans(n,n-1).Emis().TauTot()*SQRTPI/flin ));
181  }
182  }
183 
184  fprintf( ioQQQ, "\n" );
185 
186  fprintf( ioQQQ, "%3i-%2i",2, 1 );
187  fprintf( ioQQQ,PrintEfmt("%9.2e", iso_sp[ipH_LIKE][nelem].trans(ipH2p,ipH1s).Emis().TauIn()*SQRTPI/flin ));
188 
189  for( n=3; n <= iso_sp[ipH_LIKE][nelem].n_HighestResolved_local; n++ )
190  {
191  if( n%NUMB_PER_LINE ==1)
192  fprintf(ioQQQ,"\n");
193  fprintf( ioQQQ, "%3ld-%2ld",n, n-1 );
194  fprintf( ioQQQ,PrintEfmt("%9.2e",
195  /* just do nP - n'S */
196  iso_sp[ipH_LIKE][nelem].trans( iso_sp[ipH_LIKE][nelem].QuantumNumbers2Index[n][1][2],
197  iso_sp[ipH_LIKE][nelem].QuantumNumbers2Index[n-1][0][2] ).Emis().TauIn()*SQRTPI/flin ));
198  }
199  if( prt.lgPrnIsoCollapsed )
200  {
201  for( n=iso_sp[ipH_LIKE][nelem].numLevels_local - iso_sp[ipH_LIKE][nelem].nCollapsed_local; n < iso_sp[ipH_LIKE][nelem].numLevels_local; n++ )
202  {
203  if( iso_sp[ipH_LIKE][nelem].st[n].n() % NUMB_PER_LINE ==1)
204  fprintf(ioQQQ,"\n");
205  fprintf( ioQQQ, "%3ld-%2ld", iso_sp[ipH_LIKE][nelem].st[n].n(), iso_sp[ipH_LIKE][nelem].st[n-1].n() );
206  fprintf( ioQQQ,PrintEfmt("%9.2e", iso_sp[ipH_LIKE][nelem].trans(n,n-1).Emis().TauIn()*SQRTPI/flin ));
207  }
208  }
209  fprintf( ioQQQ, "\n" );
210  }
211  }
212 
213  /* ================================================================================ */
214 
215  /* print He I lines if helium exists */
216  if( dense.lgElmtOn[ipHELIUM] )
217  {
218  fprintf( ioQQQ, "\n Old He Is optical depths:" );
219  for( i=0; i < 5; i++ )
220  {
221  fprintf( ioQQQ, "%5ld", i+1 );
222  fprintf( ioQQQ,PrintEfmt("%9.2e", opac.TauAbsGeo[1][iso_sp[ipHE_LIKE][ipHELIUM].fb[i].ipIsoLevNIonCon-1]/fcon) );
223  }
224  fprintf( ioQQQ, "\n" );
225 
226  fprintf( ioQQQ, " New He Is optical depths:" );
227  for( i=0; i < 5; i++ )
228  {
229  fprintf( ioQQQ, "%5ld", i+1 );
230  fprintf( ioQQQ,PrintEfmt("%9.2e", opac.TauAbsGeo[0][iso_sp[ipHE_LIKE][ipHELIUM].fb[i].ipIsoLevNIonCon-1]/fcon ));
231  }
232  fprintf( ioQQQ, "\n" );
233 
234  /* ================================================================================*/
235 
236  fprintf( ioQQQ, " Old He Is Lines:" );
237  fprintf( ioQQQ, " %4d",584 );
238  fprintf( ioQQQ,PrintEfmt("%9.2e", iso_sp[ipHE_LIKE][ipHELIUM].trans(ipHe2p1P,ipHe1s1S).Emis().TauTot()*SQRTPI/flin ));
239  fprintf( ioQQQ, " %4d",3889 );
240  fprintf( ioQQQ,PrintEfmt("%9.2e", iso_sp[ipHE_LIKE][ipHELIUM].trans(ipHe3p3P,ipHe2s3S).Emis().TauTot()*SQRTPI/flin ));
241  fprintf( ioQQQ, " %4d",5016 );
242  fprintf( ioQQQ,PrintEfmt("%9.2e", iso_sp[ipHE_LIKE][ipHELIUM].trans(ipHe3p1P,ipHe2s1S).Emis().TauTot()*SQRTPI/flin ));
243  fprintf( ioQQQ, " %4d",5876 );
244  fprintf( ioQQQ,PrintEfmt("%9.2e", iso_sp[ipHE_LIKE][ipHELIUM].trans(ipHe3d3D,ipHe2p3P2).Emis().TauTot()*SQRTPI/flin ));
245  fprintf( ioQQQ, "\n" );
246 
247  fprintf( ioQQQ, " New He Is Lines:" );
248  fprintf( ioQQQ, " %4d",584 );
249  fprintf( ioQQQ,PrintEfmt("%9.2e", iso_sp[ipHE_LIKE][ipHELIUM].trans(ipHe2p1P,ipHe1s1S).Emis().TauIn()*SQRTPI/flin ));
250  fprintf( ioQQQ, " %4d",3889 );
251  fprintf( ioQQQ,PrintEfmt("%9.2e", iso_sp[ipHE_LIKE][ipHELIUM].trans(ipHe3p3P,ipHe2s3S).Emis().TauIn()*SQRTPI/flin ));
252  fprintf( ioQQQ, " %4d",5016 );
253  fprintf( ioQQQ,PrintEfmt("%9.2e", iso_sp[ipHE_LIKE][ipHELIUM].trans(ipHe3p1P,ipHe2s1S).Emis().TauIn()*SQRTPI/flin ));
254  fprintf( ioQQQ, " %4d",5876 );
255  fprintf( ioQQQ,PrintEfmt("%9.2e", iso_sp[ipHE_LIKE][ipHELIUM].trans(ipHe3d3D,ipHe2p3P2).Emis().TauIn()*SQRTPI/flin ));
256  fprintf( ioQQQ, "\n" );
257 
258  /* ================================================================================*/
259  }
260  return;
261 }
colden.h
ipHE_LIKE
const int ipHE_LIKE
Definition: iso.h:63
dense
t_dense dense
Definition: dense.cpp:24
elementnames.h
prtmet
void prtmet(void)
Definition: prt_met.cpp:15
ioQQQ
FILE * ioQQQ
Definition: cddefines.cpp:7
elementnames
t_elementnames elementnames
Definition: elementnames.cpp:5
geometry.h
PrintE93
void PrintE93(FILE *, double)
Definition: service.cpp:838
PrtAllTau
void PrtAllTau(void)
Definition: prt_alltau.cpp:15
realnum
float realnum
Definition: cddefines.h:103
t_opac::TauTotalGeo
realnum ** TauTotalGeo
Definition: opacity.h:87
t_dense::lgElmtOn
bool lgElmtOn[LIMELM]
Definition: dense.h:146
ipH3s
const int ipH3s
Definition: iso.h:30
t_iso_sp::numLevels_local
long int numLevels_local
Definition: iso.h:498
TransitionProxy::ipCont
long & ipCont() const
Definition: transition.h:450
t_opac::TauAbsGeo
realnum ** TauAbsGeo
Definition: opacity.h:82
ASSERT
#define ASSERT(exp)
Definition: cddefines.h:578
iso.h
ipHYDROGEN
const int ipHYDROGEN
Definition: cddefines.h:305
PrintE82
void PrintE82(FILE *, double)
Definition: service.cpp:739
t_geometry::lgStatic
bool lgStatic
Definition: geometry.h:54
opac
t_opac opac
Definition: opacity.cpp:5
ipH4p
const int ipH4p
Definition: iso.h:34
ipHe3d3D
const int ipHe3d3D
Definition: iso.h:55
dense.h
t_opac::thmin
realnum thmin
Definition: opacity.h:176
prt
t_prt prt
Definition: prt.cpp:10
cddefines.h
ipH2s
const int ipH2s
Definition: iso.h:28
ipHe1s1S
const int ipHe1s1S
Definition: iso.h:41
ipHe3p1P
const int ipHe3p1P
Definition: iso.h:57
t_iso_sp::numLevels_max
long int numLevels_max
Definition: iso.h:493
t_elementnames::chElementSym
char chElementSym[LIMELM][CHARS_ELEMENT_SYM]
Definition: elementnames.h:25
colden
t_colden colden
Definition: colden.cpp:5
t_prt::lgPrnIsoCollapsed
bool lgPrnIsoCollapsed
Definition: prt.h:154
t_geometry::lgSphere
bool lgSphere
Definition: geometry.h:24
t_iso_sp::fb
vector< freeBound > fb
Definition: iso.h:452
t_colden::colden
realnum colden[NCOLD]
Definition: colden.h:38
MAX2
#define MAX2
Definition: cddefines.h:782
SQRTPI
const UNUSED double SQRTPI
Definition: physconst.h:44
t_iso_sp::nCollapsed_max
long int nCollapsed_max
Definition: iso.h:487
ipHe2p1P
const int ipHe2p1P
Definition: iso.h:49
NUMB_PER_LINE
#define NUMB_PER_LINE
prt.h
ipH2p
const int ipH2p
Definition: iso.h:29
ipH3p
const int ipH3p
Definition: iso.h:31
ipHe3p3P
const int ipHe3p3P
Definition: iso.h:54
PrintEfmt
#define PrintEfmt(F, V)
Definition: cddefines.h:1472
t_opac::telec
realnum telec
Definition: opacity.h:175
ipHELIUM
const int ipHELIUM
Definition: cddefines.h:306
t_iso_sp::trans
TransitionProxy trans(const long ipHi, const long ipLo)
Definition: iso.h:444
taulines.h
ipH4s
const int ipH4s
Definition: iso.h:33
geometry
t_geometry geometry
Definition: geometry.cpp:5
t_iso_sp::n_HighestResolved_local
long int n_HighestResolved_local
Definition: iso.h:507
ipH1s
const int ipH1s
Definition: iso.h:27
ipHe2s1S
const int ipHe2s1S
Definition: iso.h:45
ipCOL_H2p
#define ipCOL_H2p
Definition: colden.h:20
ipCOL_H0
#define ipCOL_H0
Definition: colden.h:22
opacity.h
iso_sp
t_iso_sp iso_sp[NISO][LIMELM]
Definition: iso.cpp:8
ipHe2s3S
const int ipHe2s3S
Definition: iso.h:44
ipHe2p3P2
const int ipHe2p3P2
Definition: iso.h:48
DEBUG_ENTRY
#define DEBUG_ENTRY(funcname)
Definition: cddefines.h:684
ipH_LIKE
const int ipH_LIKE
Definition: iso.h:62
t_iso_sp::QuantumNumbers2Index
multi_arr< long, 3 > QuantumNumbers2Index
Definition: iso.h:461