Skip to content

Commit

Permalink
Merge 9a64521 into a08a91e
Browse files Browse the repository at this point in the history
  • Loading branch information
onufer committed Jul 20, 2022
2 parents a08a91e + 9a64521 commit 225faac
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 8 deletions.
4 changes: 2 additions & 2 deletions armi/bookkeeping/db/tests/test_database3.py
Expand Up @@ -298,11 +298,11 @@ def test_load_updateGlobalAssemNum(self):

# there will 77 assemblies added to the newly created core
self.db.load(0, 0, allowMissing=True, updateGlobalAssemNum=False)
self.assertEqual(assemblies._assemNum, 77)
self.assertEqual(assemblies._assemNum, 85)

# now do the same call again and show that the global _assemNum just keeps going up
self.db.load(0, 0, allowMissing=True, updateGlobalAssemNum=False)
self.assertEqual(assemblies._assemNum, 77 * 2)
self.assertEqual(assemblies._assemNum, 85 * 2)

# now load but also updateGlobalAssemNum and show that it updates to the value
# stored in self.r.p.maxAssemNum plus 1
Expand Down
40 changes: 34 additions & 6 deletions armi/reactor/reactors.py
Expand Up @@ -2262,14 +2262,42 @@ def processLoading(self, cs):
"Please make sure that this is intended and not a input error."
)

self.p.referenceBlockAxialMesh = self.findAllAxialMeshPoints(applySubMesh=False)
self.p.axialMesh = self.findAllAxialMeshPoints()
refAssem = self.refAssem
# if we have these params loaded from the database do not overwrite,
# otherwise initialize them
if not self.p.referenceBlockAxialMesh:
self.p.referenceBlockAxialMesh = self.findAllAxialMeshPoints(
applySubMesh=False
)
if not self.p.axialMesh:
self.p.axialMesh = self.findAllAxialMeshPoints()

refAssem = self.refAssem
# blueprints.assemblies.values need to be populated
# In a load from DB case construction may not have been prepped yet.
# this normally happens during blueprints constructAssem, but for DB
# load this is not called.
self.parent.blueprints._prepConstruction(cs)
if not cs["detailedAxialExpansion"]:
for a in self.getAssemblies(includeBolAssems=True):
# prepare for mesh snapping during axial expansion
a.makeAxialSnapList(refAssem)
# prepare core for mesh snapping during axial expansion
for a in self.getAssemblies():
# No BOL assemblies since the core may have an expanded mesh
# That wont work for snap list. BOL (blueprints) assemblies
# will have the expansion applied upon core.createAssemblyOfType
a.makeAxialSnapList(refAssem=refAssem)

# Now apply mesh snapping for blueprints
# All mesh points should line up with the ref mesh, so first
# find the assembly with the finest mesh (it is the ref).
finestMeshA = sorted(
self.parent.blueprints.assemblies.values(),
key=lambda a: len(a),
reverse=True,
)[0]
# Apply an unexpanded ref mesh to the blueprints.Since they are
# not yet expanded, the normal core mesh would not line up.
# They will get expanded by core.createAssemblyOfType.
for a in self.parent.blueprints.assemblies.values():
a.makeAxialSnapList(refAssem=finestMeshA)

self.numRings = self.getNumRings() # TODO: why needed?

Expand Down
18 changes: 18 additions & 0 deletions armi/reactor/tests/test_reactors.py
Expand Up @@ -776,6 +776,24 @@ def test_createAssemblyOfType(self):
)
self.assertAlmostEqual(aNew3.getMass(), bol.getMass())

def test_createAssemblyOfTypeExpandedCore(self):
"""Test creation of new assemblies in an expanded core."""
# change the mesh of inner blocks
mesh = self.r.core.p.referenceBlockAxialMesh[1:]
lastIndex = len(mesh) - 1
mesh = [val + 5 for val in mesh]
mesh[0] -= 5
mesh[lastIndex] -= 5

# expand the core
self.r.core.p.referenceBlockAxialMesh = [0] + mesh
for a in self.r.core:
a.setBlockMesh(mesh)
aType = self.r.core.getFirstAssembly(Flags.FUEL).getType()

# demonstrate we can still create assemblies
self.assertTrue(self.r.core.createAssemblyOfType(aType))

def test_getAvgTemp(self):
t0 = self.r.core.getAvgTemp([Flags.CLAD, Flags.WIRE, Flags.DUCT])
self.assertAlmostEqual(t0, 459.267, delta=0.01)
Expand Down

0 comments on commit 225faac

Please sign in to comment.