Skip to content

Commit

Permalink
Running black code formatter.
Browse files Browse the repository at this point in the history
  • Loading branch information
jakehader committed May 2, 2022
1 parent d96f733 commit 4d92dd6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 14 deletions.
2 changes: 1 addition & 1 deletion armi/mpiActions.py
Expand Up @@ -707,7 +707,7 @@ def _diagnosePickleError(o):
class Multiprocessor:
"""
This is useful for running a function in parallel using multiple available processors.
Notes
-----
This solution is taken from https://stackoverflow.com/a/45829852
Expand Down
27 changes: 15 additions & 12 deletions armi/reactor/converters/uniformMesh.py
Expand Up @@ -97,11 +97,13 @@ def convert(self, r=None):
self._computeAverageAxialMesh()
self._buildAllUniformAssemblies()
self._clearStateOnReactor(self.convReactor)
self._mapStateFromReactorToOther(self._sourceReactor, self.convReactor)
self._mapStateFromReactorToOther(self._sourceReactor, self.convReactor)
self.convReactor.core.updateAxialMesh()
self._checkConversion()
completeEndTime = timer()
runLog.extra(f"Reactor core conversion time: {completeEndTime-completeStartTime} seconds")
runLog.extra(
f"Reactor core conversion time: {completeEndTime-completeStartTime} seconds"
)
return self.convReactor

def _checkConversion(self):
Expand Down Expand Up @@ -165,7 +167,7 @@ def makeAssemWithUniformMesh(sourceAssem, newMesh):
newAssem = UniformMeshGeometryConverter._createNewAssembly(sourceAssem)
runLog.debug(f"Creating a uniform mesh of {newAssem}")
bottom = 0.0

for topMeshPoint in newMesh:
overlappingBlockInfo = sourceAssem.getBlocksBetweenElevations(
bottom, topMeshPoint
Expand Down Expand Up @@ -220,7 +222,7 @@ def makeAssemWithUniformMesh(sourceAssem, newMesh):
_setNumberDensitiesFromOverlaps(block, overlappingBlockInfo)
newAssem.add(block)
bottom = topMeshPoint

newAssem.reestablishBlockOrder()
newAssem.calculateZCoords()
return newAssem
Expand Down Expand Up @@ -305,7 +307,9 @@ def applyStateToOriginal(self):
self._clearStateOnReactor(self._sourceReactor)
self._mapStateFromReactorToOther(self.convReactor, self._sourceReactor)
completeEndTime = timer()
runLog.extra(f"Parameter remapping time: {completeEndTime-completeStartTime} seconds")
runLog.extra(
f"Parameter remapping time: {completeEndTime-completeStartTime} seconds"
)

def _mapStateFromReactorToOther(self, sourceReactor, destReactor):
"""
Expand Down Expand Up @@ -504,6 +508,7 @@ def _setNumberDensitiesFromOverlaps(block, overlappingBlockInfo):
)
block.setNumberDensities(totalDensities)


def _setStateFromOverlaps(
sourceAssembly, destinationAssembly, setter, getter, paramNames
):
Expand Down Expand Up @@ -593,9 +598,7 @@ def _setStateFromOverlaps(
sourceBlockVals = getter(sourceBlock, paramNames)
sourceBlockHeight = sourceBlock.getHeight()

for paramName, sourceBlockVal in zip(
paramNames, sourceBlockVals
):
for paramName, sourceBlockVal in zip(paramNames, sourceBlockVals):
# The value can be `None` if it has not been set yet. In this case,
# the mapping should be skipped.
if sourceBlockVal is None:
Expand All @@ -609,15 +612,15 @@ def _setStateFromOverlaps(
# If the parameter is volume integrated (e.g., flux, linear power)
# then calculate the fractional contribution from the source block.
if isVolIntegrated:
integrationFactor = (
sourceBlockOverlapHeight / sourceBlockHeight
)
integrationFactor = sourceBlockOverlapHeight / sourceBlockHeight

# If the parameter is not volume integrated (e.g., volumetric reaction rate)
# then calculate the fraction contribution on the destination block.
# This smears the parameter over the destination block.
else:
integrationFactor = sourceBlockOverlapHeight / destinationBlockHeight
integrationFactor = (
sourceBlockOverlapHeight / destinationBlockHeight
)

updatedDestVals[paramName] += sourceBlockVal * integrationFactor

Expand Down
1 change: 0 additions & 1 deletion armi/reactor/reactorParameters.py
Expand Up @@ -549,7 +549,6 @@ def detailedNucKeys(self, value):
description="Decay power from decaying radionuclides",
)


pb.defParam("medAbsCore", units="?", description="?")

pb.defParam("medFluxCore", units="?", description="?")
Expand Down

0 comments on commit 4d92dd6

Please sign in to comment.