Skip to content

Commit 86e9a4b

Browse files
committed
Adding constants for coincidence checking
1 parent e5863ee commit 86e9a4b

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

include/openmc/constants.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ constexpr double FP_PRECISION {1e-14};
5151
constexpr double FP_REL_PRECISION {1e-5};
5252
constexpr double FP_COINCIDENT {1e-12};
5353

54+
// Coincidence tolerances
55+
constexpr double TORUS_TOL {1e-10};
56+
constexpr double RADIAL_MESH_TOL {1e-10};
57+
5458
// Maximum number of random samples per history
5559
constexpr int MAX_SAMPLE {100000};
5660

src/mesh.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1088,7 +1088,7 @@ double CylindricalMesh::find_r_crossing(
10881088
D = std::sqrt(D);
10891089

10901090
// the solution -p - D is always smaller as -p + D : Check this one first
1091-
if (std::abs(c) <= 1e-10)
1091+
if (std::abs(c) <= RADIAL_MESH_TOL)
10921092
return INFTY;
10931093

10941094
if (-p - D > l)
@@ -1316,7 +1316,7 @@ double SphericalMesh::find_r_crossing(
13161316
double c = r.dot(r) - r0 * r0;
13171317
double D = p * p - c;
13181318

1319-
if (std::abs(c) <= 1e-10)
1319+
if (std::abs(c) <= RADIAL_MESH_TOL)
13201320
return INFTY;
13211321

13221322
if (D >= 0.0) {

src/surface.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1044,7 +1044,7 @@ double torus_distance(double x1, double x2, double x3, double u1, double u2,
10441044
// zero but possibly small and positive. A tolerance is set to discard that
10451045
// zero.
10461046
double distance = INFTY;
1047-
double cutoff = coincident ? 1e-10 : 0.0;
1047+
double cutoff = coincident ? TORUS_TOL : 0.0;
10481048
for (int i = 0; i < 4; ++i) {
10491049
if (roots[i].imag() == 0) {
10501050
double root = roots[i].real();

0 commit comments

Comments
 (0)