Meaning of GF settings

Robert C. Helling helling at
Sat Jan 5 14:56:59 PST 2013

On Jan 5, 2013, at 5:35 PM, Dirk Hohndel wrote:

Hi everybody,

I guess I found the origin of the discontinuities: It comes about by the (strange) way, the code tries to express everything in gradient factors rather than depths. But let me first say...

> That part I understand - what surprised me is how drastic these steps
> are. It seems as if there still is a 3m step hidden in the code
> somewhere... and I already found where... it's in the GF adjustment
> code:
> 	new_gradient_factor = gradient_factor_calculation(&mydata);
> 	below_gradient_limit = (new_gradient_factor < actual_gradient_limit(&mydata));
> 	while(!below_gradient_limit)
> 	{
> 		mydata.pressure += PRESSURE_CHANGE_3M;
> 		new_gradient_factor = gradient_factor_calculation(&mydata);
> 		below_gradient_limit = (new_gradient_factor < actual_gradient_limit(&mydata));
> 	}
> 	depth = rel_mbar_to_depth((mydata.pressure - surface_pressure) * 1000, dive);
> 	return depth;
> So while we do the smooth calculation for most of the time, the GF
> pushes us into 3M changes... I think I'll play with a modification that
> does the loop here with 1M increments if we are in 'smooth' mode.

if I understand this correctly, at least in the smooth case, this loop tries to reverse the calculation of the function actual_gradient_limit by trial an error. It tries to find a pressure (i.e. depth) where the corresponding percentage of saturation matches the current maximal) by increasing the pressure until it matches while one could much more easily invert the formula as 

pressure_diff = (gf_high - gf)/(gf_high - gf_low) * gf_low_position_this_dive

Furthermore, it seems, gf_low_position_this_dive should be set to the difference between ambient pressure and surface pressure at the deepest point of the dive (where GF_low applies) but this is not in the code. It is only initialized but never again set.

The real origin of the discontinuities is the return statement of gradient_factor_calculation: When the leading compartment changes, indeed as I wrote earlier the tolerated ambient pressure of the two compartments is equal. But the tissue_inertgas_saturation differs as the compartments have different a's and b's. Thus the return value jumps when the leading compartment changes.

I should say that this code is not how I would have implemented GF's according to my understanding of the algorithm. I always thought that at the deepest point of the dive GF_low applies and that at any other depths one uses a linearly interpolated GF between GF_low at max depth and GH_high at the surface. Then one calculates the tolerated ambient pressure for each compartment by computing the pressure excess according to Buehlmann and multiplies this with the GF of the current depth. I.e. I would calculate with pressures or depths rather than percentages.

Let me know what you think but it seems to me deco.c would need a complete rewrite to at least match my understanding of the GF algorithm.

Good night

Robert C. Helling     Elite Master Course Theoretical and Mathematical Physics  
                      Scientific Coordinator                                   
                      Ludwig Maximilians Universitaet Muenchen, Dept. Physik    
print "Just another   Phone: +49 89 2180-4523  Theresienstr. 39, rm. B339       
    stupid .sig\n"; 

More information about the subsurface mailing list