forked from openmc-dev/openmc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prevent segfault in distance to boundary calculation (openmc-dev#2659)
- Loading branch information
1 parent
e0ad23d
commit 281adb9
Showing
2 changed files
with
32 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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 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,30 @@ | ||
import openmc | ||
|
||
|
||
def test_no_visible_boundary(run_in_tmpdir): | ||
copper = openmc.Material() | ||
copper.add_nuclide('Cu63', 1.0) | ||
copper.set_density('g/cm3', 0.3) | ||
air = openmc.Material() | ||
air.add_nuclide('N14', 1.0) | ||
air.set_density('g/cm3', 0.0012) | ||
|
||
# Create a simple model of a neutron source directly impinging on a thin | ||
# disc of copper. Neutrons leaving the back of the disc see no surfaces in | ||
# front of them. | ||
disc = openmc.model.RightCircularCylinder((0., 0., 1.), 0.1, 1.2) | ||
box = openmc.rectangular_prism(width=10, height=10, boundary_type='vacuum') | ||
c1 = openmc.Cell(fill=copper, region=-disc) | ||
c2 = openmc.Cell(fill=air, region=+disc & box) | ||
model = openmc.Model() | ||
model.geometry = openmc.Geometry([c1, c2]) | ||
model.settings.run_mode = 'fixed source' | ||
model.settings.particles = 1000 | ||
model.settings.batches = 5 | ||
model.settings.source = openmc.IndependentSource( | ||
space=openmc.stats.Point(), | ||
angle=openmc.stats.Monodirectional((0., 0., 1.)) | ||
) | ||
|
||
# Run model to ensure it doesn't segfault | ||
model.run() |