McLachlan triggers arithmetic exception (but results are fine)

Create issue
Issue #734 closed
Wolfgang Kastaun created an issue

If I enable floating point exceptions for debugging purposes, they are triggered by McLachlan in the routine ML_BSSN_convertToADMBaseDtLapseShift_Body. The guilty line is

568 kfmin(ToReal(1),kmul(INV(rL),ToReal(SpatialBetaDriverRadius)));

the involved values are (gdb) p rL $1 = 0 (gdb) p SpatialBetaDriverRadius $2 = 1000000000000

This only happens once per grid, apparently at the origin.

The results look fine otherwise, no NaNs or INFs propagated, but this is annoying when debugging other code, trying to find the first time a NaN is produced.

ET version is the Maxwell release.

Keyword: McLachlan

Comments (2)

  1. Erik Schnetter
    • changed status to resolved
    • removed comment

    Thank you. This problem was caused by the expression

    etaExpr = Min [SpatialBetaDriverRadius / r, 1];

    which divides by r, and then (luckily?) ignores the result. I have changed this to

    etaExpr = SpatialBetaDriverRadius / Max [r, SpatialBetaDriverRadius];

    which is equivalent, but avoids the division by r if r is too small.

  2. Log in to comment