cloudy  trunk
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
deuterium.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 #include "cddefines.h"
4 #include "deuterium.h"
5 #include "mole.h"
6 
8 
10 {
11  xIonDense[0] = 0.;
12  xIonDense[1] = 0.;
13  m_xMolecules = 0.;
14 }
15 
17 {
19 }
20 
21 void ScaleDensitiesDeuterium( const realnum &factor )
22 {
23  deut.gas_phase *= factor;
24  deut.xIonDense[0] *= factor;
25  deut.xIonDense[1] *= factor;
26  return;
27 }
28 
30 {
31  deut.zero();
32  deut.xIonDense[0] = deut.gas_phase;
33  deut.xIonDense[1] = 0.;
34  return;
35 }
36 
37 void SetDeuteriumIonization( const double &xNeutral, const double &xIonized )
38 {
39  if( !deut.lgElmtOn )
40  return;
41 
42  realnum total = deut.gas_phase - deut.xMolecules();
43 
44  double neut = total * xNeutral/( xNeutral + xIonized );
45  double ionz = total * xIonized/( xNeutral + xIonized );
46 
47  deut.xIonDense[0] = neut;
48  deut.xIonDense[1] = ionz;
49 
50  //if( iteration >= 3 )
51  // fprintf( ioQQQ, "DEBUGGG SetDeuteriumIonization %li\t%.12e\t%.12e\t%.12e\t%.12e\t%.12e\n",
52  // nzone, deut.gas_phase, deut.xMolecules(), total, deut.xIonDense[0], deut.xIonDense[1] );
53 
54  return;
55 }
56 
58 {
59  if( !deut.lgElmtOn )
60  return;
61  deut.fractionation = frac;
62  return;
63 }
64 
65 void SetGasPhaseDeuterium( const realnum &Hdensity )
66 {
67  if( !deut.lgElmtOn )
68  return;
69  deut.gas_phase = Hdensity * deut.fractionation;
70 }
71 
bool lgElmtOn
Definition: deuterium.h:21
void total_molecule_deut(realnum &total)
void InitDeuteriumIonization()
Definition: deuterium.cpp:29
realnum m_xMolecules
Definition: deuterium.h:28
float realnum
Definition: cddefines.h:124
void SetDeuteriumFractionation(const realnum &frac)
Definition: deuterium.cpp:57
void SetGasPhaseDeuterium(const realnum &Hdensity)
Definition: deuterium.cpp:65
realnum gas_phase
Definition: deuterium.h:22
double xIonDense[2]
Definition: deuterium.h:23
void ScaleDensitiesDeuterium(const realnum &factor)
Definition: deuterium.cpp:21
void SetDeuteriumIonization(const double &xNeutral, const double &xIonized)
Definition: deuterium.cpp:37
realnum fractionation
Definition: deuterium.h:24
t_deuterium deut
Definition: deuterium.cpp:7
realnum xMolecules(void)
Definition: deuterium.h:30
double frac(double d)
void updateXMolecules()
Definition: deuterium.cpp:16
void zero()
Definition: deuterium.cpp:9