Meaning of GF settings

Dirk Hohndel dirk at
Tue Jan 8 07:14:21 PST 2013

"Robert C. Helling" <helling at> writes:
>> I will stop messing with the deco routines and wait for your rewrite.
> ok, here we go. This does look somewhat reasonable to me. Please check 
> that it gives sensible results for your test cases!

I'll do that in a moment...

> Here is what I did:
> o) Instead of using gradient factors as means of comparison, I now use 
> pressure (as in: maximal ambient pressure).

That seems like a good idea.

> o) tissue_tolerance_calc() now computes the maximal ambient pressure now 
> respecting gradient factors. For this, it needs to know about the surface 
> pressure (as refernce for GF_high), thus gets *dive as an argument. It is 
> called from add_segment() which this also needs *dive as an additional 
> argument.

I used to explicitly pass the surface pressure around (but obviously not
into that function) but we might as well pass the dive around (it's
just a pointer). I'll make sure this is done consistently.

> o) This implies deco_allowed_depth is now mainly a ambient-pressure to 
> depth conversion with decorations to avoid negative depth (i.e. no deco 
> obliation), implementation of quantization (!smooth => multiples of 3m) 
> and explicit setting of last deco depth (e.g. 6m for O2 deco).
> o) gf_low_pressure_this_dive (slight change of name), the max depth in 
> pressure units is updated in add_segment. I set the minimal value in 
> buehlmann_config to the equivalent of 20m as otherwise good values of 
> GF_low add a lot of deco to shallow dives which do not need deep stops in 
> the first place.
> o) The bogus loop is gone as well as actual_gradient_limit() and 
> gradient_factor_calculation() and large parts of deco_allowed_depth() 
> although I did not delete the code but put it in comments.

That sounds like a huge improvement :-)

> o) The meat is in the formula in lines 147-154 of deco.c. Here is the 
> rationale:
> Without gradient factors, the M-value (i.e the maximal tissue pressure) 
> at a given depth is given by ambient_pressure / buehlmann_b + a.
> According to "Clearing Up The Confusion About "Deep Stops" by Erik C. 
> Baker (as found via google) the effect of the gradient factors is no 
> replace this by a reduced affine relation (i.e. another line) such that at 
> the surface the difference between M-value and ambient pressure is reduced 
> by a factor GF_high and at the maximal depth by a factor GF_low.
> That is, we are looking for parameters alpha and beta such that
> alpha surface + beta = surface + gf_high * (surface/b + a - surface)
> and
> alpha max_p + beta = max_p + gf_low * (max_p/b + a - max_p)
> This can be solved for alpha and beta (I did this in Mathematica, notebook 
> attached as well) and then inverted to obtain the max ambient pressure 
> given tissue loadings. The result is the above mentioned formula.

Excellent. I like the idea of an analytic solotion very much. Let's see
how it compares to the deco data we have from our dive computers!

> PS: And now I can start my paid work for today...

A feeling I know all too well :-/

One request -  could you send a 

Signed-off-by: ....your name / email

That's a requirement for code to go into Subsurface... you can simply
respond to this email with that, you don't need to resend the patch.
I'll create a commit message using your email :-)


More information about the subsurface mailing list