cloudy  trunk
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
collision.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 
4 #include "cddefines.h"
5 #include "collision.h"
6 
7 #include "dense.h"
8 #include "h2.h"
9 #include "hmi.h"
10 
12 {
13  DEBUG_ENTRY( "ColliderList::ColliderList()" );
14 
15  realnum e_amu = ELECTRON_MASS*AVOGADRO;
16  // weight of 1 eV of binding energy in amu
17  realnum eV_amu = EN1EV*AVOGADRO/pow2(SPEEDLIGHT);
18 
19  list.resize( ipNCOLLIDER );
20  list[ipELECTRON].charge = -1;
21  list[ipELECTRON].mass_amu = e_amu;
22 
23  // the masses derived below are for a standard mixture of isotopes, not for p or alpha!
24  list[ipPROTON].charge = 1;
25  list[ipPROTON].mass_amu = d.AtomicWeight[ipHYDROGEN] - e_amu + 13.6f*eV_amu;
26 
27  list[ipHE_PLUS].charge = 1;
28  list[ipHE_PLUS].mass_amu = d.AtomicWeight[ipHELIUM] - e_amu + 24.6f*eV_amu;
29 
30  list[ipALPHA].charge = 2;
31  list[ipALPHA].mass_amu = d.AtomicWeight[ipHELIUM] - 2.f*e_amu + 79.0f*eV_amu;
32 
33  list[ipATOM_H].charge = 0;
34  list[ipATOM_H].mass_amu = d.AtomicWeight[ipHYDROGEN];
35 
36  list[ipATOM_HE].charge = 0;
37  list[ipATOM_HE].mass_amu = d.AtomicWeight[ipHELIUM];
38 
39  list[ipH2_ORTHO].charge = 0;
40  list[ipH2_ORTHO].mass_amu = 2.f*d.AtomicWeight[ipHYDROGEN] - 4.75f*eV_amu;
41 
42  list[ipH2_PARA].charge = 0;
43  list[ipH2_PARA].mass_amu = 2.f*d.AtomicWeight[ipHYDROGEN] - 4.75f*eV_amu;
44 
45  list[ipH2].charge = 0;
46  list[ipH2].mass_amu = 2.f*d.AtomicWeight[ipHYDROGEN] - 4.75f*eV_amu;
47 }
48 
50 {
51  DEBUG_ENTRY( "ColliderList::init()" );
52 
53  list[ipELECTRON].density = &(dense.EdenHCorr);
54  list[ipPROTON].density = &(dense.xIonDense[ipHYDROGEN][1]);
55  list[ipHE_PLUS].density = &(dense.xIonDense[ipHELIUM][1]);
56  list[ipALPHA].density = &(dense.xIonDense[ipHELIUM][2]);
57  list[ipATOM_H].density = &(dense.xIonDense[ipHYDROGEN][0]);
58  list[ipATOM_HE].density = &(dense.xIonDense[ipHELIUM][0]);
59  list[ipH2_ORTHO].density = &(h2.ortho_density);
60  list[ipH2_PARA].density = &(h2.para_density);
61  list[ipH2].density = &(hmi.H2_total);
62 }
63 
64 /*CollisionJunk set all elements of transition struc to dangerous values */
65 void CollisionJunk( const CollisionProxy & t )
66 {
67 
68  DEBUG_ENTRY( "CollisionJunk()" );
69 
70  /* Coll->cooling and Coll->heating due to collisional excitation */
71  t.cool() = -FLT_MAX;
72  t.heat() = -FLT_MAX;
73 
74  /* collision strengths for transition */
75  t.col_str() = -FLT_MAX;
76 
77  t.is_gbar() = -1;
78 
79  for( long i=0; i<ipNCOLLIDER; i++ )
80  t.rate_coef_ul_set()[i] = 0.f;
81 
82  t.rate_lu_nontherm_set() = 0.f;
83 
84  return;
85 }
86 
87 /*CollisionZero zeros out the structure */
88 void CollisionZero( const CollisionProxy & t )
89 {
90 
91  DEBUG_ENTRY( "CollisionZero()" );
92 
93  /* Coll->cooling and Coll->heating due to collisional excitation */
94  t.cool() = 0.;
95  t.heat() = 0.;
96 
97  return;
98 }
99 
double EdenHCorr
Definition: dense.h:227
ColliderList(const t_dense &d)
Definition: collision.cpp:11
void init()
Definition: collision.cpp:49
int & is_gbar() const
Definition: collision.h:197
Definition: dense.h:26
double * rate_coef_ul_set() const
Definition: collision.h:202
t_dense dense
Definition: global.cpp:15
double xIonDense[LIMELM][LIMELM+1]
Definition: dense.h:135
double ortho_density
Definition: h2_priv.h:326
double para_density
Definition: h2_priv.h:326
double & heat() const
Definition: collision.h:224
float realnum
Definition: cddefines.h:124
diatomics h2("h2", 4100.,&hmi.H2_total, Yan_H2_CS)
realnum AtomicWeight[LIMELM]
Definition: dense.h:80
vector< t_collider > list
Definition: collision.h:41
T pow2(T a)
Definition: cddefines.h:981
void CollisionJunk(const CollisionProxy &t)
Definition: collision.cpp:65
realnum & col_str() const
Definition: collision.h:191
#define DEBUG_ENTRY(funcname)
Definition: cddefines.h:723
double & cool() const
Definition: collision.h:220
const int ipHELIUM
Definition: cddefines.h:350
double H2_total
Definition: hmi.h:25
realnum & rate_lu_nontherm_set() const
Definition: collision.h:211
t_hmi hmi
Definition: hmi.cpp:5
void CollisionZero(const CollisionProxy &t)
Definition: collision.cpp:88
const int ipHYDROGEN
Definition: cddefines.h:349
Definition: collision.h:19