Repository navigation
Streamline use of CompositeSurface with SurfaceFilter #3167
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
Changes from 1 commit
f07974e
e4c0ee8
c418c32
9f03bcc
f0cee3a
a7fa568
7c8df81
906763d
7d2e116
066f2a4
f37d7d9
2968a5e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -294,3 +294,43 @@ def test_tabular_from_energyfilter(): | |
|
|
||
| tab = efilter.get_tabular(values=np.array([10, 10, 5]), interpolation='linear-linear') | ||
| assert tab.interpolation == 'linear-linear' | ||
|
|
||
|
|
||
| def test_SurfaceFilter_CompositeSurface(run_in_tmpdir, box_model): | ||
| m = openmc.Material() | ||
| m.add_nuclide('U235', 1.0) | ||
| m.set_density('g/cm3', 1.0) | ||
|
|
||
| box = openmc.model.RectangularPrism(10., 10., boundary_type='vacuum') | ||
| c = openmc.Cell(fill=m, region=-box) | ||
| box_model.geometry.root_universe = openmc.Universe(cells=[c]) | ||
|
|
||
| tally = openmc.Tally() | ||
| tally.filters = [openmc.SurfaceFilter(box.get_surfaces())] | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think better yet we'd be able to pass a
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I think it is clearer. It is already done. I thought it was easier to change the |
||
| tally.scores = ['current'] | ||
|
|
||
| box_model.tallies = [tally] | ||
|
|
||
| sp_name = box_model.run() | ||
|
|
||
| with openmc.StatePoint(sp_name) as sp: | ||
| current = sp.tallies[tally.id] | ||
| assert len(current.get_pandas_dataframe()['surface']) == 4 | ||
| assert np.all(current.get_pandas_dataframe()['surface'] == box.get_id_surfaces()) | ||
|
|
||
| box = openmc.model.RectangularParallelepiped(*[-10, 10]*3, boundary_type='vacuum') | ||
| c = openmc.Cell(fill=m, region=-box) | ||
| box_model.geometry.root_universe = openmc.Universe(cells=[c]) | ||
|
|
||
| tally = openmc.Tally() | ||
| tally.filters = [openmc.SurfaceFilter(box.get_surfaces())] | ||
| tally.scores = ['current'] | ||
|
|
||
| box_model.tallies = [tally] | ||
|
|
||
| sp_name = box_model.run() | ||
|
|
||
| with openmc.StatePoint(sp_name) as sp: | ||
| current = sp.tallies[tally.id] | ||
| assert len(current.get_pandas_dataframe()['surface']) == 6 | ||
| assert np.all(current.get_pandas_dataframe()['surface'] == box.get_id_surfaces()) | ||
Uh oh!
There was an error while loading. Please reload this page.