-
Notifications
You must be signed in to change notification settings - Fork 500
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
Adding ability to set additional ww attrs from openmc.lib #2609
Conversation
I notice the CI is failing with |
I've read through this PR and been making use of it locally. I used the script below to check that the attributes are set and change from their default values. Everything looks good to me. import openmc
import openmc.lib
mat_water = openmc.Material()
mat_water.add_element("H", 1)
mat_water.add_element("O", 2)
mat_water.set_density("g/cm3", 1.0)
my_materials = openmc.Materials([mat_water])
outer_surface = openmc.model.RectangularParallelepiped(-300, 300, -300, 300, -300, 300, boundary_type="vacuum")
region_1 = -outer_surface
cell_1 = openmc.Cell(region=region_1)
cell_1.fill = mat_water
my_geometry = openmc.Geometry([cell_1])
space = openmc.stats.Point((0, 0, 0))
angle = openmc.stats.Isotropic()
energy = openmc.stats.Discrete([14e6], [1.0])
source = openmc.Source(space=space, angle=angle, energy=energy)
source.particle = "neutron"
mesh = openmc.RegularMesh().from_domain(domain=my_geometry)
mesh.dimension = (2,2,2)
mesh_filter = openmc.MeshFilter(mesh)
flux_tally = openmc.Tally(name="flux tally")
flux_tally.filters = [mesh_filter]
flux_tally.scores = ["flux"]
flux_tally.id = 55
my_tallies = openmc.Tallies()
my_tallies.append(flux_tally)
tallies = openmc.Tallies([flux_tally])
my_settings = openmc.Settings()
my_settings.run_mode = "fixed source"
my_settings.source = source
my_settings.particles = 120
my_settings.batches = 10
my_settings.output = {'tallies': False}
my_model = openmc.Model(my_geometry, my_materials, my_settings, my_tallies)
my_model.export_to_xml()
with openmc.lib.run_in_memory():
tally = openmc.lib.tallies[55]
wws = openmc.lib.WeightWindows.from_tally(tally)
wws.max_split = 25
wws.survival_ratio = 26
wws.max_lower_bound_ratio = 27
wws.weight_cutoff = 28
for i in range(5):
openmc.lib.run()
wws.update_magic(tally)
openmc.lib.settings.particles = int(openmc.lib.settings.particles * 1.5)
openmc.lib.export_weight_windows(filename=f'weight_windows{str(i).zfill(2)}.h5')
openmc.lib.statepoint_write(filename=f'statepoint_simulation_{str(i).zfill(2)}.h5')
openmc.lib.settings.weight_windows_on = True
wws2 = openmc.hdf5_to_wws(f'weight_windows{str(i).zfill(2)}.h5')
print(wws2) |
added missing attribute to __repr__
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.
All looks straightforward to me. Thanks @pshriwise!
@pshriwise Can you push an empty commit to this branch to restart CI from a fresh state? |
🎉 CI is passing on this PR. Seeing as Paul has approved I'm going to go ahead and merge while I'm here |
…#2609) Co-authored-by: Jonathan Shimwell <[email protected]>
Description
This adds the ability to set additional attributes of
WeightWindows
objects:survival_ratio
max_lower_bound_ratio
weight_cutoff
max_splits
Fixes # (issue)
#2607
Checklist