snow.py
Go to the documentation of this file.
1 from atomicdata import *
2 from util import *
3 
4 # Snow is just water, but to make it easy to print out its Z/A, etc.
5 # in a consistent way, go through the mechanism of generating it.
6 
7 # *Is* snow just water? Yes, typically at the 99.99%+ level:
8 # https://link.springer.com/referenceworkentry/10.1007/978-90-481-2642-2_59
9 
10 compositions = {
11  'water': { 'H' : 2, 'O': 1 },
12 }
13 
14 fractions = {
15  'water': 1,
16 }
17 
18 
19 def tot_weight(compos):
20  weight = 0
21  for element, number in compos.items():
22  weight += number * atomic_weight[element]
23  return weight
24 
26  tions = 0
27  for material, fraction in fractions.items():
28  tions += fraction
29  return tions
30 
31 def elem_frac(compos, elem):
32  if elem in compos:
33  return compos[elem] * atomic_weight[elem] / tot_weight(compos)
34  else:
35  return 0
36 
37 def elem_frac_total(elem):
38  frac = 0
39  for material, compos in compositions.items():
40  frac += elem_frac(compos, elem) * fractions[material]
41  return frac / tot_fractions()
42 
44  return make_composition("snow", fractions, compositions)
def snow_composition()
Definition: snow.py:43
def elem_frac(compos, elem)
Definition: snow.py:31
def elem_frac_total(elem)
Definition: snow.py:37
def tot_weight(compos)
Definition: snow.py:19
def tot_fractions()
Definition: snow.py:25
def make_composition(name, fractions, compositions)
Definition: util.py:46