Hi all,
I am a newbie to openmc. I am working on fusion application but for a first study, I would like to stick to a cylindrical geometry. While trying to do so, I repetitively got the error :
ERROR: More than 95% of external source sites sampled were rejected. Please check your external source definition.
From what I understand, it is probably due to a particle leakage resulting from a faulty definition of the geometry. Here is my script with a simplified geometry :
import openmc
import json
# MATERIALS
#iron
density_of_iron_in_g_per_cm3 = 7.75
iron = openmc.Material(name='Iron')
iron.set_density('g/cm3', density_of_iron_in_g_per_cm3)
iron.add_element('Fe', 1.0, percent_type='wo')
#lithium
lithium = openmc.Material(name='Lithium')
lithium.set_density('g/cm3',0.535)
lithium.add_element('Li',1.0)
#materials
my_material = [iron, lithium]
mats = openmc.Materials(my_material)
# GEOMETRY
# Create concentric cylindrical surfaces
inner_surf = openmc.ZCylinder(r=100 , name='inner_surf')
inter_surf = openmc.ZCylinder(r=150, name='inetr_surf')
outer_surf = openmc.ZCylinder(r=160, name='outer_surf', boundary_type='vacuum')
#Create horizontal planes
bottom_p = openmc.ZPlane(z0=-200, name='Front plane' , boundary_type='reflective')
top_p = openmc.ZPlane(z0=200, name='Back plane' , boundary_type='reflective')
#Create region
blanket_region = +inner_surf & -inter_surf & +bottom_p & -top_p
vessel_region = +inter_surf & -outer_surf & +bottom_p & -top_p
# Create cells, mapping materials to regions
blanket_cell = openmc.Cell(fill = lithium, region = blanket_region)
vessel_cell = openmc.Cell(fill = iron, region = vessel_region)
# Create a geometry and export to XML
universe = openmc.Universe(cells=[blanket_cell,vessel_cell])
geom = openmc.Geometry(universe)
geom.export_to_xml()
# SIMULATION SETTINGS
# Instantiate a Settings object
sett = openmc.Settings()
batches = 10
sett.batches = batches
sett.inactive = 0
sett.particles = 10000
sett.run_mode = 'fixed source'
# Create a DT point source
source = openmc.Source()
source.space = openmc.stats.Point((0, 0, 0))
source.angle = openmc.stats.Isotropic()
source.energy = openmc.stats.Discrete([14e6], [1])
sett.source = source
#TALLY DPA COMPUTATION
tallies = openmc.Tallies()
# added a cell tally for DPA to the iron vessel cell
cell_filter = openmc.CellFilter(vessel_cell)
reaction_tally = openmc.Tally(name='DPA')
reaction_tally.filters = [cell_filter]
reaction_tally.scores = ['444'] # note use of 444 in string format
reaction_tally.nuclides = ['Fe54', 'Fe56', 'Fe57', 'Fe58'] # this records the tally for each nuclide in the list
tallies.append(reaction_tally)
#RUN THE SIMULATION
model = openmc.model.Model(geom, mats, sett, tallies)
Any idea how to fix it ?
I ran the above script in the geometry debug mode and obtain this:
Minimum neutron data temperature: 294.0 K
Maximum neutron data temperature: 294.0 K
Reading tallies XML file...
Preparing distributed cell instances...
Writing summary.h5 file...
WARNING: Cell overlap checking is ON.
Maximum neutron transport energy: 20000000.0 eV for Fe58
Maximum neutron transport energy: 20000000.0 eV for Fe58
===============> FIXED SOURCE TRANSPORT SIMULATION <===============
Simulating batch 1
ERROR: More than 95% of external source sites sampled were rejected. Please
check your external source definition.
Segmentation fault
(If this helps)
A subsidary question :
Is the following will be the correct manner to define a uniform cylindrical DT source ?
# Create a cylindrical DT source
source = openmc.Source()
rad_src = openmc.stats.Uniform(a=0, b=100)
phi_src = openmc.stats.Uniform(a=0, b=2*3.14159265359)
z_src = openmc.stats.Uniform(a=-200, b=200)
origin_src = (0.0, 0.0, 0.0)
source.space = openmc.stats.CylindricalIndependent(r=rad_src, phi=phi_src, z=z_src,origin=origin_src)
source.angle = openmc.stats.Isotropic()
source.energy = openmc.stats.Discrete([14e6], [1])
sett.source = source
sett.run_modes = 'fixed source'
Thanks in advance for any clue.