Skip to content

Commit

Permalink
test added
Browse files Browse the repository at this point in the history
  • Loading branch information
zoeprieto committed Nov 12, 2024
1 parent 58e1180 commit 8352a30
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions tests/unit_tests/test_source_weight.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import openmc
import openmc.stats
import h5py


def test_musurface(run_in_tmpdir):
sphere = openmc.Sphere(r=1.0, boundary_type='vacuum')
cell = openmc.Cell(region=-sphere, fill=None)
model = openmc.Model()
model.geometry = openmc.Geometry([cell])
model.settings.particles = 100
model.settings.batches = 1
E = 1.0
model.settings.source = openmc.IndependentSource(
space=openmc.stats.Point(),
angle=openmc.stats.Isotropic(),
energy=openmc.stats.delta_function(E),
weight=openmc.stats.delta_function(100)
)
model.settings.run_mode = "fixed source"
model.settings.surf_source_write = {
"max_particles": 100,
}

# Run OpenMC
sp_filename = model.run()

# All contributions should show up in last bin
with h5py.File("surface_source.h5", "r") as f:
source = f["source_bank"]

assert len(source) == 100

for point in source:
assert point["wgt"] == 100.0


0 comments on commit 8352a30

Please sign in to comment.