Generate_single_ww_and_apply.ipynb is not working with fission neutrons.Neutrons do not promot any further

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()

image

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()

image

The micro python package called openmc_weight_window_generator is depreciated and has been archived

I would suggest making use of inbuilt openmc.WeightWindowGenerator or openmc.lib.WeightWindows methods in OpenMC

Here are some examples

1 Like

@Shimwell
These examples are for the fixed source.
Do they work for ‘fission source’ ?
I am using reactor core as a neutron source for Boron Neutron Capture Therapy.

Hi @SamiCodhen,

good question! By ‘fission source’ do you mean running OpenMC in ‘eigenvalue’ mode?

I’ve never tried it, but weight windows should applicable in either case. As @Shimwell said, it’s probably best to use the built-in options that come with OpenMC.

It may be advantageous for you to break this simulation into two: one eigenvalue simulation to determine the behavior of the reactor and tally a source term exiting the reactor/entering the neutron beam port with a surface tally; and another, fixed-source calculation (with variance reduction) to determine the efficacy for BNCT. In this approach, some additional normalization of tally result would be required as each source particle in the fixed-source calculation is per source particle of the eigenvalue simulation. The advantage is that you only need to perform the eigenvalue simulation once, allowing you to iterate on the beam port/BNCT design more quickly.

Keep us posted!

-Patrick

1 Like

Hello
Dear @pshriwise
Yes ! I am trying to run a single simulation in ‘eigenvalue mode’ to get the neutron flux at the far end of the beamtube with the help of’ ‘’ Weight Window’'.
But I think ww doesn’t work in ‘eigenvalue mode’.
@Shimwell
Would to like to elaborate that how to apply tally to get the ‘’ source ‘’ for the ‘‘fixed_source’’ mode and how to use it in that mode.