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 t_phoHeat photoHeat;
00085
00086
00087
00088 ionbal.PhotoRate_Shell[nelem][ion][ns][0] =
00089 GammaK(iplow,iphi,
00090 ipop,t_yield::Inst().elec_eject_frac(nelem,ion,ns,0),
00091 &photoHeat )*ionbal.lgPhotoIoniz_On;
00092
00093
00094
00095
00096
00097 ionbal.PhotoRate_Shell[nelem][ion][ns][1] = photoHeat.HeatLowEnr*ionbal.lgPhotoIoniz_On;
00098 ionbal.PhotoRate_Shell[nelem][ion][ns][2] = photoHeat.HeatHiEnr*ionbal.lgPhotoIoniz_On;
00099 }
00100 }
00101
00102
00103
00104
00105 ns = (Heavy.nsShells[nelem][ion]-1);
00106
00107 ionbal.PhotoRate_Shell[nelem][ion][ns][0] += ionbal.CompRecoilIonRate[nelem][ion];
00108
00109 ionbal.PhotoRate_Shell[nelem][ion][ns][2] += ionbal.CompRecoilHeatRate[nelem][ion];
00110 }
00111
00112
00113 if( lgPrintIt )
00114 {
00115
00116 ns = 5;
00117 ion = 1;
00118 GammaPrt(
00119 opac.ipElement[nelem][ion][ns][0],
00120 opac.ipElement[nelem][ion][ns][1],
00121 opac.ipElement[nelem][ion][ns][2],
00122 ioQQQ,
00123 ionbal.PhotoRate_Shell[nelem][ion][ns][0],
00124 0.05);
00125
00126
00127 for( ns=0; ns < Heavy.nsShells[nelem][0]; ns++ )
00128 {
00129 fprintf( ioQQQ, "\n %s", elementnames.chElementNameShort[nelem] );
00130 fprintf( ioQQQ, " %s" , Heavy.chShell[ns]);
00131
00132 for( ion=0; ion < dense.IonHigh[nelem]; ion++ )
00133 {
00134 if( Heavy.nsShells[nelem][ion] > ns )
00135 {
00136 fprintf( ioQQQ, " %8.1e", ionbal.PhotoRate_Shell[nelem][ion][ns][0] );
00137 }
00138 else
00139 {
00140 break;
00141 }
00142 }
00143 }
00144 fprintf(ioQQQ,"\n");
00145 }
00146 return;
00147 }