Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed volume allocation in openmc.deplete.Operator._differentiate_burnable_mats #1392

Merged
merged 2 commits into from
Nov 5, 2019

Conversation

awgolas
Copy link
Contributor

@awgolas awgolas commented Oct 31, 2019

When the variable diff_burnable_mats=True was specified when calling openmc.deplete.Operator(), the volume of each material instance was specified as the same as the non-differentiated burnable materials, e.g, if the given burnable material had 3 instances:

<material depletable="true" id="10001" name="fuel" volume="435">
...
  </material>

The diff_burnable_mats=True would produce differentiated burnable materials:

<material depletable="true" id="1" name="fuel" volume="435">
...</material>

<material depletable="true" id="2" name="fuel" volume="435">
...</material>

<material depletable="true" id="3" name="fuel" volume="435">
...</material>

This changed the material instance creation such that the sum of the differentiated material volumes is the same as the original undifferentiated material volume.

Changed burnable material volume to volume of material instance
@awgolas awgolas requested a review from drewejohnson as a code owner October 31, 2019 21:19
@liangjg
Copy link
Contributor

liangjg commented Nov 1, 2019

@awgolas Yes, originally I thought the users specify the volume as the volume of a single instance (not the total volume) when they are going to differentiate the material. That's why the heavy_metal is accumulated, in L345.

If we want to change this logic -- assume the users are specifying the total volume, I suggest changing the differentiated materials themselves when they are cloned (L312).

Copy link
Contributor

@drewejohnson drewejohnson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pointing this out. I understand the confusion here, as the documentation isn't clear how the volumes are treated for the cloned materials. Both approaches I think are equally valid, e.g.

  1. User-specified volume is for a single instance. Cloned materials copy the volume as well
  2. User-specified volume is the total volume this material occupies. Cloned materials take an equal share of the volume (as you proposed)

I'm not convinced that either is worse, but our documentation should indicate what method we choose.
If you want to proceed with this PR, please make sure the test suite passes. The issue appears to be the materials don't know how many instances when you scale the volumes

@awgolas
Copy link
Contributor Author

awgolas commented Nov 1, 2019

@liangjg
I wasn't sure what volume was supposed to be specified at first. I had originally just used a script which used the stochastic volume calculation results in order to determine the total volume of the fuel in the assembly. I had assumed that diff_burnable_mats also differentiated the volume up as well.

When I've created geometries with fuel cells in which the volume of the fuel cell region is not constant, I've used the same material id in each case. If I were to run a depletion calculation in which the material volume specified is equal to the total volume of the material, does OpenMC perform the nuclide accumulation calculations as if each cell volume is equal to the total volume of the material?

@drewejohnson
Is it best practice to specify different material IDs if the fuel cell volume varies? If so, I think I may have just created a problem which didn't exist. It's also worth noting that mat.volume/mat.num_instances would not solve that problem either. However, I think that this would benefit if there was a check for consistency between the total volume and the differentiated material volume. I can close this and resubmit the problem into the issue section if you think that's appropriate.

@liangjg
Copy link
Contributor

liangjg commented Nov 2, 2019

@awgolas I agree it is more self-consistent to assume the input volume is always the total volume, no matter whether the differetiation is on or off.
But I think it is better to make changes in the function _differentiate_burnable_mats(), so that the update of volume is only performed when differetiation is on and geometry.determine_paths() is called (that's why your test fails). Code changes are like the following:

--- a/openmc/deplete/operator.py
+++ b/openmc/deplete/operator.py
@@ -309,7 +309,12 @@ class Operator(TransportOperator):
             # Assign distribmats to cells
             for cell in self.geometry.get_all_material_cells().values():
                 if cell.fill in distribmats and cell.num_instances > 1:
-                    cell.fill = [cell.fill.clone()
+                    mat = cell.fill
+                    if mat.volume is None:
+                        raise RuntimeError("Volume not specified for depletable "
+                                           "material with ID={}.".format(mat.id))
+                    mat.volume /= mat.num_instances
+                    cell.fill = [mat.clone()
                                  for i in range(cell.num_instances)]

@drewejohnson
Copy link
Contributor

@liangjg has made excellent points and I agree with their proposed implementation. If you want to adjust the PR accordingly, please do so. Otherwise we can raise this as a separate issue / PR later

@awgolas awgolas changed the title Fixed openmc.deplete.Operator()._get_burnable_mats() Fixed volume allocation in openmc.deplete.Operator._differentiate_burnable_mats Nov 4, 2019
@awgolas awgolas requested a review from drewejohnson November 4, 2019 19:09
@drewejohnson drewejohnson merged commit 8a77ee7 into openmc-dev:develop Nov 5, 2019
@drewejohnson
Copy link
Contributor

Thank you for this! I will put up a PR shortly with some changes to the documentation 👍

drewejohnson pushed a commit to drewejohnson/openmc that referenced this pull request Nov 5, 2019
In PR openmc-dev#1392, it was revealed that the distribution of material
volumes with ``diff_burnable_mats`` was not clear. In that PR,
the Operator now divides the volume of the shared material
equally across all identical and newly created instances.
This commit adds some clarifying language into the Operator
docstring and depletion users guide on the handling
of volumes across repeated materials.
@awgolas awgolas deleted the deplete_burnable_mats branch November 6, 2019 00:58
drewejohnson pushed a commit to drewejohnson/openmc that referenced this pull request Nov 8, 2019
In PR openmc-dev#1392, it was revealed that the distribution of material
volumes with ``diff_burnable_mats`` was not clear. In that PR,
the Operator now divides the volume of the shared material
equally across all identical and newly created instances.
This commit adds some clarifying language into the Operator
docstring and depletion users guide on the handling
of volumes across repeated materials.
makeclean pushed a commit to makeclean/openmc that referenced this pull request Nov 28, 2019
In PR openmc-dev#1392, it was revealed that the distribution of material
volumes with ``diff_burnable_mats`` was not clear. In that PR,
the Operator now divides the volume of the shared material
equally across all identical and newly created instances.
This commit adds some clarifying language into the Operator
docstring and depletion users guide on the handling
of volumes across repeated materials.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants