00001
00002
00003
00004
00005 #include "cddefines.h"
00006 #include "taulines.h"
00007 #include "hmi.h"
00008 #include "iso.h"
00009 #include "phycon.h"
00010 #include "physconst.h"
00011 #include "elementnames.h"
00012 #include "hydrogenic.h"
00013 #include "lines_service.h"
00014 #include "dense.h"
00015 #include "atomfeii.h"
00016 #include "lines.h"
00017 #include "atmdat.h"
00018 #include "prt.h"
00019 #include "mole.h"
00020 #include "mole_co_atom.h"
00021 #include "h2.h"
00022 #include "thermal.h"
00023 #include "cooling.h"
00024 #include "punch.h"
00025
00026 void PunchLineData(FILE * ioPUN)
00027 {
00028
00029 long int i,
00030 j,
00031 limit ,
00032 nelem ,
00033 ipHi ,
00034 ipLo;
00035
00036 const long nskip=2;
00037 double tot;
00038 bool lgElemOff=false;
00039 float a , b;
00040
00041 DEBUG_ENTRY( "PunchLineData()" );
00042
00043
00044
00045
00046
00047 fprintf( ioQQQ, " punching line data, then stopping\n" );
00048
00049
00050 for( nelem=ipHYDROGEN; nelem<LIMELM; ++nelem )
00051 {
00052 if( !dense.lgElmtOn[nelem] )
00053 {
00054 fprintf(ioQQQ," WARNING - I am punching line data but element %s is turned off.\n",
00055 elementnames.chElementName[nelem]);
00056 lgElemOff = true;
00057 }
00058 }
00059 if( lgElemOff )
00060 {
00061 fprintf(ioQQQ,"Some elements are turned off and punch line data requested.\n");
00062 fprintf(ioQQQ,"Code is now designed to do punch line data only with all elements on.\n");
00063 fprintf(ioQQQ,"Please try again with all elements on.\n");
00064 puts( "[Stop in PunchLineData]" );
00065 cdEXIT(EXIT_FAILURE);
00066 }
00067
00068
00069
00070 if( thermal.lgTSetOn )
00071 {
00072 phycon.te = thermal.ConstTemp;
00073 }
00074 else
00075 {
00076 phycon.te = 1e4;
00077 }
00078 tfidle(false);
00079
00080
00081 t_ADfA::Inst().rec_lines(phycon.te,LineSave.RecCoefCNO);
00082 fprintf( ioPUN, "\n Recombination lines of C, N, O\n" );
00083 fprintf( ioPUN, " Ion WL(A) Coef Ion WL(A) Coef\n" );
00084 for( i=0; i<471; i+=nskip)
00085 {
00086
00087 limit = MIN2(471,i+nskip);
00088 fprintf( ioPUN, " " );
00089 for( j=i; j < limit; j++ )
00090 {
00091 fprintf( ioPUN, "%2.2s%2ld%6ld%8.3f ",
00092 elementnames.chElementSym[(long)(LineSave.RecCoefCNO[0][j])-1],
00093 (long)(LineSave.RecCoefCNO[0][j]-LineSave.RecCoefCNO[1][j]+1.01),
00094 (long)(LineSave.RecCoefCNO[2][j]+0.5),
00095 log10(SDIV(LineSave.RecCoefCNO[3][j]) ) );
00096 }
00097 fprintf( ioPUN, " \n" );
00098 }
00099 fprintf( ioPUN, "\n\n" );
00100
00101 dense.eden = 1.;
00102 dense.gas_phase[ipHYDROGEN] = 1.;
00103 dense.EdenHCorr = 1.;
00104
00105
00106 dense.xIonDense[ipHYDROGEN][1] = 1.e-5f;
00107 hmi.Hmolec[ipMH2g] = 0.;
00108 dense.xIonDense[ipHYDROGEN][1] = 1.;
00109 for( i=1; i <= nLevel1; i++ )
00110 {
00111 TauLines[i].PopLo = 1.;
00112 }
00113
00114 for( i=0; i < nWindLine; i++ )
00115 {
00116 TauLine2[i].PopLo = 1.;
00117 }
00118
00119 for( i=0; i < nUTA; i++ )
00120 {
00121 UTALines[i].PopLo = 1.;
00122 }
00123
00124 for( i=0; i < LIMELM; i++ )
00125 {
00126 for( j=0; j < LIMELM+1; j++ )
00127 {
00128 dense.xIonDense[i][j] = 1.;
00129 }
00130 }
00131
00132
00133 CoolEvaluate(&tot);
00134
00135 fprintf( ioPUN, " Level 1 transferred lines\n" );
00136
00137 fprintf( ioPUN, "Ion WL gl gu gf A CS n(crt)\n" );
00138
00139 for( i=1; i <= nLevel1; i++ )
00140 {
00141
00142
00143
00144
00145 Punch1LineData( &TauLines[i] , ioPUN , true);
00146 }
00147
00148 fprintf( ioPUN, "\n\n\n" );
00149 fprintf( ioPUN, " end level 1, start level 2\n" );
00150 fprintf( ioPUN, "Ion WL gl gu gf A CS n(crt)\n" );
00151 for( i=0; i < nWindLine; i++ )
00152 {
00153 if( TauLine2[i].IonStg < TauLine2[i].nelem+1-NISO )
00154 {
00155 Punch1LineData( &TauLine2[i] , ioPUN , true);
00156 }
00157 }
00158
00159 fprintf( ioPUN, "\n\n\n" );
00160 fprintf( ioPUN, " end level 2, start inner shell\n" );
00161 fprintf( ioPUN, "Ion WL gl gu gf A CS n(crt)\n" );
00162
00163 for( i=0; i < nUTA; i++ )
00164 {
00165 if( UTALines[i].Aul > 0. )
00166 Punch1LineData( &UTALines[i] , ioPUN , true);
00167 }
00168
00169 fprintf( ioPUN, "\n\n\n" );
00170 fprintf( ioPUN, " end inner shell, start h-like iso seq\n" );
00171 fprintf( ioPUN, "Ion WL gl gu gf A CS n(crt)\n" );
00172
00173
00174
00175 for( nelem=0; nelem < LIMELM; nelem++ )
00176 {
00177 HydroCollid( nelem );
00178 if( nelem < 2 || dense.lgElmtOn[nelem] )
00179 {
00180
00181
00182 for( ipLo=ipH1s; ipLo < iso.numLevels_max[ipH_LIKE][nelem]-1; ipLo++ )
00183 {
00184
00185 for( ipHi=ipLo+1; ipHi < iso.numLevels_max[ipH_LIKE][nelem]; ipHi++ )
00186 {
00187 Punch1LineData( &EmisLines[ipH_LIKE][nelem][ipHi][ipLo] , ioPUN , false );
00188 }
00189 }
00190 }
00191 }
00192
00193 fprintf( ioPUN, "\n\n\n" );
00194 fprintf( ioPUN, " end h-like iso seq, start he-like iso seq\n" );
00195 fprintf( ioPUN, "Ion WL gl gu gf A CS n(crt)\n" );
00196 for( nelem=1; nelem < LIMELM; nelem++ )
00197 {
00198 if( nelem < 2 || dense.lgElmtOn[nelem] )
00199 {
00200
00201 for( ipLo=ipHe1s1S; ipLo < iso.numLevels_max[ipHE_LIKE][nelem]-1; ipLo++ )
00202 {
00203
00204 for( ipHi=ipLo+1; ipHi < iso.numLevels_max[ipHE_LIKE][nelem]; ipHi++ )
00205 {
00206 Punch1LineData( &EmisLines[ipHE_LIKE][nelem][ipHi][ipLo] , ioPUN , false );
00207 }
00208 }
00209 }
00210 }
00211
00212 fprintf( ioPUN, "\n\n\n" );
00213 fprintf( ioPUN, " end he-like iso seq, start hyperfine structure lines\n" );
00214 fprintf( ioPUN, "Ion WL gl gu gf A CS n(crt)\n" );
00215
00216 for( i=0; i < nHFLines; i++ )
00217 {
00218 Punch1LineData( &HFLines[i] , ioPUN , true);
00219 }
00220
00221
00222 dense.eden = 1e-6;
00223 dense.gas_phase[ipHYDROGEN] = 1e-6f;
00224 dense.EdenHCorr = 1e-6f;
00225 dense.xIonDense[ipHYDROGEN][1] = 1.;
00226 hmi.Hmolec[ipMH2g] = 1.;
00227 hmi.Hmolec[ipMH2s] = 1.;
00228 dense.xIonDense[ipHYDROGEN][1] = 1e-6f;
00229
00230
00231 fprintf( ioPUN, "\n\n\n" );
00232 fprintf( ioPUN, " end hyperfine, start H2 lines\n" );
00233 fprintf( ioPUN, "Eu Vu Ju El Vl Jl WL gl gu gf A CS n(crt)\n" );
00234
00235
00236
00237 H2_LevelPops();
00238 H2_Punch_line_data( ioPUN , false );
00239
00240 fprintf( ioPUN, "\n\n\n" );
00241 fprintf( ioPUN, " end H2, start 12CO rotation lines\n" );
00242 fprintf( ioPUN, "Ion WL gl gu gf A CS n(crt)\n" );
00243 CO_PopsEmisCool(&C12O16Rotate, nCORotate ,1. , "12CO",&a,&b );
00244 for( j=0; j< nCORotate; ++j )
00245 {
00246 Punch1LineData( &C12O16Rotate[j] , ioPUN , true);
00247 }
00248
00249 fprintf( ioPUN, "\n\n\n" );
00250 fprintf( ioPUN, " end 12CO start 13CO rotation lines\n" );
00251 fprintf( ioPUN, "Ion WL gl gu gf A CS n(crt)\n" );
00252 CO_PopsEmisCool(&C13O16Rotate, nCORotate , 1. ,"13CO",&a,&b );
00253 for( j=0; j< nCORotate; ++j )
00254 {
00255 Punch1LineData( &C13O16Rotate[j] , ioPUN , true);
00256 }
00257
00258
00259 fprintf( ioPUN, "\n\n\n" );
00260 fprintf( ioPUN, " end 13CO rotation lines, start FeII lines\n" );
00261 fprintf( ioPUN, " Lo Hi Ion label WL gl gu gf A CS n(crt)\n" );
00262
00263
00264
00265 FeIIPunData( ioPUN , false );
00266
00267 DEBUG_EXIT( "PunchLineData()" );
00268
00269
00270 puts( "[Normal stop in PunchLineData - no ChkAssert to report]" );
00271 fprintf( ioQQQ, " Cloudy ends, exited OK\n" );
00272 cdEXIT(EXIT_SUCCESS);
00273 }
00274
00275
00276 void Punch1LineData( EmLine * t , FILE * ioPUN ,
00277
00278
00279 bool lgCS_2 )
00280 {
00281
00282 double CritDen;
00283
00284 char chLbl[11];
00285
00286 DEBUG_ENTRY( "Punch1LineData()" );
00287
00293
00294
00295 chIonLbl(chLbl , t );
00296 fprintf(ioPUN,"%s\t", chLbl );
00297
00298
00299
00300
00301 prt_wl(ioPUN, t->WLAng );
00302
00303 fprintf( ioPUN, " %3ld%3ld",
00304
00305 (long)(t->gLo),
00306 (long)(t->gHi) );
00307
00308
00309 fprintf( ioPUN,PrintEfmt("%9.2e", t->gf));
00310
00311
00312 fprintf( ioPUN,PrintEfmt("%9.2e", t->Aul));
00313
00314
00315 if( t->cs > 1. )
00316 {
00317 fprintf( ioPUN, "%7.3f", t->cs );
00318 }
00319 else if( t->cs > .01 )
00320 {
00321 fprintf( ioPUN, "%7.4f", t->cs );
00322 }
00323 else if( t->cs > 0.0 )
00324 {
00325 fprintf( ioPUN, " %.3e", t->cs );
00326 }
00327 else
00328 {
00329 fprintf( ioPUN, "%7.4f", 0. );
00330 }
00331
00332
00333
00334
00335 if( lgCS_2 && t->cs> 0. )
00336 {
00337 CritDen = t->Aul * t->gHi*phycon.sqrte / (t->cs*COLL_CONST);
00338 CritDen = log10(CritDen);
00339 }
00340 else
00341 {
00342 CritDen = 0.;
00343 }
00344 fprintf( ioPUN, "%7.3f\n",CritDen );
00345
00346 DEBUG_EXIT( "Punch1LineData()" );
00347
00348 return;
00349 }