-
Notifications
You must be signed in to change notification settings - Fork 582
Generalize RotationalPeriodicBC for X-, Y-, or Z-axis #3591
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
lewisgross1296
wants to merge
6
commits into
openmc-dev:develop
Choose a base branch
from
lewisgross1296:generalize-periodic-bc
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.
Open
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
7c7727a
allow RotationalPeriodicBC around x,y, or z axis
lewisgross1296 d0da4dc
added two periodic cylinders with 1/6th symmetry to regression tests.…
lewisgross1296 47c9ac3
syntax corrections
lewisgross1296 995f1ea
apply style locally
lewisgross1296 dbd1a42
remove lingering check for z periodicity. get tests actually setup co…
lewisgross1296 ba9b54b
acccount for flip in sign for y rotation. assign components of new_r …
lewisgross1296 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
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
Empty file.
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,91 @@ | ||
| import openmc | ||
| import numpy as np | ||
| import pytest | ||
| from openmc.utility_funcs import change_directory | ||
| from tests.testing_harness import PyAPITestHarness | ||
|
|
||
|
|
||
| @pytest.fixture | ||
| def xcyl_model(): | ||
| model = openmc.Model() | ||
| # Define materials | ||
| fuel = openmc.Material() | ||
| fuel.add_nuclide('U235', 0.2) | ||
| fuel.add_nuclide('U238', 0.8) | ||
| fuel.set_density('g/cc', 19.1) | ||
| model.materials = openmc.Materials([fuel]) | ||
|
|
||
| # Define geometry | ||
| # finite cylinder | ||
| x_min = openmc.XPlane(x0=0.0, boundary_type='reflective') | ||
| x_max = openmc.XPlane(x0=20.0, boundary_type='reflective') | ||
| x_cyl = openmc.XCylinder(r=20.0,boundary_type='vacuum') | ||
| # slice cylinder for periodic BC | ||
| periodic_bounding_yplane = openmc.YPlane(y0=0, boundary_type='periodic') | ||
| periodic_bounding_plane = openmc.Plane( | ||
| a=0.0, b=-np.sqrt(3) / 3, c=1, boundary_type='periodic', | ||
| ) | ||
| sixth_cyl_cell = openmc.Cell(1, fill=fuel, region = | ||
| +x_min &- x_max & -x_cyl & +periodic_bounding_yplane & +periodic_bounding_plane) | ||
| periodic_bounding_yplane.periodic_surface = periodic_bounding_plane | ||
| periodic_bounding_plane.periodic_surface = periodic_bounding_yplane | ||
|
|
||
| model.geometry = openmc.Geometry([sixth_cyl_cell]) | ||
|
|
||
|
|
||
| # Define settings | ||
| model.settings.particles = 1000 | ||
| model.settings.batches = 4 | ||
| model.settings.inactive = 0 | ||
| model.settings.source = openmc.IndependentSource(space=openmc.stats.Box( | ||
| (0, 0, 0), (20, 20, 20)) | ||
| ) | ||
| return model | ||
|
|
||
| @pytest.fixture | ||
| def ycyl_model(): | ||
| model = openmc.Model() | ||
| # Define materials | ||
| fuel = openmc.Material() | ||
| fuel.add_nuclide('U235', 0.2) | ||
| fuel.add_nuclide('U238', 0.8) | ||
| fuel.set_density('g/cc', 19.1) | ||
| model.materials = openmc.Materials([fuel]) | ||
|
|
||
| # Define geometry | ||
| # finite cylinder | ||
| y_min = openmc.YPlane(y0=0.0, boundary_type='reflective') | ||
| y_max = openmc.YPlane(y0=20.0, boundary_type='reflective') | ||
| y_cyl = openmc.YCylinder(r=20.0,boundary_type='vacuum') | ||
| # slice cylinder for periodic BC | ||
| periodic_bounding_xplane = openmc.XPlane(x0=0, boundary_type='periodic') | ||
| periodic_bounding_plane = openmc.Plane( | ||
| a=-np.sqrt(3) / 3, b=0.0, c=1, boundary_type='periodic', | ||
| ) | ||
| sixth_cyl_cell = openmc.Cell(1, fill=fuel, region = | ||
| +y_min &- y_max & -y_cyl & +periodic_bounding_xplane & +periodic_bounding_plane) | ||
| periodic_bounding_xplane.periodic_surface = periodic_bounding_plane | ||
| periodic_bounding_plane.periodic_surface = periodic_bounding_xplane | ||
| model.geometry = openmc.Geometry([sixth_cyl_cell]) | ||
|
|
||
|
|
||
| # Define settings | ||
| model.settings.particles = 1000 | ||
| model.settings.batches = 4 | ||
| model.settings.inactive = 0 | ||
| model.settings.source = openmc.IndependentSource(space=openmc.stats.Box( | ||
| (0, 0, 0), (20, 20, 20)) | ||
| ) | ||
| return model | ||
|
|
||
| def test_xcyl(xcyl_model): | ||
| with change_directory("xcyl_model"): | ||
| openmc.reset_auto_ids() | ||
| harness = PyAPITestHarness('statepoint.4.h5', xcyl_model) | ||
| harness.main() | ||
|
|
||
| def test_ycyl(ycyl_model): | ||
| with change_directory("ycyl_model"): | ||
| openmc.reset_auto_ids() | ||
| harness = PyAPITestHarness('statepoint.4.h5', ycyl_model) | ||
| harness.main() |
29 changes: 29 additions & 0 deletions
29
tests/regression_tests/periodic_cyls/xcyl_model/inputs_true.dat
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,29 @@ | ||
| <?xml version='1.0' encoding='utf-8'?> | ||
| <model> | ||
| <materials> | ||
| <material id="1" depletable="true"> | ||
| <density value="19.1" units="g/cc"/> | ||
| <nuclide name="U235" ao="0.2"/> | ||
| <nuclide name="U238" ao="0.8"/> | ||
| </material> | ||
| </materials> | ||
| <geometry> | ||
| <cell id="1" material="1" region="1 -2 -3 4 5" universe="1"/> | ||
| <surface id="1" type="x-plane" boundary="reflective" coeffs="0.0"/> | ||
| <surface id="2" type="x-plane" boundary="reflective" coeffs="20.0"/> | ||
| <surface id="3" type="x-cylinder" boundary="vacuum" coeffs="0.0 0.0 20.0"/> | ||
| <surface id="4" type="y-plane" boundary="periodic" coeffs="0" periodic_surface_id="5"/> | ||
| <surface id="5" type="plane" boundary="periodic" coeffs="0.0 -0.5773502691896257 1 0.0" periodic_surface_id="4"/> | ||
| </geometry> | ||
| <settings> | ||
| <run_mode>eigenvalue</run_mode> | ||
| <particles>1000</particles> | ||
| <batches>4</batches> | ||
| <inactive>0</inactive> | ||
| <source type="independent" strength="1.0" particle="neutron"> | ||
| <space type="box"> | ||
| <parameters>0 0 0 20 20 20</parameters> | ||
| </space> | ||
| </source> | ||
| </settings> | ||
| </model> |
Empty file.
29 changes: 29 additions & 0 deletions
29
tests/regression_tests/periodic_cyls/ycyl_model/inputs_true.dat
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,29 @@ | ||
| <?xml version='1.0' encoding='utf-8'?> | ||
| <model> | ||
| <materials> | ||
| <material id="1" depletable="true"> | ||
| <density value="19.1" units="g/cc"/> | ||
| <nuclide name="U235" ao="0.2"/> | ||
| <nuclide name="U238" ao="0.8"/> | ||
| </material> | ||
| </materials> | ||
| <geometry> | ||
| <cell id="1" material="1" region="1 -2 -3 4 5" universe="1"/> | ||
| <surface id="1" type="y-plane" boundary="reflective" coeffs="0.0"/> | ||
| <surface id="2" type="y-plane" boundary="reflective" coeffs="20.0"/> | ||
| <surface id="3" type="y-cylinder" boundary="vacuum" coeffs="0.0 0.0 20.0"/> | ||
| <surface id="4" type="x-plane" boundary="periodic" coeffs="0" periodic_surface_id="5"/> | ||
| <surface id="5" type="plane" boundary="periodic" coeffs="-0.5773502691896257 0.0 1 0.0" periodic_surface_id="4"/> | ||
| </geometry> | ||
| <settings> | ||
| <run_mode>eigenvalue</run_mode> | ||
| <particles>1000</particles> | ||
| <batches>4</batches> | ||
| <inactive>0</inactive> | ||
| <source type="independent" strength="1.0" particle="neutron"> | ||
| <space type="box"> | ||
| <parameters>0 0 0 20 20 20</parameters> | ||
| </space> | ||
| </source> | ||
| </settings> | ||
| </model> |
Empty file.
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.
Just realized that my "generalization" was based on the z-case that existed here before. The x and z cases should be similar but the y rotation matrix has the sign flipped, which I think explains why I'm seeing one test failure in this way. If we condition on

zero_axis_idxI think I can get it right