cloudy  trunk
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
prt_columns.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 /*PrtColumns print column densities of all elements */
4 #include "cddefines.h"
5 #include "cddrive.h"
6 #include "dense.h"
7 #include "elementnames.h"
8 #include "h2.h"
9 #include "taulines.h"
10 #include "molcol.h"
11 #include "prt.h"
12 
14  /* this is stream used for io, is stdout when called by final,
15  * is punch unit when punch output generated */
16  FILE *ioMEAN )
17 {
18  long int i,
19  nelem;
20 
21  double aa;
22 
23  DEBUG_ENTRY( "PrtColumns()" );
24 
25  /* print molecular element column densities */
26  molcol("PRIN" , ioMEAN);
27 
28  fprintf( ioMEAN, "\n" );
29 
30  fprintf( ioMEAN, "\n " );
31  for( i=1; i <= 17; i++ )
32  {
33  fprintf( ioMEAN, "%7ld", i );
34  }
35  fprintf( ioMEAN, "\n\n" );
36 
37  /* ionization column densities */
38  for( nelem=0; nelem < LIMELM; nelem++ )
39  {
40  if( dense.lgElmtOn[nelem] )
41  {
42  bool lgDONE = false;
43 
44  fprintf( ioMEAN, " %10.10s", elementnames.chElementName[nelem] );
45 
46  i = 1;
47  while( !lgDONE )
48  {
49  if( cdColm(
50  /* return value is zero if all ok, 1 if errors happened */
51  /* 4-char + eol string that is first
52  * 4 char of element name as spelled by cloudy */
54 
55  /* integer stage of ionization, 1 for atom, 0 for CO or H2 */
56  i,
57 
58  /* the theoretical column density derived by the code */
59  &aa ) )
60  TotalInsanity();
61 
62  if( aa == 0. )
63  {
64  aa = -30.;
65  }
66  else if( aa > 0. )
67  {
68  aa = log10(aa);
69  }
70 
71  if( i == 18 )
72  {
73  fprintf( ioMEAN, "\n" );
74  }
75  fprintf( ioMEAN, "%7.3f", aa );
76 
77  /* increment counter and check if at upper limit */
78  ++i;
79  /* MAX2 is to include H2 in H array */
80  if( i > MAX2(3,nelem+2) )
81  lgDONE = true;
82 
83  /* print title for this info if we are done with hydrogen */
84  if( nelem==ipHYDROGEN && lgDONE )
85  fprintf(ioMEAN," (H2) Log10 Column density (cm^-2)");
86  }
87 
88  fprintf( ioMEAN, "\n" );
89  }
90  }
91 
92  /* only print excited state column densities if level2 lines are included
93  * since they populated the upper level by UV pumping. This process
94  * is not included if level2 lines are not considered, by introducing
95  * the "no level2" command */
96  if( nWindLine>0 )
97  {
98 # define NEXCIT_COL 12
99  char chExcit_Col[NEXCIT_COL][5]={
100  "He1*","CII*","C11*","C12*","C13*","O11*","O12*","O13*","Si2*","C30*","C31*","C32*"};
101  long int nprt = 0;
102  /* print excited level column densities */
103  fprintf(ioMEAN," Exc state ");
104  nprt = 12;
105  for(i=0; i<NEXCIT_COL; ++i )
106  {
107  if( cdColm(
108  /* return value is zero if all ok, 1 if errors happened */
109  /* 4-char + eol string that is first
110  * 4 char of element name as spelled by cloudy */
111  chExcit_Col[i],
112  /* integer stage of ionization, 1 for atom, 0 for CO, OH, CII*, or H2 */
113  0,
114  /* the theoretical column density derived by the code */
115  &aa ) )
116  TotalInsanity();
117 
118  if( nprt > 120 )
119  {
120  fprintf(ioMEAN,"\n ");
121  nprt = 0;
122  }
123  fprintf(ioMEAN," %s%7.3f",
124  chExcit_Col[i],
125  log10(SDIV(aa) ));
126  nprt += 14;
127  }
128  fprintf(ioMEAN,"\n");
129  }
130 
131  /* print column densities for H2 */
132  H2_Prt_column_density(ioMEAN);
133 
134  fprintf(ioMEAN,"\n");
135  return;
136 }

Generated for cloudy by doxygen 1.8.4