cloudy  trunk
prt_met.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 /*prtmet print all line optical depths at end of iteration */
4 #include "cddefines.h"
5 #include "taulines.h"
6 #include "h2.h"
7 #include "iso.h"
8 #include "lines_service.h"
9 #include "dense.h"
10 #include "prt.h"
11 #include "mole.h"
12 #include "trace.h"
13 
14 /*prtmet print all line optical depths at end of iteration */
15 void prtmet(void)
16 {
17  long int i,
18  nelem ,
19  ipHi ,
20  ipLo ,
21  ipISO;
22 
23  DEBUG_ENTRY( "prtmet()" );
24 
25  /* default is to not print optical depths, turn on with
26  * print optical depths on command */
27  if( prt.lgPrtTau || (trace.lgTrace && trace.lgOptcBug) )
28  {
29  fprintf( ioQQQ, "\n\n Mean Line Optical Depths\n");
30 
31  // initialize -- TauLines[0] is just a dummy here
32  prme(true, TauLines[0]);
33 
34  /* iso sequences */
35  for( ipISO=ipH_LIKE; ipISO<NISO; ++ipISO )
36  {
37  for( nelem=ipISO; nelem < LIMELM; nelem++ )
38  {
39  if( dense.lgElmtOn[nelem] )
40  {
41  /* print Lyman, Balmer, Paschen, etc sequence optical depths */
42  for( ipLo=0; ipLo < iso_sp[ipISO][nelem].numLevels_local-1; ipLo++ )
43  {
44  for( ipHi=ipLo+1; ipHi < iso_sp[ipISO][nelem].numLevels_local; ipHi++ )
45  {
46  prme(false,iso_sp[ipISO][nelem].trans(ipHi,ipLo));
47  }
48  }
49  }
50  }
51  }
52 
53  /* print main lines optical depths */
54  for( i=1; i <= nLevel1; i++ )
55  {
56  prme(false,TauLines[i]);
57  }
58 
59  for( i=0; i < nWindLine; i++ )
60  {
61  if( (*TauLine2[i].Hi()).IonStg() < (*TauLine2[i].Hi()).nelem()+1-NISO )
62  {
63  prme(false,TauLine2[i]);
64  }
65  }
66 
67  for( i=0; i < nUTA; i++ )
68  {
69  prme(false,UTALines[i]);
70  }
71 
72  /* print H2 line optical depths */
73  for( diatom_iter diatom = diatoms.begin(); diatom != diatoms.end(); ++diatom )
74  (*diatom)->H2_Prt_line_tau();
75 
76  for( i=0; i < nHFLines; i++ )
77  {
78  prme(false,HFLines[i]);
79  }
80 
81  /* data base lines */
82  for (int ipSpecies=0; ipSpecies < nSpecies; ++ipSpecies)
83  {
84  for( EmissionList::iterator em=dBaseTrans[ipSpecies].Emis().begin();
85  em != dBaseTrans[ipSpecies].Emis().end(); ++em)
86  {
87  prme(false,(*em).Tran());
88  }
89  }
90 
91  fprintf( ioQQQ, "\n");
92  }
93  return;
94 }
95 
96 /* prme - print line optical depth */
97 void prme(
98  const bool lgReset,
99  const TransitionProxy &t)
100 {
101  static long int n ;
102 
103  DEBUG_ENTRY( "prme()" );
104 
105  if( lgReset )
106  n = 0;
107 
108  if( t.ipCont() <= 0 )
109  {
110  /* line is not transferred */
111  return;
112  }
113 
114  /* print optical depth if greater than lower limit, or significantly negative
115  * PrtTauFnt is threshold for printing it
116  * */
117  if( t.Emis().TauIn()*SQRTPI > prt.PrtTauFnt || t.Emis().TauIn()*SQRTPI < -1e-5 )
118  {
119  fprintf( ioQQQ, " %10.10s",chLineLbl(t));
120  /*>> chng 12 jul 25, print mean optical depths, rather than line center */
121  fprintf( ioQQQ, PrintEfmt("%9.2e", t.Emis().TauIn()*SQRTPI ));
122 
123  // throw CR after printing 6 numbers
124  ++n;
125  if(n == 6)
126  {
127  n = 0;
128  fprintf( ioQQQ, " \n");
129  }
130  }
131 
132  return;
133 }
chLineLbl
char * chLineLbl(const TransitionProxy &t)
Definition: transition.cpp:237
dense
t_dense dense
Definition: dense.cpp:24
ioQQQ
FILE * ioQQQ
Definition: cddefines.cpp:7
nLevel1
long int nLevel1
Definition: taulines.cpp:28
dBaseTrans
vector< TransitionList > dBaseTrans
Definition: taulines.cpp:17
diatom_iter
vector< diatomics * >::iterator diatom_iter
Definition: h2.h:13
nWindLine
long nWindLine
Definition: cdinit.cpp:19
nUTA
long int nUTA
Definition: taulines.cpp:26
mole.h
t_dense::lgElmtOn
bool lgElmtOn[LIMELM]
Definition: dense.h:146
diatoms
vector< diatomics * > diatoms
Definition: h2.cpp:8
t_iso_sp::numLevels_local
long int numLevels_local
Definition: iso.h:498
trace.h
ProxyIterator
Definition: proxy_iterator.h:58
lines_service.h
TransitionProxy::ipCont
long & ipCont() const
Definition: transition.h:450
prtmet
void prtmet(void)
Definition: prt_met.cpp:15
iso.h
EmissionProxy::TauIn
realnum & TauIn() const
Definition: emission.h:423
TransitionProxy
Definition: transition.h:23
TransitionProxy::Emis
EmissionList::reference Emis() const
Definition: transition.h:408
dense.h
trace
t_trace trace
Definition: trace.cpp:5
prt
t_prt prt
Definition: prt.cpp:10
cddefines.h
TauLine2
TransitionList TauLine2("TauLine2", &AnonStates)
SQRTPI
const UNUSED double SQRTPI
Definition: physconst.h:44
LIMELM
const int LIMELM
Definition: cddefines.h:258
UTALines
TransitionList UTALines("UTALines", &AnonStates)
prme
void prme(const bool lgReset, const TransitionProxy &t)
Definition: prt_met.cpp:97
TauLines
TransitionList TauLines("TauLines", &AnonStates)
prt.h
t_prt::PrtTauFnt
realnum PrtTauFnt
Definition: prt.h:141
PrintEfmt
#define PrintEfmt(F, V)
Definition: cddefines.h:1472
taulines.h
nHFLines
long int nHFLines
Definition: taulines.cpp:31
iso_sp
t_iso_sp iso_sp[NISO][LIMELM]
Definition: iso.cpp:8
h2.h
nSpecies
long int nSpecies
Definition: taulines.cpp:21
NISO
const int NISO
Definition: cddefines.h:261
DEBUG_ENTRY
#define DEBUG_ENTRY(funcname)
Definition: cddefines.h:684
ipH_LIKE
const int ipH_LIKE
Definition: iso.h:62
t_trace::lgTrace
bool lgTrace
Definition: trace.h:12
HFLines
TransitionList HFLines("HFLines", &AnonStates)
t_trace::lgOptcBug
bool lgOptcBug
Definition: trace.h:49
t_prt::lgPrtTau
bool lgPrtTau
Definition: prt.h:130