00001
00002
00003
00004 #include "cddefines.h"
00005 #include "yield.h"
00006 #include "heavy.h"
00007 #include "opacity.h"
00008 #include "dense.h"
00009 #include "thermal.h"
00010 #include "conv.h"
00011 #include "grainvar.h"
00012 #include "elementnames.h"
00013 #include "gammas.h"
00014 #include "ionbal.h"
00015
00016 void ion_photo(
00017
00018 long int nelem ,
00019
00020 bool lgPrintIt )
00021 {
00022 long int ion,
00023 iphi,
00024 iplow,
00025 ipop,
00026 limit_hi,
00027 limit_lo,
00028 ns;
00029
00030 DEBUG_ENTRY( "ion_photo()" );
00031
00032
00033
00034
00035 ASSERT( nelem < LIMELM );
00036 ASSERT( dense.IonLow[nelem] >= 0 );
00037 ASSERT( dense.IonLow[nelem] <= nelem);
00038 ASSERT( dense.IonHigh[nelem] <= nelem + 1);
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052 limit_hi = MIN2( dense.IonHigh[nelem] , nelem+1-NISO );
00053
00054
00055 limit_hi = MAX2( 1 , limit_hi );
00056
00057
00058
00059 if( !conv.nPres2Ioniz && gv.lgDustOn )
00060 {
00061 limit_lo = 0;
00062 }
00063 else
00064 {
00065 limit_lo = dense.IonLow[nelem];
00066 }
00067
00068
00069
00070
00071 for( ion=limit_lo; ion < limit_hi; ion++ )
00072 {
00073
00074 for( ns=0; ns < Heavy.nsShells[nelem][ion]; ns++ )
00075 {
00076
00077 if( (ns==(Heavy.nsShells[nelem][ion]-1) || opac.lgRedoStatic) )
00078 {
00079
00080 iplow = opac.ipElement[nelem][ion][ns][0];
00081 iphi = opac.ipElement[nelem][ion][ns][1];
00082 ipop = opac.ipElement[nelem][ion][ns][2];
00083
00084
00085
00086 ionbal.PhotoRate_Shell[nelem][ion][ns][0] =
00087 GammaK(iplow,iphi,
00088 ipop,t_yield::Inst().elec_eject_frac(nelem,ion,ns,0))*ionbal.lgPhotoIoniz_On;
00089
00090
00091
00092
00093
00094 ionbal.PhotoRate_Shell[nelem][ion][ns][1] = thermal.HeatLowEnr*ionbal.lgPhotoIoniz_On;
00095 ionbal.PhotoRate_Shell[nelem][ion][ns][2] = thermal.HeatHiEnr*ionbal.lgPhotoIoniz_On;
00096 }
00097 }
00098
00099
00100
00101
00102 ns = (Heavy.nsShells[nelem][ion]-1);
00103
00104 ionbal.PhotoRate_Shell[nelem][ion][ns][0] += ionbal.CompRecoilIonRate[nelem][ion];
00105
00106 ionbal.PhotoRate_Shell[nelem][ion][ns][2] += ionbal.CompRecoilHeatRate[nelem][ion];
00107 }
00108
00109
00110 if( lgPrintIt )
00111 {
00112
00113 ns = 5;
00114 ion = 1;
00115 GammaPrt(
00116 opac.ipElement[nelem][ion][ns][0],
00117 opac.ipElement[nelem][ion][ns][1],
00118 opac.ipElement[nelem][ion][ns][2],
00119 ioQQQ,
00120 ionbal.PhotoRate_Shell[nelem][ion][ns][0],
00121 0.05);
00122
00123
00124 for( ns=0; ns < Heavy.nsShells[nelem][0]; ns++ )
00125 {
00126 fprintf( ioQQQ, "\n %s", elementnames.chElementNameShort[nelem] );
00127 fprintf( ioQQQ, " %s" , Heavy.chShell[ns]);
00128
00129 for( ion=0; ion < dense.IonHigh[nelem]; ion++ )
00130 {
00131 if( Heavy.nsShells[nelem][ion] > ns )
00132 {
00133 fprintf( ioQQQ, " %8.1e", ionbal.PhotoRate_Shell[nelem][ion][ns][0] );
00134 }
00135 else
00136 {
00137 break;
00138 }
00139 }
00140 }
00141 fprintf(ioQQQ,"\n");
00142 }
00143 return;
00144 }