Skip to content

Commit

Permalink
Plot cartesian (#71)
Browse files Browse the repository at this point in the history
Improve plotting and pitch handling for Cartesian cases.

There were some issues with Cartesian plotting and pitch
that this solves. Most get pitch methods returned 2 pitches
for Cartesian (rectangular) composites, one for each dimension.
getAssemblyPitch had a bug where it produced the average of
the two pitches, and was fixed to be consistent with the rest.

Improved plotFaceMap to handle Cartesian geometry. Moved
plotting from reactor core methods to utils.plotting since plotting
is not integral to the ARMI data model and can be distracting.

plotBlockDepthMap was added so that block parameter
distributionscan more readily be analyzed interactively. This
feature allows the user to interactively select different axial planes
to view block parameters on.  plotFaceMap could only display
total/peak/average values, so this was created to allow the 3D 
distribution to be more readily visualized.

Added multiple neutron energy group structures to support 
thermal reactor work.

The issue with handling pitch in rectangular assemblies 
has been strange since it returns 2 values, while hex pitch
returns one. We plan to work to improve it.
  • Loading branch information
onufer committed May 11, 2020
1 parent b0368f5 commit c0edb11
Show file tree
Hide file tree
Showing 14 changed files with 1,049 additions and 1,521 deletions.
11 changes: 7 additions & 4 deletions armi/bookkeeping/report/reportingUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@
from armi import utils
from armi.utils import iterables
from armi.utils import units
from armi.utils import pathTools
from armi.utils import textProcessors
from armi.utils import plotting
from armi import interfaces
from armi.bookkeeping import report
from armi.reactor.flags import Flags
from armi.reactor.components import ComponentType
from armi.operators import RunTypes
from armi.localization import strings
from armi.localization import warnings


# Set to prevent the image and text from being too small to read.
MAX_ASSEMS_PER_ASSEM_PLOT = 6
Expand Down Expand Up @@ -934,7 +934,9 @@ def makeCoreAndAssemblyMaps(r, cs, generateFullCoreMap=False, showBlockAxMesh=Tr
report.data.Report.groupsOrderFirst.insert(-1, assemPlotImage)
report.data.Report.componentWellGroups.insert(-1, assemPlotImage)
assemPlotName = os.path.abspath(
core.plotAssemblyTypes(
plotting.plotAssemblyTypes(
core.parent.blueprints,
core.name,
assemBatch,
plotNum,
maxAssems=MAX_ASSEMS_PER_ASSEM_PLOT,
Expand Down Expand Up @@ -973,7 +975,8 @@ def makeCoreAndAssemblyMaps(r, cs, generateFullCoreMap=False, showBlockAxMesh=Tr
]

fName = "".join([cs.caseTitle, "RadialCoreMap.", cs["outputFileExtension"]])
corePlotName = core.plotFaceMap(
corePlotName = plotting.plotFaceMap(
core,
title="{} Radial Core Map".format(cs.caseTitle),
fName=fName,
cmapName="RdYlBu",
Expand Down
2 changes: 1 addition & 1 deletion armi/bookkeeping/tests/test_plotting.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2019 TerraPower, LLC
# Copyright 2020 TerraPower, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
8 changes: 3 additions & 5 deletions armi/physics/fuelCycle/fuelHandlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,18 @@
"""
import re
import os
import collections
import math
import importlib.util
import warnings

import numpy

import armi
from armi import interfaces
from armi import runLog
from armi.localization.exceptions import InputError
from armi.reactor.flags import Flags
from armi.operators import RunTypes
from armi.utils import directoryChangers, pathTools
from armi import utils
from armi.utils import plotting


class FuelHandlerInterface(interfaces.Interface):
Expand Down Expand Up @@ -130,7 +127,8 @@ def manageFuel(self, cycle):
fh.outage(shuffleFactors) # move the assemblies around
if self.cs["plotShuffleArrows"]:
arrows = fh.makeShuffleArrows()
self.r.core.plotFaceMap(
plotting.plotFaceMap(
self.r.core,
"percentBu",
labelFmt=None,
fName="{}.shuffles_{}.png".format(self.cs.caseTitle, self.r.p.cycle),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import unittest

from armi.physics.neutronics.fissionProductModel import fissionProductModel
from armi.reactor.tests.test_reactors import buildOperatorOfEmptyBlocks
from armi.reactor.tests.test_reactors import buildOperatorOfEmptyHexBlocks

from armi.physics.neutronics.fissionProductModel.tests import test_lumpedFissionProduct

Expand All @@ -29,7 +29,7 @@ class TestFissionProductModel(unittest.TestCase):
"""

def setUp(self):
o = buildOperatorOfEmptyBlocks()
o = buildOperatorOfEmptyHexBlocks()
self.fpModel = fissionProductModel.FissionProductModel(o.r, o.cs)
o.removeAllInterfaces()
o.addInterface(self.fpModel)
Expand Down
5 changes: 1 addition & 4 deletions armi/reactor/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -1846,14 +1846,12 @@ def getPitch(self, returnComp=False):
"""
c, _p = self._pitchDefiningComponent

if c is None:
raise ValueError("{} has no valid pitch defining component".format(self))

# ask component for dimensions, since they could have changed,
# due to temperature, for example.
p = c.getPitchData()

return (p, c) if returnComp else p

def hasPinPitch(self):
Expand Down Expand Up @@ -2811,8 +2809,7 @@ def getMaxArea(self):

def setPitch(self, val, updateBolParams=False, updateNumberDensityParams=True):
raise NotImplementedError(
"Directly setting the pitch of a cartesian block is currently "
"not supported"
"Directly setting the pitch of a cartesian block is currently not supported."
)

def getSymmetryFactor(self):
Expand Down
10 changes: 8 additions & 2 deletions armi/reactor/converters/uniformMesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
from armi import runLog
from armi import utils
from armi.utils import iterables
from armi.utils import plotting
from armi.reactor import grids
from armi.reactor.flags import Flags
from armi.reactor.converters.geometryConverters import GeometryConverter
Expand Down Expand Up @@ -222,8 +223,13 @@ def _buildAllUniformAssemblies(self):
def plotConvertedReactor(self):
assemsToPlot = self.convReactor.core[:12]
for plotNum, assemBatch in enumerate(iterables.chunk(assemsToPlot, 6), start=1):
self.convReactor.core.plotAssemblyTypes(
assemBatch, plotNum, maxAssems=6, showBlockAxMesh=True
plotting.plotAssemblyTypes(
self.convReactor.core.parent.blueprints,
self.convReactor.core.name,
assemBatch,
plotNum,
maxAssems=6,
showBlockAxMesh=True,
)

def _setParamsToUpdate(self):
Expand Down
Loading

0 comments on commit c0edb11

Please sign in to comment.