Converting conductivity to PSS-78 salinity and vice versa
Devices for the measurement of conductivity, temperature and depth (CTD’s) return a conductivity value to represent the amount of dissolved ions in seawater. The conductivity can be converted to a salinity value of the 1978 defined dimensionless practical-salinity-scale (PSS-78, UNESCO 1981 and references therein), which is influenced by the ambient temperature and pressure. Here a function is given to convert values in both directions under consideration of the respective influence of temperature and pressure. The code is based on the Fortran code proposed in 1983 (UNESCO 1983). Additionally, a second function is introduced solely for the conversion of conductivity to practical salinity. It returns the result of the conversion as a parameter, while the return value of the function is a boolean state, indicating whether the result is reliable.
Equation
The complete equation for conversion between conductivity ratio and salinity is given in the UNESCO handbook ‘Algorithms for computation of fundamental properties of seawater’ (UNESCO 1983 and references therein). The coductivity ratio is defined as the ratio between the measured electrical conductivity at a given temperature and pressure against the conductivity of a standard seawater of practical salinity 35 at a temperature of 15°C and atmospheric pressure, defined as 0 dbar. For the function SAL78 the conductivity ratio is calculated by
where R is the conductivity ratio, C(S,t,p) is the measured electrical conductivity and C(35,15,0) the electrical conductivity of the standard seawater, which is 4.2914 S*m-1. For electrical conductivities measured in mS*cm-1 the value needs to be shifted one decade to 42.914 mS*cm-1.
The function Cond2Sal78 uses conductivity values in S*m-1 and can be directly used to convert CTD conductivity values to salinity.
Equations are valid within the temperature range between –2°C and +35°C, pressure range between 0 and 10000 decibars and a practical salinity range between 2 and 42 or the respective electrical conductivity and conductivity ratio. Although practical salinity values <2 are not defined, the equations deliver valid non-zero results down to thresholds of conductivity ratios >0.0005 and salinities >0.02. Values in these outer limits are estimates congruent with the Fortran algorithms (UNESCO 1983). Below these thresholds functions return 0 (UNESCO 1983).
Algorithm
The here given algorithms in object Pascal closely resemble the original Fortran code (UNESCO 1983). Main differences are that GoTo statements were replaced by loops and some minor internal design improvements made.
The SAL78 function ensures downward compatibility for existing interfaces. It implements the original behaviour of the Fortran code given in the UNESCO handbook (UNESCO 1983). The conversion is controlled by the state variable M. For M=0, a conversion from conductivity to practical salinity is performed and for M=1 vice versa. Additionally to the state, the input value is required in the variable CND (as conductivity ratio or salinity in PSS-78), temperature in T (°C) and pressure in P (decibars). The return value of the function is the converted result.
Function Sal78 (CND, T, P: Double; M : Integer) : Double; // THE CONDUCTIVITY RATIO (CND)=1.0000000 FOR SALINITY=35 PSS-78 // TEMPERATURE=15.0 DEG. CELSIUS AND ATMOSPHERIC PRESSURE. // FUNCTION TO CONVERT CONDUCTIVITY RATIO TO SALINITY (M=0) // SALINITY TO CONDUCTIVITY RATIO (M=1, CND BECOMES INPUT SALINITY) // REFERENCES: ALSO LOCATED IN UNESCO REPORT NO. 37 1981 // PRACTICAL SALINITY SCALE 1978: E.L. LEWIS IEEE OCEAN ENG. JAN. 1980 // ---------------------------------------------------------- // UNITS: // PRESSURE P DECIBARS // TEMPERATURE T DEG CELSIUS IPTS-68 // CONDUCTIVITY CND RATIO (M=0) // SALINITY SAL78 PSS-78 (M=0) // ---------------------------------------------------------- // CHECKVALUES: // 1.) SAL78=1.888091 for CND=40.0000, T=40 DEG C, P=10000 DECIBARS: M=1 // 2.) SAL78=40.00000 for CND=1.888091, T=40 DEG C, P=10000 DECIBARS: M=0 // ---------------------------------------------------------- // SAL78 RATIO: RETURNS ZERO FOR CONDUCTIVITY RATIO: < 0.0005 // SAL78: RETURNS ZERO FOR SALINITY: < 0.02 // ---------------------------------------------------------- // Original fortran code is found in: // UNESCO technical papers in marine science 44 (1983) - // 'Algorithms for computation of fundamental properties of seawater' // ---------------------------------------------------------- // Translated to object pascal by: // Dr. Jan Schulz, 19. May 2008, www.code10.info
Function SAL (XR, XT: Double): Double; // PRACTICAL SALINITY SCALE 1978 DEFINITION WITH TEMPERATURE // CORRECTION;XT :=T-15.0; XR:=SQRT(RT); Begin
SAL := ((((2.7081*XR-7.0261)*XR+14.0941)*XR+25.3851)*XR - 0.1692)*XR+0.0080 + (XT/(1.0+0.0162*XT))*(((((-0.0144*XR + 0.0636)*XR-0.0375)*XR-0.0066)*XR-0.0056)*XR+0.0005); end;
Function DSAL (XR, XT: Double): Double; // FUNCTION FOR DERIVATIVE OF SAL(XR,XT) WITH XR Begin DSAL := ((((13.5405 * XR - 28.1044) * XR + 42.2823) * XR + 50.7702) * XR - 0.1692) + (XT / (1.0 + 0.0162 * XT)) * ((((-0.0720 * XR + 0.2544) * XR - 0.1125) * XR - 0.0132) * XR - 0.0056); end;
Function RT35 (XT : Double) : Double; // FUNCTION RT35: C(35,T,0)/C(35,15,0) VARIATION WITH TEMPERATURE Begin RT35 := (((1.0031E-9 * XT - 6.9698E-7) * XT + 1.104259E-4) * XT + 2.00564E-2) * XT + 0.6766097; end;
Function C (XP : Double) : Double; // C(XP) POLYNOMIAL CORRESPONDS TO A1-A3 CONSTANTS: LEWIS 1980 Begin C := ((3.989E-15 * XP - 6.370E-10) * XP + 2.070E-5) * XP; end;
Function B (XT :Double) : Double; Begin B := (4.464E-4 * XT + 3.426E-2) * XT + 1.0; end;
Function A (XT : Double): Double; //A(XT) POLYNOMIAL CORRESPONDS TO B3 AND B4 CONSTANTS: LEWIS 1980 Begin A := -3.107E-3 * XT + 0.4215; end;
Var DT : Double; Res : Double; RT : Double; SI : Double; N : Integer; DELS : Double; RTT : Double; AT : Double; BT : Double; CP : Double; Begin SAL78 := 0;
// ZERO SALINITY/CONDUCTIVITY TRAP If ((M = 0) And (CND <= 5e-4)) Or ((M = 1) And (CND <= 0.2)) THen Begin Exit; end;
DT := T - 15;
// SELECT BRANCH FOR SALINITY (M=0) OR CONDUCTIVITY (M=1) If M = 0 THen Begin // CONVERT CONDUCTIVITY TO SALINITY Res := CND; RT := Res / (RT35 (T) * (1.0 + C (P) / (B (T) + A (T) * Res))); RT := Sqrt (ABS (RT)); Sal78 := SAL (RT, DT); Exit; end;
If M = 1 THen Begin // INVERT SALINITY TO CONDUCTIVITY BY THE // NEWTON-RAPHSON ITERATIVE METHOD // FIRST APPROXIMATION
RT := Sqrt (CND / 35); SI := SAL (RT, DT); N := 0;
// ITERATION LOOP BEGINS HERE WITH A MAXIMUM OF 10 CYCLES Repeat RT := RT + (CND - SI) / DSAL (RT, DT); SI := SAL (RT, DT); N := N + 1; DELS := Abs (SI - CND)
//IF((DELS.GT.1.0E-4).AND.(N.LT.10)) GO TO 15 Until (DELS < 1e-4) Or (N >= 10); //Until not ((DELS > 1.0E-4) AND (N <10));
//COMPUTE CONDUCTIVITY RATIO RTT := RT35 (T) * RT * RT; AT := A (T); BT := B (T); CP := C (P); CP := RTT * (CP + BT); BT := BT - RTT * AT;
// SOLVE QUADRATIC EQUATION FOR R: R=RT35*RT*(1+C/AR+B) // R := SQRT (ABS (BT * BT + 4.0 * AT * CP)) - BT; Res := Sqrt (Abs (BT * BT + 4 * AT * CP)) - BT;
// CONDUCTIVITY RETURN Sal78 := 0.5 * Res / AT; end; end;
The function Cond2Sal78 converts conductivity to salinity. Required input parameters are aConductivity in S*m-1,Temp in °C and Press in decibars. In contrast to the function Sal78 it returns the salinity value as a parameter, while the return value of the function is a boolean. The function returns TRUE, if the passed conductivity value is >0.2 and the result of the conversion is between 2 and 40 PSS-78. In other cases FALSE is returned, indicating that the result might be unreliable (see above: Equation).
Function Cond2Sal78 (aConductivity, Temp, Press : Double; Var aSalinity: Double) : Boolean; // Function Cond2Sal converts a conductivity value of seawater to a value // of the pratical-salinity-scale 1978 (PSS-78) for given values of // conductivity, temperature and pressure. Result is returned as // parameter in aSalinity. A returned boolean result TRUE of the // function indicates that the result is reliable. // UNITS: // PRESSURE Press DECIBARS // TEMPERATURE Temp DEG CELSIUS IPTS-68 // CONDUCTIVITY aConductivity S/m // SALINITY aSalinity PSS-78 // ---------------------------------------------------------- // CHECKVALUES: // 2.) aSalinity=40.00000 for CND=1.888091, T=40 DEG C, P=10000 DECIBARS // ---------------------------------------------------------- // SAL78 RATIO: RETURNS ZERO FOR CONDUCTIVITY RATIO: < 0.0005 // ---------------------------------------------------------- // This source code is based on the original fortran code in: // UNESCO technical papers in marine science 44 (1983) - // 'Algorithms for computation of fundamental properties of seawater' // ---------------------------------------------------------- // Written in object pascal by: // Dr. Jan Schulz, 26. May 2008, www.code10.info
Function SAL (XR, XT: Double): Double; // PRACTICAL SALINITY SCALE 1978 DEFINITION WITH TEMPERATURE // CORRECTION;XT :=T-15.0; XR:=SQRT(RT); Begin
SAL := ((((2.7081*XR-7.0261)*XR+14.0941)*XR+25.3851)*XR - 0.1692)*XR+0.0080 + (XT/(1.0+0.0162*XT))*(((((-0.0144*XR + 0.0636)*XR-0.0375)*XR-0.0066)*XR-0.0056)*XR+0.0005); end;
Function RT35 (XT : Double) : Double; // FUNCTION RT35: C(35,T,0)/C(35,15,0) VARIATION WITH TEMPERATURE Begin RT35 := (((1.0031E-9 * XT - 6.9698E-7) * XT + 1.104259E-4) * XT + 2.00564E-2) * XT + 0.6766097; end;
Function C (XP : Double) : Double; // C(XP) POLYNOMIAL CORRESPONDS TO A1-A3 CONSTANTS: LEWIS 1980 Begin C := ((3.989E-15 * XP - 6.370E-10) * XP + 2.070E-5) * XP; end;
Function B (XT :Double) : Double; Begin B := (4.464E-4 * XT + 3.426E-2) * XT + 1.0; end;
Function A (XT : Double): Double; //A(XT) POLYNOMIAL CORRESPONDS TO B3 AND B4 CONSTANTS: LEWIS 1980 Begin A := -3.107E-3 * XT + 0.4215; end; Var DT : Double; RT : Double; Begin // we expect the best Cond2Sal78 := True; aSalinity := 0;
// equation is not defined for conductivity values below 5e-4 If aConductivity <= 0.2 THen Begin Cond2Sal78 := False; Exit; end;
// start conversion DT := Temp - 15; aSalinity := aConductivity/4.2914; RT := aSalinity / (RT35 (Temp) * (1.0 + C (Press) / (B (Temp) + A (Temp) * aSalinity))); RT := Sqrt (Abs (RT)); aSalinity := SAL (RT, DT);
// control, whether result is in the validity range of PSS-78 If (aSalinity < 2) Or (aSalinity > 42) THen Begin Cond2Sal78 := False; end; end;
Literature
UNESCO (1981): Background papers and supporting data on the Practical Salinity Scale, 1978. UNESCO technical papers in marine science 37:1-144.
UNESCO (1983): Algorithms for computation of fundamental properties of seawater. UNESCO technical papers in marine science 44:1-55.
|