cloudy
trunk
source
ion_collis.cpp
Go to the documentation of this file.
1
/* This file is part of Cloudy and is copyright (C)1978-2013 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
13
void
ion_collis
(
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
//Get the rate coefficients using either Dima or Hybrid
45
DimaRate =
t_ADfA::Inst
().
coll_ion_wrapper
( nelem, ion ,
phycon
.
te
);
46
47
crate = DimaRate*
dense
.
EdenHCorr
;
48
49
/* total collisional ionization rate
50
* with only thermal suprathermal electrons */
51
ionbal
.
CollIonRate_Ground
[nelem][ion][0] = crate;
52
53
/* cooling due to collisional ionization, which only includes thermal */
54
ionbal
.
CollIonRate_Ground
[nelem][ion][1] = (crate*
55
rfield
.
anu
[
Heavy
.
ipHeavy
[nelem][ion]-1]*
EN1RYD
);
56
}
57
58
for
( ion=
dense
.
IonHigh
[nelem]; ion <= nelem; ion++ )
59
{
60
ionbal
.
CollIonRate_Ground
[nelem][ion][0] = 0.;
61
ionbal
.
CollIonRate_Ground
[nelem][ion][1] = 0.;
62
}
63
64
/* check not rates are negative - in release mode this loop will optimize out */
65
for
( ion=0; ion <= nelem; ion++ )
66
{
67
/* there can be no negative rates */
68
ASSERT
(
ionbal
.
CollIonRate_Ground
[nelem][ion][0] >= 0. );
69
}
70
return
;
71
}
t_dense::EdenHCorr
double EdenHCorr
Definition:
dense.h:216
dense
t_dense dense
Definition:
dense.cpp:24
Singleton< t_ADfA >::Inst
static t_ADfA & Inst()
Definition:
cddefines.h:175
rfield
t_rfield rfield
Definition:
rfield.cpp:8
rfield.h
phycon
t_phycon phycon
Definition:
phycon.cpp:6
Heavy
t_Heavy Heavy
Definition:
heavy.cpp:5
ASSERT
#define ASSERT(exp)
Definition:
cddefines.h:578
atmdat.h
MIN2
#define MIN2
Definition:
cddefines.h:761
dense.h
cddefines.h
ion_collis
void ion_collis(long int nelem)
Definition:
ion_collis.cpp:13
heavy.h
ionbal
t_ionbal ionbal
Definition:
ionbal.cpp:5
LIMELM
const int LIMELM
Definition:
cddefines.h:258
t_dense::IonLow
long int IonLow[LIMELM+1]
Definition:
dense.h:119
t_dense::IonHigh
long int IonHigh[LIMELM+1]
Definition:
dense.h:120
t_rfield::anu
double * anu
Definition:
rfield.h:58
ionbal.h
physconst.h
t_ADfA::coll_ion_wrapper
double coll_ion_wrapper(long int z, long int n, double t)
Definition:
atmdat_adfa.cpp:814
t_ionbal::CollIonRate_Ground
double *** CollIonRate_Ground
Definition:
ionbal.h:120
phycon.h
t_phycon::te
double te
Definition:
phycon.h:11
NISO
const int NISO
Definition:
cddefines.h:261
t_Heavy::ipHeavy
long int ipHeavy[LIMELM][LIMELM]
Definition:
heavy.h:11
EN1RYD
const UNUSED double EN1RYD
Definition:
physconst.h:179
DEBUG_ENTRY
#define DEBUG_ENTRY(funcname)
Definition:
cddefines.h:684
Generated by
1.8.17