@@ -98,6 +98,50 @@ def test_surface_filter_flux_angled(two_cell_model, run_in_tmpdir):
9898 assert flux_mean == pytest .approx (1.0 / mu )
9999
100100
101+ def test_surface_tally_during_lattice_crossing (run_in_tmpdir ):
102+ openmc .reset_auto_ids ()
103+ model = openmc .Model ()
104+
105+ xmin = openmc .XPlane (- 1.0 , boundary_type = "vacuum" )
106+ xmax = openmc .XPlane (1.0 , boundary_type = "vacuum" )
107+ ymin = openmc .YPlane (- 1.0 , boundary_type = "vacuum" )
108+ ymax = openmc .YPlane (1.0 , boundary_type = "vacuum" )
109+ zmin = openmc .ZPlane (- 1.0 , boundary_type = "vacuum" )
110+ zmax = openmc .ZPlane (1.0 , boundary_type = "vacuum" )
111+
112+ inner_cell = openmc .Cell ()
113+ inner_univ = openmc .Universe (cells = [inner_cell ])
114+
115+ tile_cell = openmc .Cell (fill = inner_univ )
116+ tile_univ = openmc .Universe (cells = [tile_cell ])
117+
118+ lattice = openmc .RectLattice ()
119+ lattice .lower_left = (- 1.0 , - 1.0 )
120+ lattice .pitch = (1.0 , 2.0 )
121+ lattice .universes = [[tile_univ , tile_univ ]]
122+
123+ root_cell = openmc .Cell (
124+ fill = lattice , region = + xmin & - xmax & + ymin & - ymax & + zmin & - zmax )
125+ model .geometry = openmc .Geometry ([root_cell ])
126+
127+ src = openmc .IndependentSource ()
128+ src .space = openmc .stats .Point ((- 0.5 , 0.0 , 0.0 ))
129+ src .angle = openmc .stats .Monodirectional ((1.0 , 0.0 , 0.0 ))
130+
131+ model .settings .run_mode = 'fixed source'
132+ model .settings .batches = 1
133+ model .settings .particles = 5
134+ model .settings .source = src
135+
136+ current_tally = openmc .Tally ()
137+ current_tally .filters = [openmc .SurfaceFilter (xmax )]
138+ current_tally .scores = ['current' ]
139+ model .tallies = [current_tally ]
140+
141+ model .run (apply_tally_results = True )
142+ assert current_tally .mean .flat [0 ] == pytest .approx (1.0 )
143+
144+
101145def test_cellfrom_filter_flux_directional (two_cell_model , run_in_tmpdir ):
102146 """SurfaceFilter + CellFromFilter + flux scores only the correct direction."""
103147 model , xmid , cell1 , cell2 = two_cell_model
0 commit comments