-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmaterials.py
35 lines (32 loc) · 1.22 KB
/
materials.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import os
import numpy as np
from main import NGROUP
def import_xs(ngroup):
"""Create a MATERIALS dictionary using files output by an OpenMC script
Parameters
----------
ngroup : int
Number of energy groups
Returns
-------
MATERIALS : dict
dictionary containing the cross section information for materials in the
problem
"""
mimosa_dir = os.path.dirname(os.path.realpath(__file__))
folder = mimosa_dir+'/make_xs/xs_'+str(ngroup)+'group/'
fuel_file = '_cell_1'
mod_file = '_cell_0'
MATERIALS = {'fuel': {'total': np.loadtxt(folder+'total'+fuel_file),
'nufission': np.loadtxt(folder+'nufission'+fuel_file),
'scatter': np.loadtxt(folder+'scatter'+fuel_file),
'chi': np.loadtxt(folder+'chi'+fuel_file)
},
'mod': {'total': np.loadtxt(folder+'total'+mod_file),
'nufission': np.loadtxt(folder+'nufission'+mod_file),
'scatter': np.loadtxt(folder+'scatter'+mod_file),
'chi': np.loadtxt(folder+'chi'+mod_file)
}
}
return MATERIALS
MATERIALS = import_xs(NGROUP)