Skip to content

Commit

Permalink
Merge b70576d into 981459c
Browse files Browse the repository at this point in the history
  • Loading branch information
mgjarrett authored Mar 8, 2021
2 parents 981459c + b70576d commit d596bca
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 28 deletions.
49 changes: 47 additions & 2 deletions armi/physics/neutronics/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,18 +197,42 @@ def mgFlux(self, value):
default=None,
)

def pinPowersNeutron(self, value):
self._p_pinPowersNeutron = (
value
if value is None or isinstance(value, numpy.ndarray)
else numpy.array(value)
)

pb.defParam(
"pinPowersNeutron",
setter=pinPowersNeutron,
units="W/cm",
description="should be a blank 2-D array, but re-defined later (nPins x nAxialSegments)",
description="""
The block-level pin linear power densities from neutron-induced
interactions. pinPowersNeutron[i] represents the average linear power density of pin i
(from neutron heating). Power units are Watts/cm (Watts produced per cm of pin length).
""",
saveToDB=True,
default=None,
)

def pinPowersGamma(self, value):
self._p_pinPowersGamma = (
value
if value is None or isinstance(value, numpy.ndarray)
else numpy.array(value)
)

pb.defParam(
"pinPowersGamma",
setter=pinPowersGamma,
units="W/cm",
description="should be a blank 2-D array, but re-defined later (nPins x nAxialSegments)",
description="""
The block-level pin linear power densities from gamma heating.
pinPowersGamma[i] represents the average linear power density of pin i (from gamma
heating). Power units are Watts/cm (Watts produced per cm of pin length).",
""",
saveToDB=True,
default=None,
)
Expand Down Expand Up @@ -375,24 +399,45 @@ def mgFlux(self, value):
categories=[parameters.Category.detailedAxialExpansion],
)

def linPowByPin(self, value):
if value is None or isinstance(value, numpy.ndarray):
self._p_linPowByPin = value
else:
self._p_linPowByPin = numpy.array(value)

pb.defParam(
"linPowByPin",
setter=linPowByPin,
units="W/cm",
description="Pin linear power",
location=ParamLocation.CHILDREN,
default=None,
)

def linPowByPinNeutron(self, value):
if value is None or isinstance(value, numpy.ndarray):
self._p_linPowByPinNeutron = value
else:
self._p_linPowByPinNeutron = numpy.array(value)

pb.defParam(
"linPowByPinNeutron",
setter=linPowByPinNeutron,
units="W/cm",
description="Pin linear neutron power",
location=ParamLocation.CHILDREN,
default=None,
)

def linPowByPinGamma(self, value):
if value is None or isinstance(value, numpy.ndarray):
self._p_linPowByPinGamma = value
else:
self._p_linPowByPinGamma = numpy.array(value)

pb.defParam(
"linPowByPinGamma",
setter=linPowByPinGamma,
units="W/cm",
description="Pin linear gamma power",
location=ParamLocation.CHILDREN,
Expand Down
37 changes: 11 additions & 26 deletions armi/reactor/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -1613,53 +1613,38 @@ def setPinPowers(
Outputs
-------
self.p.pinPowers : list of floats
self.p.pinPowers : 1-D numpy array
The block-level pin linear power densities. pinPowers[i] represents the average linear
power density of pin i.
Power units are Watts/cm (Watts produced per cm of pin length).
The "ARMI pin ordering" is used, which is counter-clockwise from 3 o'clock.
"""
# numPins = self.getNumPins()
self.p.pinPowers = [
0 for _n in range(numPins)
] # leave as a list. maybe go to dictionary later.
self.p.pinPowers = numpy.zeros(numPins)
self.p["linPowByPin" + powerKeySuffix] = numpy.zeros(numPins)
j0 = jmax[imax - 1] / 6
pinNum = 0
cornerPinCount = 0

self.p["linPowByPin" + powerKeySuffix] = []
for i in range(imax): # loop through rings
for j in range(jmax[i]): # loop through positions in ring i
pinNum += 1

if (
removeSixCornerPins
and (i == imax - 1)
and (math.fmod(j, j0) == 0.0)
):
if removeSixCornerPins and i == imax - 1 and math.fmod(j, j0) == 0.0:
linPow = 0.0
else:
if self.hasFlags(Flags.FUEL):
pinLoc = self.p.pinLocation[pinNum - 1]
# -1 to map from pinLocations to list index
pinLoc = self.p.pinLocation[pinNum] - 1
else:
pinLoc = pinNum

linPow = powers[
pinLoc - 1
] # -1 to map from pinLocations to list index

self.p.pinPowers[pinNum - 1 - cornerPinCount] = linPow
self.p["linPowByPin" + powerKeySuffix].append(linPow)
linPow = powers[pinLoc]
self.p.pinPowers[pinNum] = linPow
self.p["linPowByPin" + powerKeySuffix][pinNum] = linPow
pinNum += 1

if powerKeySuffix == GAMMA:
self.p.pinPowersGamma = self.p.pinPowers
elif powerKeySuffix == NEUTRON:
self.p.pinPowersNeutron = self.p.pinPowers

if gamma:
self.p.pinPowers = [
n + g for n, g in zip(self.p.pinPowersNeutron, self.p.pinPowersGamma)
]
self.p.pinPowers = self.p.pinPowersNeutron + self.p.pinPowersGamma
else:
self.p.pinPowers = self.p.pinPowersNeutron

Expand Down

0 comments on commit d596bca

Please sign in to comment.