| 73 | | |
|---|
| 74 | | /* >>chng 03 may 01, move defn of these two up here, before entering matrix */ |
|---|
| 75 | | /* >>chng 01 jun 21, add */ |
|---|
| 76 | | /* charge transfer with helium itself, onto everything heavier */ |
|---|
| 77 | | if( nelem == ipHELIUM && ipISO == ipHE_LIKE ) |
|---|
| 78 | | { |
|---|
| 79 | | /* >>chng 04 mar 09, add this average of old and new */ |
|---|
| 80 | | /* take average of old and new 23S photo rate - can be dominated by Lya and a bit noisy |
|---|
| 81 | | * until ots rates have settled down */ |
|---|
| 82 | | if( nzone>1 ) |
|---|
| 83 | | { |
|---|
| 84 | | double frac=0.5; |
|---|
| 85 | | iso.gamnc[ipISO][nelem][ipHe2s3S] = frac*iso.gamnc[ipISO][nelem][ipHe2s3S] + |
|---|
| 86 | | (1.-frac)*SaveHe23S_photorate; |
|---|
| 87 | | } |
|---|
| 88 | | SaveHe23S_photorate = iso.gamnc[ipISO][nelem][ipHe2s3S]; |
|---|
| 89 | | } |
|---|
| 413 | | if( trace.lgTrace && |
|---|
| 414 | | trace.lgIsoTraceFull[ipISO] && (nelem == trace.ipIsoTrace[ipISO]) ) |
|---|
| 415 | | { |
|---|
| 416 | | /** \todo 2 generalize this, can probably then remove the trace below. */ |
|---|
| 417 | | if( ipISO == ipH_LIKE ) |
|---|
| 418 | | PrtHydroTrace2(ipH_LIKE, nelem, SaveZ); |
|---|
| 419 | | else if( ipISO == ipHE_LIKE ) |
|---|
| 420 | | { |
|---|
| 421 | | fprintf( ioQQQ, " pop level others => (iso_level)\n" ); |
|---|
| 422 | | for( n=0; n < numlevels_local; n++ ) |
|---|
| | 390 | if( trace.lgTrace && trace.lgIsoTraceFull[ipISO] && (nelem == trace.ipIsoTrace[ipISO]) ) |
|---|
| | 391 | { |
|---|
| | 392 | fprintf( ioQQQ, " pop level others => (iso_level)\n" ); |
|---|
| | 393 | for( long n=0; n < numlevels_local; n++ ) |
|---|
| | 394 | { |
|---|
| | 395 | fprintf( ioQQQ, " %s %s %2ld", iso.chISO[ipISO], elementnames.chElementNameShort[nelem], n ); |
|---|
| | 396 | for( long j=0; j < numlevels_local; j++ ) |
|---|
| 437 | | fprintf(ioQQQ," recomb ct %.2e co %.2e hectr %.2e hctr %.2e\n", |
|---|
| 438 | | atmdat.HeCharExcRecTotal, |
|---|
| 439 | | findspecies("CO")->hevmol , |
|---|
| 440 | | atmdat.HeCharExcRecTo[nelem][nelem-1]*dense.xIonDense[ipHELIUM][0] , |
|---|
| 441 | | atmdat.HCharExcRecTo[nelem][nelem-1]*dense.xIonDense[ipHYDROGEN][0] ); |
|---|
| 442 | | } |
|---|
| | 401 | } |
|---|
| | 402 | fprintf(ioQQQ," recomb "); |
|---|
| | 403 | for( long n=0; n < numlevels_local; n++ ) |
|---|
| | 404 | { |
|---|
| | 405 | fprintf( ioQQQ,"\t%.9e", creation[n] ); |
|---|
| | 406 | } |
|---|
| | 407 | fprintf( ioQQQ, "\n" ); |
|---|
| | 408 | fprintf(ioQQQ," recomb ct %.2e co %.2e hectr %.2e hctr %.2e\n", |
|---|
| | 409 | atmdat.HeCharExcRecTotal, |
|---|
| | 410 | findspecies("CO")->hevmol , |
|---|
| | 411 | atmdat.HeCharExcRecTo[nelem][nelem-ipISO]*dense.xIonDense[ipHELIUM][0] , |
|---|
| | 412 | atmdat.HCharExcRecTo[nelem][nelem-ipISO]*dense.xIonDense[ipHYDROGEN][0] ); |
|---|
| 645 | | if( ipISO == ipHE_LIKE ) |
|---|
| 646 | | { |
|---|
| 647 | | |
|---|
| 648 | | if( nzone>0 && nelem==ipHELIUM ) |
|---|
| 649 | | { |
|---|
| 650 | | /* find fraction of He0 destructions due to photoionization of 2 ^S */ |
|---|
| 651 | | double ratio; |
|---|
| 652 | | double rateOutOf2TripS = StatesElem[ipHE_LIKE][nelem][ipHe2s3S].Pop * iso.RateLevel2Cont[ipHE_LIKE][nelem][ipHe2s3S]; |
|---|
| | 614 | if( ipISO == ipHE_LIKE && nelem==ipHELIUM && nzone>0 ) |
|---|
| | 615 | { |
|---|
| | 616 | /* find fraction of He0 destructions due to photoionization of 2^3S */ |
|---|
| | 617 | double ratio; |
|---|
| | 618 | double rateOutOf2TripS = StatesElem[ipISO][nelem][ipHe2s3S].Pop * iso.RateLevel2Cont[ipISO][nelem][ipHe2s3S]; |
|---|
| | 619 | if( rateOutOf2TripS > SMALLFLOAT ) |
|---|
| | 620 | { |
|---|
| | 621 | ratio = rateOutOf2TripS / |
|---|
| | 622 | ( rateOutOf2TripS + StatesElem[ipISO][nelem][ipHe1s1S].Pop*ionbal.RateIonizTot[nelem][nelem-ipISO] ); |
|---|
| | 623 | } |
|---|
| | 624 | else |
|---|
| | 625 | { |
|---|
| | 626 | ratio = 0.; |
|---|
| | 627 | } |
|---|
| | 628 | if( ratio > he.frac_he0dest_23S ) |
|---|
| | 629 | { |
|---|
| | 630 | /* remember zone where this happended and fraction, and frac due to photoionization */ |
|---|
| | 631 | he.nzone = nzone; |
|---|
| | 632 | he.frac_he0dest_23S = ratio; |
|---|
| | 633 | rateOutOf2TripS = StatesElem[ipISO][nelem][ipHe2s3S].Pop *iso.gamnc[ipISO][nelem][ipHe2s3S]; |
|---|
| 701 | | |
|---|
| 702 | | STATIC void PrtHydroTrace2( long int ipISO, long int nelem, const multi_arr<double,2,C_TYPE>& SaveZ ) |
|---|
| 703 | | { |
|---|
| 704 | | long ipHi , j , n; |
|---|
| 705 | | double collider; |
|---|
| 706 | | |
|---|
| 707 | | DEBUG_ENTRY( "PrtHydroTrace2()" ); |
|---|
| 708 | | |
|---|
| 709 | | /* >>chng 05 aug 17, use eden as collider for H and corrected eden for heavier |
|---|
| 710 | | * nuclei - in hot PDR H is collisionally ionized, but not by other H0 since |
|---|
| 711 | | * collision is homonuclear */ |
|---|
| 712 | | if( nelem==ipHYDROGEN ) |
|---|
| 713 | | { |
|---|
| 714 | | /* special version for H0 onto H0 */ |
|---|
| 715 | | collider = dense.EdenHontoHCorr; |
|---|
| 716 | | } |
|---|
| 717 | | else |
|---|
| 718 | | { |
|---|
| 719 | | collider = dense.EdenHCorr; |
|---|
| 720 | | } |
|---|
| 721 | | |
|---|
| 722 | | if( nelem == ipHYDROGEN ) |
|---|
| 723 | | { |
|---|
| 724 | | double sum=0 , HRateDestGnd[10]; |
|---|
| 725 | | /* >>chng 06 aug 29, all of these from numLevels_max to _local. */ |
|---|
| 726 | | for(ipHi=1; ipHi<iso.numLevels_local[ipISO][nelem]; ++ipHi ) |
|---|
| 727 | | { |
|---|
| 728 | | if( Transitions[ipISO][nelem][ipHi][ipH1s].Emis->Aul <= iso.SmallA ) |
|---|
| 729 | | continue; |
|---|
| 730 | | |
|---|
| 731 | | sum += Transitions[ipISO][nelem][ipHi][ipH1s].Emis->pump; |
|---|
| 732 | | } |
|---|
| 733 | | fprintf(ioQQQ,"PrtHydroTrace2 pump\t%.2f", fnzone); |
|---|
| 734 | | for(ipHi=1; ipHi<iso.numLevels_local[ipISO][nelem]; ++ipHi ) |
|---|
| 735 | | { |
|---|
| 736 | | if( Transitions[ipISO][nelem][ipHi][ipH1s].Emis->Aul <= iso.SmallA ) |
|---|
| 737 | | continue; |
|---|
| 738 | | |
|---|
| 739 | | fprintf(ioQQQ,"\t%.3f",Transitions[ipISO][nelem][ipHi][ipH1s].Emis->pump/SDIV(sum)); |
|---|
| 740 | | } |
|---|
| 741 | | fprintf(ioQQQ,"\n"); |
|---|
| 742 | | |
|---|
| 743 | | /* remember ground state destruction rate */ |
|---|
| 744 | | HRateDestGnd[0] = iso.RateLevel2Cont[ipISO][nelem][ipH1s]; |
|---|
| 745 | | HRateDestGnd[1] = iso.gamnc[ipISO][nelem][ipH1s]/ |
|---|
| 746 | | iso.RateLevel2Cont[ipISO][nelem][ipH1s]; |
|---|
| 747 | | /* >>chng 05 aug 17, from EdeHCorr to eden as per above comment */ |
|---|
| 748 | | HRateDestGnd[2] = iso.ColIoniz[ipISO][nelem][ipH1s]* |
|---|
| 749 | | collider/iso.RateLevel2Cont[ipISO][nelem][ipH1s]; |
|---|
| 750 | | HRateDestGnd[3] = secondaries.csupra[nelem][nelem]/iso.RateLevel2Cont[ipISO][nelem][ipH1s]; |
|---|
| 751 | | HRateDestGnd[4] = secondaries.Hx12[ipISO][nelem][ipH2p]* |
|---|
| 752 | | 9./iso.RateLevel2Cont[ipISO][nelem][ipH1s]; |
|---|
| 753 | | HRateDestGnd[5] = atmdat.HCharExcIonTotal/ |
|---|
| 754 | | iso.RateLevel2Cont[ipISO][nelem][ipH1s]; |
|---|
| 755 | | HRateDestGnd[6] = atmdat.HCharExcIonTotal; |
|---|
| 756 | | HRateDestGnd[7] = sum/iso.RateLevel2Cont[ipISO][nelem][ipH1s]; |
|---|
| 757 | | HRateDestGnd[8] = sum; |
|---|
| 758 | | |
|---|
| 759 | | fprintf(ioQQQ," grnd dest fracs\t%.2f",fnzone); |
|---|
| 760 | | for( j=ipH1s; j < 9; j++ ) |
|---|
| 761 | | { |
|---|
| 762 | | fprintf( ioQQQ,"\t"); |
|---|
| 763 | | fprintf( ioQQQ,PrintEfmt("%8.1e", HRateDestGnd[j] )); |
|---|
| 764 | | } |
|---|
| 765 | | fprintf(ioQQQ,"\thcoldc\t%e\n", dense.EdenHCorr ); |
|---|
| 766 | | fprintf( ioQQQ, "\n" ); |
|---|
| 767 | | } |
|---|
| 768 | | |
|---|
| 769 | | fprintf( ioQQQ, " pop level others => (iso_level)\n" ); |
|---|
| 770 | | /* >>chng 06 aug 29, from numLevels_max to _local */ |
|---|
| 771 | | for( n=ipH1s; n < iso.numLevels_local[ipISO][nelem]; n++ ) |
|---|
| 772 | | { |
|---|
| 773 | | fprintf( ioQQQ, " HII%2ld", n ); |
|---|
| 774 | | for( j=ipH1s; j < iso.numLevels_local[ipISO][nelem]; j++ ) |
|---|
| 775 | | { |
|---|
| 776 | | fprintf( ioQQQ," "); |
|---|
| 777 | | /*fprintf( ioQQQ,PrintEfmt("%8.1e", SaveZ[j][n] ) );*/ |
|---|
| 778 | | fprintf( ioQQQ,"%.9e\t", SaveZ[j][n] ); |
|---|
| 779 | | } |
|---|
| 780 | | fprintf( ioQQQ, "\n" ); |
|---|
| 781 | | } |
|---|
| 782 | | |
|---|
| 783 | | return; |
|---|
| 784 | | } |
|---|
| 785 | | /*lint +e662 Possible access of out-of-bounds pointer*/ |
|---|