cloudy  trunk
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ion_cx.cpp
Go to the documentation of this file.
1 /* This file is part of Cloudy and is copyright (C)1978-2022 by Gary J. Ferland and
2  * others. For conditions of distribution and use see copyright notice in license.txt */
3 /*IonNelem ionization balance for elements without special cases */
4 #include "cddefines.h"
5 #include "ionbal.h"
6 #include "atmdat.h"
7 #include "iso.h"
8 #include "dense.h"
9 
11 void ion_CX( long nelem )
12 {
13  DEBUG_ENTRY( "ion_CX()" );
14 
15  ASSERT( nelem < LIMELM);
16  ASSERT( nelem > 1 );
17 
18  long limit = MIN2(nelem-NISO,dense.IonHigh[nelem]-1);
19 
20  for( long ion=0; ion < dense.IonLow[nelem]; ion++ )
21  ionbal.CX_recomb_rate_used[nelem][ion] = 0;
22 
23  // array goes up to [nelem+1] since no ion stage above bare nucleus
24  for( long ion=limit+1; ion <= nelem; ion++ )
25  ionbal.CX_recomb_rate_used[nelem][ion] = 0;
26 
27  for( long ion=dense.IonLow[nelem]; ion <= limit; ion++ )
28  {
29  /* number of bound electrons of the ion after recombination,
30  * for an atom (ion=0) this is equal to nelem+1,
31  * the element on the physical scale, since nelem is
32  * on the C scale, being 5 for carbon */
33 
34  ionbal.CX_recomb_rate_used[nelem][ion] = 0.0;
35  for (long nelem1=0; nelem1<t_atmdat::NCX; ++nelem1)
36  {
37  long ipISO=nelem1;
38  ionbal.CX_recomb_rate_used[nelem][ion] +=
39  /* nelem1^0 + ion charge transfer recombination */
40  atmdat.CharExcRecTo[nelem1][nelem][ion]*
41  /* following is density [cm-3] of nelem1^0 */
42  iso_sp[ipISO][nelem1].st[0].Pop();
43  }
44  }
45 
46  return;
47 }
t_atmdat atmdat
Definition: atmdat.cpp:6
qList st
Definition: iso.h:482
const int NISO
Definition: cddefines.h:311
long int IonHigh[LIMELM+1]
Definition: dense.h:130
#define MIN2(a, b)
Definition: cddefines.h:803
t_dense dense
Definition: global.cpp:15
t_iso_sp iso_sp[NISO][LIMELM]
Definition: iso.cpp:11
t_ionbal ionbal
Definition: ionbal.cpp:8
long int IonLow[LIMELM+1]
Definition: dense.h:129
void ion_CX(long nelem)
Definition: ion_cx.cpp:11
#define ASSERT(exp)
Definition: cddefines.h:613
double ** CX_recomb_rate_used
Definition: ionbal.h:200
const int LIMELM
Definition: cddefines.h:308
#define DEBUG_ENTRY(funcname)
Definition: cddefines.h:723
double CharExcRecTo[NCX][LIMELM][LIMELM+1]
Definition: atmdat.h:300