Description
When opening the "Log" -> "Plan dive" menu, the watertype fresh water with a density of 1,00 kg/l is selected. As long as this selection is not changed, all calculations are done with salt walter.
I was testing my own Buhlmann implementation against other implementations and stumbled upon a difference with Subsurface.
For testing purpose I got the current git master of Subsurface and added the following output to calculate_depth_to_mbarf in core/dive.cpp just before the return line.
std::cout << "calculate_depth_to_mbarf: depth=" << depth.mm << "mm, surface_pressure=" << surface_pressure.mbar << "mbar, salinity=" << salinity << "g/10l, specific_weight=" << specific_weight << "mbar/mm" << std::endl;
The salinity printed out is that of saltwater and is used in add_segment of core/deco.cpp.
When changing the water type in the gui to salt walter and back to fresh water, the correct salinity is used.
--- a/core/dive.cpp
+++ b/core/dive.cpp
@@ -6,6 +6,7 @@
#include <stdlib.h>
#include <limits.h>
#include <memory>
+#include <iostream>
#include "dive.h"
#include "gettext.h"
#include "subsurface-string.h"
@@ -2552,6 +2553,7 @@ static double calculate_depth_to_mbarf(depth_t depth, pressure_t surface_pressur
if (salinity < 500)
salinity += FRESHWATER_SALINITY;
double specific_weight = salinity_to_specific_weight(salinity);
+ std::cout << "calculate_depth_to_mbarf: depth=" << depth.mm << "mm, surface_pressure=" << surface_pressure.mbar << "mbar, salinity=" << salinity << "g/10l, specific_weight=" << specific_weight << "mbar/mm" << std::endl;
return surface_pressure.mbar + depth.mm * specific_weight;
}
Subsurface Version
6.0.5621-dfx and git master @ 40a53ed
Platform(s)
Linux
Platform Version
Debian Testing (Forky)
Divecomputer Model
none
Steps to Reproduce
- Open "Log" -> "Plan dive"
- Do not change the water type!
- Calculate a long and deep dive (eg 40m, 30 min)
- Write down the deco
- Change the water type to "salt water" and back to "fresh water"
- Compare the deco from step 3 and step 5
Logs
Mentions
No response
Description
When opening the "Log" -> "Plan dive" menu, the watertype fresh water with a density of 1,00 kg/l is selected. As long as this selection is not changed, all calculations are done with salt walter.
I was testing my own Buhlmann implementation against other implementations and stumbled upon a difference with Subsurface.
For testing purpose I got the current git master of Subsurface and added the following output to calculate_depth_to_mbarf in core/dive.cpp just before the return line.
The salinity printed out is that of saltwater and is used in add_segment of core/deco.cpp.
When changing the water type in the gui to salt walter and back to fresh water, the correct salinity is used.
Subsurface Version
6.0.5621-dfx and git master @ 40a53ed
Platform(s)
Linux
Platform Version
Debian Testing (Forky)
Divecomputer Model
none
Steps to Reproduce
Logs
Mentions
No response