Note
Go to the end to download the full example code
Write MCNP Material Cards
Here we load a test reactor and write each component of one fuel block out as MCNP material cards.
Normally, code-specific utility code would belong in a code-specific ARMI plugin. But in this case, the need for MCNP materials cards is so pervasive that it made it into the framework
m1
40090 3.35498695e-03
40091 7.31641456e-04
40092 1.11832896e-03
40094 1.13332690e-03
40096 1.82584320e-04
92234 1.00000000e-15
92235 4.36147243e-03
92236 1.00000000e-15
92238 3.48425449e-02
93237 1.00000000e-15
93238 1.00000000e-15
94236 1.00000000e-15
94238 1.00000000e-15
94239 1.00000000e-15
94240 1.00000000e-15
94241 1.00000000e-15
94242 1.00000000e-15
95241 1.00000000e-15
95242 1.00000000e-15
95243 1.00000000e-15
96242 1.00000000e-15
96243 1.00000000e-15
96244 1.00000000e-15
96245 1.00000000e-15
96246 1.00000000e-15
96247 1.00000000e-15
m2
11023 2.21665718e-02
m3
6000 7.67941747e-04
14028 3.78629407e-04
14029 1.92249968e-05
14030 1.26729800e-05
23000 2.71601526e-04
24050 4.52833976e-04
24052 8.73245259e-03
24053 9.90190013e-04
24054 2.46479253e-04
25055 4.19738893e-04
26054 4.09816265e-03
26056 6.43323879e-02
26057 1.48571542e-03
26058 1.97721449e-04
28058 2.94209415e-04
28060 1.13328336e-04
28061 4.92675527e-06
28062 1.57051128e-05
28064 4.00190823e-06
42092 7.13437638e-05
42094 4.44696641e-05
42095 7.65358976e-05
42096 8.01896213e-05
42097 4.59119235e-05
42098 1.16005724e-04
42100 4.62965260e-05
74182 3.66064130e-05
74183 1.97674630e-05
74184 4.23253002e-05
74186 3.92724649e-05
m4
6000 7.68566498e-04
14028 3.78937437e-04
14029 1.92406371e-05
14030 1.26832899e-05
23000 2.71822485e-04
24050 4.53202374e-04
24052 8.73955678e-03
24053 9.90995571e-04
24054 2.46679773e-04
25055 4.20080367e-04
26054 4.10149666e-03
26056 6.43847248e-02
26057 1.48692411e-03
26058 1.97882303e-04
28058 2.94448766e-04
28060 1.13420533e-04
28061 4.93076337e-06
28062 1.57178896e-05
28064 4.00516393e-06
42092 7.14018048e-05
42094 4.45058419e-05
42095 7.65981625e-05
42096 8.02548587e-05
42097 4.59492746e-05
42098 1.16100100e-04
42100 4.63341900e-05
74182 3.66361937e-05
74183 1.97835446e-05
74184 4.23597335e-05
74186 3.93044146e-05
m5
11023 2.21665718e-02
m6
6000 7.68566498e-04
14028 3.78937437e-04
14029 1.92406371e-05
14030 1.26832899e-05
23000 2.71822485e-04
24050 4.53202374e-04
24052 8.73955678e-03
24053 9.90995571e-04
24054 2.46679773e-04
25055 4.20080367e-04
26054 4.10149666e-03
26056 6.43847248e-02
26057 1.48692411e-03
26058 1.97882303e-04
28058 2.94448766e-04
28060 1.13420533e-04
28061 4.93076337e-06
28062 1.57178896e-05
28064 4.00516393e-06
42092 7.14018048e-05
42094 4.45058419e-05
42095 7.65981625e-05
42096 8.02548587e-05
42097 4.59492746e-05
42098 1.16100100e-04
42100 4.63341900e-05
74182 3.66361937e-05
74183 1.97835446e-05
74184 4.23597335e-05
74186 3.93044146e-05
m7
11023 2.21665718e-02
# sphinx_gallery_thumbnail_path = '.static/armi-logo.png'
from armi import configure
from armi.nucDirectory import nuclideBases as nb
from armi.reactor.flags import Flags
from armi.reactor.tests import test_reactors
from armi.utils.densityTools import formatMaterialCard
# configure ARMI
configure(permissive=True)
_o, r = test_reactors.loadTestReactor()
bFuel = r.core.getBlocks(Flags.FUEL)[0]
for ci, component in enumerate(bFuel, start=1):
ndens = component.getNumberDensities()
# convert nucName (str) keys to nuclideBase keys
ndensByBase = {nb.byName[nucName]: dens for nucName, dens in ndens.items()}
print("".join(formatMaterialCard(ndensByBase, matNum=ci)))
Total running time of the script: ( 0 minutes 0.435 seconds)