summaryrefslogtreecommitdiffstats
path: root/core/deco.c
diff options
context:
space:
mode:
authorGravatar Robert C. Helling <helling@atdotde.de>2018-04-10 21:20:38 +0200
committerGravatar Robert C. Helling <helling@atdotde.de>2018-04-11 21:15:38 +0200
commitece714556fa2403dddec481a7a09d68eb82e84fa (patch)
treec422e24795d7d866d2e98d0baa223677aa084eb4 /core/deco.c
parent71d1e78db2435c74a3170a9fe0d3e4e0e6c946c2 (diff)
downloadsubsurface-ece714556fa2403dddec481a7a09d68eb82e84fa.tar.gz
Look for actual isobaric counter diffusion
Identify segements that fullfill the folllowing criteria for the leading compartment: He is off-gasing while N2 is on-gasing Overall there is on-gasing Add a line to the info box for those segments Signed-off-by: Robert C. Helling <helling@atdotde.de>
Diffstat (limited to 'core/deco.c')
-rw-r--r--core/deco.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/core/deco.c b/core/deco.c
index 9943d470f..f72454b9b 100644
--- a/core/deco.c
+++ b/core/deco.c
@@ -482,7 +482,7 @@ void add_segment(struct deco_state *ds, double pressure, const struct gasmix *ga
(void) sac;
int ci;
struct gas_pressures pressures;
-
+ bool icd = false;
fill_pressures(&pressures, pressure - ((in_planner() && (decoMode() == VPMB)) ? WV_PRESSURE_SCHREINER : WV_PRESSURE),
gasmix, (double) ccpo2 / 1000.0, dive->dc.divemode);
@@ -494,6 +494,11 @@ void add_segment(struct deco_state *ds, double pressure, const struct gasmix *ga
double n2_satmult = pn2_oversat > 0 ? buehlmann_config.satmult : buehlmann_config.desatmult;
double he_satmult = phe_oversat > 0 ? buehlmann_config.satmult : buehlmann_config.desatmult;
+ // Report ICD if N2 is more on-gasing than He off-gasing in leading tissue
+ if (ci == ds->ci_pointing_to_guiding_tissue && pn2_oversat > 0.0 && phe_oversat < 0.0 &&
+ pn2_oversat * n2_satmult * n2_f + phe_oversat * he_satmult * he_f > 0)
+ icd = true;
+
ds->tissue_n2_sat[ci] += n2_satmult * pn2_oversat * n2_f;
ds->tissue_he_sat[ci] += he_satmult * phe_oversat * he_f;
ds->tissue_inertgas_saturation[ci] = ds->tissue_n2_sat[ci] + ds->tissue_he_sat[ci];
@@ -501,6 +506,7 @@ void add_segment(struct deco_state *ds, double pressure, const struct gasmix *ga
}
if (decoMode() == VPMB)
calc_crushing_pressure(ds, pressure);
+ ds->icd_warning = icd;
return;
}