Rick,
thanks for catching this! It turned out, this could be triggered by opening the planner with VPM-B on an empty log and just changing the gas to OXYGEN (in fact any nitrox with >=78% oxygen). This came about by a numerical instability when applying the Boyle law compensation when there is nothing to compensate for. Here are two patches of which the first should fix the issue (at least it does for me). Please test carefully! Best Robert PS: This happened to be quite hard to debug, took me >2h to fix. |
From 1aad7246170e9f06b91ab4c09301d482cbbd62f6 Mon Sep 17 00:00:00 2001 From: "Robert C. Helling" <[email protected]> Date: Fri, 21 Aug 2015 17:19:32 +0200 Subject: [PATCH 1/2] Don't do Boyle compensation when still on first stop
There is nothing to compensate but we would hit a 0/0 numerical instability there. Signed-off-by: Robert C. Helling <[email protected]> --- deco.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/deco.c b/deco.c index 7b8d7c2..16089e3 100644 --- a/deco.c +++ b/deco.c @@ -362,6 +362,10 @@ void boyles_law(double next_stop_pressure) { int ci; + // This should be a tautology but prevents a numerical instability. + if (IS_FP_SAME(next_stop_pressure, first_stop_pressure)) + return; + if (!first_stop_pressure) return; for (ci = 0; ci < 16; ++ci) { -- 1.9.5 (Apple Git-50.3)
From 598ab8ca87e0f7856a07ba3e49ef56e48ed32983 Mon Sep 17 00:00:00 2001 From: "Robert C. Helling" <[email protected]> Date: Fri, 21 Aug 2015 17:22:07 +0200 Subject: [PATCH 2/2] Don't do computationally expensive Boyle compensation when not using VPM-B Signed-off-by: Robert C. Helling <[email protected]> --- deco.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/deco.c b/deco.c index 16089e3..6f8f0f6 100644 --- a/deco.c +++ b/deco.c @@ -362,6 +362,9 @@ void boyles_law(double next_stop_pressure) { int ci; + if (!in_planner() || prefs.deco_mode != VPMB) + return; + // This should be a tautology but prevents a numerical instability. if (IS_FP_SAME(next_stop_pressure, first_stop_pressure)) return; -- 1.9.5 (Apple Git-50.3)
signature.asc
Description: Message signed with OpenPGP using GPGMail
_______________________________________________ subsurface mailing list [email protected] http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
