Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing defunct code from historyTracker Interface #594

Merged
merged 1 commit into from Mar 10, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
127 changes: 0 additions & 127 deletions armi/bookkeeping/historyTracker.py
Expand Up @@ -279,133 +279,6 @@ def filterTimeIndices(self, timeIndices, boc=False, moc=False, eoc=False):

return filtered

def getTimeIndices(self, a=None, boc=False, moc=False, eoc=False):
r"""
Generate a list of timestep indices where valid history data exist for the given criteria.

Parameters
----------
a : Assembly, optional
If given, only generate time indices where the assembly `a` is in the core. Default: All assemblies.

boc, moc, eoc : bool, optional
Will return boc/moc/eoc timenodes in every cycle. If any of these are true, allNodes becomes False

Returns
-------
timeIndices : list
A list of integers where history data exists.

Examples
--------
If there are 5 nodes per cycle (burnSteps = 4),
0 1 2 3 4 | 5 6 7 8 9 | 10 11 12 13 14 | ...:

>>> getTimeIndices(moc=True):
[2, 7, 12, ...]

Warning
-------
This is no longer functional, as much of the old history tracking was based on
implementation details of the Database, version 2. We now directly support
history tracking through the Database, version 3. At some point this code should
be removed.

See Also
--------
getTimeSteps : gets time in years where the assembly is in the core

"""
timeIndices = []
coreGrid = self.r.core.spatialGrid
for globalNode in range(
utils.getTimeStepNum(self.r.p.cycle, self.r.p.timeNode, self.cs) + 1
):
if a is None:
timeIndices.append(globalNode)
else:
fBlock = a.getFirstBlock(Flags.FUEL)
if fBlock is None:
blockLocationLabel = None
else:
blockLocationLabel = self._blockLocationAtTimenode(
fBlock, globalNode
)
runLog.info(
"Location label of {} at timestep {} is {}".format(
fBlock, globalNode, blockLocationLabel
)
)
# only add this timestep if it's around for this assembly.
if blockLocationLabel is not None:
# this label doesn't actually properly correspond to the block
# location label determined by _blockLocationAtTimenode.
# blockLocationLabel is supposed to be coming from a previous time
# state in the database.
if a.spatialLocator.grid is coreGrid:
timeIndices.append(globalNode)

return self.filterTimeIndices(timeIndices, boc, moc, eoc)

def getBOCEOCTimeIndices(self, assem=None):
r"""returns a list of time step indices that only include BOC and EOC, no intermediate ones."""
tIndices = self.getTimeIndices(assem) # list of times in years
counter = 0
filtered = []
for tIndex in tIndices:
if counter == 0:
# boc. add it.
filtered.append(tIndex)
counter += 1
elif counter == self.cs["burnSteps"]:
# eoc. add it.
filtered.append(tIndex)
counter = 0
else:
# not boc or eoc. Just increment counter. tick, tick, tick
counter += 1

return filtered

def getAssemParamHistory(self, a, neededParams):
"""Gets the history typically used for the Alchemy Writer

Returns
-------
assemHistory : dict, nested with 3 levels,
e.g. assemHistory[block][time_step][parameter] = value of parameter at time step on block


Raises
------
RuntimeError
When the assembly has no history.
"""
timeSteps = self.getTimeIndices(a)
if not timeSteps:
raise RuntimeError(
"Time steps empty. Cannot get assembly history for {}".format(a)
)

# assemHistory[block][time_step][parameter] = value of parameter at time step on block
assemHistory = OrderedDict([(block, None) for block in a.getBlocks(Flags.FUEL)])
for block in assemHistory:
assemHistory[block] = OrderedDict([(ts, None) for ts in timeSteps])

for ts in assemHistory[block]:
assemHistory[block][ts] = OrderedDict(
[(param, None) for param in neededParams]
)

for param in assemHistory[block][ts]:
val = self.getBlockHistoryVal(block.getName(), param, ts)
assemHistory[block][ts][param] = val
assemHistory[block][ts]["location"] = self.getBlockHistoryVal(
block.getName(), "loc", ts
)

return assemHistory

def writeAssemHistory(self, a, fName=""):
"""Write the assembly history report to a text file."""
fName = fName or self._getAssemHistoryFileName(a)
Expand Down