mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
VPM-B: add next gradient calculation.
It improves (increases) gradients for all the compartments, so more free gas can be created in the divers body. Next gradients will converge, so the volume won't exceed the safe limit, indicated by the crit_volume_lambda parameter. Function takes time of the last deco in seconds. Requires vpmb_start_gradient() to be run before. Signed-off-by: Jan Darowski <jan.darowski@gmail.com>
This commit is contained in:
parent
02f1339917
commit
bfb9f19080
2 changed files with 25 additions and 0 deletions
24
deco.c
24
deco.c
|
@ -238,6 +238,30 @@ void vpmb_start_gradient()
|
|||
}
|
||||
}
|
||||
|
||||
void vpmb_next_gradient(double deco_time)
|
||||
{
|
||||
int ci;
|
||||
double gradient_n2, gradient_he;
|
||||
double n2_b, n2_c;
|
||||
double he_b, he_c;
|
||||
deco_time /= 60.0 ;
|
||||
|
||||
for (ci = 0; ci < 16; ++ci) {
|
||||
n2_b = allowable_n2_gradient[ci] + ((vpmb_config.crit_volume_lambda * vpmb_config.surface_tension_gamma) / (vpmb_config.skin_compression_gammaC * (deco_time + buehlmann_N2_t_halflife[ci] * 60.0 / log(2.0))));
|
||||
he_b = allowable_he_gradient[ci] + ((vpmb_config.crit_volume_lambda * vpmb_config.surface_tension_gamma) / (vpmb_config.skin_compression_gammaC * (deco_time + buehlmann_He_t_halflife[ci] * 60.0 / log(2.0))));
|
||||
|
||||
n2_c = vpmb_config.surface_tension_gamma * vpmb_config.surface_tension_gamma * vpmb_config.crit_volume_lambda * max_n2_crushing_pressure[ci];
|
||||
n2_c = n2_c / (vpmb_config.skin_compression_gammaC * vpmb_config.skin_compression_gammaC * (deco_time + buehlmann_N2_t_halflife[ci] * 60.0 / log(2.0)));
|
||||
he_c = vpmb_config.surface_tension_gamma * vpmb_config.surface_tension_gamma * vpmb_config.crit_volume_lambda * max_he_crushing_pressure[ci];
|
||||
he_c = he_c / (vpmb_config.skin_compression_gammaC * vpmb_config.skin_compression_gammaC * (deco_time + buehlmann_He_t_halflife[ci] * 60.0 / log(2.0)));
|
||||
|
||||
allowable_n2_gradient[ci] = 0.5 * ( n2_b + sqrt(n2_b * n2_b - 4.0 * n2_c));
|
||||
allowable_he_gradient[ci] = 0.5 * ( he_b + sqrt(he_b * he_b - 4.0 * he_c));
|
||||
|
||||
total_gradient[ci] = ((allowable_n2_gradient[ci] * tissue_n2_sat[ci]) + (allowable_he_gradient[ci] * tissue_he_sat[ci])) / (tissue_n2_sat[ci] + tissue_he_sat[ci]);
|
||||
}
|
||||
}
|
||||
|
||||
void nuclear_regeneration(double time)
|
||||
{
|
||||
time /= 60.0;
|
||||
|
|
1
dive.h
1
dive.h
|
@ -785,6 +785,7 @@ extern void cache_deco_state(double, char **datap);
|
|||
extern double restore_deco_state(char *data);
|
||||
extern void nuclear_regeneration(double time);
|
||||
extern void vpmb_start_gradient();
|
||||
extern void vpmb_next_gradient(double deco_time);
|
||||
extern bool is_vpmb_ok(double pressure);
|
||||
|
||||
/* this should be converted to use our types */
|
||||
|
|
Loading…
Add table
Reference in a new issue