68 static double salinity(
double cnd_milli_siemens_per_cm,
double temp_deg_c,
double pressure_dbar,
71 const double CONDUCTIVITY_AT_STANDARD = 42.914;
72 double CND = cnd_milli_siemens_per_cm / CONDUCTIVITY_AT_STANDARD;
73 double T = temp_deg_c;
74 double P = pressure_dbar;
79 if (((M == 0) && (CND <= 5e-4)) || ((M == 1) && (CND <= 0.2)))
89 double RT = Res / (RT35(T) * (1.0 + C(P) / (
B(T) +
A(T) * Res)));
90 RT = std::sqrt(std::abs(RT));
100 double RT = std::sqrt(CND / 35);
101 double SI = SAL(RT, DT);
108 RT = RT + (CND - SI) / DSAL(RT, DT);
111 DELS = std::abs(SI - CND);
114 while ((DELS < 1e-4) || (N >= 10));
118 double RTT = RT35(T) * RT * RT;
122 CP = RTT * (CP + BT);
127 double Res = std::sqrt(std::abs(BT * BT + 4 * AT * CP)) - BT;
129 SAL78 = 0.5 * Res / AT;
135 static double SAL(
double XR,
double XT)
140 ((((2.7081 * XR - 7.0261) * XR + 14.0941) * XR + 25.3851) * XR - 0.1692) * XR + 0.0080 +
141 (XT / (1.0 + 0.0162 * XT)) *
142 (((((-0.0144 * XR + 0.0636) * XR - 0.0375) * XR - 0.0066) * XR - 0.0056) * XR +
147 static double DSAL(
double XR,
double XT)
150 double dsal = ((((13.5405 * XR - 28.1044) * XR + 42.2823) * XR + 50.7702) * XR - 0.1692) +
151 (XT / (1.0 + 0.0162 * XT)) *
152 ((((-0.0720 * XR + 0.2544) * XR - 0.1125) * XR - 0.0132) * XR - 0.0056);
156 static double RT35(
double XT)
160 (((1.0031E-9 * XT - 6.9698E-7) * XT + 1.104259E-4) * XT + 2.00564E-2) * XT + 0.6766097;
164 static double C(
double XP)
167 double c = ((3.989E-15 * XP - 6.370E-10) * XP + 2.070E-5) * XP;
171 static double B(
double XT)
173 double b = (4.464E-4 * XT + 3.426E-2) * XT + 1.0;
177 static double A(
double XT)
180 double a = -3.107E-3 * XT + 0.4215;