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 "save.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 DEBUG_ENTRY( "IonCarbo()" );
00036
00037 if( trace.lgTrace && trace.lgCarBug )
00038 {
00039 fprintf( ioQQQ, " IonCarbo called.\n" );
00040 }
00041
00042 if( !dense.lgElmtOn[ipCARBON] )
00043 {
00044 carb.p1909 = 0.;
00045 carb.p2326 = 0.;
00046 thermal.heating[ipCARBON][9] = 0.;
00047 return;
00048 }
00049
00050
00051 ion_zero(ipCARBON);
00052
00053 ion_photo(ipCARBON,false);
00054
00055
00056
00057 if(!co.lgUMISTrates)
00058 {
00059 int nelem=ipCARBON , ion=0 , ns=2;
00060 ionbal.PhotoRate_Shell[nelem][ion][ns][0] =
00061 (HMRATE((1e-10)*3.0,0,0)*(hmi.UV_Cont_rel2_Habing_TH85_face*
00062 exp(-(3.0*rfield.extin_mag_V_point))/1.66));
00063
00064 ionbal.PhotoRate_Shell[nelem][ion][ns][1] = 0.;
00065 ionbal.PhotoRate_Shell[nelem][ion][ns][2] = 0.;
00066
00067
00068
00069
00070
00071
00072 }
00073
00074
00075 ion_collis(ipCARBON);
00076
00077
00078
00079 ion_recomb(false,(const double*)dicoef,(const double*)dite,ditcrt,aa,bb,cc,dd,ff,ipCARBON);
00080
00081
00082
00083 carb.p1909 = ionbal.PhotoRate_Shell[ipCARBON][1][1][0];
00084
00085
00086 carb.p2326 = ionbal.PhotoRate_Shell[ipCARBON][0][1][0];
00087
00088
00089 bool lgDEBUG=false;
00090
00091
00092
00093
00094
00095 ion_solver(ipCARBON,lgDEBUG);
00096
00097
00098
00099 carb.p1909 *= dense.xIonDense[ipCARBON][1]*0.62;
00100 carb.p2326 *= dense.xIonDense[ipCARBON][0]*0.1;
00101
00102 if( trace.lgTrace )
00103 {
00104 fprintf( ioQQQ, " IonCarbo returns; fracs=" );
00105 for( int i=0; i < 7; i++ )
00106 {
00107 fprintf( ioQQQ, " %10.3e", dense.xIonDense[ipCARBON][i]/
00108 dense.gas_phase[ipCARBON] );
00109 }
00110 fprintf( ioQQQ, "\n" );
00111 }
00112
00113 enum {AGN=false};
00114
00115 if( AGN )
00116 {
00117 phycon.te=10.;
00118
00119 save.lgioRecom = true;
00120
00121 save.ioRecom = ioQQQ;
00122 while( phycon.te<1e7 )
00123 {
00124
00125
00126 ion_recomb(false,(double*)dicoef,(double*)dite,ditcrt,aa,bb,cc,
00127 dd,ff,ipCARBON);
00128
00129 TempChange(phycon.te *2.f , true);
00130 }
00131
00132 cdEXIT(EXIT_SUCCESS);
00133 }
00134 return;
00135 }