EGSnrc C++ class library
Report PIRS-898 (2021)
Iwan Kawrakow, Ernesto Mainegra-Hing, Frederic Tessier, Reid Townson and Blake Walters
egs++
estar
estar_formulaCalcs.h
1
/*
2
###############################################################################
3
#
4
# EGSnrc estar
5
# Copyright (C) 2026 National Research Council Canada
6
#
7
# This file is part of EGSnrc.
8
#
9
# EGSnrc is free software: you can redistribute it and/or modify it under
10
# the terms of the GNU Affero General Public License as published by the
11
# Free Software Foundation, either version 3 of the License, or (at your
12
# option) any later version.
13
#
14
# EGSnrc is distributed in the hope that it will be useful, but WITHOUT ANY
15
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16
# FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
17
# more details.
18
#
19
# You should have received a copy of the GNU Affero General Public License
20
# along with EGSnrc. If not, see <http://www.gnu.org/licenses/>.
21
#
22
###############################################################################
23
#
24
# Author: Sehmimul Hoque, 2022
25
#
26
# Contributors: Martin J. Berger
27
# Johnathan S. Coursey
28
# Reid Townson
29
# Ernesto Mainegra-Hing
30
#
31
# Based on the original ESTAR code by Martin J. Berger,
32
# National Institute of Standards and Technology (NIST). Including
33
# modifications by Johnathan S. Coursey.
34
#
35
###############################################################################
36
*/
37
38
#pragma once
39
40
#include <string>
41
42
using namespace
std;
43
44
/*
45
Here we define a structure that will be useful to store the information of a
46
substance (element/compound or molecule)
47
The information stored are:
48
49
* 1. jz[]: this is an array containing the atomic numbers of each of the elements
50
present in the mixture. The elements can be present in the mixture as part of
51
a compound or just as an element.
52
There are 100 elements in our table of elements.
53
* 2. wt[]: this is an array containing the weight of each of the elements
54
present in the mixture. The elements can be present in the mixture as part of
55
a compound or just as an element. This means for the element with atomic
56
number jz[i], the weight in the mixture/compound/element is wt[i]
57
* 3. zav: This is the Z/A as used in equation 4 (Sternheimer 1984)
58
* 4. pot: This is the I-value (mean ionization energy in eV) of the substance
59
* 5. mmax: The number of different elements present in the substance
60
* For example, if a mixture is made with NaCl and H2O, mmax will be 4
61
*
62
*/
63
struct
formula_calc
{
64
double
wt[100];
65
int
jz[100];
66
double
zav;
67
double
pot;
68
int
mmax;
69
};
70
71
formula_calc
getDataFromFormulae(
int
knmat,
double
rho,
string
*elementArray,
double
*massFraction,
float
*numOfAtoms,
int
NEP,
int
mediaNum);
72
73
/*
74
This module provides functions for computing formula_calc objects
75
for a single chemical formula (e.g. Na, Cl, NaCl2, H2O).
76
For mixtures, refer to mixformula.cpp.
77
*/
78
84
int
atom_num(std::string elem_name);
85
96
formula_calc
fcalc(
int
knmat,
double
rho, std::string elemName);
97
98
/*
99
This module provides functions for computing formula_calc objects
100
for a single chemical formula (e.g. Na, Cl, NaCl2, H2O).
101
For mixtures, refer to mixformula.cpp.
102
*/
103
104
int
const
max_comp = 100;
105
106
// this struct stores the data present in a mixture
107
struct
mixtureData
{
108
int
ncomp;
// number of COMPONENTS in mixture
109
// * example: if a mixture is made with NaCl and H2O, ncomp will be 2
110
string
frm[max_comp];
// array containing each formula
111
// * example: if a mixture is made with NaCl and H2O, frm[] will be ["NaCl", "H2O"]
112
double
frac[max_comp];
// array containing fraction by weight of each subsatance used in mixture
113
// * example: if a mixture is made with 0.8 NaCl and 0.2 H2O, frac[] will be [0.8, 0.2]
114
// NOTE: weights do not need to be normalized as program automatically normalizes weights
115
};
116
117
mixtureData
getData();
118
119
mixtureData
getEgsMediaData(
string
*elementArray,
double
*massFraction,
int
NEP);
120
121
formula_calc
mixtureCalculation(
double
rho,
string
*elementArray,
double
*massFraction,
int
NEP);
formula_calc
Definition:
estar_formulaCalcs.h:63
mixtureData
Definition:
estar_formulaCalcs.h:107
Generated by
1.9.1