00001
00002
00003
00004 #include "cddefines.h"
00005 #include "thermal.h"
00006 #include "carb.h"
00007 #include "trace.h"
00008 #include "dense.h"
00009 #include "phycon.h"
00010 #include "hmi.h"
00011 #include "mole.h"
00012 #include "rfield.h"
00013 #include "punch.h"
00014 #include "ionbal.h"
00015
00016 void IonCarbo(void)
00017 {
00018 const int NDIM = ipCARBON+1;
00019
00020 static const double dicoef[2][NDIM] = {
00021 {2.54e-3,6.15e-3,1.62e-3,4.78e-2,3.22e-2,0.}, {4.42e-2,5.88e-2,0.343,0.362,0.315,0.}
00022 };
00023 static const double dite[2][NDIM] = {
00024 {1.57e5,1.41e5,8.19e4,3.44e6,4.06e6,0.}, {3.74e5,1.41e5,1.59e5,5.87e5,8.31e5,0.}
00025 };
00026 static const double ditcrt[NDIM] = {1.2e4,1.2e4,1.1e4,4.4e5,7.0e5,1e20};
00027
00028 static const double aa[NDIM] = {.0108,1.8267,2.3196,0.,0.,0.};
00029 static const double bb[NDIM] = {-0.1075,4.1012,10.7328,0.,0.,0.};
00030 static const double cc[NDIM] = {.2810,4.8443,6.8830,0.,0.,0.};
00031 static const double dd[NDIM] = {-0.0193,.2261,-0.1824,0.,0.,0.};
00032
00033 static const double ff[NDIM] = {0.000,0.5960,0.4101,0.1,0.1,0.};
00034
00035 double save_rec;
00036
00037 DEBUG_ENTRY( "IonCarbo()" );
00038
00039 if( trace.lgTrace && trace.lgCarBug )
00040 {
00041 fprintf( ioQQQ, " IonCarbo called.\n" );
00042 }
00043
00044 if( !dense.lgElmtOn[ipCARBON] )
00045 {
00046 carb.p1909 = 0.;
00047 carb.p2326 = 0.;
00048 thermal.heating[ipCARBON][9] = 0.;
00049
00050 DEBUG_EXIT( "IonCarbo()" );
00051 return;
00052 }
00053
00054
00055 ion_zero(ipCARBON);
00056
00057 ion_photo(ipCARBON,false);
00058
00059
00060
00061 if(!co.lgUMISTrates)
00062 {
00063 int nelem=ipCARBON , ion=0 , ns=2;
00064 ionbal.PhotoRate_Shell[nelem][ion][ns][0] =
00065 (HMRATE((1e-10)*3.0,0,0)*(hmi.UV_Cont_rel2_Habing_TH85_face*
00066 exp(-(3.0*rfield.extin_mag_V_point))/1.66));
00067
00068 ionbal.PhotoRate_Shell[nelem][ion][ns][1] = 0.;
00069 ionbal.PhotoRate_Shell[nelem][ion][ns][2] = 0.;
00070
00071
00072
00073
00074
00075
00076 }
00077
00078
00079 ion_collis(ipCARBON);
00080
00081
00082
00083
00084 ion_recomb(false,(const double*)dicoef,(const double*)dite,ditcrt,aa,bb,cc,dd,ff,ipCARBON);
00085
00086
00087
00088 carb.p1909 = ionbal.PhotoRate_Shell[ipCARBON][1][1][0];
00089
00090
00091 carb.p2326 = ionbal.PhotoRate_Shell[ipCARBON][0][1][0];
00092
00093
00094
00095
00096
00097 save_rec = ionbal.RateRecomTot[ipCARBON][0];
00098
00099 bool lgDEBUG=false;
00100
00101
00102
00103
00104
00105 ion_solver(ipCARBON,lgDEBUG);
00106
00107
00108 if( save_rec > 0. )
00109 ionbal.RateRecomTot[ipCARBON][0] = save_rec;
00110
00111
00112
00113 carb.p1909 *= dense.xIonDense[ipCARBON][1]*0.62;
00114 carb.p2326 *= dense.xIonDense[ipCARBON][0]*0.1;
00115
00116 if( trace.lgTrace )
00117 {
00118 fprintf( ioQQQ, " IonCarbo returns; fracs=" );
00119 for( int i=0; i < 7; i++ )
00120 {
00121 fprintf( ioQQQ, " %10.3e", dense.xIonDense[ipCARBON][i]/
00122 dense.gas_phase[ipCARBON] );
00123 }
00124 fprintf( ioQQQ, "\n" );
00125 }
00126
00127
00128
00129
00130 enum {AGN=false};
00131
00132
00133 if( AGN )
00134 {
00135 phycon.te=10.;
00136
00137 punch.lgioRecom = true;
00138
00139 punch.ioRecom = ioQQQ;
00140 while( phycon.te<1e7 )
00141 {
00142
00143
00144 ion_recomb(false,(double*)dicoef,(double*)dite,ditcrt,aa,bb,cc,
00145 dd,ff,ipCARBON);
00146
00147 phycon.te = phycon.te *2.f;
00148 tfidle(true);
00149 }
00150
00151 cdEXIT(EXIT_SUCCESS);
00152 }
00153
00154 DEBUG_EXIT( "IonCarbo()" );
00155 return;
00156
00157 }