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 /*prtmet print all line optical depths at end of iteration */ 00004 #include "cddefines.h" 00005 #include "taulines.h" 00006 #include "h2.h" 00007 #include "iso.h" 00008 #include "lines_service.h" 00009 #include "dense.h" 00010 #include "prt.h" 00011 #include "mole.h" 00012 00013 void prtmet(void) 00014 { 00015 long int i, 00016 nelem , 00017 ipHi , 00018 ipLo , 00019 ipISO; 00020 00021 DEBUG_ENTRY( "prtmet()" ); 00022 00023 /* default is to not print optical depths, turn on with 00024 * print optical depths on command */ 00025 if( prt.lgPrtTau ) 00026 { 00027 fprintf( ioQQQ, " Line Optical Depths\n"); 00028 00029 /* "IN" - initialize */ 00030 prme("IN",&TauLines[0]); 00031 00032 /* iso sequences */ 00033 for( ipISO=ipH_LIKE; ipISO<NISO; ++ipISO ) 00034 { 00035 for( nelem=ipISO; nelem < LIMELM; nelem++ ) 00036 { 00037 if( dense.lgElmtOn[nelem] ) 00038 { 00039 /* print Lyman, Balmer, Paschen, etc sequence optical depths */ 00040 for( ipLo=0; ipLo < iso.numLevels_local[ipISO][nelem]-1; ipLo++ ) 00041 { 00042 for( ipHi=ipLo+1; ipHi < iso.numLevels_local[ipISO][nelem]; ipHi++ ) 00043 { 00044 prme(" c",&Transitions[ipISO][nelem][ipHi][ipLo]); 00045 } 00046 } 00047 } 00048 } 00049 } 00050 00051 /* print main lines optical depths */ 00052 for( i=1; i <= nLevel1; i++ ) 00053 { 00054 prme(" c",&TauLines[i]); 00055 } 00056 00057 for( i=0; i < nWindLine; i++ ) 00058 { 00059 if( TauLine2[i].Hi->IonStg < TauLine2[i].Hi->nelem+1-NISO ) 00060 { 00061 prme(" c",&TauLine2[i]); 00062 } 00063 } 00064 00065 for( i=0; i < nUTA; i++ ) 00066 { 00067 if( UTALines[i].Emis->Aul > 0. ) 00068 prme(" c",&UTALines[i]); 00069 } 00070 00071 /* print H2 line optical depths */ 00072 H2_Prt_line_tau(); 00073 00074 for( i=0; i < nCORotate; i++ ) 00075 { 00076 prme(" c",&C12O16Rotate[i]); 00077 } 00078 00079 for( i=0; i < nCORotate; i++ ) 00080 { 00081 prme(" c",&C13O16Rotate[i]); 00082 } 00083 00084 for( i=0; i < nHFLines; i++ ) 00085 { 00086 prme(" c",&HFLines[i]); 00087 } 00088 00089 /* data base lines */ 00090 for( i=0; i < linesAdded2; i++) 00091 { 00092 prme("DB",atmolEmis[i].tran); 00093 } 00094 00095 fprintf( ioQQQ, "\n"); 00096 } 00097 return; 00098 } 00099 00100 /* prme - print optical depth */ 00101 void prme( 00102 /* flag saying what to do 00103 * "IN" initialize 00104 * " c" add to list of old style lines 00105 * "DB" add to list of database lines 00106 */ 00107 const char *chDoIt, 00108 transition * t) 00109 { 00110 char chAtMolWL[20],chAtMol[35]; 00111 static long int n ; 00112 00113 DEBUG_ENTRY( "prme()" ); 00114 00115 if( t->ipCont <= 0 ) 00116 { 00117 /* line is not transferred */ 00118 return; 00119 } 00120 00121 /* "In" is to initialize for new printout */ 00122 if( strncmp(chDoIt,"IN",2) == 0 ) 00123 { 00124 n = 0; 00125 } 00126 00127 else if( strncmp(chDoIt,"DB",2) == 0) 00128 { 00129 /* database lines, - cannot now address species labels for atoms 00130 * and molecules in one simple way so separate from most lines 00131 * print optical depth if greater than lower limit, or significantly negative */ 00132 if( t->Emis->TauIn > prt.PrtTauFnt || t->Emis->TauIn < -1e-5 ) 00133 { 00134 sprt_wl(chAtMolWL,t->WLAng); 00135 strcpy(chAtMol,t->Hi->chLabel); 00136 strcat(chAtMol," "); 00137 strcat(chAtMol,chAtMolWL); 00138 fprintf( ioQQQ, " %10.15s",chAtMol); 00139 fprintf( ioQQQ,PrintEfmt("%9.2e", t->Emis->TauIn)); 00140 fprintf( ioQQQ, " "); 00141 // throw CR after printing 6 numbers 00142 ++n; 00143 if(n == 6) 00144 { 00145 n = 0; 00146 fprintf( ioQQQ, " \n"); 00147 } 00148 } 00149 } 00150 00151 else if( strncmp(chDoIt," c",2) == 0) 00152 { 00153 /* print optical depth if greater than lower limit, or significantly negative */ 00154 if( t->Emis->TauIn > prt.PrtTauFnt || t->Emis->TauIn < -1e-5 ) 00155 { 00156 /* PrtTauFnt is threshold for printing it */ 00157 fprintf( ioQQQ, " %10.10s",chLineLbl(t)); 00158 fprintf( ioQQQ, PrintEfmt("%9.2e", t->Emis->TauIn )); 00159 00160 // throw CR after printing 6 numbers 00161 ++n; 00162 if(n == 6) 00163 { 00164 n = 0; 00165 fprintf( ioQQQ, " \n"); 00166 } 00167 } 00168 } 00169 else 00170 TotalInsanity(); 00171 return; 00172 }