00001
00002
00003
00004 #include "cddefines.h"
00005 #include "atmdat.h"
00006 #include "dense.h"
00007 #include "prt.h"
00008 #include "hydrogenic.h"
00009 #include "iso.h"
00010 #include "rfield.h"
00011 #include "geometry.h"
00012 #include "lines.h"
00013 #include "lines_service.h"
00014 #include "phycon.h"
00015 #include "radius.h"
00016 #include "secondaries.h"
00017 #include "taulines.h"
00018 #include "trace.h"
00019
00020 void lines_hydro(void)
00021 {
00022 long ipISO = ipH_LIKE;
00023 long int i, nelem, ipHi, ipLo;
00024 char chLabel[5]=" ";
00025
00026 double hbetab,
00027 em ,
00028 pump ,
00029 caseb;
00030
00031 DEBUG_ENTRY( "lines_hydro()" );
00032
00033 if( trace.lgTrace )
00034 fprintf( ioQQQ, " lines_hydro called\n" );
00035
00036
00037 ASSERT( iso.n_HighestResolved_max[ipH_LIKE][ipHYDROGEN] >= 3 );
00038 ASSERT( iso.n_HighestResolved_max[ipH_LIKE][ipHELIUM] >= 3 );
00039
00040 i = StuffComment( "H-like iso-sequence" );
00041 linadd( 0., (realnum)i , "####", 'i',
00042 " start H -like iso sequence ");
00043
00044 linadd(MAX2(0.,iso.xLineTotCool[ipH_LIKE][ipHYDROGEN]),912,"Clin",'c',
00045 " total collisional cooling due to all hydrogen lines ");
00046
00047 linadd(MAX2(0.,-iso.xLineTotCool[ipH_LIKE][ipHYDROGEN]),912,"Hlin",'h' ,
00048 " total collisional heating due to all hydrogen lines ");
00049
00050 linadd(MAX2(0.,iso.xLineTotCool[ipH_LIKE][ipHELIUM]),228,"Clin",'c',
00051 " total collisional cooling due to all HeII lines ");
00052
00053 linadd(MAX2(0.,-iso.xLineTotCool[ipH_LIKE][ipHELIUM]),228,"Hlin",'h' ,
00054 " total collisional heating due to all HeII lines ");
00055
00056
00057
00058
00059
00060
00061
00062 linadd(MAX2(0.,iso.cLya_cool[ipH_LIKE][ipHYDROGEN]),1216,"Cool",'i',
00063 "collisionally excited La cooling ");
00064
00065 linadd(MAX2(0.,-iso.cLya_cool[ipH_LIKE][ipHYDROGEN]),1216,"Heat",'i',
00066 " collisionally de-excited La heating ");
00067
00068 linadd(MAX2(0.,iso.cLyrest_cool[ipH_LIKE][ipHYDROGEN]),960,"Crst",'i',
00069 " cooling due to n>2 Lyman lines ");
00070
00071 linadd(MAX2(0.,-iso.cLyrest_cool[ipH_LIKE][ipHYDROGEN]),960,"Hrst",'i',
00072 " heating due to n>2 Lyman lines ");
00073
00074 linadd(MAX2(0.,iso.cBal_cool[ipH_LIKE][ipHYDROGEN]),4861,"Crst",'i',
00075 " cooling due to n>3 Balmer lines ");
00076
00077 linadd(MAX2(0.,-iso.cBal_cool[ipH_LIKE][ipHYDROGEN]),4861,"Hrst",'i',
00078 " heating due to n>3 Balmer lines ");
00079
00080 linadd(MAX2(0.,iso.cRest_cool[ipH_LIKE][ipHYDROGEN]),0,"Crst",'i',
00081 " cooling due to higher Paschen lines ");
00082
00083 linadd(MAX2(0.,-iso.cRest_cool[ipH_LIKE][ipHYDROGEN]),0,"Hrst",'i',
00084 " heating due to higher Paschen lines ");
00085
00086
00087 secondaries.SecHIonMax = MAX2( secondaries.SecHIonMax , secondaries.sec2total );
00088
00089
00090 atmdat.HIonFracMax = MAX2( atmdat.HIonFracMax, atmdat.HIonFrac);
00091
00092
00093 hydro.HCollIonMax =
00094 (realnum)MAX2( hydro.HCollIonMax , hydro.H_ion_frac_collis );
00095
00096 linadd(secondaries.x12tot*StatesElemNEW[ipHYDROGEN][ipHYDROGEN-ipH_LIKE][ipH1s].Pop*1.634e-11,1216,"LA X" ,'i',
00097 "Lyaa contribution from suprathermal secondaries from ground ");
00098
00099
00100
00101
00102 pump = (double)(Transitions[ipH_LIKE][ipHYDROGEN][ipH4p][ipH1s].Emis->pump*StatesElemNEW[ipHYDROGEN][ipHYDROGEN-ipH_LIKE][ipH1s].Pop*4.09e-12*0.4836);
00103 linadd(pump,4861,"Pump",'r',
00104 "part of Hbeta formed by continuum pumping");
00105
00106 linadd(MAX2(0.,iso.coll_ion[ipH_LIKE][ipHYDROGEN]),0,"CION",'c',
00107 "collision ionization cooling of hydrogen ");
00108
00109 linadd(MAX2(-iso.coll_ion[ipH_LIKE][ipHYDROGEN],0.),0,"3bHt",'h',
00110 " this is the heating due to 3-body recombination ");
00111
00112 linadd(MAX2(0.,iso.coll_ion[ipH_LIKE][ipHELIUM]),0,"He2C",'c',
00113 "collision ionization cooling of He+ ");
00114
00115 linadd(MAX2(-iso.coll_ion[ipH_LIKE][ipHELIUM],0.),0,"He2H",'h',
00116 " this is the heating due to 3-body recombination onto He+");
00117
00118 fixit();
00119 linadd(StatesElemNEW[ipHYDROGEN][ipHYDROGEN-ipH_LIKE][ipH2p].Pop*0.*iso.pestrk[ipH_LIKE][ipHYDROGEN][ipH2p][ipH1s]*1.634e-11,1216,"Strk",'i',
00120 " Stark broadening contribution to line ");
00121
00122 linadd(StatesElemNEW[ipHYDROGEN][ipHYDROGEN-ipH_LIKE][ipH3s].Pop*iso.pestrk[ipH_LIKE][ipHYDROGEN][ipH3s][ipH2p]*3.025e-12,
00123 6563,"Strk",'i',
00124 " Stark broadening contribution to line ");
00125
00126 linadd(StatesElemNEW[ipHYDROGEN][ipHYDROGEN-ipH_LIKE][ipH4s].Pop*iso.pestrk[ipH_LIKE][ipHYDROGEN][ipH4s][ipH2p]*4.084e-12,
00127 4861,"Strk",'i',
00128 "Stark broadening contribution to line ");
00129
00130 linadd(StatesElemNEW[ipHYDROGEN][ipHYDROGEN-ipH_LIKE][ipH4p].Pop*iso.pestrk[ipH_LIKE][ipHYDROGEN][ipH4p][ipH3s]*1.059e-12,
00131 18751,"Strk",'i',
00132 " Stark broadening contribution to line ");
00133
00134
00135
00136 if( iso.n_HighestResolved_max[ipH_LIKE][ipHYDROGEN] >= 5 )
00137 {
00138 long ip5p = iso.QuantumNumbers2Index[ipH_LIKE][ipHYDROGEN][5][1][2];
00139 linadd(StatesElemNEW[ipHYDROGEN][ipHYDROGEN-ipH_LIKE][ip5p].Pop*iso.pestrk[ipH_LIKE][ipHYDROGEN][ip5p][ipH4s]*4.900e-13,40512,"Strk",'i',
00140 "Stark broadening part of line");
00141 }
00142
00143
00144 ASSERT( LineSave.ipass <1 ||
00145 Transitions[ipH_LIKE][ipHYDROGEN][ipH2p][ipH1s].Emis->ots>= 0.);
00146
00147 linadd(Transitions[ipH_LIKE][ipHYDROGEN][ipH2p][ipH1s].Emis->ots*Transitions[ipH_LIKE][ipHYDROGEN][ipH2p][ipH1s].EnergyErg, 1216,"Dest",'i',
00148 " portion of line lost due to absorp by background opacity ");
00149
00150
00151 linadd(Transitions[ipH_LIKE][ipHYDROGEN][ipH3p][ipH2s].Emis->ots*Transitions[ipH_LIKE][ipHYDROGEN][ipH3p][ipH2s].EnergyErg, 6563,"Dest",'i',
00152 "Ha destroyed by background opacity");
00153
00154
00155 if( iso.n_HighestResolved_max[ipH_LIKE][ipHYDROGEN] >= 5 )
00156 {
00157 long ip5p = iso.QuantumNumbers2Index[ipH_LIKE][ipHYDROGEN][5][1][2];
00158 linadd(Transitions[ipH_LIKE][ipHYDROGEN][ip5p][ipH4s].Emis->ots*Transitions[ipH_LIKE][ipHYDROGEN][ip5p][ipH4s].EnergyErg,40516, "Dest",'i',
00159 "portion of line lost due to absorb by background opacity");
00160 }
00161
00162
00163 if( iso.numLevels_max[ipH_LIKE][ipHYDROGEN] > ipH4p )
00164 linadd(Transitions[ipH_LIKE][ipHYDROGEN][ipH4p][ipH2s].Emis->ots*Transitions[ipH_LIKE][ipHYDROGEN][ipH4p][ipH2s].EnergyErg, 4861,"Dest",'i',
00165 "portion of line lost due to absorb by background opacity");
00166
00167
00168 if( iso.numLevels_max[ipH_LIKE][ipHYDROGEN] > ipH4p )
00169 linadd(Transitions[ipH_LIKE][ipHYDROGEN][ipH4p][ipH3s].Emis->ots*Transitions[ipH_LIKE][ipHYDROGEN][ipH4p][ipH3s].EnergyErg ,18751, "Dest",'i',
00170 "portion of line lost due to absorb by background opacity");
00171
00172 linadd(StatesElemNEW[ipHYDROGEN][ipHYDROGEN-ipH_LIKE][ipH2p].Pop*Transitions[ipH_LIKE][ipHYDROGEN][ipH2p][ipH1s].Emis->Aul*
00173 hydro.dstfe2lya*Transitions[ipH_LIKE][ipHYDROGEN][ipH2p][ipH1s].EnergyErg , 1216 , "Fe 2" , 'i',
00174 "Ly-alpha destroyed by overlap with FeII " );
00175
00176 linadd(iso.RadRec_caseB[ipH_LIKE][ipHYDROGEN]*dense.xIonDense[ipHYDROGEN][1]*dense.eden * 1.64e-11,1216,"Ca B",'i',
00177 " simple high-density case b intensity of Ly-alpha, no two photon ");
00178
00179
00180 if( geometry.iEmissPower == 2 )
00181 {
00182
00183 if( nzone == 1 )
00184 {
00185
00186 caseb = rfield.qhtot*
00187 atmdat_HS_caseB( 4 , 2 , 1 , phycon.te , dense.eden, 'b' ) / iso.RadRec_caseB[ipH_LIKE][ipHYDROGEN];
00188
00189
00190 if( caseb < 0 )
00191 {
00192 caseb = rfield.qhtot*4.75e-13;
00193 }
00194 LineSv[LineSave.nsum].SumLine[0] = 0.;
00195 LineSv[LineSave.nsum].SumLine[1] = 0.;
00196 }
00197 else
00198 {
00199 caseb = 0.;
00200 }
00201
00202 linadd( caseb/radius.dVeffAper*geometry.covgeo , 4861 , "Q(H)" , 'i' ,
00203 "Case B H-beta computed from Q(H) and specified covering factor");
00204
00205 if( nzone == 1 )
00206 {
00207 caseb = rfield.qhtot*Transitions[ipH_LIKE][ipHYDROGEN][ipH2p][ipH1s].EnergyErg;
00208 LineSv[LineSave.nsum].SumLine[0] = 0.;
00209 LineSv[LineSave.nsum].SumLine[1] = 0.;
00210 }
00211 else
00212 {
00213 caseb = 0.;
00214 }
00215
00216 linadd( caseb/radius.dVeffAper*geometry.covgeo , 1216 , "Q(H)" , 'i',
00217 "Ly-alpha from Q(H), high-dens lim, specified covering factor" );
00218 }
00219
00220
00221 for( nelem=ipISO; nelem < LIMELM; nelem++ )
00222 {
00223 if( dense.lgElmtOn[nelem] )
00224 {
00225 ASSERT( iso.n_HighestResolved_max[ipH_LIKE][nelem] >= 3 );
00226
00227 for( ipHi=1; ipHi < iso.numLevels_max[ipISO][nelem]; ipHi++ )
00228 {
00229 for( ipLo=0; ipLo < ipHi; ipLo++ )
00230 {
00231 if( Transitions[ipISO][nelem][ipHi][ipLo].Emis->Aul <= iso.SmallA )
00232 continue;
00233
00234
00235 Transitions[ipISO][nelem][ipHi][ipLo].Emis->phots =
00236 Transitions[ipISO][nelem][ipHi][ipLo].Emis->Aul*
00237 StatesElemNEW[nelem][nelem-ipISO][ipHi].Pop*
00238 Transitions[ipISO][nelem][ipHi][ipLo].Emis->Pesc;
00239
00240
00241 Transitions[ipISO][nelem][ipHi][ipLo].Emis->xIntensity =
00242 Transitions[ipISO][nelem][ipHi][ipLo].Emis->phots*
00243 Transitions[ipISO][nelem][ipHi][ipLo].EnergyErg;
00244 }
00245 }
00246 }
00247 }
00248
00249
00250
00251 for( nelem=0; nelem < LIMELM; nelem++ )
00252 {
00253 if( dense.IonHigh[nelem] == nelem + 1 )
00254 {
00255
00256 for( ipHi=3; ipHi < iso.numLevels_max[ipH_LIKE][nelem]; ipHi++ )
00257 {
00258 long index_of_nHi_P;
00259
00260
00261 if( N_(ipHi) > iso.n_HighestResolved_max[ipH_LIKE][nelem] )
00262 index_of_nHi_P = ipHi;
00263 else
00264 index_of_nHi_P = iso.QuantumNumbers2Index[ipH_LIKE][nelem][ N_(ipHi) ][1][2];
00265
00266
00267 for( ipLo=0; ipLo < ipHi; ipLo++ )
00268 {
00269 long index_of_nLo_S = iso.QuantumNumbers2Index[ipH_LIKE][nelem][ N_(ipLo) ][0][2];
00270
00271
00272
00273 if( N_(ipLo) > iso.n_HighestResolved_local[ipH_LIKE][nelem] || N_(ipLo) == N_(ipHi) )
00274 break;
00275
00276 if( Transitions[ipH_LIKE][nelem][ipHi][ipLo].Emis->Aul <= iso.SmallA )
00277 continue;
00278
00279
00280 if( ipHi == index_of_nHi_P && ipLo == index_of_nLo_S )
00281 continue;
00282 else
00283 {
00284
00285 Transitions[ipH_LIKE][nelem][index_of_nHi_P][index_of_nLo_S].Emis->xIntensity +=
00286 Transitions[ipH_LIKE][nelem][ipHi][ipLo].Emis->xIntensity;
00287
00288 Transitions[ipH_LIKE][nelem][ipHi][ipLo].Emis->xIntensity = 0;
00289
00290 }
00291 }
00292 }
00293 }
00294 }
00295
00296
00297 hbetab = (double)((pow(10.,-20.89 - 0.10612*POW2(phycon.alogte - 4.4)))/
00298 phycon.te);
00299
00300
00301
00302 ASSERT( iso.numLevels_max[ipH_LIKE][ipHYDROGEN] > 4 );
00303 hbetab *= dense.xIonDense[ipHYDROGEN][1]*dense.eden;
00304
00305 lindst(hbetab, -4861 ,"CaBo",
00306 1 ,'i',false,
00307 " this is old case b based on Ferland (1980) PASP ");
00308
00309 if( dense.lgElmtOn[ipHELIUM] )
00310 {
00311
00312
00313
00314 ASSERT( iso.numLevels_max[ipH_LIKE][ipHELIUM] > 4 );
00315
00316 em = 2.03e-20/(phycon.te70*phycon.te10*phycon.te03);
00317 em *= dense.xIonDense[ipHELIUM][2]*dense.eden;
00318
00319 lindst(em,-1640,"CaBo",
00320 1,'i',false,
00321 " old prediction of He II 1640, Case B at low densities");
00322
00323
00324
00325 em = 2.52e-20/(pow(phycon.te,1.05881));
00326 em *= dense.xIonDense[ipHELIUM][2]*dense.eden;
00327
00328 lindst(em,-4686,"CaBo", 1,'i',false,
00329 " old prediction of He II 4686, Case B at low densities");
00330 }
00331
00332
00333 if( LineSave.ipass <= 0 )
00334 {
00335 for(nelem=0; nelem<HS_NZ; ++nelem )
00336 {
00337 atmdat.lgHCaseBOK[0][nelem] = true;
00338 atmdat.lgHCaseBOK[1][nelem] = true;
00339 }
00340 }
00341
00342 for( nelem=0; nelem < LIMELM; nelem++ )
00343 {
00344 if( dense.lgElmtOn[nelem] )
00345 {
00346
00347
00348
00349 if( nelem < HS_NZ && (nelem<2 || nelem>4) )
00350 {
00351 int iCase;
00352 for( iCase=0; iCase<2; ++iCase )
00353 {
00354 char chAB[2]={'A','B'};
00355 char chLab[5]="Ca ";
00356
00357
00358
00359
00360
00361 for( ipLo=1+iCase; ipLo<MIN2(10,iso.n_HighestResolved_max[ipH_LIKE][nelem] + iso.nCollapsed_max[ipH_LIKE][nelem]); ++ipLo )
00362 {
00363 for( ipHi=ipLo+1; ipHi< MIN2(25,iso.n_HighestResolved_max[ipH_LIKE][nelem] + iso.nCollapsed_max[ipH_LIKE][nelem]+1); ++ipHi )
00364 {
00365 realnum wl;
00366 double case_b_Intensity;
00367 long int ipCHi , ipCLo;
00368
00369
00370
00371
00372
00373
00374
00375
00376
00377
00378 case_b_Intensity = atmdat_HS_caseB( ipHi,ipLo , nelem+1, phycon.te , dense.eden, chAB[iCase] );
00379 if( case_b_Intensity<=0. )
00380 {
00381 atmdat.lgHCaseBOK[iCase][nelem] = false;
00382 case_b_Intensity = 0.;
00383 }
00384
00385 case_b_Intensity *= dense.xIonDense[nelem][nelem+1-ipISO]*dense.eden;
00386
00387 if( iCase==0 && ipLo==1 )
00388 {
00389
00390 ipCHi = ipHi;
00391 ipCLo = 0;
00392 }
00393 else
00394 {
00395
00396 ipCHi = ipHi;
00397 ipCLo = ipLo;
00398 }
00399
00400
00401 chLab[3] = chAB[iCase];
00402
00403
00404 if( ipCHi > 2 )
00405 {
00406 if( ipCLo > 2 )
00407 {
00408
00409 ipCHi = iso.QuantumNumbers2Index[ipH_LIKE][nelem][ipCHi][1][2];
00410 ipCLo = iso.QuantumNumbers2Index[ipH_LIKE][nelem][ipCLo][0][2];
00411 }
00412 else if( ipCLo == 2 )
00413 {
00414
00415 ipCHi = iso.QuantumNumbers2Index[ipH_LIKE][nelem][ipCHi][0][2];
00416 }
00417 else if( ipCLo == 1 || ipCLo == 0 )
00418 {
00419
00420 ipCHi = iso.QuantumNumbers2Index[ipH_LIKE][nelem][ipCHi][1][2];
00421 }
00422 }
00423
00424
00425 wl = Transitions[ipH_LIKE][nelem][ipCHi][ipCLo].WLAng;
00426 atmdat.WaveLengthCaseB[nelem][ipHi][ipLo] = wl;
00427
00428 lindst(case_b_Intensity,wl,chLab,Transitions[ipH_LIKE][nelem][ipCHi][ipCLo].ipCont,'i',false,
00429 " case a or case b from Hummer & Storey tables" );
00430 }
00431 }
00432 }
00433 }
00434
00435
00436
00437
00438
00439 if( LineSave.ipass == 0 )
00440 {
00441
00442
00443
00444 chIonLbl(chLabel, &Transitions[ipH_LIKE][nelem][ipH2s][ipH1s]);
00445 }
00446 linadd( Transitions[ipH_LIKE][nelem][ipH2s][ipH1s].Emis->xIntensity , 0,chLabel,'r',
00447 "two-photon emission");
00448
00449 linadd(
00450 StatesElemNEW[nelem][nelem-ipH_LIKE][ipH2s].Pop*
00451 iso.TwoNu_induc_dn[ipH_LIKE][nelem]*
00452 Transitions[ipH_LIKE][nelem][ipH2s][ipH1s].EnergyErg,
00453 22, chLabel ,'i',
00454 "induced two-photon emission ");
00455
00456
00457
00458 for( ipLo=ipH1s; ipLo < iso.numLevels_max[ipH_LIKE][nelem]-1; ipLo++ )
00459 {
00460
00461 if( ipLo==ipH2p )
00462 continue;
00463
00464
00465
00466
00467 long int nLoop = iso.numLevels_max[ipH_LIKE][nelem] - iso.nCollapsed_max[ipH_LIKE][nelem];
00468 if( prt.lgPrnIsoCollapsed )
00469 nLoop = iso.numLevels_max[ipH_LIKE][nelem];
00470
00471 for( ipHi=ipLo+1; ipHi < nLoop; ipHi++ )
00472 {
00473
00474
00475 if( Transitions[ipH_LIKE][nelem][ipHi][ipLo].ipCont < 1 )
00476 continue;
00477
00478 char chComment[23];
00479 GenerateTransitionConfiguration( &Transitions[ipH_LIKE][nelem][ipHi][ipLo], chComment);
00480 fixit();
00481 PutLine(&Transitions[ipH_LIKE][nelem][ipHi][ipLo],
00482 "predicted line, all processes included");
00483 }
00484 }
00485 }
00486 }
00487
00488 if( trace.lgTrace )
00489 {
00490 fprintf( ioQQQ, " lines_hydro returns\n" );
00491 }
00492 return;
00493 }