Open albeanth opened 4 months ago
Just found this method in blocks.py as well which is likely a more useful method to retrieve the number of pins. If one wanted to maintain functionality on the Assembly and Core levels, I would suggest that specific methods be written on those classes to loop over the appropriate composites (or maybe this method on block.py is generalized to the Composite class, I'm not sure).
I think the name getNumComponents()
is sufficiently generic, and accurate to it's goal.
ArmiObject.getNumComponts()
doesn't just get "pins". As the docstring says, it finds all the sub-components of the given type.
In blocks.py
, we use this to get the number of fuel sub-components, so we can calculate the area of the cladding.
Looking downstream, this is used to get number of pins, sure, but it is also used to find the number of clad or duct items in an area.
It's just weird to me. If we have a typical pinned fuel block consisting of the following:
I, personally, would expect getNumComponents(Flags.FUEL)
to return 1. There's only 1 fuel component... Now if that method was called something like getTotalMultForComponentsOfType(Flags.FUEL)
then that would clearly return 169 and would be way clearer, imo.
There's also a scenario that doesn't look to be tested (at least not in test_block.py). Consider the case in which a block has multiple types of pins (e.g., a mix of fuel and reflector pins). In this case it looks like getNumComponents
has better/more predictable behavior than getNumPins
- so that's fun lol. Check out this feature branch I made to play with this. Let me know what you think?
https://github.com/terrapower/armi/tree/playWithPinNumbers
Also, as an aside:
getNumComponents
is tested in test_blocks.py and looks to only be used on blocks in ARMI and one major in-house project. We could maybe/probably make getNumComponents
a Block method.
@albeanth examples are here:
Here I see two entirely separate concerns:
getNumComponents()
returns values respecting multiplicity, but Tony did not expect that or finds that counterintuitive. (Tony mostly uses this method to replace getNumPins()
.)getNumPins()
does not work correct, or as Tony expected.My thoughts:
getNumComponents()
respects multiplicity. We do in many, many places in ARMI, and if we didn't, multiplicity would be meaningless. The ARMI Reactor model is designed with multiplicity in mind at nearly all levels.I could happily call this out even more explicitly in the docstring, if you like.This is called out explicitly in the requirement, but I can't say I fully understand WHY. The only way this makes sense is if Tony's example above is erroneous, because we would not normally have two different components with different pin types in the same block. But if THAT were true... why would we need the "max" in this method anyway?
why would we need the "max" in this method anyway?
No idea.
Coming across this again with pin-related level work... It's a bit frustrating, but maybe it's just my own problem! I'll just pretend the blocks.getNumPins()
doesn't exist.... 🤷
As I see it, in general, an ARMI Component != a pin (yes you could define Component as a single pin, but in my experience this is not generally the case). That said, I think this method name is misleading. Instead of
getNumComponents
I would advocate that this begetNumPins
.https://github.com/terrapower/armi/blob/f535add83f2a1322d455b93b5fc6c827731531e3/armi/reactor/composites.py#L2369-L2372