Skip to content

Commit

Permalink
Improving Helix constructor to be more correct (terrapower#558)
Browse files Browse the repository at this point in the history
  • Loading branch information
john-science authored and scottyak committed Oct 27, 2022
1 parent 74d0efe commit 83ceb82
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 4 deletions.
8 changes: 4 additions & 4 deletions armi/reactor/components/complexShapes.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,10 @@ def __init__(
material,
Tinput,
Thot,
od=None,
axialPitch=None,
mult=None,
helixDiameter=None,
od,
axialPitch,
helixDiameter,
mult=1.0,
id=0.0,
modArea=None,
isotopics=None,
Expand Down
47 changes: 47 additions & 0 deletions armi/reactor/tests/test_components.py
Original file line number Diff line number Diff line change
Expand Up @@ -821,6 +821,53 @@ def test_dimensionThermallyExpands(self):
cur = d in self.component.THERMAL_EXPANSION_DIMS
self.assertEqual(cur, ref[i])

def test_validParameters(self):
"""testing the Helix class performs as expected with various inputs"""
# stupid/simple inputs
h = Helix("thing", "Cu", 0, 0, 1, 1, 1)
self.assertEqual(h.getDimension("axialPitch"), 1)

# standard case / inputs ordered well
h = Helix(
"what",
"Cu",
Tinput=25.0,
Thot=425.0,
id=0.1,
od=0.35,
mult=1.0,
axialPitch=1.123,
helixDiameter=1.5,
)
self.assertTrue(1.123 < h.getDimension("axialPitch") < 1.15)

# inputs ordered crazy
h = Helix(
material="Cu",
id=0.1,
mult=1.0,
Tinput=25.0,
Thot=425.0,
axialPitch=1.123,
name="stuff",
od=0.35,
helixDiameter=1.5,
)
self.assertTrue(1.123 < h.getDimension("axialPitch") < 1.15)

# missing helixDiameter input
with self.assertRaises(TypeError):
h = Helix(
name="helix",
material="Cu",
Tinput=25.0,
Thot=425.0,
id=0.1,
od=0.35,
mult=1.0,
axialPitch=1.123,
)


class TestSphere(TestShapedComponent):
componentCls = Sphere
Expand Down

0 comments on commit 83ceb82

Please sign in to comment.