cloudy  trunk
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ion_collis.cpp
Go to the documentation of this file.
1 /* This file is part of Cloudy and is copyright (C)1978-2008 by Gary J. Ferland and
2  * others. For conditions of distribution and use see copyright notice in license.txt */
3 /*ion_collis fill in collisional ionization rates, and resulting cooling */
4 #include "cddefines.h"
5 #include "physconst.h"
6 #include "phycon.h"
7 #include "rfield.h"
8 #include "heavy.h"
9 #include "dense.h"
10 #include "atmdat.h"
11 #include "ionbal.h"
12 
14  /* element number on c scale, H is 0 */
15  long int nelem )
16 {
17  long int ion,
18  limit;
19  double DimaRate, crate;
20 
21  DEBUG_ENTRY( "ion_collis()" );
22 
23  /* compute collisional ionization rate */
24 
25  /* CollidRate[nelem][ion][0] is collisional ionization rate, s-1
26  * CollidRate[nelem][ion][1] is collisional ionization cooling, erg/s
27  */
28 
29  /* zero out rates below lowest ionization stage we will consider */
30  for( ion=0; ion < (dense.IonLow[nelem] - 1); ion++ )
31  {
32  ionbal.CollIonRate_Ground[nelem][ion][0] = 0.;
33  ionbal.CollIonRate_Ground[nelem][ion][1] = 0.;
34  }
35 
36  /* chng logic changed to be precisely same as ion_solver */
37  /* >>chng 02 nov 08, change 2 to NISO */
38  /*limit = MIN2(nelem-2,dense.IonHigh[nelem]-1);*/
39  limit = MIN2(nelem-NISO,dense.IonHigh[nelem]-1);
40  ASSERT( limit < LIMELM );
41 
42  for( ion=dense.IonLow[nelem]; ion <= limit; ion++ )
43  {
44  /*
45  * collisional ionization by thermal electrons
46  * >>chng 97 mar 19, to Dima's new routine using
47  * >>refer all coll_ion Voronov G.S., 1997, At. Data Nucl. Data Tables 65, 1
48  */
49  DimaRate = t_ADfA::Inst().coll_ion( nelem+1, nelem+1-ion , phycon.te );
50 
51  crate = DimaRate*dense.EdenHCorr;
52 
53  /* total collisional ionization rate
54  * with only thermal suprathermal electrons */
55  ionbal.CollIonRate_Ground[nelem][ion][0] = crate;
56 
57  /* cooling due to collisional ionization, which only includes thermal */
58  ionbal.CollIonRate_Ground[nelem][ion][1] = (crate*
59  rfield.anu[Heavy.ipHeavy[nelem][ion]-1]* EN1RYD);
60  }
61 
62  for( ion=dense.IonHigh[nelem]; ion <= nelem; ion++ )
63  {
64  ionbal.CollIonRate_Ground[nelem][ion][0] = 0.;
65  ionbal.CollIonRate_Ground[nelem][ion][1] = 0.;
66  }
67 
68  /* check not rates are negative - in release mode this loop will optimize out */
69  for( ion=0; ion <= nelem; ion++ )
70  {
71  /* there can be no negative rates */
72  ASSERT( ionbal.CollIonRate_Ground[nelem][ion][0] >= 0. );
73  }
74  return;
75 }

Generated for cloudy by doxygen 1.8.3.1