cloudy trunk
|
00001 /* This file is part of Cloudy and is copyright (C)1978-2008 by Gary J. Ferland and 00002 * others. For conditions of distribution and use see copyright notice in license.txt */ 00003 /*PrtColumns print column densities of all elements */ 00004 #include "cddefines.h" 00005 #include "cddrive.h" 00006 #include "dense.h" 00007 #include "elementnames.h" 00008 #include "h2.h" 00009 #include "taulines.h" 00010 #include "molcol.h" 00011 #include "prt.h" 00012 00013 void PrtColumns( 00014 /* this is stream used for io, is stdout when called by final, 00015 * is punch unit when punch output generated */ 00016 FILE *ioMEAN ) 00017 { 00018 long int i, 00019 nelem; 00020 00021 double aa; 00022 00023 DEBUG_ENTRY( "PrtColumns()" ); 00024 00025 /* print molecular element column densities */ 00026 molcol("PRIN" , ioMEAN); 00027 00028 fprintf( ioMEAN, "\n" ); 00029 00030 fprintf( ioMEAN, "\n " ); 00031 for( i=1; i <= 17; i++ ) 00032 { 00033 fprintf( ioMEAN, "%7ld", i ); 00034 } 00035 fprintf( ioMEAN, "\n\n" ); 00036 00037 /* ionization column densities */ 00038 for( nelem=0; nelem < LIMELM; nelem++ ) 00039 { 00040 if( dense.lgElmtOn[nelem] ) 00041 { 00042 bool lgDONE = false; 00043 00044 fprintf( ioMEAN, " %10.10s", elementnames.chElementName[nelem] ); 00045 00046 i = 1; 00047 while( !lgDONE ) 00048 { 00049 if( cdColm( 00050 /* return value is zero if all ok, 1 if errors happened */ 00051 /* 4-char + eol string that is first 00052 * 4 char of element name as spelled by cloudy */ 00053 elementnames.chElementNameShort[nelem], 00054 00055 /* integer stage of ionization, 1 for atom, 0 for CO or H2 */ 00056 i, 00057 00058 /* the theoretical column density derived by the code */ 00059 &aa ) ) 00060 TotalInsanity(); 00061 00062 if( aa == 0. ) 00063 { 00064 aa = -30.; 00065 } 00066 else if( aa > 0. ) 00067 { 00068 aa = log10(aa); 00069 } 00070 00071 if( i == 18 ) 00072 { 00073 fprintf( ioMEAN, "\n" ); 00074 } 00075 fprintf( ioMEAN, "%7.3f", aa ); 00076 00077 /* increment counter and check if at upper limit */ 00078 ++i; 00079 /* MAX2 is to include H2 in H array */ 00080 if( i > MAX2(3,nelem+2) ) 00081 lgDONE = true; 00082 00083 /* print title for this info if we are done with hydrogen */ 00084 if( nelem==ipHYDROGEN && lgDONE ) 00085 fprintf(ioMEAN," (H2) Log10 Column density (cm^-2)"); 00086 } 00087 00088 fprintf( ioMEAN, "\n" ); 00089 } 00090 } 00091 00092 /* only print excited state column densities if level2 lines are included 00093 * since they populated the upper level by UV pumping. This process 00094 * is not included if level2 lines are not considered, by introducing 00095 * the "no level2" command */ 00096 if( nWindLine>0 ) 00097 { 00098 # define NEXCIT_COL 12 00099 char chExcit_Col[NEXCIT_COL][5]={ 00100 "He1*","CII*","C11*","C12*","C13*","O11*","O12*","O13*","Si2*","C30*","C31*","C32*"}; 00101 long int nprt = 0; 00102 /* print excited level column densities */ 00103 fprintf(ioMEAN," Exc state "); 00104 nprt = 12; 00105 for(i=0; i<NEXCIT_COL; ++i ) 00106 { 00107 if( cdColm( 00108 /* return value is zero if all ok, 1 if errors happened */ 00109 /* 4-char + eol string that is first 00110 * 4 char of element name as spelled by cloudy */ 00111 chExcit_Col[i], 00112 /* integer stage of ionization, 1 for atom, 0 for CO, OH, CII*, or H2 */ 00113 0, 00114 /* the theoretical column density derived by the code */ 00115 &aa ) ) 00116 TotalInsanity(); 00117 00118 if( nprt > 120 ) 00119 { 00120 fprintf(ioMEAN,"\n "); 00121 nprt = 0; 00122 } 00123 fprintf(ioMEAN," %s%7.3f", 00124 chExcit_Col[i], 00125 log10(SDIV(aa) )); 00126 nprt += 14; 00127 } 00128 fprintf(ioMEAN,"\n"); 00129 } 00130 00131 /* print column densities for H2 */ 00132 H2_Prt_column_density(ioMEAN); 00133 00134 fprintf(ioMEAN,"\n"); 00135 return; 00136 }