57 #ifndef GOBY_UTIL_SEAWATER_DETAIL_SALINITY_IMPL_H
58 #define GOBY_UTIL_SEAWATER_DETAIL_SALINITY_IMPL_H
77 static double compute(
double CND,
double T,
double P,
bool M)
82 if (((M == 0) && (CND <= 5
e-4)) || ((M == 1) && (CND <= 0.2)))
92 double RT = Res / (RT35(T) * (1.0 + C(P) / (
B(T) + A(T) * Res)));
93 RT = std::sqrt(std::abs(RT));
103 double RT = std::sqrt(CND / 35);
104 double SI = SAL(RT, DT);
111 RT = RT + (CND - SI) / DSAL(RT, DT);
114 DELS = std::abs(SI - CND);
116 }
while ((DELS > 1
e-4) && (N < 10));
119 double RTT = RT35(T) * RT * RT;
123 CP = RTT * (CP + BT);
128 double Res = std::sqrt(std::abs(BT * BT + 4 * AT * CP)) - BT;
130 SAL78 = 0.5 * Res / AT;
136 static double SAL(
double XR,
double XT)
141 ((((2.7081 * XR - 7.0261) * XR + 14.0941) * XR + 25.3851) * XR - 0.1692) * XR + 0.0080 +
142 (XT / (1.0 + 0.0162 * XT)) *
143 (((((-0.0144 * XR + 0.0636) * XR - 0.0375) * XR - 0.0066) * XR - 0.0056) * XR +
148 static double DSAL(
double XR,
double XT)
151 double dsal = ((((13.5405 * XR - 28.1044) * XR + 42.2823) * XR + 50.7702) * XR - 0.1692) +
152 (XT / (1.0 + 0.0162 * XT)) *
153 ((((-0.0720 * XR + 0.2544) * XR - 0.1125) * XR - 0.0132) * XR - 0.0056);
157 static double RT35(
double XT)
161 (((1.0031E-9 * XT - 6.9698E-7) * XT + 1.104259E-4) * XT + 2.00564E-2) * XT + 0.6766097;
165 static double C(
double XP)
168 double c = ((3.989E-15 * XP - 6.370E-10) * XP + 2.070E-5) * XP;
172 static double B(
double XT)
174 double b = (4.464E-4 * XT + 3.426E-2) * XT + 1.0;
178 static double A(
double XT)
181 double a = -3.107E-3 * XT + 0.4215;
185 SalinityCalculator();
186 ~SalinityCalculator();
187 SalinityCalculator(
const SalinityCalculator&);
188 SalinityCalculator& operator=(
const SalinityCalculator&);