00001 
00002 
00003 
00004 #include "cddefines.h"
00005 #include "dense.h"
00006 #include "thermal.h"
00007 #include "atoms.h"
00008 #include "opacity.h"
00009 #include "trace.h"
00010 #include "conv.h"
00011 #include "gammas.h"
00012 #include "ionbal.h"
00013 
00014 void IonNitro(void)
00015 {
00016         const int NDIM = ipNITROGEN+1;
00017 
00018         static const double dicoef[2][NDIM] = {
00019                 {2.98e-3,7.41e-3,1.13e-2,2.62e-3,7.5e-2,4.61e-2,0.},
00020                 {0.,.0764,.164,.243,.35,.309,0.}
00021         };
00022         static const double dite[2][NDIM] = {
00023                 {2.2e5,2.01e5,1.72e5,1.02e5,4.75e6,5.44e6,0.},
00024                 {0.,7.37e4,2.25e5,1.25e5,8.35e5,1.14e6,0.}
00025         };
00026         static const double ditcrt[NDIM] = {1.8e4,1.8e4,2.4e4,1.5e4,6.8e5,1.0e6,1e20};
00027         static const double aa[NDIM] = {0.0,0.0320,-0.8806,0.4134,0.,0.,0.};
00028         static const double bb[NDIM] = {0.6310,-0.6624,11.2406,-4.6319,0.,0.,0.};
00029         static const double cc[NDIM] = {0.1990,4.3191,30.7066,25.9172,0.,0.,0.};
00030         static const double dd[NDIM] = {-0.0197,0.0003,-1.1721,-2.2290,0.,0.,0.};
00031         static const double ff[NDIM] = {0.4398,0.5946,0.6127,0.2360,0.1,0.,0.};
00032 
00033         bool lgDebug;
00034         double save_rec;
00035 
00036         DEBUG_ENTRY( "IonNitro()" );
00037 
00038         
00039         if( !dense.lgElmtOn[ipNITROGEN] )
00040         {
00041                 return;
00042         }
00043 
00044         ion_zero(ipNITROGEN);
00045 
00046         ion_photo(ipNITROGEN,false);
00047 
00048         
00049         ion_collis(ipNITROGEN);
00050 
00051         
00052         
00053         ion_recomb(false,(const double*)dicoef,(const double*)dite,ditcrt,aa,bb,cc,dd,ff,ipNITROGEN);
00054         
00055 
00056         
00057 
00058 
00059 
00060         save_rec = ionbal.RateRecomTot[ipNITROGEN][0];
00061         
00062 
00063 
00064         
00065 #       if 0
00066         if( dense.IonLow[ipNITROGEN]==0 && 
00067                 co.hevmol[ipNP] > SMALLFLOAT && 
00068                 ionbal.RateIonizTot[ipNITROGEN][0]*co.hevmol[ipATN]> 0. )
00069         {
00070                 ionbal.RateRecomTot[ipNITROGEN][0] = 
00071                         ionbal.RateIonizTot[ipNITROGEN][0]*
00072                         co.hevmol[ipATN]/co.hevmol[ipNP];
00073         }
00074 #       endif
00075 
00076         
00077         if( dense.xIonDense[ipNITROGEN][0] > 0. )
00078         {
00079                 atoms.d5200r = (realnum)GammaK(opac.in1[0],opac.in1[1],opac.in1[2],1.);
00080                 
00081                 
00082                 
00083                 
00084                 
00085                 
00086                 if( !conv.nTotalIoniz ) 
00087                         atoms.p2nit = 0.;
00088                 
00089                 ionbal.PhotoRate_Shell[ipNITROGEN][0][2][0] = ionbal.PhotoRate_Shell[ipNITROGEN][0][2][0]*
00090                   (1. - atoms.p2nit) + atoms.p2nit*atoms.d5200r;
00091                 ionbal.PhotoRate_Shell[ipNITROGEN][0][2][1] = ionbal.PhotoRate_Shell[ipNITROGEN][0][2][1]*
00092                   (1. - atoms.p2nit) + thermal.HeatNet*atoms.p2nit;
00093         }
00094         else
00095         {
00096                 atoms.p2nit = 0.;
00097                 atoms.d5200r = 0.;
00098         }
00099 
00100         
00101 #       if 0
00102         broken();
00103         if(nzone == 1 )
00104                 lgDebug = true;
00105         else
00106                 lgDebug = false;
00107 #       endif
00108         lgDebug = false;
00109         ion_solver(ipNITROGEN,lgDebug);
00110 
00111         
00112         if( save_rec > 0.)
00113                 ionbal.RateRecomTot[ipNITROGEN][0] = save_rec;
00114 
00115         if( trace.lgTrace && trace.lgHeavyBug )
00116         {
00117                 fprintf( ioQQQ, "     IonNitro retun; frac=" );
00118                 for( int i=0; i < 8; i++ )
00119                 {
00120                         fprintf( ioQQQ, "%10.3e", dense.xIonDense[ipNITROGEN][i]/
00121                           dense.gas_phase[ipNITROGEN] );
00122                 }
00123                 fprintf( ioQQQ, "\n" );
00124         }
00125         return;
00126 }