terrapower / armi

An open-source nuclear reactor analysis automation framework that helps design teams increase efficiency and quality
https://terrapower.github.io/armi/
Apache License 2.0
230 stars 90 forks source link

Block.getNumPins broken for C5G7 model :: multiple cladding components per lattice site #1946

Open drewj-tp opened 2 weeks ago

drewj-tp commented 2 weeks ago

If you load the C5G7 test reactor and grab an assembly, you get a hilariously large number of pins

>>> r = armi.init(fName="armi/tests/c5g7/c5g7-settings.yaml").r
>>> fuelBlock = r.core[0][0]
>>> fuelBlock.getNumPins()
528

In that model, there are two clad components per lattice site

https://github.com/terrapower/armi/blob/c6f46e5d04dc265e7a8e470fdd1977c9a4e16e3e/armi/tests/c5g7/c5g7-blueprints.yaml#L86-L114

So you double count the sites. There are 17x17 total lattice sites, some of which are empty, so the upper bound on "real" pins is 289

Originally posted by @drewj-tp in https://github.com/terrapower/armi/discussions/1900#discussioncomment-10908081

john-science commented 1 week ago

A great place for to start would be to write a unit test that can go with the existing C5G7 unit test for this exact thing:

https://github.com/terrapower/armi/blob/c6f46e5d04dc265e7a8e470fdd1977c9a4e16e3e/armi/tests/test_lwrInputs.py#L26-L29

I see you use armi.init() in the above example, that is a no-no for unit tests, so I suggest something like this:

    def test_numFuelPinsC5G7(self):
        _o, r = test_reactors.loadTestReactor(
            os.path.join(TEST_ROOT, "c5g7"),
            inputFileName=TEST_INPUT_TITLE,
        )
        b = r.core.getFirstBlock(Flags.FUEL)
        self.assertEqual(b.getNumPins(), 264)

Or something like that.