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

Adding year to time logging #1796

Merged
merged 4 commits into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion armi/cases/tests/test_cases.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ def test_run(self):
self.assertIn("Triggering BOL Event", mock.getStdout())
self.assertIn("xsGroups", mock.getStdout())
self.assertIn(
"Completed EveryNode - timestep: cycle 0, node 0 Event",
"Completed EveryNode - timestep: cycle 0, node 0, year 0.0 Event",
john-science marked this conversation as resolved.
Show resolved Hide resolved
mock.getStdout(),
)

Expand Down
9 changes: 6 additions & 3 deletions armi/operators/operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -567,17 +567,20 @@ def _expandCycleAndTimeNodeArgs(self, interactionName):
"""
if interactionName == "Coupled":
cycleNodeInfo = (
f" - timestep: cycle {self.r.p.cycle}, node {self.r.p.timeNode}"
f" - iteration {self.r.core.p.coupledIteration}"
f" - timestep: cycle {self.r.p.cycle}, node {self.r.p.timeNode}, "
f"year {self.r.p.time} - iteration {self.r.core.p.coupledIteration}"
john-science marked this conversation as resolved.
Show resolved Hide resolved
)
elif interactionName in ("BOC", "EOC"):
cycleNodeInfo = f" - timestep: cycle {self.r.p.cycle}"
# - timestep: cycle 2
elif interactionName in ("Init", "BOL", "EOL"):
cycleNodeInfo = ""
else:
cycleNodeInfo = (
f" - timestep: cycle {self.r.p.cycle}, node {self.r.p.timeNode}"
f" - timestep: cycle {self.r.p.cycle}, node {self.r.p.timeNode}, "
f"year {self.r.p.time}"
)

return cycleNodeInfo

def _debugDB(self, interactionName, interfaceName, statePointIndex=0):
Expand Down
8 changes: 5 additions & 3 deletions armi/operators/tests/test_operators.py
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,7 @@ def setUpClass(cls):
)
cls.r.p.cycle = 0
cls.r.p.timeNode = 1
cls.r.p.time = 11
cls.r.core.p.coupledIteration = 7

def test_expandCycleAndTimeNodeArgs_Empty(self):
Expand All @@ -572,15 +573,16 @@ def test_expandCycleAndTimeNodeArgs_EveryNode(self):
"""When cycleNodeInfo should return the cycle and node."""
self.assertEqual(
self.o._expandCycleAndTimeNodeArgs(interactionName="EveryNode"),
f" - timestep: cycle {self.r.p.cycle}, node {self.r.p.timeNode}",
f" - timestep: cycle {self.r.p.cycle}, node {self.r.p.timeNode}, "
f"year {self.r.p.time}",
)

def test_expandCycleAndTimeNodeArgs_Coupled(self):
"""When cycleNodeInfo should return the cycle, node, and iteration number."""
self.assertEqual(
self.o._expandCycleAndTimeNodeArgs(interactionName="Coupled"),
(
f" - timestep: cycle {self.r.p.cycle}, node {self.r.p.timeNode} "
f"- iteration {self.r.core.p.coupledIteration}"
f" - timestep: cycle {self.r.p.cycle}, node {self.r.p.timeNode}, "
f"year {self.r.p.time} - iteration {self.r.core.p.coupledIteration}"
),
)
Loading