Greetings
@pshriwise
@Shimwell
@paulromano
@khurrum
Does this works with fission neutrons too?
Beam Tube Meshing
mesh_bt = openmc.RegularMesh()
mesh_bt.lower_left = [-363, -20, -(20+12.8)]
mesh_bt.upper_right = [core_width/2 ,+20, +(20-12.8)]
mesh_bt.dimension = [400,80,1]
mesh_bt_filter = openmc.MeshFilter(mesh_bt)
Ploting total flux profile along beamtube
tally_flux_profile_bt = openmc.Tally(name = ‘flux profile along beam tube’)
tally_flux_profile_bt.filters = [mesh_bt_filter]
tally_flux_profile_bt.scores = [‘flux’]
Settings
settings = openmc.Settings()
settings.particles = 10000
settings.batches = 15
settings.inactive = 5
settings.source = source
settings.geometry_debug=False
model = openmc.Model(geometry=geometry, materials=mat, settings=settings, tallies=tallies)
model.run
Constants
x,y=(400,80)
print(x,y)
Define volume correctly
volume = (6 * 7.711 * 4 * 8.1 * 60)/(x*y) # [cm^3]
V = volume # Volume [cm^3]
P = 9e6 # Power [J/sec]
Q = 3.2e-11 # Energy per fission [J/fission]
Extract tallies
flux_profile = sp.get_tally(name=‘flux profile along beam tube’) # [#-cm/source]
fission = sp.get_tally(name=‘fission’)
nu_fission = sp.get_tally(name=‘nu-fission’)
Get mean values of tallies
flux_mean = flux_profile.mean.ravel()
fission_rate = fission.mean.ravel()
neutrons_per_fission = nu_fission.mean.ravel()
Calculate nu (neutrons per fission) while avoiding division by zero
fission_rate[fission_rate == 0] = 1e-10 # Small value to prevent division by zero
nu = neutrons_per_fission / fission_rate
Calculate k (neutron multiplication factor)
k = neutrons_per_fission
Compute the neutron flux in normal units [neutrons/cm^2-sec]
Flux = flux_mean * P * nu / (V * Q * k)
Reshape Flux to match the original flux profile shape (6x4)
Flux_reshaped = Flux.reshape(y,x)
Plot the total neutron flux as a heatmap
plt.imshow(Flux_reshaped, cmap=‘coolwarm’, origin=‘lower’)
plt.colorbar(label=‘Neutron Flux [neutrons/cm^2-sec]’)
plt.xlabel(‘X Position’)
plt.ylabel(‘Y Position’)
plt.suptitle(‘Without Weight Window’)
plt.title(‘Total Neutron Flux Distribution’)
plt.show()
import openmc_weight_window_generator
this is a minimal package that adds some functionality to openmc, namely it adds:
- openmc.StatePoint.generate_wws which we use in this task
- openmc.Model.generate_wws_magic_method which we use in the next task
this generates an openmc.WeightWindow object from the flux tally
weight_windows = sp.generate_wws(tally=flux_profile)
#deletes the old output files
!rm summary.h5
!rm statepoint.*.h5
model.settings.weight_windows = weight_windows
model.settings.max_split = 1_000_000
model.run()