Hello
I am trying to track this problem down with openmc-0.15.0
In file mesh.cpp:669 there is the follwing loop:
// For all directions outside the mesh, find the distance that we need to
// travel to reach the next surface. Use the largest distance, as only
// this will cross all outer surfaces.
int k_max {0};
for (int k = 0; k < n; ++k) {
if ((ijk[k] < 1 || ijk[k] > shape_[k]) &&
(distances[k].distance > traveled_distance)) {
traveled_distance = distances[k].distance;
k_max = k;
}
}
For particle 23228, traveled_distance is always equal to 0, so the particle will never advance in the subsequent code, causing the problem to hang because of an upstream infinite loop.
For particle 23228 the involved variables in this loop have the following values:
- ijk = {-7, 1, 1}
- shape_ = {1, 1, 1}
- distances =
{next_index = -6, max_surface = true, distance = 0},
{next_index = 2, max_surface = true, distance = 1614.1689884883433},
{next_index = 0, max_surface = false, distance = 4916.5287060087403}
So, in the case of particle 23228 the traveled_distance will be only updated when k==1, but the distance in this case is 0, so it won’t go into the if clause.
I am not sure if the problem is in ijk or in the distances variables.
distance is calculated in mesh.cpp:1050 as:
d.distance = (positive_grid_boundary(ijk, i) - r0[i]) / u[i];
where:
positive_grid_boundary(ijk, i)== 100r0[i]== 100
giving as a result a distance of 0.