Large negative pressures

Robert Helling helling at lmu.de
Wed Aug 7 06:42:26 PDT 2019


Hi,

here is a problem that came up in https://github.com/Subsurface-divelog/subsurface/issues/2212 that I would like your opinion on how to address it:

The planner tries computes the consumed gas for the dives it plans. It computes it in terms of litres of gas. Then, in the end, using the assumed cylinder size this is converted into a pressure drop.

As you know, internally, all our pressures are in mbar and stored in pressure_t which happens to be an int32_t. Its maximal value corresponds to about 200bar.

If you now plan a dive that is deep and long and assume a very small cylinders size (say 1l), the pressure can underflow and weird things happen, the pressure graphs go zig zag (as they are over/underflowing in the attempted interpolation) and Subsurface hangs when saving the plan in the attempt to redraw the profile (I have not yet spent enough time in the debugger to find exactly where).

So here are two ways to proceed:

1) Conclude that tank pressures of minus some thousand bar are ridiculous and cut them off at some value (for example replace negative pressures by 0 or allow only somewhat negative values like minus maximal operating pressure. This is of course supported by reality which does not like negative pressures. However, a negative pressure can be meaningful in the sense of informing the user how much bigger the cylinder would need to be to accommodate the gas usage. So cutting at zero removes that information and any other number is arbitrary.

2) Make pressure_t (and related variable) int64_t, increase memory footprint and slow down pressure computations to accommodate these values. I have to admit, I tried to do that but have not found all places where this needs to be done, I can avoid the hand but it still takes a long time to save a plan and the pressure graphs still look wrong.

I would like to have your opinion on how to proceed from here.

Best
Robert

--
.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oO
Robert C. Helling   Elite Master Course Theoretical and Mathematical Physics
                    Scientific Coordinator
                    Ludwig Maximilians Universitaet Muenchen, Dept. Physik
                    Phone: +49 89 2180-4523  Theresienstr. 39, rm. B339
                    http://www.atdotde.de

Enhance your privacy, use cryptography! My PGP keys have fingerprints
A9D1 A01D 13A5 31FA 6515  BB44 0820 367C 36BC 0C1D    and
DCED 37B6 251C 7861 270D  5613 95C7 9D32 9A8D 9B8F

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 235 bytes
Desc: Message signed with OpenPGP
URL: <http://lists.subsurface-divelog.org/pipermail/subsurface/attachments/20190807/a2be23df/attachment.sig>


More information about the subsurface mailing list