Skip to content

Sound velocity

MATLAB Scripts

Matlab scripts for sound velocity

 

UNESCO ’95 sound speed equations

Fitting the velocity of sound (Vsnd) calculated from the UNESCO ’95 equation to the van ‘t Hoff equation format was a multi-step process. The following Matlab® code script files were used:

  1. Vsnd_tp.m – Fit sound speed calculated with UNESCO ’95 equation for T,P matrix at SP=35 to the van ‘t Hoff equation.
    • Vsnd_un95.m – Calculate Vsnd using the UNESCO ’95 equation at S,T,P. Called by #1 above.
    • setfont.m – Set font style and size for plots. Called by #1 above.
  2. Vsnd_tp_xplt.m – Comparison check plots of Vsnd calculated by the UNESCO ’95 equation and the van ‘t Hoff format equation (3rd order in T and 3rd order in P) at SP=35.
    • Figure 1: ln(Vsnd) vs 1000/T°K.
    • Figure 2: Vsnd vs T°C.
  3. Vsnd_tp_xplt2.m – Comparison check plots of Vsnd calculated by the UNESCO ’95 equation and the van ‘t Hoff format equation (4th order in T and 2nd order in P) at SP=35.
    • Figure 1: ln(Vsnd) vs 1000/T°K.
    • Figure 2: Vsnd vs T°C.
  4. Vsnd_tp_xplt3.m – Comparison check plots of Vsnd calculated by the UNESCO ’95 equation and the van ‘t Hoff format equation (4th order in T and 3rd order in P) at SP=35.
    • Figure 1: ln(Vsnd) vs 1000/T°K.
    • Figure 2: Vsnd vs T°C.
  5. Vsnd_tp_xplt4.m – Comparison check plots of Vsnd calculated by the UNESCO ’95 equation and the van ‘t Hoff format equation (4th order in T and 4th order in P) at SP=35.
    • Figure 1: ln(Vsnd) vs 1000/T°K.
    • Figure 2: Vsnd vs T°C.
  6. Vsnd_sc.m – Calculation of Vsnd salinity correction term, ΔV, with UNESCO ’95 equation for S,T matrix at P = 0 dbar.
  7. Vsnd_sc_xplt.m – Comparison check plots of Vsnd(S) calculated by the UNESCO ’95 equation and the van ‘t Hoff format equation.
    • Figure 1: ln(Vsnd) vs 1000/T°K at P = 0 dbar.
    • Figure 2: Vsnd vs T°C at P = 0 dbar.
  8. Vsnd_stp_xplt.m – Comparison check plots of Vsnd(S,T,P) calculated by the UNESCO ’95 equation and the van ‘t Hoff format equation.
    • Figure 1: Vsnd vs T°C at P = 0 bar.
    • Figure 2: Vsnd vs T°C at P = 200 bar.
    • Figure 3: Vsnd vs T°C at P = 400 bar.
    • Figure 4: Vsnd vs T°C at P = 600 bar.
    • Figure 5: Vsnd vs T°C at P = 800 bar.
    • Figure 6: Vsnd vs T°C at P = 1000 bar.
  9. Vsnd_x_sigfigs.m – Comparison of Vsnd(S,T,P) calculated by the van ‘t Hoff format equation using full precision coefficients (15 digits) vs reduced length coefficients in order to find minimum coefficient length needed in order to calculate Vsnd without any loss of accuracy.
    • Vsnd_flc1.m – van ‘t Hoff Vsnd function with full length coefficients.
    • Vsnd_stp1.m – van ‘t Hoff Vsnd function with reduced length coefficients.

Then we made a series of plots to demonstrate the closeness of fit and the minimal size of the offsets between Vsnd(UNESCO ’95) and Vsnd(van ‘t Hoff):

  1. xPlot_AR01S54.m – Sound speed comparison for WOCE Leg AR01 / station 54.
    • AR01_S54.mat – Hydrographic data for WOCE Leg AR01 / station 54.
    • setfont.m – Set font style and size for plots.
    • Vsnd_un95.m – Matlab function to calculate Vsnd using the UNESCO ’95 equation.
    • Vsnd_stp1.m – Matlab function to calculate Vsnd using the van ‘t Hoff format equation fit to the UNESCO ’95 data matrix.
  2. xPlot_P17NS10.m – Sound speed comparison for WOCE Leg P17N / station 10.
    • P17N_S10.mat – Hydrographic data for WOCE Leg P17N / station 10.
  3. yPlot_Contours.m – Draw 2-D contours showing rms differences between the van ‘t Hoff formulation of the speed of sound in seawater minus the UNESCO 1995 speed of sound equation.
  4. zPlot_Offsets_fig1.m – Draw 3-D graphic showing rms differences between the van ‘t Hoff formulation of the speed of sound in seawater minus the UNESCO 1995 speed of sound equation for S = 33 to 37.
  5. zPlot_Offsets_fig2.m – Draw 3-D graphic showing rms differences between the van ‘t Hoff formulation of the speed of sound in seawater minus the UNESCO 1995 speed of sound equation for S = 15 to 40.

TEOS-10 sound speed equations

Fitting the velocity of sound (Vsnd) calculated from the Thermodynamic Equation of Seawater 2010 (TEOS-10) to the van ‘t Hoff equation format was also a multi-step process. Note: to use the following equations, the Matlab® Gibbs-SeaWater (GSW) Oceanographic Toolbox, which contains the TEOS-10 equations, must be installed on your computer and the toolbox folders must be in your Matlab® path. For more information about the GSW Oceanographic Toolbox please refer to: McDougall, T.J. and P.M. Barker (2011) Getting started with TEOS-10 and the Gibbs Seawater (GSW) Oceanographic Toolbox, 28pp., SCOR/IAPSO WG127, ISBN 978-0-646-55621-5.

  1. Vsnd_tp.m – Fit sound speed calculated with TEOS-10 equation for T,P matrix at SP=35 to the van ‘t Hoff equation.
    • setfont.m – Set font style and size for plots. Called by #1 above.
  2. Vsnd_sc.m – Calculation of Vsnd salinity correction term, ΔV, with TEOS-10 equation for S,T matrix at P = 0 dbar.
  3. Vsnd_x_sigfigs.m – Comparison of Vsnd(S,T,P) calculated by the van ‘t Hoff format equation using full precision coefficients (15 digits) vs reduced length coefficients in order to find minimum coefficient length needed in order to calculate Vsnd without any loss of accuracy.
    • Vsnd_flc2.m – van ‘t Hoff Vsnd function with full length coefficients.
    • Vsnd_stp2.m – van ‘t Hoff Vsnd function with reduced length coefficients.

Then we made a series of plots to demonstrate the closeness of fit and the minimal size of the offsets between Vsnd(TEOS-10) and Vsnd(van ‘t Hoff):

  1. xPlot_AR01S54_6a.m – Sound speed comparison for WOCE Leg AR01 / station 54.
    • AR01_S54.mat – Hydrographic data for WOCE Leg AR01 / station 54.
    • Vsnd_stp2.m – Matlab function to calculate Vsnd using the van ‘t Hoff format equation fit to the TEOS-10 data matrix.
  2. xPlot_P17NS10_6a.m – Sound speed comparison for WOCE Leg P17N / station 10.
    • P17N_S10.mat – Hydrographic data for WOCE Leg P17N / station 10.
    • Vsnd_stp2.m – Matlab function to calculate Vsnd using the van ‘t Hoff format equation fit to the TEOS-10 data matrix.
  3. yPlot_Contours_6a.m – Draw 2-D contours showing rms differences between the van ‘t Hoff formulation of the speed of sound in seawater minus the TEOS-10 speed of sound equation.
  4. zPlot_Offsets_6a_fig1.m – Draw 3-D graphic showing rms differences between the van ‘t Hoff formulation of the speed of sound in seawater minus the UNESCO 1995 speed of sound equation for S = 33 to 37.
  5. zPlot_Offsets_6a_fig2.m – Draw 3-D graphic showing rms differences between the van ‘t Hoff formulation of the speed of sound in seawater minus the UNESCO 1995 speed of sound equation for S = 15 to 40.

Lastly we made a series of plots to demonstrate the closeness of fit between Vsnd calculated with the TEOS-10 computationally efficient equation (using 75 coefficients) and the TEOS-10 full equation (with 104 coefficients) as was used above:

  1. xPlot_AR01S54_6b.m – Sound speed comparison for WOCE Leg AR01 / station 54.
    • AR01_S54.mat – Hydrographic data for WOCE Leg AR01 / station 54.
  2. xPlot_P17NS10_6b.m – Sound speed comparison for WOCE Leg P17N / station 10.
    • P17N_S10.mat – Hydrographic data for WOCE Leg P17N / station 10.
  3. yPlot_Contours_6b.m – Draw 2-D contours showing rms differences between the van ‘t Hoff formulation of the speed of sound in seawater minus the TEOS-10 speed of sound equation.
  4. zPlot_Offsets_6b_fig1.m – Draw 3-D graphic showing rms differences between the van ‘t Hoff formulation of the speed of sound in seawater minus the UNESCO 1995 speed of sound equation for S = 33 to 37.
  5. zPlot_Offsets_6b_fig2.m – Draw 3-D graphic showing rms differences between the van ‘t Hoff formulation of the speed of sound in seawater minus the UNESCO 1995 speed of sound equation for S = 15 to 40.