Skip to content

Commit

Permalink
Merge 00ab0ff into 183ff31
Browse files Browse the repository at this point in the history
  • Loading branch information
jakehader committed May 2, 2022
2 parents 183ff31 + 00ab0ff commit 9ccbd5c
Show file tree
Hide file tree
Showing 8 changed files with 317 additions and 261 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -53,6 +53,7 @@ venv*/
**/__pycache__
**/.coverage*
**/logs/*
*.png

# Misc. exclusions
*.html
Expand Down
3 changes: 2 additions & 1 deletion armi/physics/neutronics/globalFlux/globalFluxInterface.py
Expand Up @@ -450,7 +450,8 @@ def _undoGeometryTransformations(self):

meshConverter = self.geomConverters.get("axial")
if meshConverter:
meshConverter.applyStateToOriginal()
if self.options.applyResultsToReactor:
meshConverter.applyStateToOriginal()
self.r = meshConverter._sourceReactor # pylint: disable=protected-access;

nAssemsBeforeConversion = [
Expand Down
40 changes: 6 additions & 34 deletions armi/reactor/assemblies.py
Expand Up @@ -955,10 +955,9 @@ def getBlocksBetweenElevations(self, zLower, zUpper):
blocksHere.append((b, heightHere))

totalHeight = 0.0
allMeshPoints = sorted(allMeshPoints)
# The expected height snaps to the minimum height that is requested
expectedHeight = min(
sorted(allMeshPoints)[-1] - sorted(allMeshPoints)[0], zUpper - zLower
)
expectedHeight = min(allMeshPoints[-1] - allMeshPoints[0], zUpper - zLower)
for _b, height in blocksHere:
totalHeight += height

Expand All @@ -967,41 +966,14 @@ def getBlocksBetweenElevations(self, zLower, zUpper):
if abs(totalHeight - expectedHeight) > 1e-5:
raise ValueError(
f"The cumulative height of {blocksHere} is {totalHeight} cm "
f"and does not equal the expected height of {expectedHeight} cm"
f"and does not equal the expected height of {expectedHeight} cm.\n"
f"All mesh points: {allMeshPoints}\n"
f"Upper mesh point: {zUpper} cm\n"
f"Lower mesh point: {zLower} cm\n"
)

return blocksHere

def getBlockLengthAboveAndBelowHeight(self, height):
"""
Returns a tuple with the amount of a block above or below a given height in an assembly.
Used to determine what fraction of the block should be merged with a control
rod.
Parameters
----------
height : float
The height of interest to grab a block (cm)
Returns
-------
distances : tuple
tuple containing the distance from height to top of block followed by
distance of height to bottom of block
"""
for b in self:
if height > b.p.zbottom and height <= b.p.ztop:
distanceFromTop = abs(b.p.ztop - height)
distanceFromBottom = abs(height - b.p.zbottom)
break
else:
raise ValueError(
"There are no blocks in {} at a height of {} cm".format(self, height)
)
return (distanceFromTop, distanceFromBottom)

def getParamValuesAtZ(
self, param, elevations, interpType="linear", fillValue=numpy.NaN
):
Expand Down
79 changes: 46 additions & 33 deletions armi/reactor/assemblyParameters.py
Expand Up @@ -172,6 +172,52 @@ def detailedNDens(self, value):
categories=[parameters.Category.assignInBlueprints],
)

with pDefs.createBuilder(
location="N/A", default=0.0, categories=["control rods"]
) as pb:

pb.defParam(
"crCriticalFraction",
units="",
description=(
"The insertion fraction when the control rod assembly is in its critical configuration. "
"Note that the default of -1.0 is a trigger for this value not being set yet."
),
saveToDB=True,
default=-1.0,
)

pb.defParam(
"crCurrentElevation",
units="cm",
description="The current elevation of the bottom of the moveable section of a control rod assembly.",
categories=[parameters.Category.assignInBlueprints],
saveToDB=True,
)

pb.defParam(
"crEndingElevation",
units="cm",
description="The final elevation of the bottom of the control material when fully inserted.",
categories=[parameters.Category.assignInBlueprints],
saveToDB=True,
)

pb.defParam(
"crRodLength",
units="cm",
description="length of the control material within the control rod",
saveToDB=True,
)

pb.defParam(
"crStartingElevation",
units="cm",
description="The initial starting elevation of the moveable section of a control rod assembly when fully withdrawn.",
categories=[parameters.Category.assignInBlueprints],
saveToDB=True,
)

with pDefs.createBuilder(
location=ParamLocation.AVERAGE, default=0.0, categories=["thermal hydraulics"]
) as pb:
Expand Down Expand Up @@ -234,39 +280,6 @@ def detailedNDens(self, value):
default=0, # integer default
)

with pDefs.createBuilder(
location="N/A", default=0.0, categories=["control rods"]
) as pb:

pb.defParam(
"crCurrentHeight",
units="cm",
description="The current height of the bottom of the control material from the 0 point in the reactor model",
)

pb.defParam(
"crEndingHeight",
units="cm",
description="The final position of the bottom of the control material when "
"starting control operations as measured from the 0 point in the reactor model",
)

pb.defParam(
"crRodLength",
units="cm",
description="length of the control material within the control rod",
)

pb.defParam(
"crStartingHeight",
units="cm",
description="The initial starting position of the bottom of the control "
"material when starting control operations as measured from the 0 point in the "
"reactor model. Note that the starting height is taken to be a maximum withdrawn "
"location for the control rod for determining the position when the control rod "
"is fully withdrawn.",
)

with pDefs.createBuilder() as pb:

pb.defParam(
Expand Down
8 changes: 4 additions & 4 deletions armi/reactor/converters/tests/test_uniformMesh.py
Expand Up @@ -199,12 +199,12 @@ def test_setStateFromOverlaps(self):
for b in self.sourceAssem:
b.p[pName] = 3

def setter(block, vals, _paramNames):
for pName, val in zip(paramList, vals):
def setter(block, vals, paramNames):
for pName, val in zip(paramNames, vals):
block.p[pName] = val

def getter(block, _paramNames):
return numpy.array([block.p[pName] for pName in paramList])
def getter(block, paramNames):
return numpy.array([block.p[pName] for pName in paramNames])

# pylint: disable=protected-access
uniformMesh._setStateFromOverlaps(
Expand Down

0 comments on commit 9ccbd5c

Please sign in to comment.