Note
Click here 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.
Out:
m1
40090 3.35392810e-03
40091 7.31410545e-04
40092 1.11797601e-03
40094 1.13296921e-03
40096 1.82526696e-04
92234 1.00000000e-15
92235 4.36009592e-03
92236 1.00000000e-15
92238 3.48315484e-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
6000 8.74751046e-04
14028 4.31291138e-04
14029 2.18989085e-05
14030 1.44356034e-05
23000 3.09377267e-04
24050 5.15816461e-04
24052 9.94700712e-03
24053 1.12791075e-03
24054 2.80760858e-04
25055 4.78118343e-04
26054 4.66815624e-03
26056 7.32800682e-02
26057 1.69235639e-03
26058 2.25221567e-04
28058 3.35129578e-04
28060 1.29090626e-04
28061 5.61199380e-06
28062 1.78894609e-05
28064 4.55851426e-06
42092 8.12666224e-05
42094 5.06547343e-05
42095 8.71809049e-05
42096 9.13428074e-05
42097 5.22975906e-05
42098 1.32140399e-04
42100 5.27356856e-05
74182 4.16978216e-05
74183 2.25168237e-05
74184 4.82121213e-05
74186 4.47346819e-05
m3
11023 2.21665718e-02
m4
6000 8.75462690e-04
14028 4.31642010e-04
14029 2.19167241e-05
14030 1.44473473e-05
23000 3.09628958e-04
24050 5.16236098e-04
24052 9.95509940e-03
24053 1.12882835e-03
24054 2.80989268e-04
25055 4.78507311e-04
26054 4.67195397e-03
26056 7.33396844e-02
26057 1.69373318e-03
26058 2.25404794e-04
28058 3.35402219e-04
28060 1.29195646e-04
28061 5.61655937e-06
28062 1.79040147e-05
28064 4.56222279e-06
42092 8.13327360e-05
42094 5.06959439e-05
42095 8.72518300e-05
42096 9.14171183e-05
42097 5.23401367e-05
42098 1.32247900e-04
42100 5.27785881e-05
74182 4.17317444e-05
74183 2.25351420e-05
74184 4.82513437e-05
74186 4.47710753e-05
m5
11023 2.21665718e-02
m6
6000 8.75462690e-04
14028 4.31642010e-04
14029 2.19167241e-05
14030 1.44473473e-05
23000 3.09628958e-04
24050 5.16236098e-04
24052 9.95509940e-03
24053 1.12882835e-03
24054 2.80989268e-04
25055 4.78507311e-04
26054 4.67195397e-03
26056 7.33396844e-02
26057 1.69373318e-03
26058 2.25404794e-04
28058 3.35402219e-04
28060 1.29195646e-04
28061 5.61655937e-06
28062 1.79040147e-05
28064 4.56222279e-06
42092 8.13327360e-05
42094 5.06959439e-05
42095 8.72518300e-05
42096 9.14171183e-05
42097 5.23401367e-05
42098 1.32247900e-04
42100 5.27785881e-05
74182 4.17317444e-05
74183 2.25351420e-05
74184 4.82513437e-05
74186 4.47710753e-05
m7
11023 2.21665718e-02
# sphinx_gallery_thumbnail_path = '.static/armi-logo.png'
import logging
from armi.reactor.tests import test_reactors
from armi.reactor.flags import Flags
from armi.utils.densityTools import formatMaterialCard
from armi.nucDirectory import nuclideBases as nb
from armi import configure, runLog
# init ARMI logging tools
logging.setLoggerClass(runLog.RunLogger)
# 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.867 seconds)