aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Jan Darowski <jan.darowski@gmail.com>2015-07-03 22:45:29 +0200
committerGravatar Jan Darowski <jan.darowski@gmail.com>2015-07-03 22:45:29 +0200
commit2435d79c0e6e4e30ace3b23765005c90181ddae5 (patch)
tree54ca29170d5cf372975729e85ca164a8b593be9a
parent0180d2eb1e8101eb362efb00edaae9eb9bcb24aa (diff)
downloadsubsurface-2435d79c0e6e4e30ace3b23765005c90181ddae5.tar.gz
VPM-B: add nuclei size calculation and nuclear regeneration.
This function calculates the size of nuclei at the end of deco, then simulates their regeneration, to the moment before the deco. This is redundant as nuclear regeneration is a very slow process. Function should be called with time in seconds, just before the ascent. Signed-off-by: Jan Darowski <jan.darowski@gmail.com>
-rw-r--r--deco.c15
-rw-r--r--dive.h1
2 files changed, 16 insertions, 0 deletions
diff --git a/deco.c b/deco.c
index 70430bb66..0b221c225 100644
--- a/deco.c
+++ b/deco.c
@@ -206,6 +206,21 @@ double he_factor(int period_in_seconds, int ci)
return cache[ci].last_factor;
}
+void nuclear_regeneration(double time)
+{
+ time /= 60.0;
+ int ci;
+ double crushing_radius_N2, crushing_radius_He;
+ for (ci = 0; ci < 16; ++ci) {
+ //rm
+ crushing_radius_N2 = 1.0 / (max_n2_crushing_pressure[ci] / (2.0 * (vpmb_config.skin_compression_gammaC - vpmb_config.surface_tension_gamma)) + 1.0 / vpmb_config.crit_radius_N2);
+ crushing_radius_He = 1.0 / (max_he_crushing_pressure[ci] / (2.0 * (vpmb_config.skin_compression_gammaC - vpmb_config.surface_tension_gamma)) + 1.0 / vpmb_config.crit_radius_He);
+ //rs
+ n2_regen_radius[ci] = crushing_radius_N2 + (vpmb_config.crit_radius_N2 - crushing_radius_N2) * (1.0 - exp (-time / vpmb_config.regeneration_time));
+ he_regen_radius[ci] = crushing_radius_He + (vpmb_config.crit_radius_He - crushing_radius_He) * (1.0 - exp (-time / vpmb_config.regeneration_time));
+ }
+}
+
// Calculates the nucleons inner pressure during the impermeable period
double calc_inner_pressure(double crit_radius, double onset_tension, double current_ambient_pressure)
{
diff --git a/dive.h b/dive.h
index f7044fba2..8f0f84832 100644
--- a/dive.h
+++ b/dive.h
@@ -783,6 +783,7 @@ extern unsigned int deco_allowed_depth(double tissues_tolerance, double surface_
extern void set_gf(short gflow, short gfhigh, bool gf_low_at_maxdepth);
extern void cache_deco_state(double, char **datap);
extern double restore_deco_state(char *data);
+extern void nuclear_regeneration(double time);
/* this should be converted to use our types */
struct divedatapoint {