On 07 Feb 2017, at 09:09, Rick Walsh <[email protected]> wrote:

That quirk is indeed odd.  I can see how it could have this unexpected effect, but are you sure that's the entire cause?  I found no change at all when the surface interval was in the range 10min to 47hr.  Surely there ought to be some variation with surface interval, even if the smaller "crushing radius" remains.

From 6764534fc24d6f2e1533aee0ba0805405d74cc59 Mon Sep 17 00:00:00 2001
From: "Robert C. Helling" <[email protected]>
Date: Tue, 7 Feb 2017 09:18:19 +0100
Subject: [PATCH] Debug VPM repetitive dive
To: [email protected]

This prints out all kinds of debug information.

Removing the comments in clear_vpmb_stat() removes the oddity.

Signed-off-by: Robert C. Helling <[email protected]>
---
 core/deco.c     | 20 +++++++++++++++++++-
 core/divelist.c |  3 +++
 2 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/core/deco.c b/core/deco.c
index dd5cfa0..6e0b7fb 100644
--- a/core/deco.c
+++ b/core/deco.c
@@ -48,7 +48,7 @@ struct buehlmann_config {
 
 struct buehlmann_config buehlmann_config = {
        .satmult = 1.0,
-       .desatmult = 1.01,
+       .desatmult = 1.0,
        .last_deco_stop_in_mtr =  0,
        .gf_high = 0.75,
        .gf_low = 0.35,
@@ -404,6 +404,7 @@ void vpmb_start_gradient()
                initial_n2_gradient[ci] = bottom_n2_gradient[ci] = 2.0 * 
(vpmb_config.surface_tension_gamma / vpmb_config.skin_compression_gammaC) * 
((vpmb_config.skin_compression_gammaC - vpmb_config.surface_tension_gamma) / 
n2_regen_radius[ci]);
                initial_he_gradient[ci] = bottom_he_gradient[ci] = 2.0 * 
(vpmb_config.surface_tension_gamma / vpmb_config.skin_compression_gammaC) * 
((vpmb_config.skin_compression_gammaC - vpmb_config.surface_tension_gamma) / 
he_regen_radius[ci]);
        }
+       printf("initial gradidient %f radius %f\n", initial_n2_gradient[0], 
n2_regen_radius[0]);
 }
 
 void vpmb_next_gradient(double deco_time, double surface_pressure)
@@ -414,6 +415,7 @@ void vpmb_next_gradient(double deco_time, double 
surface_pressure)
        double desat_time;
        deco_time /= 60.0;
 
+       printf("New gradient: ");
        for (ci = 0; ci < 16; ++ci) {
                desat_time = deco_time + calc_surface_phase(surface_pressure, 
tissue_he_sat[ci], tissue_n2_sat[ci], log(2.0) / buehlmann_He_t_halflife[ci], 
log(2.0) / buehlmann_N2_t_halflife[ci]);
 
@@ -427,7 +429,10 @@ void vpmb_next_gradient(double deco_time, double 
surface_pressure)
 
                bottom_n2_gradient[ci] = 0.5 * ( n2_b + sqrt(n2_b * n2_b - 4.0 
* n2_c));
                bottom_he_gradient[ci] = 0.5 * ( he_b + sqrt(he_b * he_b - 4.0 
* he_c));
+               if (ci == 0)
+                       printf("%f %f %f %f\n", initial_n2_gradient[ci], 
initial_he_gradient[ci], bottom_n2_gradient[ci], bottom_he_gradient[ci]);
        }
+       printf("\n");
 }
 
 // A*r^3 - B*r^2 - C == 0
@@ -523,6 +528,7 @@ void add_segment(double pressure, const struct gasmix 
*gasmix, int period_in_sec
        int ci;
        struct gas_pressures pressures;
 
+//     printf("Add segment duration %d\n", period_in_seconds);
        fill_pressures(&pressures, pressure - ((in_planner() && (decoMode() == 
VPMB)) ? WV_PRESSURE_SCHREINER : WV_PRESSURE),
                       gasmix, (double) ccpo2 / 1000.0, dive->dc.divemode);
 
@@ -537,8 +543,10 @@ void add_segment(double pressure, const struct gasmix 
*gasmix, int period_in_sec
                double n2_satmult = pn2_oversat > 0 ? buehlmann_config.satmult 
: buehlmann_config.desatmult;
                double he_satmult = phe_oversat > 0 ? buehlmann_config.satmult 
: buehlmann_config.desatmult;
 
+//             printf("he_oversat=%f\t he_f=%f", phe_oversat, he_f);
                tissue_n2_sat[ci] += n2_satmult * pn2_oversat * n2_f;
                tissue_he_sat[ci] += he_satmult * phe_oversat * he_f;
+//             printf("tissue after %f\n", tissue_he_sat[ci]);
                tissue_inertgas_saturation[ci] = tissue_n2_sat[ci] + 
tissue_he_sat[ci];
 
        }
@@ -559,9 +567,19 @@ void dump_tissues()
        printf("\n");
 }
 
+void clear_vpmb_state() {
+       int ci;
+       for (ci = 0; ci < 16; ci++) {
+//             max_n2_crushing_pressure[ci] = 0.0;
+//             max_he_crushing_pressure[ci] = 0.0;
+       }
+       max_ambient_pressure = 0;
+}
+
 void clear_deco(double surface_pressure)
 {
        int ci;
+       clear_vpmb_state();
        for (ci = 0; ci < 16; ci++) {
                tissue_n2_sat[ci] = (surface_pressure - ((in_planner() && 
(decoMode() == VPMB)) ? WV_PRESSURE_SCHREINER : WV_PRESSURE)) * N2_IN_AIR / 
1000;
                tissue_he_sat[ci] = 0.0;
diff --git a/core/divelist.c b/core/divelist.c
index b28dd5e..cac6fcb 100644
--- a/core/divelist.c
+++ b/core/divelist.c
@@ -358,6 +358,7 @@ int get_divesite_idx(struct dive_site *ds)
 }
 
 static struct gasmix air = { .o2.permille = O2_IN_AIR, .he.permille = 0 };
+void clear_vpmb_state();
 
 /* take into account previous dives until there is a 48h gap between dives */
 /* return true if this is a repetitive dive */
@@ -409,6 +410,7 @@ unsigned int init_decompression(struct dive *dive)
                        clear_deco(surface_pressure);
                        deco_init = true;
 #if DECO_CALC_DEBUG & 2
+                       printf("Clear deco\n");
                        dump_tissues();
 #endif
                }
@@ -425,6 +427,7 @@ unsigned int init_decompression(struct dive *dive)
                laststart = pdive->when;
 #if DECO_CALC_DEBUG & 2
                printf("added dive #%d\n", pdive->number);
+               clear_vpmb_state();
                dump_tissues();
 #endif
        }
-- 
2.10.1 (Apple Git-78)


Hi Rick,

here is what I did. This patch (NOT for master!) prints all kinds of debug information. And it introduces a function clear_vpmb_state(). Currently, there, resetting the maximal crushing pressure is commented out. Once you enable these two lines, the oddity goes away (this is called after the previous dive is evaluated for the deco).

In the model, there is a regeneration of the crushing radius, but it has this ridiculous half-time of two weeks. And even if we make this shorter, it does not influence the oddity, that doing a dive in the previous 48h (even when the actual tissue loadings have gone back to normal for all practical purposes) you get out of the water faster rather than slower.

I think the conclusion once more should be that people should not trust this model as it is crazy.

Best
Robert

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

_______________________________________________
subsurface mailing list
[email protected]
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to