00001 /* This file is part of Cloudy and is copyright (C)1978-2010 by Gary J. Ferland and 00002 * others. For conditions of distribution and use see copyright notice in license.txt */ 00003 /*ion_collis fill in collisional ionization rates, and resulting cooling */ 00004 #include "cddefines.h" 00005 #include "physconst.h" 00006 #include "phycon.h" 00007 #include "rfield.h" 00008 #include "heavy.h" 00009 #include "dense.h" 00010 #include "atmdat.h" 00011 #include "ionbal.h" 00012 00013 void ion_collis( 00014 /* element number on c scale, H is 0 */ 00015 long int nelem ) 00016 { 00017 long int ion, 00018 limit; 00019 double DimaRate, crate; 00020 00021 DEBUG_ENTRY( "ion_collis()" ); 00022 00023 /* compute collisional ionization rate */ 00024 00025 /* CollidRate[nelem][ion][0] is collisional ionization rate, s-1 00026 * CollidRate[nelem][ion][1] is collisional ionization cooling, erg/s 00027 */ 00028 00029 /* zero out rates below lowest ionization stage we will consider */ 00030 for( ion=0; ion < (dense.IonLow[nelem] - 1); ion++ ) 00031 { 00032 ionbal.CollIonRate_Ground[nelem][ion][0] = 0.; 00033 ionbal.CollIonRate_Ground[nelem][ion][1] = 0.; 00034 } 00035 00036 /* chng logic changed to be precisely same as ion_solver */ 00037 /* >>chng 02 nov 08, change 2 to NISO */ 00038 /*limit = MIN2(nelem-2,dense.IonHigh[nelem]-1);*/ 00039 limit = MIN2(nelem-NISO,dense.IonHigh[nelem]-1); 00040 ASSERT( limit < LIMELM ); 00041 00042 for( ion=dense.IonLow[nelem]; ion <= limit; ion++ ) 00043 { 00044 /* 00045 * collisional ionization by thermal electrons 00046 * >>chng 97 mar 19, to Dima's new routine using 00047 * >>refer all coll_ion Voronov G.S., 1997, At. Data Nucl. Data Tables 65, 1 00048 */ 00049 DimaRate = t_ADfA::Inst().coll_ion( nelem+1, nelem+1-ion , phycon.te ); 00050 00051 crate = DimaRate*dense.EdenHCorr; 00052 00053 /* total collisional ionization rate 00054 * with only thermal suprathermal electrons */ 00055 ionbal.CollIonRate_Ground[nelem][ion][0] = crate; 00056 00057 /* cooling due to collisional ionization, which only includes thermal */ 00058 ionbal.CollIonRate_Ground[nelem][ion][1] = (crate* 00059 rfield.anu[Heavy.ipHeavy[nelem][ion]-1]* EN1RYD); 00060 } 00061 00062 for( ion=dense.IonHigh[nelem]; ion <= nelem; ion++ ) 00063 { 00064 ionbal.CollIonRate_Ground[nelem][ion][0] = 0.; 00065 ionbal.CollIonRate_Ground[nelem][ion][1] = 0.; 00066 } 00067 00068 /* check not rates are negative - in release mode this loop will optimize out */ 00069 for( ion=0; ion <= nelem; ion++ ) 00070 { 00071 /* there can be no negative rates */ 00072 ASSERT( ionbal.CollIonRate_Ground[nelem][ion][0] >= 0. ); 00073 } 00074 return; 00075 }