cloudy  trunk
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
prt_alltau.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 /*PrtAllTau master routine controlling printout of optical depths at end of calculation */
4 #include "cddefines.h"
5 #include "iso.h"
6 #include "opacity.h"
7 #include "dense.h"
8 #include "elementnames.h"
9 #include "geometry.h"
10 #include "prt.h"
11 #include "mole.h"
12 #include "freebound.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", findspecieslocal("H")->column*6.71e-24));
56 
57  fprintf( ioQQQ, " H2+:");
58  fprintf( ioQQQ,PrintEfmt("%9.2e", findspecieslocal("H2+")->column*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  {
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  {
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  {
100  }
101  else
102  {
103  PrintE82( ioQQQ , 0.);
104  }
105 
106  fprintf( ioQQQ, " La:");
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 }
void PrintE93(FILE *, double)
Definition: service.cpp:923
const int ipHE_LIKE
Definition: iso.h:65
t_opac opac
Definition: opacity.cpp:5
const int ipHe3d3D
Definition: iso.h:57
const int ipHe2s3S
Definition: iso.h:46
#define PrintEfmt(F, V)
Definition: cddefines.h:1349
long int nCollapsed_max
Definition: iso.h:518
const int ipHe2p1P
Definition: iso.h:51
const int ipHe3p3P
Definition: iso.h:56
FILE * ioQQQ
Definition: cddefines.cpp:7
molezone * findspecieslocal(const char buf[])
const int ipHe1s1S
Definition: iso.h:43
vector< freeBound > fb
Definition: iso.h:481
void PrtAllTau(void)
Definition: prt_alltau.cpp:15
t_dense dense
Definition: global.cpp:15
t_elementnames elementnames
Definition: elementnames.cpp:5
t_iso_sp iso_sp[NISO][LIMELM]
Definition: iso.cpp:11
bool lgSphere
Definition: geometry.h:34
long int n_HighestResolved_local
Definition: iso.h:538
void prtmet(void)
Definition: prt_met.cpp:19
t_geometry geometry
Definition: geometry.cpp:5
bool lgPrnIsoCollapsed
Definition: prt.h:195
const int ipHe2s1S
Definition: iso.h:47
const int ipH1s
Definition: iso.h:29
const int ipHe3p1P
Definition: iso.h:59
long & ipCont() const
Definition: transition.h:489
float realnum
Definition: cddefines.h:124
const int ipH4p
Definition: iso.h:36
bool lgStatic
Definition: geometry.h:64
realnum thmin
Definition: opacity.h:188
realnum telec
Definition: opacity.h:188
const int ipH3s
Definition: iso.h:32
double column(const genericState &gs)
multi_arr< long, 3 > QuantumNumbers2Index
Definition: iso.h:490
t_prt prt
Definition: prt.cpp:14
bool lgElmtOn[LIMELM]
Definition: dense.h:160
TransitionProxy trans(const long ipHi, const long ipLo)
Definition: iso.h:473
char chElementSym[LIMELM][CHARS_ELEMENT_SYM]
Definition: elementnames.h:25
const int ipH2p
Definition: iso.h:31
realnum ** TauTotalGeo
Definition: opacity.h:96
#define ASSERT(exp)
Definition: cddefines.h:613
const int ipH2s
Definition: iso.h:30
const int ipH_LIKE
Definition: iso.h:64
const int ipHe2p3P2
Definition: iso.h:50
#define NUMB_PER_LINE
#define DEBUG_ENTRY(funcname)
Definition: cddefines.h:723
const int ipHELIUM
Definition: cddefines.h:350
realnum ** TauAbsGeo
Definition: opacity.h:91
#define MAX2(a, b)
Definition: cddefines.h:824
int fprintf(const Output &stream, const char *format,...)
Definition: service.cpp:1121
const int ipH4s
Definition: iso.h:35
long int numLevels_max
Definition: iso.h:524
void PrintE82(FILE *, double)
Definition: service.cpp:824
const int ipHYDROGEN
Definition: cddefines.h:349
const int ipH3p
Definition: iso.h:33
long int numLevels_local
Definition: iso.h:529