From 67d54491275baf9d3d5a8c8701e5e3fb266ed1f6 Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Thu, 12 May 2022 10:19:02 -0500 Subject: [PATCH 1/2] After exhaustive find cell search following surface crossing, set surface on particle --- src/particle.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/particle.cpp b/src/particle.cpp index b622a4d691..8738fac2bc 100644 --- a/src/particle.cpp +++ b/src/particle.cpp @@ -455,6 +455,7 @@ void Particle::cross_surface() // COULDN'T FIND PARTICLE IN NEIGHBORING CELLS, SEARCH ALL CELLS // Remove lower coordinate levels and assignment of surface + auto surface_index = surface(); surface() = 0; n_coord() = 1; bool found = exhaustive_find_cell(*this); @@ -478,6 +479,9 @@ void Particle::cross_surface() return; } } + + // Reassign surface to avoid tracking errors + surface() = surface_index; } void Particle::cross_vacuum_bc(const Surface& surf) From 256078ef10399836eb1579b0221822be7882f85c Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Thu, 26 May 2022 10:01:15 -0500 Subject: [PATCH 2/2] Don't initially reset surface when doing exhaustive find cell search --- src/particle.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/particle.cpp b/src/particle.cpp index 8738fac2bc..972ef25759 100644 --- a/src/particle.cpp +++ b/src/particle.cpp @@ -454,9 +454,7 @@ void Particle::cross_surface() // ========================================================================== // COULDN'T FIND PARTICLE IN NEIGHBORING CELLS, SEARCH ALL CELLS - // Remove lower coordinate levels and assignment of surface - auto surface_index = surface(); - surface() = 0; + // Remove lower coordinate levels n_coord() = 1; bool found = exhaustive_find_cell(*this); @@ -466,6 +464,7 @@ void Particle::cross_surface() // the particle is really traveling tangent to a surface, if we move it // forward a tiny bit it should fix the problem. + surface() = 0; n_coord() = 1; r() += TINY_BIT * u(); @@ -479,9 +478,6 @@ void Particle::cross_surface() return; } } - - // Reassign surface to avoid tracking errors - surface() = surface_index; } void Particle::cross_vacuum_bc(const Surface& surf)