00001 /* This file is part of Cloudy and is copyright (C)1978-2013 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 //Get the rate coefficients using either Dima or Hybrid 00045 DimaRate = t_ADfA::Inst().coll_ion_wrapper( nelem, ion , phycon.te ); 00046 00047 crate = DimaRate*dense.EdenHCorr; 00048 00049 /* total collisional ionization rate 00050 * with only thermal suprathermal electrons */ 00051 ionbal.CollIonRate_Ground[nelem][ion][0] = crate; 00052 00053 /* cooling due to collisional ionization, which only includes thermal */ 00054 ionbal.CollIonRate_Ground[nelem][ion][1] = (crate* 00055 rfield.anu[Heavy.ipHeavy[nelem][ion]-1]* EN1RYD); 00056 } 00057 00058 for( ion=dense.IonHigh[nelem]; ion <= nelem; ion++ ) 00059 { 00060 ionbal.CollIonRate_Ground[nelem][ion][0] = 0.; 00061 ionbal.CollIonRate_Ground[nelem][ion][1] = 0.; 00062 } 00063 00064 /* check not rates are negative - in release mode this loop will optimize out */ 00065 for( ion=0; ion <= nelem; ion++ ) 00066 { 00067 /* there can be no negative rates */ 00068 ASSERT( ionbal.CollIonRate_Ground[nelem][ion][0] >= 0. ); 00069 } 00070 return; 00071 }