mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 13:45:36 -04:00
Option to divide material volumes by pin divisions
This commit is contained in:
parent
50ea1ed02a
commit
044ac4ce2a
2 changed files with 23 additions and 1 deletions
|
|
@ -448,7 +448,8 @@ def subdivide(surfaces):
|
|||
return regions
|
||||
|
||||
|
||||
def pin(surfaces, materials, subdivisions=None, universe_id=None, name=""):
|
||||
def pin(surfaces, materials, subdivisions=None, divide_vols=True,
|
||||
universe_id=None, name=""):
|
||||
"""Convenience function for building a fuel pin
|
||||
|
||||
Parameters
|
||||
|
|
@ -466,6 +467,11 @@ def pin(surfaces, materials, subdivisions=None, universe_id=None, name=""):
|
|||
Dictionary describing which rings to subdivide and how
|
||||
many times. Keys are indexes of the annular rings
|
||||
to be divided. Will construct equal area rings
|
||||
divide_vols : bool
|
||||
If this evaluates to ``True``, then volumes of subdivided
|
||||
materials will also be divided by the number of divisions.
|
||||
Otherwise the volume of the original material will not be
|
||||
modified before subdivision
|
||||
universe_id : None or int
|
||||
Identifier for this universe
|
||||
name : str
|
||||
|
|
@ -555,6 +561,10 @@ def pin(surfaces, materials, subdivisions=None, universe_id=None, name=""):
|
|||
|
||||
surfaces = (
|
||||
surfaces[:ring_index] + new_surfs + surfaces[ring_index:])
|
||||
|
||||
if divide_vols and materials[ring_index].volume is not None:
|
||||
materials[ring_index].volume /= nr
|
||||
|
||||
materials = (
|
||||
materials[:ring_index]
|
||||
+ [materials[ring_index].clone() for _i in range(nr - 1)]
|
||||
|
|
|
|||
|
|
@ -23,7 +23,9 @@ def get_pin_radii(pin_univ):
|
|||
@pytest.fixture
|
||||
def pin_mats():
|
||||
fuel = openmc.Material(name="UO2")
|
||||
fuel.volume = 100
|
||||
clad = openmc.Material(name="zirc")
|
||||
clad.volume = 100
|
||||
water = openmc.Material(name="water")
|
||||
return fuel, clad, water
|
||||
|
||||
|
|
@ -73,6 +75,11 @@ def test_subdivide(pin_mats, good_radii, surf_type):
|
|||
div0 = pin(surfs, pin_mats, {0: N})
|
||||
assert len(div0.cells) == len(pin_mats) + N - 1
|
||||
|
||||
# Check volume of fuel material
|
||||
for mid, mat in div0.get_all_materials().items():
|
||||
if mat.name == "UO2":
|
||||
assert mat.volume == pytest.approx(100 / N)
|
||||
|
||||
# check volumes of new rings
|
||||
radii = get_pin_radii(div0)
|
||||
bounds = [0] + radii[:N]
|
||||
|
|
@ -83,6 +90,11 @@ def test_subdivide(pin_mats, good_radii, surf_type):
|
|||
new_pin = pin(surfs, pin_mats, {1: N})
|
||||
assert len(new_pin.cells) == len(pin_mats) + N - 1
|
||||
|
||||
# Check volume of clad material
|
||||
for mid, mat in div0.get_all_materials().items():
|
||||
if mat.name == "zirc":
|
||||
assert mat.volume == pytest.approx(100 / N)
|
||||
|
||||
# check volumes of new rings
|
||||
radii = get_pin_radii(new_pin)
|
||||
sqrs = numpy.square(radii[:N + 1])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue