WARNING: Particle had a negative distance to a lattice boundary after 0.12.1 update

I used to be able to run the simulation and complete it in the previous version. But after 0.12.1 update (I have to update to do the couple physic simulation) this error prevent me from running

 ====================>     K EIGENVALUE SIMULATION     <====================

  Bat./Gen.      k            Average k
  =========   ========   ====================
 WARNING: Particle 830 had a negative distance to a lattice boundary
 WARNING: Particle 525 had a negative distance to a lattice boundary
 WARNING: Particle 469 had a negative distance to a lattice boundary
 WARNING: Particle 80 had a negative distance to a lattice boundary
 WARNING: Particle 609 had a negative distance to a lattice boundary
 WARNING: Particle 849 had a negative distance to a lattice boundary
 WARNING: Particle 914 had a negative distance to a lattice boundary
 WARNING: Particle 360 had a negative distance to a lattice boundary
 WARNING: Particle 44 had a negative distance to a lattice boundary
 WARNING: Particle 90 had a negative distance to a lattice boundary
 WARNING: Particle 922 had a negative distance to a lattice boundary
 ERROR: Maximum number of lost particles has been reached.

This is how i define my lattice

  fuel_or = openmc.ZCylinder(r=0.2965)
clad_ir = openmc.ZCylinder(r=0.3020)
clad_or = openmc.ZCylinder(r=0.3620)

fuel_region = -fuel_or
gap_region = +fuel_or & -clad_ir
clad_region = +clad_ir & -clad_or
water_region = +clad_or


#Fuel Cell for pin
fuel_cell_11 = openmc.Cell()
fuel_cell_11.fill = FUEL1
fuel_cell_11.region = fuel_region

gap_cell_11 = openmc.Cell()
gap_cell_11.region = gap_region

clad_cell_11 = openmc.Cell()
clad_cell_11.fill = cladb
clad_cell_11.region = clad_region

water_cell_11 = openmc.Cell()
water_cell_11.fill = waterLF1
water_cell_11.region = water_region

#Pin
pin11_universe = openmc.Universe(name='Lower Fissile 1 Pin',universe_id=711)
pin11_universe.add_cells((fuel_cell_11, gap_cell_11 , clad_cell_11 , water_cell_11))

#Water Cell for pin
water_cell_111 = openmc.Cell(fill=waterLF1)

#Water Pin
water111_universe = openmc.Universe(cells=(water_cell_111,))
 lat_211 = openmc.HexLattice(name="Lower Fissile Zone 1", lattice_id=211)
 lat_211.center = (0., 0.)
lat_211.pitch = [0.941]
lat_211.outer = water111_universe

ring1 = [pin11_universe]*6*11
ring2 = [pin11_universe]*6*10
ring3 = [pin11_universe]*6*9
ring4 = [pin11_universe]*6*8
ring5 = [pin11_universe]*6*7
ring6 = [pin11_universe]*6*6
ring7 = [pin11_universe]*6*5
ring8 = [pin11_universe]*6*4
ring9 = [pin11_universe]*6*3
ring10 = [pin11_universe]*6*2
ring11 = [pin11_universe]*6
ring12 = [pin11_universe]*1
lat_211.universes = [ring1,ring2,ring3,ring4,ring5,ring6,ring7,ring8,ring9,ring10,ring11,ring12]

core_surf_38 = openmc.Plane(-0.5773502692, 1.0, 0.0, 0.0) # Left Corner Plane
core_surf_39 = openmc.Plane( 0.5773502692, 1.0, 0.0, 0.0) # Right Corner Plane

core_surf_31 = openmc.model.hexagonal_prism(edge_length=9.4790/math.cos(30/180*math.pi),orientation='y') # Inner can
core_surf_32 = openmc.model.hexagonal_prism(edge_length=9.679/math.cos(30/180*math.pi),orientation='y')# Outer can
core_surf_33 = openmc.model.hexagonal_prism(edge_length=9.7428/math.cos(30/180*math.pi),orientation='y') # Large gap, coolant layer 1
core_surf_34 = openmc.model.hexagonal_prism(edge_length=9.7830/math.cos(30/180*math.pi),orientation='y') # Large gap, CR stainless steel sheath
core_surf_35 = openmc.model.hexagonal_prism(edge_length=9.8100/math.cos(30/180*math.pi),orientation='y') # Large gap, coolant layer 2/follower
core_surf_36 = openmc.model.hexagonal_prism(edge_length=9.8390/math.cos(30/180*math.pi),orientation='y') # Large gap, Zr CR cladding/follower
core_surf_37 = openmc.model.hexagonal_prism(edge_length=9.8833/math.cos(30/180*math.pi),orientation='y',boundary_type='reflective') # Large gap, CR absorber/follower,unitcell


watersmallB_region = ~core_surf_32 & -core_surf_38 & +core_surf_39
watersmallA_region = ~core_surf_32 & +core_surf_38
crod_region = ~core_surf_36 & -core_surf_38 & -core_surf_39
crclad_region = ~core_surf_35 & core_surf_36 & -core_surf_38 & -core_surf_39
waterlar_region = ~core_surf_34 & core_surf_35 & -core_surf_38 & -core_surf_39
sheath_region = ~core_surf_33 & core_surf_34 & -core_surf_38 & -core_surf_39
waterlarge_region = ~core_surf_32 & core_surf_33 & -core_surf_38 & -core_surf_39
cani_region = ~core_surf_31 & core_surf_32
assyi_region = core_surf_31


#For UR1
waterlargeUR1_region = ~core_surf_32& -core_surf_38 & -core_surf_39



LFZ1pin1 = openmc.Universe(universe_id=301, name='LFZ1pin1')

assyi = openmc.Cell(fill=lat_211, region= assyi_region)
cani = openmc.Cell(fill=cladb, region= cani_region)
waterlarge = openmc.Cell(fill=waterwideLF1, region= waterlarge_region)
sheath = openmc.Cell(fill=shthc, region= sheath_region)
waterlar = openmc.Cell(fill=follower, region= waterlar_region)
crclad = openmc.Cell(fill=follower, region= crclad_region)
crod = openmc.Cell(fill=follower, region= crod_region)
watersmallA= openmc.Cell(fill=waternarrowLF1, region= watersmallA_region)
watersmallB= openmc.Cell(fill=waternarrowLF1, region= watersmallB_region)

LFZ1pin1.add_cells((assyi,cani,waterlarge,sheath,waterlar,crclad,crod,watersmallA,watersmallB))


1 Like

@Sivakorn.SSW Sorry to hear you’ve run into this issue. Are you able to share your model or at least a simple version of it that produces this error? That will help me determine whether there is an error in the geometry or whether it’s a bug in the code.

Hi Paul,

I’ve been experiencing this problem myself (to a lesser extent than the first time I encountered it last year). Here is a sample script that reproduces the problem.

hex_test.py (3.1 KB)

There’s 3 very simple cases that are executed by the attachment. Tests 1 and 2 execute successfully. Test 3 results in multiple lost particle warnings until the maximum allowable number is reached and it fails. Test 3 is identical to Test 2, other than that the lattice pitch has been multiplied by 10.

I executed this on OpenMC 0.12.0 (last pull Nov 2020). I confirmed that the fix from pull #1414 is present in our installation.

Thanks for taking a look.

Edit: My mistake. I do receive the negative distance error with more complicated geometry, but the simple case only results in multiple " WARNING: After particle * crossed surface * it could not be located in any cell and it did not leak." I will delete and create a new topic if it’s not the same problem.

Hi @sourena! Hope all is well up north. I did take a look at these three tests you put together. The geometry in the third test looks ill-formed to me:


When particles in the regions that extend beyond x=-25 and x=25 travel up or down to the z=10 and z=-10 planes, there is no cell above/below for them to go into, hence the warning messages and eventually aborting.

@Sivakorn.SSW I tried using the definition of that lattice in a model but was unable to reproduce the issue you are seeing with the negative distance to lattice boundary. However, the lattice you shared is not a complete geometry so there may still be differences in what you are running and what I am. If you’re able to share a complete model that illustrates this problem, I can try to diagnose further.

Thanks Paul, nice catch. I made a mistake in the geometry while I was simplifying. As discussed, I’ll try to come up with a better example.

I have attached the complete one that I used in my research in the private message. I tried doing just about everything but still can’t figure out where is the main problem.

I really appreciate your support on this.

https://openmc.discourse.group/t/particle-had-a-negative-distance-to-a-lattice-boundary-after-0-12-1-update/1143

I was able to reproduce this warning message on the model that @Sivakorn.SSW shared with me. It turns out that the root cause has already been fixed on our develop branch (from PR #1809). I think what we may do is issue a hotfix release (0.12.2) that includes this fix as well as a few other bug fixes.

Hi, @paulromano
Sorry to bother you again, Can I know when the hotfix (0.12.2) will release on Conda.

( It better for me to get the conda version instead of dev-version from GitHub as I’m using the public HPC that having problems with deprecated algorithms, ssh, and many other permission terms)

@Sivakorn.SSW The 0.12.2 release is now available on conda:
https://anaconda.org/conda-forge/openmc