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

Implement more detailed __lt__ for components. #1882

Draft
wants to merge 39 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
707aa88
Implement more detailed __lt__ for components.
mgjarrett Sep 11, 2024
35b63a8
Add a unit test for component sorting.
mgjarrett Sep 16, 2024
6bc7dc1
Update release notes.
mgjarrett Sep 16, 2024
1265d7c
Address linting error
mgjarrett Sep 16, 2024
dbed10f
Catch NotImplementedError
mgjarrett Sep 16, 2024
0fd1632
Remove all of the circular imports in components.
mgjarrett Sep 16, 2024
cca4a14
Fix broken unit tests.
mgjarrett Sep 16, 2024
06f1ec1
Fix unit test reference result.
mgjarrett Sep 16, 2024
37e8f0b
Register RadialSegment component type.
mgjarrett Sep 16, 2024
af44807
Black formatting.
mgjarrett Sep 16, 2024
c65a0c3
Merge branch 'main' into component_sort
mgjarrett Sep 16, 2024
9cb98e5
Refactor more unit tests.
mgjarrett Sep 16, 2024
d50b6dc
Ignore unused import
mgjarrett Sep 16, 2024
d1db895
Revert "Refactor more unit tests."
mgjarrett Sep 16, 2024
6c891fd
Revert "Fix broken unit tests."
mgjarrett Sep 16, 2024
914fe58
Revert "Remove all of the circular imports in components."
mgjarrett Sep 16, 2024
88feb80
Clear merge conflict.
mgjarrett Sep 16, 2024
0b1b6ef
Revert trivial change.
mgjarrett Sep 16, 2024
12980cd
Add getCircleInnerDiameter for UnshapedComponent.
mgjarrett Sep 16, 2024
a62fd41
Fix circular import.
mgjarrett Sep 16, 2024
acbf2fc
Black formatting.
mgjarrett Sep 16, 2024
53780e4
Update docstring.
mgjarrett Sep 16, 2024
2a7e4a1
Address review comments.
mgjarrett Sep 16, 2024
64d1d09
One more review comment.
mgjarrett Sep 16, 2024
37e4310
Remove commented code.
mgjarrett Sep 16, 2024
80d57ab
Remove kwargs
mgjarrett Sep 16, 2024
9457b49
Black formatting
mgjarrett Sep 16, 2024
6dca45a
Fix namespace errors.
mgjarrett Sep 16, 2024
4e2234b
Add getCircleInnerDiameter to RadialSegment.
mgjarrett Sep 16, 2024
48603a4
Update armi/reactor/components/__init__.py
mgjarrett Sep 16, 2024
3ccdc5b
Update doc/release/0.4.rst
mgjarrett Sep 16, 2024
2075f3a
Revert to main blocks.py
mgjarrett Sep 16, 2024
5b601f9
Revert import change.
mgjarrett Sep 16, 2024
15155be
Merge branch 'component_sort' of https://github.com/terrapower/armi i…
mgjarrett Sep 16, 2024
7733ad8
Revert more import changes.
mgjarrett Sep 16, 2024
9b61363
Revert more imports.
mgjarrett Sep 16, 2024
b87c1d1
Fix an import.
mgjarrett Sep 16, 2024
557a333
Merge branch 'main' into component_sort
john-science Oct 23, 2024
0fb4219
merging in main
john-science Nov 20, 2024
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
Prev Previous commit
Next Next commit
Revert "Refactor more unit tests."
This reverts commit 9cb98e5.
  • Loading branch information
mgjarrett committed Sep 16, 2024
commit d1db8950672f452299a5045ec6796556cc7dca27
13 changes: 8 additions & 5 deletions armi/bookkeeping/visualization/tests/test_vis.py
Original file line number Diff line number Diff line change
@@ -20,10 +20,11 @@

from armi import settings
from armi.bookkeeping.db import Database3
from armi.bookkeeping.visualization import utils, vtk, xdmf
from armi.bookkeeping.visualization import utils
from armi.bookkeeping.visualization import vtk
from armi.bookkeeping.visualization import xdmf
from armi.reactor import blocks
from armi.reactor.components.basicShapes import Circle
from armi.reactor.components.complexShapes import HoledSquare
from armi.reactor import components
from armi.reactor.tests import test_reactors
from armi.utils.directoryChangers import TemporaryDirectoryChanger

@@ -73,7 +74,7 @@ def setUpClass(cls):
cls.hexBlock = cls.r.core.getBlocks()[0]

cls.cartesianBlock = blocks.CartesianBlock("TestCartesianBlock", caseSetting)
cartesianComponent = HoledSquare(
cartesianComponent = components.HoledSquare(
"duct",
"UZr",
Tinput=273.0,
@@ -84,7 +85,9 @@ def setUpClass(cls):
)
cls.cartesianBlock.add(cartesianComponent)
cls.cartesianBlock.add(
Circle("clad", "HT9", Tinput=273.0, Thot=273.0, od=68.0, mult=169.0)
components.Circle(
"clad", "HT9", Tinput=273.0, Thot=273.0, od=68.0, mult=169.0
)
)

def test_dumpReactorVtk(self):
10 changes: 5 additions & 5 deletions armi/nucDirectory/tests/test_thermalScattering.py
Original file line number Diff line number Diff line change
@@ -16,8 +16,8 @@

from armi.nucDirectory import nuclideBases as nb
from armi.nucDirectory import thermalScattering as ts
from armi.reactor import blocks, components
from armi.reactor.components.basicShapes import Circle
from armi.reactor import blocks
from armi.reactor import components


def buildBlockWithTSL():
@@ -28,8 +28,8 @@ def buildBlockWithTSL():
cladDims = {"Tinput": 25.0, "Thot": 450, "od": 0.80, "id": 0.77, "mult": 127.0}
coolDims = {"Tinput": 25.0, "Thot": 400}

fuel = Circle("fuel", "UZr", **fuelDims)
clad = Circle("clad", "Graphite", **cladDims)
fuel = components.Circle("fuel", "UZr", **fuelDims)
clad = components.Circle("clad", "Graphite", **cladDims)
coolant = components.DerivedShape("coolant", "Sodium", **coolDims)

b.add(fuel)
@@ -96,7 +96,7 @@ def test_failOnMultiple(self):
"""HT9 has carbon in it with no TSL, while graphite has C with TSL. This should crash."""
b = buildBlockWithTSL()
cladDims = {"Tinput": 25.0, "Thot": 450, "od": 0.80, "id": 0.79, "mult": 127.0}
clad2 = Circle("clad", "HT9", **cladDims)
clad2 = components.Circle("clad", "HT9", **cladDims)
b.add(clad2)
with self.assertRaises(RuntimeError):
getNuclideThermalScatteringData(b)
13 changes: 7 additions & 6 deletions armi/physics/fuelCycle/tests/test_fuelHandlers.py
Original file line number Diff line number Diff line change
@@ -36,13 +36,14 @@
from armi.physics.neutronics.latticePhysics.latticePhysicsInterface import (
LatticePhysicsInterface,
)
from armi.reactor import assemblies, blocks, grids
from armi.reactor.components.basicShapes import Circle, Hexagon
from armi.reactor import assemblies, blocks, components, grids
from armi.reactor.flags import Flags
from armi.reactor.tests import test_reactors
from armi.reactor.zones import Zone
from armi.settings import caseSettings
from armi.tests import TEST_ROOT, ArmiTestHelper, mockRunLogs
from armi.tests import ArmiTestHelper
from armi.tests import mockRunLogs
from armi.tests import TEST_ROOT
from armi.utils import directoryChangers


@@ -85,10 +86,10 @@ def setUp(self):
nPins = 271

fuelDims = {"Tinput": 273.0, "Thot": 273.0, "od": 1.0, "id": 0.0, "mult": nPins}
fuel = Circle("fuel", "UZr", **fuelDims)
fuel = components.Circle("fuel", "UZr", **fuelDims)

cladDims = {"Tinput": 273.0, "Thot": 273.0, "od": 1.1, "id": 1.0, "mult": nPins}
clad = Circle("clad", "HT9", **cladDims)
clad = components.Circle("clad", "HT9", **cladDims)

interDims = {
"Tinput": 273.0,
@@ -97,7 +98,7 @@ def setUp(self):
"ip": 16.0,
"mult": 1.0,
}
interSodium = Hexagon("interCoolant", "Sodium", **interDims)
interSodium = components.Hexagon("interCoolant", "Sodium", **interDims)

# generate a block
self.block = blocks.HexBlock("TestHexBlock")
8 changes: 4 additions & 4 deletions armi/physics/neutronics/tests/test_crossSectionManager.py
Original file line number Diff line number Diff line change
@@ -621,10 +621,10 @@ def test_checkComponentConsistency(self):
blockCollection._checkComponentConsistency(refBlock, b)

def _makeComponents(self, multiplicity, densities):
from armi.reactor.components.basicShapes import Circle
from armi.reactor import components

baseComponents = self.r.core.getFirstBlock(Flags.CONTROL).getComponents()
controlComponent = Circle(
controlComponent = components.Circle(
"control",
baseComponents[0].material,
20.0,
@@ -633,7 +633,7 @@ def _makeComponents(self, multiplicity, densities):
od=0.6,
mult=multiplicity,
)
cladComponent = Circle(
cladComponent = components.Circle(
"clad",
baseComponents[2].material,
20.0,
@@ -642,7 +642,7 @@ def _makeComponents(self, multiplicity, densities):
od=0.7,
mult=multiplicity,
)
coolantComponent = Circle(
coolantComponent = components.Circle(
"coolant",
baseComponents[4].material,
20.0,
32 changes: 16 additions & 16 deletions armi/reactor/converters/tests/test_blockConverter.py
Original file line number Diff line number Diff line change
@@ -22,8 +22,6 @@
isDepletable,
)
from armi.reactor import blocks, components, grids
from armi.reactor.components.basicShapes import Circle, Hexagon
from armi.reactor.components.complexShapes import Helix
from armi.reactor.converters import blockConverters
from armi.reactor.flags import Flags
from armi.reactor.tests.test_blocks import loadTestBlock
@@ -52,8 +50,8 @@ def buildSimpleFuelBlockNegativeArea():
}
coolDims = {"Tinput": 25.0, "Thot": 400}

fuel = Circle("fuel", "UZr", **fuelDims)
clad = Circle("clad", "HT9", **cladDims)
fuel = components.Circle("fuel", "UZr", **fuelDims)
clad = components.Circle("clad", "HT9", **cladDims)
gapDims = {
"Tinput": 25,
"Thot": 600,
@@ -62,10 +60,10 @@ def buildSimpleFuelBlockNegativeArea():
"mult": 127.0,
}
gapDims["components"] = {"fuel": fuel, "clad": clad}
gap = Circle("gap", "Void", **gapDims)
duct = Hexagon("duct", "HT9", **ductDims)
gap = components.Circle("gap", "Void", **gapDims)
duct = components.Hexagon("duct", "HT9", **ductDims)
coolant = components.DerivedShape("coolant", "Sodium", **coolDims)
intercoolant = Hexagon("intercoolant", "Sodium", **intercoolantDims)
intercoolant = components.Hexagon("intercoolant", "Sodium", **intercoolantDims)

b.add(fuel)
b.add(gap)
@@ -378,7 +376,9 @@ def _checkAreaAndComposition(self, block, convertedBlock):
def _checkCiclesAreInContact(self, convertedCircleBlock):
numComponents = len(convertedCircleBlock)
self.assertGreater(numComponents, 1)
self.assertTrue(all(isinstance(c, Circle) for c in convertedCircleBlock))
self.assertTrue(
all(isinstance(c, components.Circle) for c in convertedCircleBlock)
)

lastCompOD = None
lastComp = None
@@ -419,7 +419,7 @@ def test_fromRingOfRods(self):

def _buildJoyoFuel():
"""Build some JOYO components."""
fuel = Circle(
fuel = components.Circle(
name="fuel",
material="UO2",
Tinput=20.0,
@@ -428,7 +428,7 @@ def _buildJoyoFuel():
id=0.0,
mult=91,
)
clad = Circle(
clad = components.Circle(
name="clad",
material="HT9",
Tinput=20.0,
@@ -475,16 +475,16 @@ def buildControlBlockWithLinkedNegativeAreaComponent():
}
coolDims = {"Tinput": 25.0, "Thot": 400}

control = Circle("control", "UZr", **controlDims)
clad = Circle("clad", "HT9", **cladDims)
control = components.Circle("control", "UZr", **controlDims)
clad = components.Circle("clad", "HT9", **cladDims)
# This sets up the linking of the bond to the fuel and the clad components.
bond = Circle(
bond = components.Circle(
"bond", "Sodium", components={"control": control, "clad": clad}, **bondDims
)
wire = Helix("wire", "HT9", **wireDims)
duct = Hexagon("duct", "HT9", **ductDims)
wire = components.Helix("wire", "HT9", **wireDims)
duct = components.Hexagon("duct", "HT9", **ductDims)
coolant = components.DerivedShape("coolant", "Sodium", **coolDims)
intercoolant = Hexagon("intercoolant", "Sodium", **intercoolantDims)
intercoolant = components.Hexagon("intercoolant", "Sodium", **intercoolantDims)

b.add(control)
b.add(bond)