-
Notifications
You must be signed in to change notification settings - Fork 621
Approximate multigroup velocity #3766
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
Open
GuySten
wants to merge
50
commits into
openmc-dev:develop
Choose a base branch
from
GuySten:check-xs-vacuum
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+143
−13
Open
Changes from 48 commits
Commits
Show all changes
50 commits
Select commit
Hold shift + click to select a range
3e45571
multigroup inverse-speed data for void regions
GuySten 1d19ba0
wip
GuySten 6c51c14
add another warning
GuySten 51dfb76
wip
GuySten 3d22ce7
fix typo and import
GuySten a1b09c2
fix typo
GuySten 7ac31b3
fix typo
GuySten 6e358d1
fix typo
GuySten ba43542
move around code
GuySten 59c0b50
rename void to approx void in random ray example
GuySten 6568952
update inputs
GuySten fb469c6
more fixes
GuySten 5672eac
use default velocity approx when imberse velocity data is missing
GuySten 9ef5648
wip
GuySten 05abd9c
wip
GuySten 957d098
wip
GuySten 59b4c00
revert warning
GuySten a954f5d
Merge branch 'develop' into check-xs-vacuum
GuySten a78f7d6
simplify code
GuySten a394950
off by one
GuySten 68822cf
fix xt code
GuySten aa1703f
fix typo
GuySten 4998e8a
simplify code
GuySten 28c044f
ran clang format
GuySten 58c0090
ensure minimum neutron energy
GuySten 26e6c6d
ensure minimum neutron energy in tests
GuySten 4571f8d
dos2unix
GuySten 2c98286
fix missing file
GuySten c4f149f
simplify code
GuySten 0c057df
Remove group edge validation checks
GuySten db2c48c
simplify code
GuySten 1f653f7
close hdf5 groups
GuySten e56b6ed
update test results
GuySten 0854ff5
Merge branch 'develop' into check-xs-vacuum
GuySten d5af24c
update
GuySten 1861ab1
fix some errors
GuySten fe7e5a3
another simplification
GuySten d4f7c34
Revert "another simplification"
GuySten f9a7e38
rafactor mass method
GuySten ab6c770
further simplification
GuySten 3d91c0d
fix some errors
GuySten c017a90
revert test
GuySten f8da4ff
decrease number of particles
GuySten f7b0fd4
try further simplification
GuySten efa9250
Revert "try further simplification"
GuySten d16f89a
added docs
GuySten 03af12d
Update cross_sections.rst
nelsonag 2226113
improved docs according to reviewer suggestions
GuySten 76edf35
Fix documentation
paulromano 33b021b
Merge branch 'develop' into pr/GuySten/3766
paulromano File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| import openmc | ||
| import numpy as np | ||
| import pytest | ||
|
|
||
| @pytest.fixture | ||
| def one_group_lib(): | ||
| groups = openmc.mgxs.EnergyGroups([0.0, 20.0e6]) | ||
| xsdata = openmc.XSdata('slab_mat', groups) | ||
| xsdata.order = 0 | ||
| xsdata.set_total([0.0]) | ||
| xsdata.set_absorption([0.0]) | ||
| xsdata.set_scatter_matrix([[[0.0]]]) | ||
|
|
||
| mg_library = openmc.MGXSLibrary(groups) | ||
| mg_library.add_xsdata(xsdata) | ||
| name = 'mgxs.h5' | ||
| mg_library.export_to_hdf5(name) | ||
| yield name | ||
|
|
||
| @pytest.fixture | ||
| def slab_model(one_group_lib): | ||
| model = openmc.Model() | ||
| mat = openmc.Material(name='slab_material') | ||
| mat.set_density('macro', 1.0) | ||
| mat.add_macroscopic('slab_mat') | ||
|
|
||
| model.materials = openmc.Materials([mat]) | ||
| model.materials.cross_sections = one_group_lib | ||
|
|
||
| x_min = openmc.XPlane(x0=0.0, boundary_type='vacuum') | ||
| x_max = openmc.XPlane(x0=10.0, boundary_type='vacuum') | ||
|
|
||
| y_min = openmc.YPlane(y0=-10.0, boundary_type='vacuum') | ||
| y_max = openmc.YPlane(y0=10.0, boundary_type='vacuum') | ||
| z_min = openmc.ZPlane(z0=-10.0, boundary_type='vacuum') | ||
| z_max = openmc.ZPlane(z0=19.0, boundary_type='vacuum') | ||
|
|
||
| cell = openmc.Cell(fill=mat, region=+z_min & -x_max & +y_min & -y_max & +z_min & -z_max) | ||
| model.geometry = openmc.Geometry([cell]) | ||
|
|
||
| model.settings = openmc.Settings() | ||
| model.settings.energy_mode = 'multi-group' | ||
| model.settings.run_mode = 'fixed source' | ||
| model.settings.batches = 3 | ||
| model.settings.particles = 10 | ||
|
|
||
| source = openmc.IndependentSource() | ||
| source.space = openmc.stats.Point((5.0, 0.0, 0.0)) | ||
| model.settings.source = source | ||
| return model | ||
|
|
||
| def test_inverse_velocity(run_in_tmpdir, slab_model): | ||
| tally = openmc.Tally() | ||
| tally.scores = ['flux','inverse-velocity'] | ||
| slab_model.tallies = [tally] | ||
| slab_model.run(apply_tally_results=True) | ||
| inverse_velocity = tally.mean.squeeze()[1]/tally.mean.squeeze()[0] | ||
|
|
||
| assert inverse_velocity == pytest.approx(1.6144e-5, rel=1e-4) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add under what conditions this solution is derived. I could have added it but I want it to come from you so I dont incorrectly state the assumptions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One more item, add a statement in the docs/source/io_formats/mgxs_library.rst file, under inverse-velocity that says what happens when the value is not provided but a tally of such data is requested. Feel free to point to this cross_sections.rst as much as you wish.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.