mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 13:45:36 -04:00
Merge pull request #1414 from gridley/fix_large_hex_lattice_error
use relative distances for coincidence test in hex lattice
This commit is contained in:
commit
8fcd74b14b
1 changed files with 6 additions and 2 deletions
|
|
@ -895,8 +895,12 @@ HexLattice::get_indices(Position r, Direction u) const
|
|||
Position r_t = get_local_position(r, i_xyz);
|
||||
// calculate distance
|
||||
double d = r_t.x*r_t.x + r_t.y*r_t.y;
|
||||
// check for coincidence
|
||||
bool on_boundary = coincident(d, d_min);
|
||||
// check for coincidence. Because the numerical error incurred
|
||||
// in hex geometry is higher than other geometries, the relative
|
||||
// coincidence is checked here so that coincidence is successfully
|
||||
// detected on large hex lattice with particles far from the origin
|
||||
// which have rounding errors larger than the FP_COINCIDENT thresdhold.
|
||||
bool on_boundary = coincident(1.0, d_min/d);
|
||||
if (d < d_min || on_boundary) {
|
||||
// normalize r_t and find dot product
|
||||
r_t /= std::sqrt(d);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue