Hello everyone, I am a beginner in OpenMC. I have set the energy distribution of the source as simply as possible. The code is as follows:
...
Point = openmc.stats.Point(xyz = (0.0, 0.0, -15.0))
energy_bin = [1,2,3,4,5,6,7,8,9,10,11]
pro_bin = [0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1]
energy = openmc.stats.Tabular(energy_bin, pro_bin, interpolation='histogram')
source = openmc.IndependentSource(space=Point, energy=energy, particle='neutron')
# setting
my_settings = openmc.Settings()
my_settings.run_mode = 'fixed source'
my_settings.source = source
my_settings.particles = 1
my_settings.batches = 1
my_settings.export_to_xml()
Then I tested it with openmc.lib.sample_external_source
,
openmc.lib.init(output=False)
particles = openmc.lib.sample_external_source(n_samples=20000, prn_seed=1)
openmc.lib.finalize()
e_values = [particle.E for particle in particles]
e_array = np.array(e_values)
I perform statistics on the e_array
and obtain a histogram:
I don’t know where the problem, shouldn’t it be a completely equal probability sampling?Please help me clarify my doubts, I would be very grateful, thank you
cro