Reevaluate cell in a close collision after a surface crossing#3933
Reevaluate cell in a close collision after a surface crossing#3933GuySten wants to merge 1 commit intoopenmc-dev:developfrom
Conversation
|
@lewisgross1296, can you check if this PR improves your problem as well? |
Just rebuilt with this PR and launched my |
|
Checked back this morning. Running the same XML with the code in this branch (and some extra prints in The trouble is happening on the same batch as before and is "detecting" an overlap on the same two cells. Regarding @paulromano's diagnosis in #3929, the above might be related to the case he described. In the printout, This location is near a coolant channel, but I'm a little confused why it thinks it's in I uploaded my XML on discourse. The printouts above in come from modifying bool check_cell_overlap(GeometryState& p, bool error)
{
int n_coord = p.n_coord();
// Loop through each coordinate level
for (int j = 0; j < n_coord; j++) {
Universe& univ = *model::universes[p.coord(j).universe()];
// Loop through each cell on this level
for (auto index_cell : univ.cells_) {
Cell& c = *model::cells[index_cell];
if (c.contains(p.coord(j).r(), p.coord(j).u(), p.surface())) {
if (index_cell != p.coord(j).cell()) {
if (error) {
// Print info of check
std::cout << "Logical checks" << std::endl;
std::cout << "currently on coordinate level " << j << std::endl;
std::cout << "p.coord(j).r(), p.coord(j).u() = " << p.coord(j).r() <<
"," << p.coord(j).u() << std::endl;
std::cout << "index_cell =" << index_cell << std::endl;
std::cout << "p.coord(j).cell() " << p.coord(j).cell() << std::endl;
std::cout << "cell instance " << p.cell_instance() << std::endl;
std::cout << "Surface token for the surface that the particle is currently on " << p.surface() << std::endl;
std::cout << "" << std::endl;
// PRINT INFO
std::cout << "GeometryState information" << std::endl;
std::cout << "r_born = " << p.r_born() << std::endl;
std::cout << "Current global coordinate position r=" << p.r() << std::endl;
std::cout << "Current global coordinate direction u=" << p.u() << std::endl;
std::cout << "Coordinates of last collision or reflective/periodic surface crossing for current tallies" << p.r_last_current() << std::endl;
std::cout << "Previous spatial coordinates before collision r=" << p.r_last() << std::endl;
std::cout << "Previous direction vector before last collision u=" << p.u_last() << std::endl;
std::cout << "Current material " << p.material() << std::endl;
std::cout << "Last material " << p.material_last() << std::endl;
// cell class info
std::cout << "printing cell info" << std::endl;
std::cout << "distribcell_index_" << c.distribcell_index_ << std::endl;
auto s = fmt::format("Overlapping cells detected: {}, {} on universe {}",
c.id_, model::cells[p.coord(j).cell()]->id_, univ.id_);
std::cout << s << std::endl;
std::cout << std::endl;
// turn off fatal error and see if we keep getting overlaps
// fatal_error(
// fmt::format("Overlapping cells detected: {}, {} on universe {}",
// c.id_, model::cells[p.coord(j).cell()]->id_, univ.id_));
}
return true;
}
#pragma omp atomic
++model::overlap_check_count[index_cell];
}
}
}
return false;
}
|
|
@lewisgross1296, I think your problem may come from something other that small cylinders.
|
I agree. This has been really tough to make progress on due to how long it takes it test anything / how rarely this occurs. Unfortunately, I need to use a design this complicated. If I could make a more minimal example, that would really help, but I'm not totally sure I actually understand the root issue in a way that would allow me to confidently create an MWE. I have heard that the intersection of planes and other surface types (sphere, cylinder) can lead to particles getting displaced from their true position (@gonuke called this "tunneling"). We do have many cylinders sliced by the planes that correspond to 1/6th symmetry, so perhaps that is leading to the problem. Strangely, I do not have the same issue with reflective boundary conditions (no overlaps at all despite the same high particle count), so my plan is to use those for now until we can try to figure out what is really going on here. |
Description
This PR adds a cell lookup after a collision that could change particle's cell.
This PR is an alternative path for #3923.
Checklist
I have made corresponding changes to the documentation (if applicable)