Skip to content

Commit

Permalink
tweaking docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
john-science authored Feb 6, 2025
1 parent fcda537 commit 760f9d2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
7 changes: 2 additions & 5 deletions armi/materials/material.py
Original file line number Diff line number Diff line change
Expand Up @@ -758,11 +758,8 @@ class Fluid(Material):
"""A material that fills its container. Could also be a gas."""

def __init_subclass__(cls):
# Undo the parent-aware density wrapping
# Justification: fluids do not expand in the same way solids expand so
# fluid.density(T) is an appropriate representation of the density of
# the fluid. This does not hold for solids because of the thermal expansion
# mechanics imposed by the rest of the framework
# Undo the parent-aware density wrapping. Fluids do not expand in the same way solids, so
# Fluid.density(T) is correct. This does not hold for solids because they thermalaly expand.
if hasattr(cls.density, "__wrapped__"):
cls.density = cls.density.__wrapped__

Expand Down
14 changes: 7 additions & 7 deletions armi/materials/tests/test_fluids.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ class MySolid(Material):
def test_fluidDensityWrapperNoWarning(self):
"""Test that Component.material.density does not raise a warning for fluids.
The ARMI Framework contains a mechanism to warn users if they as for the density
of a material when that material is attached to a component, e.g., ``comp.material.density()``.
The problem here is the component is the source of truth for volume and composition. It stores
dimensions, which can be thermally expanded according to the material, and number densities, which
may be updated through operation. Much of the framework operates on ``component.density`` and
other ``Component`` methods for mass accounting. However, ``comp.material.density`` does
not know about the new composition or volumes and can diverge from ``component.density``.
The ARMI Framework contains a mechanism to warn users if they ask for the density of a
material attached to a component, e.g., ``comp.material.density()``. The problem is the
component is the source of truth for volume and composition. It stores dimensions, which can
be thermally expanded according to the material and number densities, which may be updated
during operation. Much of the framework operates on ``Component.density`` and other
``Component`` methods for mass accounting. However, ``comp.material.density`` does not know
about the new composition or volumes and can diverge from ``component.density``.
Additionally, the framework does not do any thermal expansion on fluids. So the above calls to
``component.material.density`` are warranted if the material is a fluid.
Expand Down

0 comments on commit 760f9d2

Please sign in to comment.