soil.py
Go to the documentation of this file.
1 from atomicdata import *
2 from util import *
3 
4 compositions = {
5  # Very rough, not specific to Ash River site
6  'sand_silica': { 'Si' : 1, 'O': 2 },
7  'silt_silica': { 'Al' : 2, 'O': 3 },
8  'silt1': { 'K': 1, 'Al': 1, 'Si': 3, 'O': 8 },
9  'silt2': { 'Na': 1, 'Al': 1, 'Si': 3, 'O': 8 },
10  'silt3': { 'Ca': 1, 'Al': 2, 'Si': 2, 'O': 8 },
11  'clay': { 'Al': 2, 'Si': 2, 'O': 9, 'H': 4 },
12 
13  'water': { 'H' : 2, 'O': 1 },
14 }
15 
16 matrix_density = 2.7 # Typical from Wikipedia
17 water_density = 1.00
18 
19 # Rough mean from Wikipedia table
20 void_volume_fraction = 0.40
21 
22 rock_volume_fraction = 1 - void_volume_fraction
23 
24 # Lower parts saturated, upper parts not. Then there's snow on top
25 # for half the year. Reasonable guesses lead to full saturation
26 # being a sensible approximation for the soil plus snow cover (the
27 # snow geometry is wrong, of course, but at least particles that would
28 # traverse both snow and soil will be treated better like this).
29 water_volume_fraction = void_volume_fraction
30 
31 air_volume_fraction = void_volume_fraction - water_volume_fraction
32 
33 water_mass_fraction = water_volume_fraction * water_density /(
34 water_volume_fraction*water_density + rock_volume_fraction*matrix_density)
35 
36 # Mass of air in the voids is neglected
37 rock_mass_fraction = 1 - water_mass_fraction
38 
39 density = (matrix_density * rock_volume_fraction
40  + water_density * water_volume_fraction)
41 
42 print('<D value="{0:.2f}" unit="g/cm3"/>'.format(density))
43 
44 clay_fraction = 1/3.
45 sand_fraction = 1/3.
46 silt_fraction = 1/3.
47 
48 fractions = {
49  'water': water_mass_fraction,
50 
51  'sand_silica': sand_fraction * rock_mass_fraction,
52 
53  'silt_silica': 0.5 * silt_fraction * rock_mass_fraction,
54  'silt1': 0.5/3 * silt_fraction * rock_mass_fraction,
55  'silt2': 0.5/3 * silt_fraction * rock_mass_fraction,
56  'silt3': 0.5/3 * silt_fraction * rock_mass_fraction,
57 
58  'clay': clay_fraction * rock_mass_fraction,
59 }
60 
61 
62 def tot_weight(compos):
63  weight = 0
64  for element, number in compos.items():
65  weight += number * atomic_weight[element]
66  return weight
67 
69  tions = 0
70  for material, fraction in fractions.items():
71  tions += fraction
72  return tions
73 
74 def elem_frac(compos, elem):
75  if elem in compos:
76  return compos[elem] * atomic_weight[elem] / tot_weight(compos)
77  else:
78  return 0
79 
80 def elem_frac_total(elem):
81  frac = 0
82  for material, compos in compositions.items():
83  frac += elem_frac(compos, elem) * fractions[material]
84  return frac / tot_fractions()
85 
87  return make_composition("soil", fractions, compositions)
def tot_fractions()
Definition: soil.py:68
def elem_frac(compos, elem)
Definition: soil.py:74
def tot_weight(compos)
Definition: soil.py:62
bool print
def elem_frac_total(elem)
Definition: soil.py:80
std::string format(const int32_t &value, const int &ndigits=8)
Definition: HexUtils.cpp:14
def soil_composition()
Definition: soil.py:86
def make_composition(name, fractions, compositions)
Definition: util.py:46