diff --git a/Toolbox/Contents.m b/Toolbox/Contents.m index 63461df..a58ef0b 100644 --- a/Toolbox/Contents.m +++ b/Toolbox/Contents.m @@ -1,5 +1,5 @@ % GSW Oceanographic Toolbox -% Version 3.02 (R2011a) 15-May-2011 +% Version 3.03 (R2011a) 23-May-2013 % % documentation set % gsw_front_page - front page to the GSW Oceanographic Toolbox @@ -12,6 +12,7 @@ % gsw_SP_from_R - Practical Salinity from conductivity ratio, R (inc. for SP < 2) % gsw_R_from_SP - conductivity ratio, R, from Practical Salinity (inc. for SP < 2) % gsw_SP_salinometer - Practical Salinity from a laboratory salinometer (inc. for SP < 2) +% gsw_SP_from_SK - Practical Salinity from Knudsen Salinity % % Absolute Salinity (SA), Preformed Salinity (Sstar) and Conservative Temperature (CT) % gsw_SA_from_SP - Absolute Salinity from Practical Salinity @@ -24,93 +25,100 @@ % and selected potential density contours % % other conversions between temperatures, salinities, pressure and height -% gsw_deltaSA_from_SP - Absolute Salinity Anomaly from Practical Salinity -% gsw_SA_Sstar_from_SP - Absolute Salinity & Preformed Salinity from Practical Salinity -% gsw_SR_from_SP - Reference Salinity from Practical Salinity -% gsw_SP_from_SR - Practical Salinity from Reference Salinity -% gsw_SP_from_SA - Practical Salinity from Absolute Salinity -% gsw_Sstar_from_SA - Preformed Salinity from Absolute Salinity -% gsw_SA_from_Sstar - Absolute Salinity from Preformed Salinity -% gsw_SP_from_Sstar - Practical Salinity from Preformed Salinity -% gsw_pt_from_CT - potential temperature from Conservative Temperature -% gsw_t_from_CT - in-situ temperature from Conservative Temperature -% gsw_CT_from_pt - Conservative Temperature from potential temperature -% gsw_pot_enthalpy_from_pt - potential enthalpy from potential temperature -% gsw_pt0_from_t - potential temperature with a reference pressure of zero dbar -% gsw_pt_from_t - potential temperature -% gsw_t90_from_t48 - ITS-90 temperature from IPTS-48 temperature -% gsw_t90_from_t68 - ITS-90 temperature from IPTS-68 temperature -% gsw_z_from_p - height from pressure -% gsw_p_from_z - pressure from height -% gsw_depth_from_z - depth from height -% gsw_z_from_depth - height from depth -% gsw_Abs_Pressure_from_p - Absolute Pressure,P, from pressure, p -% gsw_p_from_Abs_Pressure - pressure, p, from Absolute Pressure, P -% gsw_entropy_from_CT - entropy from Conservative Temperature -% gsw_CT_from_entropy - Conservative Temperature from entropy -% gsw_entropy_from_pt - entropy from potential temperature -% gsw_pt_from_entropy - potential temperature from entropy -% gsw_molality_from_SA - molality of seawater -% gsw_ionic_strength_from_SA - ionic strength of seawater +% gsw_deltaSA_from_SP - Absolute Salinity Anomaly from Practical Salinity +% gsw_SA_Sstar_from_SP - Absolute Salinity & Preformed Salinity from Practical Salinity +% gsw_SR_from_SP - Reference Salinity from Practical Salinity +% gsw_SP_from_SR - Practical Salinity from Reference Salinity +% gsw_SP_from_SA - Practical Salinity from Absolute Salinity +% gsw_Sstar_from_SA - Preformed Salinity from Absolute Salinity +% gsw_SA_from_Sstar - Absolute Salinity from Preformed Salinity +% gsw_SP_from_Sstar - Practical Salinity from Preformed Salinity +% gsw_pt_from_CT - potential temperature from Conservative Temperature +% gsw_t_from_CT - in-situ temperature from Conservative Temperature +% gsw_CT_from_pt - Conservative Temperature from potential temperature +% gsw_pot_enthalpy_from_pt - potential enthalpy from potential temperature +% gsw_pt_from_t - potential temperature +% gsw_pt0_from_t - potential temperature with a reference pressure of zero dbar +% gsw_t_from_pt0 - in-situ temperature from potential temperature with p_ref = 0 dbar +% gsw_t90_from_t48 - ITS-90 temperature from IPTS-48 temperature +% gsw_t90_from_t68 - ITS-90 temperature from IPTS-68 temperature +% gsw_z_from_p - height from pressure +% gsw_p_from_z - pressure from height +% gsw_z_from_depth - height from depth +% gsw_depth_from_z - depth from height +% gsw_Abs_Pressure_from_p - Absolute Pressure,P, from pressure, p +% gsw_p_from_Abs_Pressure - pressure, p, from Absolute Pressure, P +% gsw_entropy_from_CT - entropy from Conservative Temperature +% gsw_CT_from_entropy - Conservative Temperature from entropy +% gsw_entropy_from_pt - entropy from potential temperature +% gsw_pt_from_entropy - potential temperature from entropy +% gsw_entropy_from_t - entropy from in-situ temperature +% gsw_t_from_entropy - in-situ temperature from entropy +% gsw_adiabatic_lapse_rate_from_CT - adiabatic lapse rate from Conservative Temperature +% gsw_adiabatic_lapse_rate_from_t - adiabatic lapse rate from in-situ temperature +% gsw_molality_from_SA - molality of seawater +% gsw_ionic_strength_from_SA - ionic strength of seawater % % density and enthalpy, based on the 48-term expression for density -% (The functions in this group ending in "_CT" may also be called without "_CT".) -% gsw_rho_CT - in-situ density from CT, and potential density -% gsw_alpha_CT - thermal expansion coefficient with respect to CT -% gsw_beta_CT - saline contraction coefficient at constant CT -% gsw_rho_alpha_beta_CT - in-situ density, thermal expansion & saline contraction coefficients -% gsw_specvol_CT - specific volume -% gsw_specvol_anom_CT - specific volume anomaly -% gsw_sigma0_CT - sigma0 from CT with reference pressure of 0 dbar -% gsw_sigma1_CT - sigma1 from CT with reference pressure of 1000 dbar -% gsw_sigma2_CT - sigma2 from CT with reference pressure of 2000 dbar -% gsw_sigma3_CT - sigma3 from CT with reference pressure of 3000 dbar -% gsw_sigma4_CT - sigma4 from CT with reference pressure of 4000 dbar -% gsw_sound_speed_CT - sound speed (approximate, with r.m.s. error of 0.067 m/s) -% gsw_internal_energy_CT - internal energy -% gsw_enthalpy_CT - enthalpy -% gsw_enthalpy_diff_CT - difference of enthalpy between two pressures -% gsw_dynamic_enthalpy_CT - dynamic enthalpy -% gsw_SA_from_rho_CT - Absolute Salinity from density & CT -% gsw_CT_from_rho - Conservative Temperature from density -% gsw_CT_maxdensity - Conservative Temperature of maximum density of seawater +% gsw_rho - in-situ density and potential density +% gsw_alpha - thermal expansion coefficient with respect to CT +% gsw_beta - saline contraction coefficient at constant CT +% gsw_rho_alpha_beta - in-situ density, thermal expansion & saline contraction coefficients +% gsw_alpha_on_beta - alpha divied by beta +% gsw_rho_first_derivaties - first derivaties of rho +% gsw_specvol - specific volume +% gsw_specvol_anom - specific volume anomaly +% gsw_sigma0 - sigma0 with reference pressure of 0 dbar +% gsw_sigma1 - sigma1 with reference pressure of 1000 dbar +% gsw_sigma2 - sigma2 with reference pressure of 2000 dbar +% gsw_sigma3 - sigma3 with reference pressure of 3000 dbar +% gsw_sigma4 - sigma4 with reference pressure of 4000 dbar +% gsw_sound_speed - sound speed (approximate, with r.m.s. error of 0.067 m/s) +% gsw_kappa - isentropic compressibility +% gsw_cabbeling - cabbeling coefficient +% gsw_thermobaric - thermobaric coefficient +% gsw_SA_from_rho - Absolute Salinity from density +% gsw_CT_from_rho - Conservative Temperature from density +% gsw_CT_maxdensity - Conservative Temperature of maximum density of seawater +% gsw_internal_energy - internal energy +% gsw_enthalpy - enthalpy +% gsw_enthalpy_diff - difference of enthalpy between two pressures +% gsw_dynamic_enthalpy - dynamic enthalpy +% gsw_enthalpy_first_derivaties - first derivaties of enthalpy +% gsw_enthalpy_second_derivaties - second derivaties of enthalpy % % water column properties, based on the 48-term expression for density -% gsw_Nsquared - buoyancy (Brunt-Vaisala) frequency squared (N^2) -% gsw_Turner_Rsubrho - Turner angle & Rsubrho -% gsw_IPV_vs_fNsquared_ratio - ratio of the vertical gradient of potential density -% (with reference pressure, p_ref), to the vertical gradient -% of locally-referenced potential density -% -% neutral and non-linear properties, based on the 48-term expression for density -% gsw_cabbeling - cabbeling coefficient -% gsw_thermobaric - thermobaric coefficient -% gsw_isopycnal_slope_ratio - ratio of the slopes of isopycnals on the SA-CT diagram -% for p & p_ref -% gsw_isopycnal_vs_ntp_CT_ratio - ratio of the gradient of Conservative Temperature -% in a potential density surface to that in the neutral -% tangent plane -% gsw_ntp_pt_vs_CT_ratio - ratio of gradients of potential temperature & -% Conservative Temperature in a neutral tangent plane -% (i.e. in a locally-referenced potential density surface) +% gsw_Nsquared - buoyancy (Brunt-Vaisala) frequency squared (N^2) +% gsw_Turner_Rsubrho - Turner angle & Rsubrho +% gsw_IPV_vs_fNsquared_ratio - ratio of the vertical gradient of potential density +% (with reference pressure, p_ref), to the vertical +% gradient of locally-referenced potential density +% +% neutral properties, based on the 48-term expression for density +% gsw_isopycnal_slope_ratio - ratio of the slopes of isopycnals on the SA-CT diagram +% for p & p_ref +% gsw_isopycnal_vs_ntp_CT_ratio - ratio of the gradient of Conservative Temperature +% in a potential density surface to that in the neutral +% tangent plane +% gsw_ntp_pt_vs_CT_ratio - ratio of gradients of potential temperature & +% Conservative Temperature in a neutral tangent plane +% (i.e. in a locally-referenced potential density surface) % % geostrophic streamfunctions, based on the 48-term expression for density -% gsw_geo_strf_dyn_height - dynamic height anomaly -% gsw_geo_strf_dyn_height_pc - dynamic height anomaly for piecewise constant profiles -% gsw_geo_strf_isopycnal - approximate isopycnal geostrophic streamfunction -% gsw_geof_str_isopycnal_pc - approximate isopycnal geostrophic streamfunction for -% piecewise constant profiles -% gsw_geo_strf_Montgomery - Montgomery geostrophic streamfunction -% gsw_geo_strf_Cunningham - Cunningham geostrophic streamfunction +% gsw_geo_strf_dyn_height - dynamic height anomaly +% gsw_geo_strf_dyn_height_pc - dynamic height anomaly for piecewise constant profiles +% gsw_geo_strf_isopycnal - approximate isopycnal geostrophic streamfunction +% gsw_geof_str_isopycnal_pc - approximate isopycnal geostrophic streamfunction for +% piecewise constant profiles +% gsw_geo_strf_Montgomery - Montgomery geostrophic streamfunction +% gsw_geo_strf_Cunningham - Cunningham geostrophic streamfunction % % geostrophic velocity -% gsw_geostrophic_velocity - geostrophic velocity +% gsw_geostrophic_velocity - geostrophic velocity % -% derivatives of enthalpy, entropy, CT and pt +% derivatives of entropy, CT and pt % gsw_CT_first_derivatives - first derivatives of Conservative Temperature % gsw_CT_second_derivatives - second derivatives of Conservative Temperature -% gsw_enthalpy_first_derivatives - first derivatives of enthalpy -% gsw_enthalpy_second_derivatives - second derivatives of enthalpy % gsw_entropy_first_derivatives - first derivatives of entropy % gsw_entropy_second_derivatives - second derivatives of entropy % gsw_pt_first_derivatives - first derivatives of potential temperature @@ -149,26 +157,37 @@ % gsw_atomic_weight - mole-weighted atomic weight of sea salt; 31.4038218... g/mol % % density and enthalpy in terms of CT, based on the exact Gibbs function -% gsw_rho_CT_exact - in-situ density from CT, and potential density from CT -% gsw_alpha_CT_exact - thermal expansion coefficient with respect to CT -% gsw_beta_CT_exact - saline contraction coefficientat constant CT -% gsw_rho_alpha_beta_CT_exact - in-situ density, thermal expansion & saline contraction -% coefficient from CT -% gsw_specvol_CT_exact - specific volume from CT -% gsw_specvol_anom_CT_exact - specific volume anomaly from CT -% gsw_sigma0_CT_exact - sigma0 from CT with reference pressure of 0 dbar -% gsw_sigma1_CT_exact - sigma1 from CT with reference pressure of 1000 dbar -% gsw_sigma2_CT_exact - sigma2 from CT with reference pressure of 2000 dbar -% gsw_sigma3_CT_exact - sigma3 from CT with reference pressure of 3000 dbar -% gsw_sigma4_CT_exact - sigma4 from CT with reference pressure of 4000 dbar -% gsw_sound_speed_CT_exact - sound speed -% gsw_internal_energy_CT_exact - internal energy -% gsw_enthalpy_CT_exact - enthalpy from CT -% gsw_enthalpy_diff_CT_exact - difference of enthalpy from CT between two pressures -% gsw_dynamic_enthalpy_CT_exact - dynamic enthalpy from CT -% gsw_SA_from_rho_CT_exact - Absolute Salinity from Density & CT -% gsw_CT_from_rho_exact - Conservative Temperature from density -% gsw_CT_maxdensity_exact - Conservative Temperature of maximum density of seawater +% gsw_rho_CT_exact - in-situ density and potential density +% gsw_alpha_CT_exact - thermal expansion coefficient with respect to CT +% gsw_beta_CT_exact - saline contraction coefficientat constant CT +% gsw_rho_alpha_beta_CT_exact - in-situ density, thermal expansion & saline contraction coefficient +% gsw_alpha_on_beta_CT_exact - alpha divied by beta +% gsw_rho_first_derivaties_CT_exact - first derivaties of rho +% gsw_specvol_CT_exact - specific volume +% gsw_specvol_anom_CT_exact - specific volume anomaly +% gsw_sigma0_CT_exact - sigma0 with reference pressure of 0 dbar +% gsw_sigma1_CT_exact - sigma1 with reference pressure of 1000 dbar +% gsw_sigma2_CT_exact - sigma2 with reference pressure of 2000 dbar +% gsw_sigma3_CT_exact - sigma3 with reference pressure of 3000 dbar +% gsw_sigma4_CT_exact - sigma4 with reference pressure of 4000 dbar +% gsw_sound_speed_CT_exact - sound speed +% gsw_kappa_CT_exact - isentropic compressibility +% gsw_cabbeling_CT_exact - cabbeling coefficient +% gsw_thermobaric_CT_exact - thermobaric coefficient +% gsw_SA_from_rho_CT_exact - Absolute Salinity from density +% gsw_CT_from_rho_exact - Conservative Temperature from density +% gsw_CT_maxdensity_exact - Conservative Temperature of maximum density of seawater +% gsw_internal_energy_CT_exact - internal energy +% gsw_enthalpy_CT_exact - enthalpy +% gsw_enthalpy_diff_CT_exact - difference of enthalpy between two pressures +% gsw_dynamic_enthalpy_CT_exact - dynamic enthalpy +% gsw_enthalpy_first_derivaties_CT_exact - first derivaties of enthalpy +% gsw_enthalpy_second_derivaties_CT_exact - second derivaties of enthalpy +% +% Labroratory functions, for use with a densimeter measuremants +% gsw_SA_from_rho_t_exact - Absolute Salinity from density +% gsw_deltaSA_from_rho_t_exact - Absolute Salinity Anomaly from density +% gsw_rho_t_exact - in-situ density % % basic thermodynamic properties in terms of in-situ t, based on the exact Gibbs function % gsw_rho_t_exact - in-situ density @@ -197,14 +216,12 @@ % gsw_SA_from_rho_t_exact - Absolute Salinity from density % gsw_t_from_rho_exact - in-situ temperature from density % gsw_t_maxdensity_exact - in-situ temperature of maximum density of seawater -% gsw_entropy_t_exact - entropy % gsw_cp_t_exact - isobaric heat capacity % gsw_isochoric_heat_cap_t_exact - isochoric heat capacity % gsw_chem_potential_relative_t_exact - relative chemical potential % gsw_chem_potential_water_t_exact - chemical potential of water in seawater % gsw_chem_potential_salt_t_exact - chemical potential of salt in seawater % gsw_Helmholtz_energy_t_exact - Helmholtz energy -% gsw_adiabatic_lapse_rate_t_exact - adiabatic lapse rate % gsw_osmotic_coefficient_t_exact - osmotic coefficient of seawater % gsw_osmotic_pressure_t_exact - osmotic pressure of seawater % diff --git a/Toolbox/gsw_Abs_Pressure_from_p.m b/Toolbox/gsw_Abs_Pressure_from_p.m index 28029a9..1f49f26 100644 --- a/Toolbox/gsw_Abs_Pressure_from_p.m +++ b/Toolbox/gsw_Abs_Pressure_from_p.m @@ -19,7 +19,7 @@ % AUTHOR: % Trevor McDougall and Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (13th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of diff --git a/Toolbox/gsw_C3515.m b/Toolbox/gsw_C3515.m index 2b7aeb3..8f93af9 100644 --- a/Toolbox/gsw_C3515.m +++ b/Toolbox/gsw_C3515.m @@ -17,7 +17,7 @@ % AUTHOR: % Trevor McDougall and Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (13th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % Culkin and Smith, 1980: Determination of the Concentration of Potassium diff --git a/Toolbox/gsw_CT_first_derivatives.m b/Toolbox/gsw_CT_first_derivatives.m index 6ceddf8..e9aad64 100644 --- a/Toolbox/gsw_CT_first_derivatives.m +++ b/Toolbox/gsw_CT_first_derivatives.m @@ -34,7 +34,7 @@ % AUTHOR: % Trevor McDougall and Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (15th November, 2012) +% VERSION NUMBER: 3.03 (11th March, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of @@ -79,12 +79,9 @@ %-------------------------------------------------------------------------- cp0 = 3991.86795711963; % from Eqn. 3.3.3 of IOC et al. (2010). -n0 = 0; -n2 = 2; -pr0 = zeros(size(SA)); abs_pt = 273.15 + pt; -CT_pt = - (abs_pt.*gsw_gibbs(n0,n2,n0,SA,pt,pr0))./cp0; +CT_pt = - (abs_pt.*gsw_gibbs_pt0_pt0(SA,pt))./cp0; %-------------------------------------------------------------------------- diff --git a/Toolbox/gsw_CT_freezing.m b/Toolbox/gsw_CT_freezing.m index 0bb9454..5772118 100644 --- a/Toolbox/gsw_CT_freezing.m +++ b/Toolbox/gsw_CT_freezing.m @@ -31,7 +31,7 @@ % AUTHOR: % Trevor McDougall, Paul Barker and Rainer Feistal [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (13th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of diff --git a/Toolbox/gsw_CT_from_entropy.m b/Toolbox/gsw_CT_from_entropy.m index 339612a..8425180 100644 --- a/Toolbox/gsw_CT_from_entropy.m +++ b/Toolbox/gsw_CT_from_entropy.m @@ -22,7 +22,7 @@ % AUTHOR: % Trevor McDougall and Paul Barker. [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (13th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of diff --git a/Toolbox/gsw_CT_from_pt.m b/Toolbox/gsw_CT_from_pt.m index e7f5c68..0af1446 100644 --- a/Toolbox/gsw_CT_from_pt.m +++ b/Toolbox/gsw_CT_from_pt.m @@ -22,7 +22,7 @@ % AUTHOR: % David Jackett, Trevor McDougall and Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (13th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of diff --git a/Toolbox/gsw_CT_from_rho.m b/Toolbox/gsw_CT_from_rho.m index c7a4f36..5d78a62 100644 --- a/Toolbox/gsw_CT_from_rho.m +++ b/Toolbox/gsw_CT_from_rho.m @@ -11,11 +11,11 @@ % Calculates the Conservative Temperature of a seawater sample, for given % values of its density, Absolute Salinity and sea pressure (in dbar), % using the computationally-efficient 48-term expression for density in -% terms of SA, CT and p (McDougall et al., 2011) +% terms of SA, CT and p (IOC et al., 2010) % % Note that the 48-term equation has been fitted in a restricted range of % parameter space, and is most accurate inside the "oceanographic funnel" -% described in McDougall et al. (2011). The GSW library function +% described in IOC et al. (2010). The GSW library function % "gsw_infunnel(SA,CT,p)" is avaialble to be used if one wants to test if % some of one's data lies outside this "funnel". % @@ -43,7 +43,7 @@ % AUTHOR: % Trevor McDougall & Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (15th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of @@ -51,11 +51,6 @@ % Intergovernmental Oceanographic Commission, Manuals and Guides No. 56, % UNESCO (English), 196 pp. Available from http://www.TEOS-10.org % -% McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2013: A -% computationally efficient 48-term expression for the density of -% seawater in terms of Conservative Temperature, and related properties -% of seawater. To be submitted to J. Atm. Ocean. Technol., xx, yyy-zzz. -% % The software is available from http://www.TEOS-10.org % %========================================================================== diff --git a/Toolbox/gsw_CT_from_rho_exact.m b/Toolbox/gsw_CT_from_rho_exact.m index c615af4..e65b5d1 100644 --- a/Toolbox/gsw_CT_from_rho_exact.m +++ b/Toolbox/gsw_CT_from_rho_exact.m @@ -34,7 +34,7 @@ % AUTHOR: % Trevor McDougall & Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (13th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of diff --git a/Toolbox/gsw_CT_from_t.m b/Toolbox/gsw_CT_from_t.m index 53beb93..c5fc015 100644 --- a/Toolbox/gsw_CT_from_t.m +++ b/Toolbox/gsw_CT_from_t.m @@ -25,7 +25,7 @@ % AUTHOR: % David Jackett, Trevor McDougall and Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (13th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of diff --git a/Toolbox/gsw_CT_maxdensity.m b/Toolbox/gsw_CT_maxdensity.m index d2f95ca..31dd35f 100644 --- a/Toolbox/gsw_CT_maxdensity.m +++ b/Toolbox/gsw_CT_maxdensity.m @@ -12,12 +12,12 @@ % This function returns the Conservative temperature at which the density % of seawater is a maximum, at given Absolute Salinity, SA, and sea % pressure, p (in dbar). This function uses the computationally-efficient -% 48-term expression for density in terms of SA, CT and p (McDougall et -% al., 2013). +% 48-term expression for density in terms of SA, CT and p (IOC et +% al., 2010). % % Note that the 48-term equation has been fitted in a restricted range of % parameter space, and is most accurate inside the "oceanographic funnel" -% described in McDougall et al. (2013). The GSW library function +% described in IOC et al. (2010). The GSW library function % "gsw_infunnel(SA,CT,p)" is avaialble to be used if one wants to test if % some of one's data lies outside this "funnel". % @@ -36,7 +36,7 @@ % AUTHOR: % Trevor McDougall & Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.01 (3rd April, 2011) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of @@ -45,11 +45,6 @@ % UNESCO (English), 196 pp. Available from http://www.TEOS-10.org % See section 3.42 of this TEOS-10 Manual. % -% McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2013: A -% computationally efficient 48-term expression for the density of -% seawater in terms of Conservative Temperature, and related properties -% of seawater. To be submitted to J. Atm. Ocean. Technol., xx, yyy-zzz. -% % McDougall T.J. and S.J. Wotherspoon, 2012: A simple modification of % Newton’s method to achieve convergence of order "1 + sqrt(2)". % Submitted to Applied Mathematics and Computation. diff --git a/Toolbox/gsw_CT_maxdensity_exact.m b/Toolbox/gsw_CT_maxdensity_exact.m index 5039452..aa923f1 100644 --- a/Toolbox/gsw_CT_maxdensity_exact.m +++ b/Toolbox/gsw_CT_maxdensity_exact.m @@ -28,7 +28,7 @@ % AUTHOR: % Trevor McDougall & Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (15th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of diff --git a/Toolbox/gsw_CT_second_derivatives.m b/Toolbox/gsw_CT_second_derivatives.m index cce850f..ffba2c1 100644 --- a/Toolbox/gsw_CT_second_derivatives.m +++ b/Toolbox/gsw_CT_second_derivatives.m @@ -44,7 +44,7 @@ % AUTHOR: % Trevor McDougall and Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (15th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of @@ -53,11 +53,6 @@ % UNESCO (English), 196 pp. Available from http://www.TEOS-10.org. % See appendix A.12 of this TEOS-10 Manual. % -% McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2013: A -% computationally efficient 48-term expression for the density of -% seawater in terms of Conservative Temperature, and related properties -% of seawater. To be submitted to J. Atm. Ocean. Technol., xx, yyy-zzz. -% % This software is available from http://www.TEOS-10.org % %========================================================================== diff --git a/Toolbox/gsw_C_from_SP.m b/Toolbox/gsw_C_from_SP.m index 661157f..dd3d6d0 100644 --- a/Toolbox/gsw_C_from_SP.m +++ b/Toolbox/gsw_C_from_SP.m @@ -43,7 +43,7 @@ % AUTHOR: % Trevor McDougall, Paul Barker and Rich Pawlowicz [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (16th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % Hill, K.D., T.M. Dauphinee and D.J. Woods, 1986: The extension of the diff --git a/Toolbox/gsw_IPV_vs_fNsquared_ratio.m b/Toolbox/gsw_IPV_vs_fNsquared_ratio.m index f80d19b..8cd79d6 100644 --- a/Toolbox/gsw_IPV_vs_fNsquared_ratio.m +++ b/Toolbox/gsw_IPV_vs_fNsquared_ratio.m @@ -21,11 +21,11 @@ % IPV_vs_fNsquared_ratio is evaluated at the mid pressure between the % individual data points in the vertical. This function uses the % computationally-efficient 48-term expression for density in terms of -% SA, CT and p (McDougall et al., 2013). +% SA, CT and p (IOC et al., 2010). % % Note that the 48-term equation has been fitted in a restricted range of % parameter space, and is most accurate inside the "oceanographic funnel" -% described in McDougall et al. (2013). The GSW library function +% described in IOC et al. (2010). The GSW library function % "gsw_infunnel(SA,CT,p)" is avaialble to be used if one wants to test if % some of one's data lies outside this "funnel". % @@ -53,7 +53,7 @@ % AUTHOR: % Trevor McDougall and Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (15th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of @@ -62,11 +62,6 @@ % UNESCO (English), 196 pp. Available from http://www.TEOS-10.org % See Eqn. (3.20.5) of this TEOS-10 Manual. % -% McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2013: A -% computationally efficient 48-term expression for the density of -% seawater in terms of Conservative Temperature, and related properties -% of seawater. To be submitted to J. Atm. Ocean. Technol., xx, yyy-zzz. -% % The software is available from http://www.TEOS-10.org % %========================================================================== diff --git a/Toolbox/gsw_Nsquared.m b/Toolbox/gsw_Nsquared.m index a7bbb17..8971963 100644 --- a/Toolbox/gsw_Nsquared.m +++ b/Toolbox/gsw_Nsquared.m @@ -23,7 +23,7 @@ % efficient 48-term expression for density in terms of SA, CT and p. The % 48-term equation has been fitted in a restricted range of parameter % space, and is most accurate inside the "oceanographic funnel" described -% in McDougall et al. (2013). The GSW library function +% in IOC et al. (2010). The GSW library function % "gsw_infunnel(SA,CT,p)" is avaialble to be used if one wants to test if % some of one's data lies outside this "funnel". % @@ -49,7 +49,7 @@ % AUTHOR: % Trevor McDougall and Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (15th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % Griffies, S. M., 2004: Fundamentals of Ocean Climate Models. Princeton, @@ -61,11 +61,6 @@ % UNESCO (English), 196 pp. Available from http://www.TEOS-10.org % See section 3.10 and Eqn. (3.10.2) of this TEOS-10 Manual. % -% McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2013: A -% computationally efficient 48-term expression for the density of -% seawater in terms of Conservative Temperature, and related properties -% of seawater. To be submitted to J. Atm. Ocean. Technol., xx, yyy-zzz. -% % The software is available from http://www.TEOS-10.org % %========================================================================== diff --git a/Toolbox/gsw_P0.m b/Toolbox/gsw_P0.m index bef30c0..15442e6 100644 --- a/Toolbox/gsw_P0.m +++ b/Toolbox/gsw_P0.m @@ -15,7 +15,7 @@ % AUTHOR: % Trevor McDougall and Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (15th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of diff --git a/Toolbox/gsw_R_from_SP.m b/Toolbox/gsw_R_from_SP.m index 46cf24a..856125c 100644 --- a/Toolbox/gsw_R_from_SP.m +++ b/Toolbox/gsw_R_from_SP.m @@ -43,7 +43,7 @@ % AUTHOR: % Trevor McDougall, Paul Barker and Rich Pawlowicz [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (15th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % Culkin and Smith, 1980: Determination of the Concentration of Potassium diff --git a/Toolbox/gsw_SA_CT_plot.m b/Toolbox/gsw_SA_CT_plot.m index fbd2bcd..5d65d03 100644 --- a/Toolbox/gsw_SA_CT_plot.m +++ b/Toolbox/gsw_SA_CT_plot.m @@ -14,11 +14,11 @@ function gsw_SA_CT_plot(SA,CT,p_ref,isopycs,title_string) % point for p = 0 dbar assuming the seawater is completely saturated with % dissolved air and user defined potential density contours. This % function uses the computationally efficient 48-term expression for -% density in terms of SA, CT and p (McDougall et al., 2011). +% density in terms of SA, CT and p (McDougall et al., 2013). % % Note that the 48-term equation has been fitted in a restricted range of % parameter space, and is most accurate inside the "oceanographic funnel" -% described in McDougall et al. (2011). The GSW library function +% described in McDougall et al. (2013). The GSW library function % "gsw_infunnel(SA,CT,p)" is avaialble to be used if one wants to test if % some of one's data lies outside this "funnel". % @@ -47,7 +47,7 @@ function gsw_SA_CT_plot(SA,CT,p_ref,isopycs,title_string) % MODIFIED: % Paul Barker & Trevor McDougall % -% VERSION NUMBER: 3.02 (15th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2013: A diff --git a/Toolbox/gsw_SA_Sstar_from_SP.m b/Toolbox/gsw_SA_Sstar_from_SP.m index ac5baf9..5887b3c 100644 --- a/Toolbox/gsw_SA_Sstar_from_SP.m +++ b/Toolbox/gsw_SA_Sstar_from_SP.m @@ -36,7 +36,7 @@ % AUTHOR: % Paul Barker and Trevor McDougall [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (7th January, 2013) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of diff --git a/Toolbox/gsw_SA_from_SP.m b/Toolbox/gsw_SA_from_SP.m index 90f8935..c17a190 100644 --- a/Toolbox/gsw_SA_from_SP.m +++ b/Toolbox/gsw_SA_from_SP.m @@ -33,7 +33,7 @@ % AUTHOR: % David Jackett, Trevor McDougall & Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (7th January, 2013) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of diff --git a/Toolbox/gsw_SA_from_Sstar.m b/Toolbox/gsw_SA_from_Sstar.m index 0b7a9df..2d08ab2 100644 --- a/Toolbox/gsw_SA_from_Sstar.m +++ b/Toolbox/gsw_SA_from_Sstar.m @@ -31,7 +31,7 @@ % AUTHOR: % David Jackett, Trevor McDougall and Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (7th January, 2013) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of diff --git a/Toolbox/gsw_SA_from_rho.m b/Toolbox/gsw_SA_from_rho.m index bb46f19..48e07b9 100644 --- a/Toolbox/gsw_SA_from_rho.m +++ b/Toolbox/gsw_SA_from_rho.m @@ -10,11 +10,11 @@ % Calculates the Absolute Salinity of a seawater sample, for given values % of its density, Conservative Temperature and sea pressure (in dbar). % This function uses the computationally-efficient 48-term expression for -% density in terms of SA, CT and p (McDougall et al., 2013). +% density in terms of SA, CT and p (IOC et al., 2013). % % Note that the 48-term equation has been fitted in a restricted range of % parameter space, and is most accurate inside the "oceanographic funnel" -% described in McDougall et al. (2013). The GSW library function +% described in IOC et al. (2013). The GSW library function % "gsw_infunnel(SA,CT,p)" is avaialble to be used if one wants to test if % some of one's data lies outside this "funnel". % @@ -37,7 +37,7 @@ % AUTHOR: % Trevor McDougall & Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (15th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of @@ -46,11 +46,6 @@ % UNESCO (English), 196 pp. Available from http://www.TEOS-10.org % See section 2.5 of this TEOS-10 Manual. % -% McDougall, T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2013: A -% computationally efficient 48-term expression for the density of -% seawater in terms of Conservative Temperature, and related properties -% of seawater. To be submitted to J. Atm. Ocean. Technol., xx, yyy-zzz. -% % Millero, F. J., R. Feistel, D. G. Wright, and T. J. McDougall, 2008: % The composition of Standard Seawater and the definition of the % Reference-Composition Salinity Scale, Deep-Sea Res. I, 55, 50-72. diff --git a/Toolbox/gsw_SA_from_rho_CT.m b/Toolbox/gsw_SA_from_rho_CT.m index 6d100d4..3a521ed 100644 --- a/Toolbox/gsw_SA_from_rho_CT.m +++ b/Toolbox/gsw_SA_from_rho_CT.m @@ -16,11 +16,11 @@ % Calculates the Absolute Salinity of a seawater sample, for given values % of its density, Conservative Temperature and sea pressure (in dbar). % This function uses the computationally-efficient 48-term expression for -% density in terms of SA, CT and p (McDougall et al., 2013). +% density in terms of SA, CT and p (IOC et al., 2013). % % Note that the 48-term equation has been fitted in a restricted range of % parameter space, and is most accurate inside the "oceanographic funnel" -% described in McDougall et al. (2013). The GSW library function +% described in IOC et al. (2013). The GSW library function % "gsw_infunnel(SA,CT,p)" is avaialble to be used if one wants to test if % some of one's data lies outside this "funnel". % @@ -43,7 +43,7 @@ % AUTHOR: % Trevor McDougall & Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (15th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of @@ -52,11 +52,6 @@ % UNESCO (English), 196 pp. Available from http://www.TEOS-10.org % See section 2.5 of this TEOS-10 Manual. % -% McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2013: A -% computationally efficient 48-term expression for the density of -% seawater in terms of Conservative Temperature, and related properties -% of seawater. To be submitted to J. Atm. Ocean. Technol., xx, yyy-zzz. -% % Millero, F. J., R. Feistel, D. G. Wright, and T. J. McDougall, 2008: % The composition of Standard Seawater and the definition of the % Reference-Composition Salinity Scale, Deep-Sea Res. I, 55, 50-72. diff --git a/Toolbox/gsw_SA_from_rho_CT_exact.m b/Toolbox/gsw_SA_from_rho_CT_exact.m index d81aaa9..7d0c75d 100644 --- a/Toolbox/gsw_SA_from_rho_CT_exact.m +++ b/Toolbox/gsw_SA_from_rho_CT_exact.m @@ -12,9 +12,9 @@ % % Note that this function uses the full Gibbs function. There is an % alternative to calling this function, namely -% gsw_SA_from_rho_CT(rho,CT,p), which uses the computationally +% gsw_SA_from_rho(rho,CT,p), which uses the computationally % efficient 48-term expression for density in terms of SA, CT and p -% (McDougall et al., 2013). +% (IOC et al., 2013). % % INPUT: % rho = density of a seawater sample (e.g. 1026 kg/m^3). [ kg/m^3 ] @@ -35,7 +35,7 @@ % AUTHOR: % Trevor McDougall & Paul Barker [ help_gsw@csiro.au ] % -% VERSION NUMBER: 3.02 (15th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of diff --git a/Toolbox/gsw_SA_from_rho_t.m b/Toolbox/gsw_SA_from_rho_t.m deleted file mode 100644 index 9b4e329..0000000 --- a/Toolbox/gsw_SA_from_rho_t.m +++ /dev/null @@ -1,219 +0,0 @@ -function SA = gsw_SA_from_rho_t(rho,t,p) - -% gsw_SA_from_rho_t Absolute Salinity from density -% ========================================================================= -% -% USAGE: -% SA = gsw_SA_from_rho_t(rho,t,p) -% -% DESCRIPTION: -% Calculates the Absolute Salinity of a seawater sample, for given values -% of its density, in-situ temperature and sea pressure (in dbar). -% This function uses the computationally-efficient 48-term expression for -% density in terms of SA, CT and p (McDougall et al., 2013). -% -% Note that the 48-term equation has been fitted in a restricted range of -% parameter space, and is most accurate inside the "oceanographic funnel" -% described in McDougall et al. (2013). The GSW library function -% "gsw_infunnel(SA,CT,p)" is avaialble to be used if one wants to test if -% some of one's data lies outside this "funnel". -% -% INPUT: -% rho = density of a seawater sample (e.g. 1026 kg/m^3). [ kg/m^3 ] -% Note. This input has not had 1000 kg/m^3 subtracted from it. -% That is, it is 'density', not 'density anomaly'. -% t = in-situ temperature (ITS-90) [ deg C ] -% p = sea pressure [ dbar ] -% ( i.e. absolute pressure - 10.1325 dbar ) -% -% rho & t need to have the same dimensions. -% p may have dimensions 1x1 or Mx1 or 1xN or MxN, where rho & t are MxN. -% -% OUTPUT: -% SA = Absolute Salinity. [ g/kg ] -% Note. This is expressed on the Reference-Composition Salinity -% Scale of Millero et al. (2008). -% -% AUTHOR: -% Paul Barker and Trevor McDougall [ help@teos-10.org ] -% -% VERSION NUMBER: 3.02 (15th November, 2012) -% -% REFERENCES: -% IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of -% seawater - 2010: Calculation and use of thermodynamic properties. -% Intergovernmental Oceanographic Commission, Manuals and Guides No. 56, -% UNESCO (English), 196 pp. Available from http://www.TEOS-10.org -% -% McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2013: A -% computationally efficient 48-term expression for the density of -% seawater in terms of Conservative Temperature, and related properties -% of seawater. To be submitted to J. Atm. Ocean. Technol., xx, yyy-zzz. -% -% Millero, F. J., R. Feistel, D. G. Wright, and T. J. McDougall, 2008: -% The composition of Standard Seawater and the definition of the -% Reference-Composition Salinity Scale, Deep-Sea Res. I, 55, 50-72. -% -% The software is available from http://www.TEOS-10.org -% -%========================================================================== - -%-------------------------------------------------------------------------- -% Check variables and resize if necessary -%-------------------------------------------------------------------------- - -if ~(nargin==3) - error('gsw_SA_from_rho_t: Requires three inputs') -end %if - -[md,nd] = size(rho); -[mt,nt] = size(t); -[mp,np] = size(p); - -if (mt ~= md | nt ~= nd) - error('gsw_SA_from_rho_t: rho and t must have same dimensions') -end - -if (mp == 1) & (np == 1) % p scalar - fill to size of rho - p = p*ones(size(rho)); -elseif (nd == np) & (mp == 1) % p is row vector, - p = p(ones(1,md), :); % copy down each column. -elseif (md == mp) & (np == 1) % p is column vector, - p = p(:,ones(1,nd)); % copy across each row. -elseif (nd == mp) & (np == 1) % p is a transposed row vector, - p = p.'; % transposed then - p = p(ones(1,md), :); % copy down each column. -elseif (md == mp) & (nd == np) - % ok -else - error('gsw_SA_from_rho_t: Inputs array dimensions arguments do not agree') -end %if - -if md == 1 - rho = rho.'; - t = t.'; - p = p.'; - transposed = 1; -else - transposed = 0; -end - -%-------------------------------------------------------------------------- -% Start of the calculation -%-------------------------------------------------------------------------- - -v_lab = ones(size(rho))./rho; -CT_0 = gsw_CT_from_t(zeros(size(rho)),t,p); -v_0 = gsw_specvol(zeros(size(rho)),CT_0,p); -CT_50 = gsw_CT_from_t(50*ones(size(rho)),t,p); -v_50 = gsw_specvol(50*ones(size(rho)),CT_50,p); - -SA = 50*(v_lab - v_0)./(v_50 - v_0); % initial estimate of SA. -SA(SA < 0 | SA > 50) = NaN; - -v_SA_t = 0.02.*(v_50 - v_0); % initial estimate of the derivative of -% specific volume with respect to -% Absolute Salinity at constant in-situ -% temperature and pressure. - -%-------------------------------------------------------------------------- -% Begin the modified Newton-Raphson iterative procedure -%-------------------------------------------------------------------------- - -for Number_of_iterations = 1:2 - SA_old = SA; - CT_old = gsw_CT_from_t(SA_old,t,p); - delta_v = gsw_specvol(SA_old,CT_old,p) - v_lab; - SA = SA_old - delta_v./v_SA_t; % this is half way through the modified N-R method (McDougall and Wotherspoon, 2012) - SA(SA < 0) = 0; - SA_mean = 0.5*(SA + SA_old); - CT_mean = gsw_CT_from_t(SA_mean,t,p); - [rho,alpha,beta] = gsw_rho_alpha_beta(SA_mean,CT_mean,p); - specvol = 1./rho; - v_SA = - beta.*specvol; - v_CT = alpha.*specvol; - dCT_dSA = gsw_dCT_dSA(SA_mean,t,p);% This is a call to get the -% derivative of CT with respect to -% Absolute Salinity at constant -% in-situ temperature and pressure. - - v_SA_t = v_SA + v_CT.*dCT_dSA; -% v_SA_t is the derivative of specific volume with respect to -% Absolute Salinity at constant in-situ temperature and pressure, -% while v_SA is the derivative of specific volume with respect to -% Absolute Salinity at constant Conservative Temperature and pressure. - - SA = SA_old - delta_v./v_SA_t; - SA(SA < 0 | SA > 50) = NaN; -end - -% After two iterations of this modified Newton-Raphson iteration, -% the error in SA is no larger than 3x10^-12 g/kg, which -% is machine precision for this calculation. - -if transposed - SA = SA.'; -end - -end - -%########################################################################## - -function dCT_dSA = gsw_dCT_dSA(SA,t,p) -%-------------------------------------------------------------------------- -% This function calculates the derivative of Conservative Temperature -% with respect to Absolute Salinity at constant in-situ temperature and -% pressure. The equation for this derivative, in terms of the derivatives -% of the Gibbs function is given in Eqn. (A.15.8) of the TEOS-10 Manual -% (IOC et al., 2010). The code below is identical to the first part of the -% GSW function gsw_beta_const_CT_t_exact. -% -% INPUT: -% SA = Absolute Salinity [ g/kg ] -% t = in-situ temperature (ITS-90) [ deg C ] -% p = sea pressure [ dbar ] -% ( i.e. absolute pressure - 10.1325 dbar ) -%-------------------------------------------------------------------------- - -db2Pa = 1e-4; -sfac = 0.0248826675584615; % sfac = 1/(40*(35.16504/35)). -cp0 = 3991.86795711963; - -pt0 = gsw_pt0_from_t(SA,t,p); - -x2 = sfac.*SA; -x = sqrt(x2); -y = 0.025*t; -y_pt = 0.025*pt0; -z = db2Pa*p; %Note.The input pressure (p) is sea pressure in units of dbar. - -g_SA_T_mod = 1187.3715515697959 + z.*(1458.233059470092 + ... - z.*(-687.913805923122 + z.*(249.375342232496 + z.*(-63.313928772146 + 14.09317606630898.*z)))) + ... - x.*(-1480.222530425046 + x.*(2175.341332000392 + x.*(-980.14153344888 + 220.542973797483.*x) + ... - y.*(-548.4580073635929 + y.*(592.4012338275047 + y.*(-274.2361238716608 + 49.9394019139016.*y))) - ... - 90.6734234051316.*z) + z.*(-525.876123559641 + (249.57717834054571 - 88.449193048287.*z).*z) + ... - y.*(-258.3988055868252 + z.*(2298.348396014856 + z.*(-325.1503575102672 + 153.8390924339484.*z)) + ... - y.*(-90.2046337756875 - 4142.8793862113125.*z + y.*(10.50720794170734 + 2814.78225133626.*z)))) + ... - y.*(3520.125411988816 + y.*(-1351.605895580406 + ... - y.*(731.4083582010072 + y.*(-216.60324087531103 + 25.56203650166196.*y) + ... - z.*(-2381.829935897496 + (597.809129110048 - 291.8983352012704.*z).*z)) + ... - z.*(4165.4688847996085 + z.*(-1229.337851789418 + (681.370187043564 - 66.7696405958478.*z).*z))) + ... - z.*(-3443.057215135908 + z.*(1349.638121077468 + ... - z.*(-713.258224830552 + (176.8161433232 - 31.68006188846728.*z).*z)))); -g_SA_T_mod = 0.5*sfac*0.025*g_SA_T_mod; - -g_SA_mod = 8645.36753595126 + ... - x.*(-7296.43987145382 + x.*(8103.20462414788 + ... - y_pt.*(2175.341332000392 + y_pt.*(-274.2290036817964 + ... - y_pt.*(197.4670779425016 + y_pt.*(-68.5590309679152 + 9.98788038278032.*y_pt)))) + ... - x.*(-5458.34205214835 - 980.14153344888.*y_pt + ... - x.*(2247.60742726704 - 340.1237483177863.*x + 220.542973797483.*y_pt))) + ... - y_pt.*(-1480.222530425046 + y_pt.*(-129.1994027934126 + ... - y_pt.*(-30.0682112585625 + y_pt.*(2.626801985426835 ))))) + ... - y_pt.*(1187.3715515697959 + y_pt.*(1760.062705994408 + y_pt.*(-450.535298526802 + ... - y_pt.*(182.8520895502518 + y_pt.*(-43.3206481750622 + 4.26033941694366.*y_pt))))); -g_SA_mod = 0.5*sfac*g_SA_mod; - -dCT_dSA = (g_SA_mod - (273.15 + pt0).*g_SA_T_mod)./cp0; - -end diff --git a/Toolbox/gsw_SA_from_rho_t_pmid.m b/Toolbox/gsw_SA_from_rho_t_pmid.m deleted file mode 100644 index 6604a04..0000000 --- a/Toolbox/gsw_SA_from_rho_t_pmid.m +++ /dev/null @@ -1,228 +0,0 @@ -function SA = gsw_SA_from_rho_t_pmid(rho,t,p,pmid) - -% gsw_SA_from_rho_t_pmid Absolute Salinity from density -% ========================================================================= -% -% USAGE: -% SA = gsw_SA_from_rho_t_pmid(rho,t,p,pmid) -% -% DESCRIPTION: -% Calculates the Absolute Salinity of a seawater sample, for given values -% of its density, in-situ temperature and sea pressure (in dbar). -% This function uses the computationally-efficient 48-term expression for -% density in terms of SA, CT and p (McDougall et al., 2011). -% -% Note that the 48-term equation has been fitted in a restricted range of -% parameter space, and is most accurate inside the "oceanographic funnel" -% described in McDougall et al. (2011). The GSW library function -% "gsw_infunnel(SA,CT,p)" is avaialble to be used if one wants to test if -% some of one's data lies outside this "funnel". -% -% INPUT: -% rho = density of a seawater sample (e.g. 1026 kg/m^3). [ kg/m^3 ] -% Note. This input has not had 1000 kg/m^3 subtracted from it. -% That is, it is 'density', not 'density anomaly'. -% t = in-situ temperature (ITS-90) [ deg C ] -% p = sea pressure [ dbar ] -% ( i.e. absolute pressure - 10.1325 dbar ) -% pmid = mid-point sea pressure [ dbar ] -% -% rho & t need to have the same dimensions. -% p may have dimensions 1x1 or Mx1 or 1xN or MxN, where rho & t are MxN. -% pmid need to have dimensions 1x1. -% -% OUTPUT: -% SA = Absolute Salinity. [ g/kg ] -% Note. This is expressed on the Reference-Composition Salinity -% Scale of Millero et al. (2008). -% -% AUTHOR: -% Paul Barker and Trevor McDougall [ help@teos-10.org ] -% -% VERSION NUMBER: 3.02 (15th November, 2012) -% -% REFERENCES: -% IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of -% seawater - 2010: Calculation and use of thermodynamic properties. -% Intergovernmental Oceanographic Commission, Manuals and Guides No. 56, -% UNESCO (English), 196 pp. Available from http://www.TEOS-10.org -% -% McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2013: A -% computationally efficient 48-term expression for the density of -% seawater in terms of Conservative Temperature, and related properties -% of seawater. To be submitted to J. Atm. Ocean. Technol., xx, yyy-zzz. -% -% Millero, F. J., R. Feistel, D. G. Wright, and T. J. McDougall, 2008: -% The composition of Standard Seawater and the definition of the -% Reference-Composition Salinity Scale, Deep-Sea Res. I, 55, 50-72. -% -% The software is available from http://www.TEOS-10.org -% -%========================================================================== - -%-------------------------------------------------------------------------- -% Check variables and resize if necessary -%-------------------------------------------------------------------------- - -if ~(nargin == 4) - error('gsw_SA_from_rho_t_pmid: Requires three inputs') -end %if - -[md,nd] = size(rho); -[mt,nt] = size(t); -[mp,np] = size(p); - -if (mt ~= md | nt ~= nd) - error('gsw_SA_from_rho_t_pmid: rho and t must have same dimensions') -end - -if (mp == 1) & (np == 1) % p scalar - fill to size of rho - p = p*ones(size(rho)); -elseif (nd == np) & (mp == 1) % p is row vector, - p = p(ones(1,md), :); % copy down each column. -elseif (md == mp) & (np == 1) % p is column vector, - p = p(:,ones(1,nd)); % copy across each row. -elseif (nd == mp) & (np == 1) % p is a transposed row vector, - p = p.'; % transposed then - p = p(ones(1,md), :); % copy down each column. -elseif (md == mp) & (nd == np) - % ok -else - error('gsw_SA_from_rho_t: Inputs array dimensions arguments do not agree') -end %if - -[mpm,npm] = size(pmid); -if (mpm ~= 1 | npm ~= 1) - error('gsw_SA_from_rho_t_pmid: pmid needs to be a single value') -end - -if md == 1 - rho = rho.'; - t = t.'; - p = p.'; - transposed = 1; -else - transposed = 0; -end - -%-------------------------------------------------------------------------- -% Start of the calculation -%-------------------------------------------------------------------------- - -v_lab = ones(size(rho))./rho; -CT_0 = gsw_CT_from_t(zeros(size(rho)),t,p); -v_0 = gsw_specvol(zeros(size(rho)),CT_0,pmid); -CT_50 = gsw_CT_from_t(50*ones(size(rho)),t,p); -v_50 = gsw_specvol(50*ones(size(rho)),CT_50,pmid); - -SA = 50*(v_lab - v_0)./(v_50 - v_0); % initial estimate of SA. - -SA(SA < 0 | SA > 50) = NaN; - -v_SA_t = 0.02.*(v_50 - v_0); % initial estimate of the derivative of -% specific volume with respect to -% Absolute Salinity at constant in-situ -% temperature and pressure. - -%-------------------------------------------------------------------------- -% Begin the modified Newton-Raphson iterative procedure (McDougall and -% Wotherspoon, 2012) -%-------------------------------------------------------------------------- - -for Number_of_iterations = 1:2 - SA_old = SA; - CT_old = gsw_CT_from_t(SA_old,t,p); - delta_v = gsw_specvol(SA_old,CT_old,pmid) - v_lab; - SA = SA_old - delta_v./v_SA_t; % this is half way through the modified N-R method - SA(SA < 0) = 0; - SA_mean = 0.5*(SA + SA_old); - CT_mean = gsw_CT_from_t(SA_mean,t,p); - [rho,alpha,beta] = gsw_rho_alpha_beta(SA_mean,CT_mean,pmid); - specvol = 1./rho; - v_SA = - beta.*specvol; - v_CT = alpha.*specvol; - dCT_dSA = gsw_dCT_dSA(SA_mean,t,pmid);% This is a call to get the -% derivative of CT with respect to -% Absolute Salinity at constant -% in-situ temperature and pressure. - - v_SA_t = v_SA + v_CT.*dCT_dSA; -% v_SA_t is the derivative of specific volume with respect to -% Absolute Salinity at constant in-situ temperature and pressure, -% while v_SA is the derivative of specific volume with respect to -% Absolute Salinity at constant Conservative Temperature and pressure. - - SA = SA_old - delta_v./v_SA_t; - SA(SA < 0 | SA > 50) = NaN; -end - -% After two iterations of this modified Newton-Raphson iteration, -% the error in SA is no larger than 3x10^-12 g/kg, which -% is machine precision for this calculation. - -if transposed - SA = SA.'; -end - -end - -%########################################################################## - -function dCT_dSA = gsw_dCT_dSA(SA,t,p) -%-------------------------------------------------------------------------- -% This function calculates the derivative of Conservative Temperature -% with respect to Absolute Salinity at constant in-situ temperature and -% pressure. The equation for this derivative, in terms of the derivatives -% of the Gibbs function is given in Eqn. (A.15.8) of the TEOS-10 Manual -% (IOC et al., 2010). The code below is identical to the first part of the -% GSW function gsw_beta_const_CT_t_exact. -% -% INPUT: -% SA = Absolute Salinity [ g/kg ] -% t = in-situ temperature (ITS-90) [ deg C ] -% p = sea pressure [ dbar ] -% ( i.e. absolute pressure - 10.1325 dbar ) -%-------------------------------------------------------------------------- - -db2Pa = 1e-4; -sfac = 0.0248826675584615; % sfac = 1/(40*(35.16504/35)). -cp0 = 3991.86795711963; - -pt0 = gsw_pt0_from_t(SA,t,p); - -x2 = sfac.*SA; -x = sqrt(x2); -y = 0.025*t; -y_pt = 0.025*pt0; -z = db2Pa*p; %Note.The input pressure (p) is sea pressure in units of dbar. - -g_SA_T_mod = 1187.3715515697959 + z.*(1458.233059470092 + ... - z.*(-687.913805923122 + z.*(249.375342232496 + z.*(-63.313928772146 + 14.09317606630898.*z)))) + ... - x.*(-1480.222530425046 + x.*(2175.341332000392 + x.*(-980.14153344888 + 220.542973797483.*x) + ... - y.*(-548.4580073635929 + y.*(592.4012338275047 + y.*(-274.2361238716608 + 49.9394019139016.*y))) - ... - 90.6734234051316.*z) + z.*(-525.876123559641 + (249.57717834054571 - 88.449193048287.*z).*z) + ... - y.*(-258.3988055868252 + z.*(2298.348396014856 + z.*(-325.1503575102672 + 153.8390924339484.*z)) + ... - y.*(-90.2046337756875 - 4142.8793862113125.*z + y.*(10.50720794170734 + 2814.78225133626.*z)))) + ... - y.*(3520.125411988816 + y.*(-1351.605895580406 + ... - y.*(731.4083582010072 + y.*(-216.60324087531103 + 25.56203650166196.*y) + ... - z.*(-2381.829935897496 + (597.809129110048 - 291.8983352012704.*z).*z)) + ... - z.*(4165.4688847996085 + z.*(-1229.337851789418 + (681.370187043564 - 66.7696405958478.*z).*z))) + ... - z.*(-3443.057215135908 + z.*(1349.638121077468 + ... - z.*(-713.258224830552 + (176.8161433232 - 31.68006188846728.*z).*z)))); -g_SA_T_mod = 0.5*sfac*0.025*g_SA_T_mod; - -g_SA_mod = 8645.36753595126 + ... - x.*(-7296.43987145382 + x.*(8103.20462414788 + ... - y_pt.*(2175.341332000392 + y_pt.*(-274.2290036817964 + ... - y_pt.*(197.4670779425016 + y_pt.*(-68.5590309679152 + 9.98788038278032.*y_pt)))) + ... - x.*(-5458.34205214835 - 980.14153344888.*y_pt + ... - x.*(2247.60742726704 - 340.1237483177863.*x + 220.542973797483.*y_pt))) + ... - y_pt.*(-1480.222530425046 + y_pt.*(-129.1994027934126 + ... - y_pt.*(-30.0682112585625 + y_pt.*(2.626801985426835 ))))) + ... - y_pt.*(1187.3715515697959 + y_pt.*(1760.062705994408 + y_pt.*(-450.535298526802 + ... - y_pt.*(182.8520895502518 + y_pt.*(-43.3206481750622 + 4.26033941694366.*y_pt))))); -g_SA_mod = 0.5*sfac*g_SA_mod; - -dCT_dSA = (g_SA_mod - (273.15 + pt0).*g_SA_T_mod)./cp0; - -end diff --git a/Toolbox/gsw_SK_from_SP.m b/Toolbox/gsw_SK_from_SP.m deleted file mode 100644 index 09d76c8..0000000 --- a/Toolbox/gsw_SK_from_SP.m +++ /dev/null @@ -1,51 +0,0 @@ -function SK = gsw_SK_from_SP(SP) - -% gsw_SK_from_SP Knudsen Salinity from Practical Salinity -%========================================================================== -% -% USAGE: -% SK = gsw_SK_from_SP(SP) -% -% DESCRIPTION: -% Calculates Knudsen Salinity from Practical Salinity. -% -% INPUT: -% SP = Practical Salinity (PSS-78) [ unitless ] -% -% OUTPUT: -% SK = Knudsen Salinity [parts per thousand, ppt] -% -% AUTHOR: -% Trevor McDougall and Paul Barker [ help@teos-10.org ] -% -% VERSION NUMBER: 3.02 (16th November, 2012) -% -% REFERENCES: -% IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of -% seawater - 2010: Calculation and use of thermodynamic properties. -% Intergovernmental Oceanographic Commission, Manuals and Guides No. 56, -% UNESCO (English), 196 pp. Available from http://www.TEOS-10.org -% See Appendix A.3 of this TEOS-10 Manual. -% -% The software is available from http://www.TEOS-10.org -% -%========================================================================== - -%-------------------------------------------------------------------------- -% Check variables -%-------------------------------------------------------------------------- - -if ~(nargin == 1) - error('gsw_SK_from_SP: Requires only one input') -end %if - -%-------------------------------------------------------------------------- -% Start of the calculation -%-------------------------------------------------------------------------- - -% This line ensures that SP is non-negative. -SP(SP < 0) = 0; - -SK = 0.03 + SP.*(1.805/1.80655); - -end diff --git a/Toolbox/gsw_SP_from_C.m b/Toolbox/gsw_SP_from_C.m index c673d7f..6dee1e0 100644 --- a/Toolbox/gsw_SP_from_C.m +++ b/Toolbox/gsw_SP_from_C.m @@ -31,7 +31,7 @@ % AUTHOR: % Paul Barker, Trevor McDougall and Rich Pawlowicz [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (16th November, 2012) +% VERSION NUMBER: 3.03 (12th March, 2013) % % REFERENCES: % Culkin and Smith, 1980: Determination of the Concentration of Potassium @@ -142,41 +142,45 @@ k = 0.0162; -t68 = t.*1.00024; +[Iocean] = find(~isnan(C + t + p)); + +t68 = t(Iocean).*1.00024; ft68 = (t68 - 15)./(1 + k*(t68 - 15)); % The dimensionless conductivity ratio, R, is the conductivity input, C, % divided by the present estimate of C(SP=35, t_68=15, p=0) which is % 42.9140 mS/cm (=4.29140 S/m), (Culkin and Smith, 1980). -R = 0.023302418791070513.*C; % 0.023302418791070513 = 1./42.9140 +R = 0.023302418791070513.*C(Iocean); % 0.023302418791070513 = 1./42.9140 % rt_lc corresponds to rt as defined in the UNESCO 44 (1983) routines. rt_lc = c0 + (c1 + (c2 + (c3 + c4.*t68).*t68).*t68).*t68; -Rp = 1 + (p.*(e1 + e2.*p + e3.*p.*p))./ ... +Rp = 1 + (p(Iocean).*(e1 + e2.*p(Iocean) + e3.*p(Iocean).*p(Iocean)))./ ... (1 + d1.*t68 + d2.*t68.*t68 + (d3 + d4.*t68).*R); -Rt = R./(Rp.*rt_lc); +Rt = R./(Rp.*rt_lc); Rt(Rt < 0) = NaN; Rtx = sqrt(Rt); -SP = a0 + (a1 + (a2 + (a3 + (a4 + a5.*Rtx).*Rtx).*Rtx).*Rtx).*Rtx + ... +SP = NaN(size(C)); + +SP(Iocean) = a0 + (a1 + (a2 + (a3 + (a4 + a5.*Rtx).*Rtx).*Rtx).*Rtx).*Rtx + ... ft68.*(b0 + (b1 + (b2 + (b3 + (b4 + b5.*Rtx).*Rtx).*Rtx).*Rtx).*Rtx); % The following section of the code is designed for SP < 2 based on the % Hill et al. (1986) algorithm. This algorithm is adjusted so that it is % exactly equal to the PSS-78 algorithm at SP = 2. -if any(SP < 2) - [I2] = find(SP < 2); - Hill_ratio = gsw_Hill_ratio_at_SP2(t(I2)); +if any(SP(Iocean) < 2) + [I2] = find(SP(Iocean) < 2); + Hill_ratio = gsw_Hill_ratio_at_SP2(t(Iocean(I2))); x = 400*Rt(I2); sqrty = 10*Rtx(I2); - part1 = 1 + x.*(1.5 + x) ; + part1 = 1 + x.*(1.5 + x); part2 = 1 + sqrty.*(1 + sqrty.*(1 + sqrty)); - SP_Hill_raw = SP(I2) - a0./part1 - b0.*ft68(I2)./part2; - SP(I2) = Hill_ratio.*SP_Hill_raw; + SP_Hill_raw = SP(Iocean(I2)) - a0./part1 - b0.*ft68(I2)./part2; + SP(Iocean(I2)) = Hill_ratio.*SP_Hill_raw; end % This line ensures that SP is non-negative. diff --git a/Toolbox/gsw_SP_from_R.m b/Toolbox/gsw_SP_from_R.m index 51c862c..bb69104 100644 --- a/Toolbox/gsw_SP_from_R.m +++ b/Toolbox/gsw_SP_from_R.m @@ -30,7 +30,7 @@ % AUTHOR: % Paul Barker, Trevor McDougall and Rich Pawlowicz [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (16th November, 2012) +% VERSION NUMBER: 3.03 (12th March, 2013) % % REFERENCES: % Hill, K.D., T.M. Dauphinee & D.J. Woods, 1986: The extension of the @@ -136,35 +136,39 @@ k = 0.0162; -t68 = t.*1.00024; +[Iocean] = find(~isnan(R + t + p)); + +t68 = t(Iocean).*1.00024; ft68 = (t68 - 15)./(1 + k*(t68 - 15)); % rt_lc corresponds to rt as defined in the UNESCO 44 (1983) routines. rt_lc = c0 + (c1 + (c2 + (c3 + c4.*t68).*t68).*t68).*t68; -Rp = 1 + (p.*(e1 + e2.*p + e3.*p.*p))./ ... - (1 + d1.*t68 + d2.*t68.*t68 + (d3 + d4.*t68).*R); -Rt = R./(Rp.*rt_lc); +Rp = 1 + (p(Iocean).*(e1 + p(Iocean).*(e2 + e3.*p(Iocean))))./ ... + (1 + d1.*t68 + d2.*t68.*t68 + (d3 + d4.*t68).*R(Iocean)); +Rt = R(Iocean)./(Rp.*rt_lc); Rt(Rt < 0) = NaN; Rtx = sqrt(Rt); -SP = a0 + (a1 + (a2 + (a3 + (a4 + a5.*Rtx).*Rtx).*Rtx).*Rtx).*Rtx + ... +SP = NaN(size(R)); + +SP(Iocean) = a0 + (a1 + (a2 + (a3 + (a4 + a5.*Rtx).*Rtx).*Rtx).*Rtx).*Rtx + ... ft68.*(b0 + (b1 + (b2+ (b3 + (b4 + b5.*Rtx).*Rtx).*Rtx).*Rtx).*Rtx); % The following section of the code is designed for SP < 2 based on the % Hill et al. (1986) algorithm. This algorithm is adjusted so that it is % exactly equal to the PSS-78 algorithm at SP = 2. -if any(SP < 2) - [I2] = find(SP < 2); - Hill_ratio = gsw_Hill_ratio_at_SP2(t(I2)); +if any(SP(Iocean) < 2) + [I2] = find(SP(Iocean) < 2); + Hill_ratio = gsw_Hill_ratio_at_SP2(t(Iocean(I2))); x = 400*Rt(I2); sqrty = 10*Rtx(I2); - part1 = 1 + x.*(1.5 + x) ; + part1 = 1 + x.*(1.5 + x); part2 = 1 + sqrty.*(1 + sqrty.*(1 + sqrty)); SP_Hill_raw = SP(I2) - a0./part1 - b0.*ft68(I2)./part2; - SP(I2) = Hill_ratio.*SP_Hill_raw; + SP(Iocean(I2)) = Hill_ratio.*SP_Hill_raw; end % This line ensures that SP is non-negative. diff --git a/Toolbox/gsw_SP_from_SA.m b/Toolbox/gsw_SP_from_SA.m index 22b860e..b17db78 100644 --- a/Toolbox/gsw_SP_from_SA.m +++ b/Toolbox/gsw_SP_from_SA.m @@ -31,7 +31,7 @@ % AUTHOR: % David Jackett, Trevor McDougall and Paul Barker [ help_gsw@csiro.au ] % -% VERSION NUMBER: 3.02 (7th January, 2013) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of diff --git a/Toolbox/gsw_SP_from_SK.m b/Toolbox/gsw_SP_from_SK.m index 8a639a8..6f2f330 100644 --- a/Toolbox/gsw_SP_from_SK.m +++ b/Toolbox/gsw_SP_from_SK.m @@ -18,7 +18,7 @@ % AUTHOR: % Trevor McDougall and Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (16th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of diff --git a/Toolbox/gsw_SP_from_SR.m b/Toolbox/gsw_SP_from_SR.m index 1548d33..d5d8107 100644 --- a/Toolbox/gsw_SP_from_SR.m +++ b/Toolbox/gsw_SP_from_SR.m @@ -18,7 +18,7 @@ % AUTHOR: % Trevor McDougall and Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (16th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of diff --git a/Toolbox/gsw_SP_from_Sstar.m b/Toolbox/gsw_SP_from_Sstar.m index b5bfae5..0376660 100644 --- a/Toolbox/gsw_SP_from_Sstar.m +++ b/Toolbox/gsw_SP_from_Sstar.m @@ -31,7 +31,7 @@ % AUTHOR: % David Jackett, Trevor McDougall and Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (7th January, 2013) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of diff --git a/Toolbox/gsw_SP_salinometer.m b/Toolbox/gsw_SP_salinometer.m index e8b985a..a44fa2d 100644 --- a/Toolbox/gsw_SP_salinometer.m +++ b/Toolbox/gsw_SP_salinometer.m @@ -32,7 +32,7 @@ % AUTHOR: % Paul Barker, Trevor McDougall and Rich Pawlowicz [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (16th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % Fofonoff, P. and R.C. Millard Jr. 1983: Algorithms for computation of diff --git a/Toolbox/gsw_SR_from_SP.m b/Toolbox/gsw_SR_from_SP.m index afff60e..1918e1a 100644 --- a/Toolbox/gsw_SR_from_SP.m +++ b/Toolbox/gsw_SR_from_SP.m @@ -18,7 +18,7 @@ % AUTHOR: % Trevor McDougall and Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (16th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of diff --git a/Toolbox/gsw_SSO.m b/Toolbox/gsw_SSO.m index b97293b..95b4d7d 100644 --- a/Toolbox/gsw_SSO.m +++ b/Toolbox/gsw_SSO.m @@ -20,7 +20,7 @@ % AUTHOR: % Trevor McDougall and Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (16th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of diff --git a/Toolbox/gsw_SonCl.m b/Toolbox/gsw_SonCl.m index 450f8ff..86fe104 100644 --- a/Toolbox/gsw_SonCl.m +++ b/Toolbox/gsw_SonCl.m @@ -20,7 +20,7 @@ % AUTHOR: % Trevor McDougall and Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (16th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % Millero, F. J., R. Feistel, D. G. Wright, and T. J. McDougall, 2008: diff --git a/Toolbox/gsw_Sstar_from_SA.m b/Toolbox/gsw_Sstar_from_SA.m index dfc83d7..f31d3c1 100644 --- a/Toolbox/gsw_Sstar_from_SA.m +++ b/Toolbox/gsw_Sstar_from_SA.m @@ -31,7 +31,7 @@ % AUTHOR: % David Jackett, Trevor McDougall and Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (7th January, 2013) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of diff --git a/Toolbox/gsw_Sstar_from_SP.m b/Toolbox/gsw_Sstar_from_SP.m index da2e56a..f3430d1 100644 --- a/Toolbox/gsw_Sstar_from_SP.m +++ b/Toolbox/gsw_Sstar_from_SP.m @@ -33,7 +33,7 @@ % AUTHOR: % David Jackett, Trevor McDougall & Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (7th January, 2013) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of diff --git a/Toolbox/gsw_T0.m b/Toolbox/gsw_T0.m index 04422fe..0ecd76d 100644 --- a/Toolbox/gsw_T0.m +++ b/Toolbox/gsw_T0.m @@ -16,7 +16,7 @@ % AUTHOR: % Trevor McDougall and Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (16th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of diff --git a/Toolbox/gsw_Turner_Rsubrho.m b/Toolbox/gsw_Turner_Rsubrho.m index da6bafc..5512530 100644 --- a/Toolbox/gsw_Turner_Rsubrho.m +++ b/Toolbox/gsw_Turner_Rsubrho.m @@ -14,7 +14,7 @@ % Brunt-Vaisala Frequency squared, N^2). Tu and Rsubrho are evaluated at % the mid pressure between the individual data points in the vertical. % This function uses computationally-efficient 48-term expression for -% density in terms of SA, CT and p (McDougall et al., 2013). Note that +% density in terms of SA, CT and p (IOC et al., 2010). Note that % in the double-diffusive literature, papers concerned with the % "diffusive" form of double-diffusive convection often define the % stability ratio as the reciprocal of what is defined here as the @@ -22,7 +22,7 @@ % % Note that the 48-term equation has been fitted in a restricted range of % parameter space, and is most accurate inside the "oceanographic funnel" -% described in McDougall et al. (2013). The GSW library function +% described in IOC et al. (2010). The GSW library function % "gsw_infunnel(SA,CT,p)" is avaialble to be used if one wants to test if % some of one's data lies outside this "funnel". % @@ -47,7 +47,7 @@ % AUTHOR: % Trevor McDougall & Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (16th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of @@ -56,11 +56,6 @@ % UNESCO (English), 196 pp. Available from http://www.TEOS-10.org % See Eqns. (3.15.1) and (3.16.1) of this TEOS-10 Manual. % -% McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2013: A -% computationally efficient 48-term expression for the density of -% seawater in terms of Conservative Temperature, and related properties -% of seawater. To be submitted to J. Atm. Ocean. Technol., xx, yyy-zzz. -% % The software is available from http://www.TEOS-10.org % %========================================================================== diff --git a/Toolbox/gsw_adiabatic_lapse_rate_from_CT.m b/Toolbox/gsw_adiabatic_lapse_rate_from_CT.m new file mode 100644 index 0000000..d01886c --- /dev/null +++ b/Toolbox/gsw_adiabatic_lapse_rate_from_CT.m @@ -0,0 +1,99 @@ +function adiabatic_lapse_rate = gsw_adiabatic_lapse_rate_from_CT(SA,CT,p) + +% gsw_adiabatic_lapse_rate_from_CT adiabatic lapse rate +%========================================================================== +% +% USAGE: +% adiabatic_lapse_rate = gsw_adiabatic_lapse_rate_from_CT(SA,CT,p) +% +% DESCRIPTION: +% Calculates the adiabatic lapse rate of sea water from Conservative +% Temperature. +% +% INPUT: +% SA = Absolute Salinity [ g/kg ] +% CT = Conservative Temperature (ITS-90) [ deg C ] +% p = sea pressure [ dbar ] +% ( i.e. absolute pressure - 10.1325 dbar ) +% +% SA & CT need to have the same dimensions. +% p may have dimensions 1x1 or Mx1 or 1xN or MxN, where SA & CT are MxN. +% +% OUTPUT: +% adiabatic_lapse_rate = adiabatic lapse rate [ K/Pa ] +% Note. The output is in unit of degress Celsius per Pa, +% (or equivilently K/Pa) not in units of K/dbar. +% +% AUTHOR: +% Trevor McDougall and Paul Barker [ help@teos-10.org ] +% +% VERSION NUMBER: 3.03 (29th April, 2013) +% +% REFERENCES: +% IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of +% seawater - 2010: Calculation and use of thermodynamic properties. +% Intergovernmental Oceanographic Commission, Manuals and Guides No. 56, +% UNESCO (English), 196 pp. Available from http://www.TEOS-10.org. +% See Eqn. (2.22.1) of this TEOS-10 Manual. +% +% The software is available from http://www.TEOS-10.org +% +%========================================================================== + +%-------------------------------------------------------------------------- +% Check variables and resize if necessary +%-------------------------------------------------------------------------- + +if ~(nargin == 3) + error('gsw_adiabatic_lapse_rate_from_CT: Requires three inputs') +end + +[ms,ns] = size(SA); +[mt,nt] = size(CT); +[mp,np] = size(p); + +if (mt ~= ms | nt ~= ns) + error('gsw_adiabatic_lapse_rate_from_CT: SA and CT must have same dimensions') +end + +if (mp == 1) & (np == 1) % p scalar - fill to size of SA + p = p*ones(size(SA)); +elseif (ns == np) & (mp == 1) % p is row vector, + p = p(ones(1,ms), :); % copy down each column. +elseif (ms == mp) & (np == 1) % p is column vector, + p = p(:,ones(1,ns)); % copy across each row. +elseif (ns == mp) & (np == 1) % p is a transposed row vector, + p = p.'; % transposed then + p = p(ones(1,ms), :); % copy down each column. +elseif (ms == mp) & (ns == np) + % ok +else + error('gsw_adiabatic_lapse_rate_from_CT: Inputs array dimensions arguments do not agree') +end %if + +if ms == 1 + SA = SA.'; + CT = CT.'; + p = p.'; + transposed = 1; +else + transposed = 0; +end + +%-------------------------------------------------------------------------- +% Start of the calculation +%-------------------------------------------------------------------------- + +n0 = 0; +n1 = 1; +n2 = 2; + +t = gsw_t_from_CT(SA,CT,p); + +adiabatic_lapse_rate = -gsw_gibbs(n0,n1,n1,SA,t,p)./(gsw_gibbs(n0,n2,n0,SA,t,p)); + +if transposed + adiabatic_lapse_rate = adiabatic_lapse_rate.'; +end + +end diff --git a/Toolbox/gsw_adiabatic_lapse_rate_t_exact.m b/Toolbox/gsw_adiabatic_lapse_rate_from_t.m similarity index 77% rename from Toolbox/gsw_adiabatic_lapse_rate_t_exact.m rename to Toolbox/gsw_adiabatic_lapse_rate_from_t.m index 319660e..55f1f01 100644 --- a/Toolbox/gsw_adiabatic_lapse_rate_t_exact.m +++ b/Toolbox/gsw_adiabatic_lapse_rate_from_t.m @@ -1,10 +1,10 @@ -function adiabatic_lapse_rate_t_exact = gsw_adiabatic_lapse_rate_t_exact(SA,t,p) +function adiabatic_lapse_rate = gsw_adiabatic_lapse_rate_from_t(SA,t,p) -% gsw_adiabatic_lapse_rate_t_exact adiabatic lapse rate +% gsw_adiabatic_lapse_rate_from_t adiabatic lapse rate %========================================================================== % % USAGE: -% adiabatic_lapse_rate_t_exact = gsw_adiabatic_lapse_rate_t_exact(SA,t,p) +% adiabatic_lapse_rate = gsw_adiabatic_lapse_rate_from_t(SA,t,p) % % DESCRIPTION: % Calculates the adiabatic lapse rate of sea water @@ -19,14 +19,14 @@ % p may have dimensions 1x1 or Mx1 or 1xN or MxN, where SA & t are MxN. % % OUTPUT: -% adiabatic_lapse_rate_t_exact = adiabatic lapse rate [ K/Pa ] +% adiabatic_lapse_rate = adiabatic lapse rate [ K/Pa ] % Note. The output is in unit of degress Celsius per Pa, % (or equivilently K/Pa) not in units of K/dbar. % % AUTHOR: % Trevor McDougall and Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (13th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of @@ -44,7 +44,7 @@ %-------------------------------------------------------------------------- if ~(nargin == 3) - error('gsw_adiabatic_lapse_rate_t_exact: Requires three inputs') + error('gsw_adiabatic_lapse_rate_from_t: Requires three inputs') end [ms,ns] = size(SA); @@ -52,7 +52,7 @@ [mp,np] = size(p); if (mt ~= ms | nt ~= ns) - error('gsw_adiabatic_lapse_rate_t_exact: SA and t must have same dimensions') + error('gsw_adiabatic_lapse_rate_from_t: SA and t must have same dimensions') end if (mp == 1) & (np == 1) % p scalar - fill to size of SA @@ -67,7 +67,7 @@ elseif (ms == mp) & (ns == np) % ok else - error('gsw_adiabatic_lapse_rate_t_exact: Inputs array dimensions arguments do not agree') + error('gsw_adiabatic_lapse_rate_from_t: Inputs array dimensions arguments do not agree') end %if if ms == 1 @@ -87,10 +87,10 @@ n1 = 1; n2 = 2; -adiabatic_lapse_rate_t_exact = -gsw_gibbs(n0,n1,n1,SA,t,p)./(gsw_gibbs(n0,n2,n0,SA,t,p)); +adiabatic_lapse_rate = -gsw_gibbs(n0,n1,n1,SA,t,p)./(gsw_gibbs(n0,n2,n0,SA,t,p)); if transposed - adiabatic_lapse_rate_t_exact = adiabatic_lapse_rate_t_exact.'; + adiabatic_lapse_rate = adiabatic_lapse_rate.'; end end diff --git a/Toolbox/gsw_alpha.m b/Toolbox/gsw_alpha.m index 20977a8..4b5a24c 100644 --- a/Toolbox/gsw_alpha.m +++ b/Toolbox/gsw_alpha.m @@ -10,11 +10,11 @@ % DESCRIPTION: % Calculates the thermal expansion coefficient of seawater with respect to % Conservative Temperature using the computationally-efficient 48-term -% expression for density in terms of SA, CT and p (McDougall et al., 2011) +% expression for density in terms of SA, CT and p (McDougall et al., 2010) % % Note that the 48-term equation has been fitted in a restricted range of % parameter space, and is most accurate inside the "oceanographic funnel" -% described in McDougall et al. (2013). The GSW library function +% described in McDougall et al. (2010). The GSW library function % "gsw_infunnel(SA,CT,p)" is avaialble to be used if one wants to test if % some of one's data lies outside this "funnel". % @@ -34,7 +34,7 @@ % AUTHOR: % Paul Barker and Trevor McDougall [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (15th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of @@ -43,11 +43,6 @@ % UNESCO (English), 196 pp. Available from http://www.TEOS-10.org % See Eqn. (2.18.3) of this TEOS-10 manual. % -% McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2013: A -% computationally efficient 48-term expression for the density of -% seawater in terms of Conservative Temperature, and related properties -% of seawater. To be submitted to J. Atm. Ocean. Technol., xx, yyy-zzz. -% % The software is available from http://www.TEOS-10.org % %========================================================================== diff --git a/Toolbox/gsw_alpha_CT.m b/Toolbox/gsw_alpha_CT.m index dd22aaf..1fb48f9 100644 --- a/Toolbox/gsw_alpha_CT.m +++ b/Toolbox/gsw_alpha_CT.m @@ -16,11 +16,11 @@ % DESCRIPTION: % Calculates the thermal expansion coefficient of seawater with respect to % Conservative Temperature using the computationally-efficient 48-term -% expression for density in terms of SA, CT and p (McDougall et al., 2013) +% expression for density in terms of SA, CT and p (IOC et al., 2010) % % Note that the 48-term equation has been fitted in a restricted range of % parameter space, and is most accurate inside the "oceanographic funnel" -% described in McDougall et al. (2013). The GSW library function +% described in IOC et al. (2010). The GSW library function % "gsw_infunnel(SA,CT,p)" is avaialble to be used if one wants to test if % some of one's data lies outside this "funnel". % @@ -40,7 +40,7 @@ % AUTHOR: % Paul Barker and Trevor McDougall [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (13th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of @@ -49,11 +49,6 @@ % UNESCO (English), 196 pp. Available from http://www.TEOS-10.org % See Eqn. (2.18.3) of this TEOS-10 manual. % -% McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2013: A -% computationally efficient 48-term expression for the density of -% seawater in terms of Conservative Temperature, and related properties -% of seawater. To be submitted to J. Atm. Ocean. Technol., xx, yyy-zzz. -% % The software is available from http://www.TEOS-10.org % %========================================================================== diff --git a/Toolbox/gsw_alpha_CT_exact.m b/Toolbox/gsw_alpha_CT_exact.m index 9a02f6d..c19f521 100644 --- a/Toolbox/gsw_alpha_CT_exact.m +++ b/Toolbox/gsw_alpha_CT_exact.m @@ -13,9 +13,9 @@ % Temperature. % % Note that this function uses the full Gibbs function. There is an -% alternative to calling this function, namely gsw_alpha_wrt_CT(SA,CT,p) +% alternative to calling this function, namely gsw_alpha(SA,CT,p) % which uses the computationally efficient 48-term expression for density -% in terms of SA, CT and p (McDougall et al., (2013)). +% in terms of SA, CT and p (McDougall et al., (2010)). % % INPUT: % SA = Absolute Salinity [ g/kg ] @@ -33,7 +33,7 @@ % AUTHOR: % David Jackett, Trevor McDougall and Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (13th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of @@ -42,11 +42,6 @@ % UNESCO (English), 196 pp. Available from http://www.TEOS-10.org % See Eqn. (2.18.3) of this TEOS-10 manual. % -% McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2013: A -% computationally efficient 48-term expression for the density of -% seawater in terms of Conservative Temperature, and related properties -% of seawater. To be submitted to J. Atm. Ocean. Technol., xx, yyy-zzz. -% % The software is available from http://www.TEOS-10.org % %========================================================================== diff --git a/Toolbox/gsw_alpha_on_beta.m b/Toolbox/gsw_alpha_on_beta.m new file mode 100644 index 0000000..b14e52a --- /dev/null +++ b/Toolbox/gsw_alpha_on_beta.m @@ -0,0 +1,255 @@ +function alpha_on_beta = gsw_alpha_on_beta(SA,CT,p) + +% gsw_alpha_on_beta alpha/beta (48-term equation) +%========================================================================== +% +% USAGE: +% alpha_on_beta = gsw_alpha_on_beta(SA,CT,p) +% +% DESCRIPTION: +% Calculates alpha divided by beta, where alpha is the thermal expansion +% coefficient and beta is the saline contraction coefficient of seawater +% from Absolute Salinity and Conservative Temperature. This function uses +% the computationally-efficient 48-term expression for density in terms of +% SA, CT and p (IOC et al., 2010). +% +% Note that the 48-term equation has been fitted in a restricted range of +% parameter space, and is most accurate inside the "oceanographic funnel" +% described in IOC et al. (2010). The GSW library function +% "gsw_infunnel(SA,CT,p)" is avaialble to be used if one wants to test if +% some of one's data lies outside this "funnel". +% +% INPUT: +% SA = Absolute Salinity [ g/kg ] +% CT = Conservative Temperature (ITS-90) [ deg C ] +% p = sea pressure [ dbar ] +% ( i.e. absolute pressure - 10.1325 dbar ) +% +% SA & CT need to have the same dimensions. +% p may have dimensions 1x1 or Mx1 or 1xN or MxN, where SA & CT are MxN. +% +% OUTPUT: +% alpha_on_beta = thermal expansion coefficient with respect to +% Conservative Temperature divided by the saline +% contraction coefficient at constant Conservative +% Temperature [ kg g^-1 K^-1 ] +% +% AUTHOR: +% Paul Barker and Trevor McDougall [ help@teos-10.org ] +% +% VERSION NUMBER: 3.03 (10th May, 2013) +% +% REFERENCES: +% IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of +% seawater - 2010: Calculation and use of thermodynamic properties. +% Intergovernmental Oceanographic Commission, Manuals and Guides No. 56, +% UNESCO (English), 196 pp. Available from http://www.TEOS-10.org +% See appendix A.20 and appendix K of this TEOS-10 Manual. +% +% The software is available from http://www.TEOS-10.org +% +%========================================================================== + +%-------------------------------------------------------------------------- +% Check variables and resize if necessary +%-------------------------------------------------------------------------- + +if ~(nargin == 3) + error('gsw_alpha_on_beta: Requires three inputs') +end %if +if ~(nargout == 1) + error('gsw_alpha_on_beta: Requires one outputs') +end %if + +[ms,ns] = size(SA); +[mt,nt] = size(CT); +[mp,np] = size(p); + +if (mt ~= ms | nt ~= ns) + error('gsw_alpha_on_beta: SA and CT must have same dimensions') +end + +if (mp == 1) & (np == 1) % p scalar - fill to size of SA + p = p*ones(size(SA)); +elseif (ns == np) & (mp == 1) % p is row vector, + p = p(ones(1,ms), :); % copy down each column. +elseif (ms == mp) & (np == 1) % p is column vector, + p = p(:,ones(1,ns)); % copy across each row. +elseif (ns == mp) & (np == 1) % p is a transposed row vector, + p = p.'; % transposed then + p = p(ones(1,ms), :); % copy down each column. +elseif (ms == mp) & (ns == np) + % ok +else + error('gsw_alpha_on_beta: Inputs array dimensions arguments do not agree') +end %if + +if ms == 1 + SA = SA.'; + CT = CT.'; + p = p.'; + transposed = 1; +else + transposed = 0; +end + +%-------------------------------------------------------------------------- +% Start of the calculation +%-------------------------------------------------------------------------- + +% This line ensures that SA is non-negative. +SA(SA < 0) = 0; + +v01 = 9.998420897506056e+2; +v02 = 2.839940833161907; +v03 = -3.147759265588511e-2; +v04 = 1.181805545074306e-3; +v05 = -6.698001071123802; +v06 = -2.986498947203215e-2; +v07 = 2.327859407479162e-4; +v08 = -3.988822378968490e-2; +v09 = 5.095422573880500e-4; +v10 = -1.426984671633621e-5; +v11 = 1.645039373682922e-7; +v12 = -2.233269627352527e-2; +v13 = -3.436090079851880e-4; +v14 = 3.726050720345733e-6; +v15 = -1.806789763745328e-4; +v16 = 6.876837219536232e-7; +v17 = -3.087032500374211e-7; +v18 = -1.988366587925593e-8; +v19 = -1.061519070296458e-11; +v20 = 1.550932729220080e-10; +v21 = 1.0; +v22 = 2.775927747785646e-3; +v23 = -2.349607444135925e-5; +v24 = 1.119513357486743e-6; +v25 = 6.743689325042773e-10; +v26 = -7.521448093615448e-3; +v27 = -2.764306979894411e-5; +v28 = 1.262937315098546e-7; +v29 = 9.527875081696435e-10; +v30 = -1.811147201949891e-11; +v31 = -3.303308871386421e-5; +v32 = 3.801564588876298e-7; +v33 = -7.672876869259043e-9; +v34 = -4.634182341116144e-11; +v35 = 2.681097235569143e-12; +v36 = 5.419326551148740e-6; +v37 = -2.742185394906099e-5; +v38 = -3.212746477974189e-7; +v39 = 3.191413910561627e-9; +v40 = -1.931012931541776e-12; +v41 = -1.105097577149576e-7; +v42 = 6.211426728363857e-10; +v43 = -1.119011592875110e-10; +v44 = -1.941660213148725e-11; +v45 = -1.864826425365600e-14; +v46 = 1.119522344879478e-14; +v47 = -1.200507748551599e-15; +v48 = 6.057902487546866e-17; + +a01 = 2.839940833161907; +a02 = -6.295518531177023e-2; +a03 = 3.545416635222918e-3; +a04 = -2.986498947203215e-2; +a05 = 4.655718814958324e-4; +a06 = 5.095422573880500e-4; +a07 = -2.853969343267241e-5; +a08 = 4.935118121048767e-7; +a09 = -3.436090079851880e-4; +a10 = 7.452101440691467e-6; +a11 = 6.876837219536232e-7; +a12 = -1.988366587925593e-8; +a13 = -2.123038140592916e-11; + +a14 = 2.775927747785646e-3; +a15 = -4.699214888271850e-5; +a16 = 3.358540072460230e-6; +a17 = 2.697475730017109e-9; +a18 = -2.764306979894411e-5; +a19 = 2.525874630197091e-7; +a20 = 2.858362524508931e-9; +a21 = -7.244588807799565e-11; +a22 = 3.801564588876298e-7; +a23 = -1.534575373851809e-8; +a24 = -1.390254702334843e-10; +a25 = 1.072438894227657e-11; +a26 = -3.212746477974189e-7; +a27 = 6.382827821123254e-9; +a28 = -5.793038794625329e-12; +a29 = 6.211426728363857e-10; +a30 = -1.941660213148725e-11; +a31 = -3.729652850731201e-14; +a32 = 1.119522344879478e-14; +a33 = 6.057902487546866e-17; + +b01 = -6.698001071123802; +b02 = -2.986498947203215e-2; +b03 = 2.327859407479162e-4; +b04 = -5.983233568452735e-2; +b05 = 7.643133860820750e-4; +b06 = -2.140477007450431e-5; +b07 = 2.467559060524383e-7; +b08 = -1.806789763745328e-4; +b09 = 6.876837219536232e-7; +b10 = 1.550932729220080e-10; +b11 = -7.521448093615448e-3; +b12 = -2.764306979894411e-5; +b13 = 1.262937315098546e-7; +b14 = 9.527875081696435e-10; +b15 = -1.811147201949891e-11; +b16 = -4.954963307079632e-5; +b17 = 5.702346883314446e-7; +b18 = -1.150931530388857e-8; +b19 = -6.951273511674217e-11; +b20 = 4.021645853353715e-12; +b21 = 1.083865310229748e-5; +b22 = -1.105097577149576e-7; +b23 = 6.211426728363857e-10; +b24 = 1.119522344879478e-14; + +sqrtSA = sqrt(SA); + +v_hat_denominator = v01 + CT.*(v02 + CT.*(v03 + v04*CT)) ... + + SA.*(v05 + CT.*(v06 + v07*CT) ... + + sqrtSA.*(v08 + CT.*(v09 + CT.*(v10 + v11*CT)))) ... + + p.*(v12 + CT.*(v13 + v14*CT) + SA.*(v15 + v16*CT) ... + + p.*(v17 + CT.*(v18 + v19*CT) + v20*SA)); + +v_hat_numerator = v21 + CT.*(v22 + CT.*(v23 + CT.*(v24 + v25*CT))) ... + + SA.*(v26 + CT.*(v27 + CT.*(v28 + CT.*(v29 + v30*CT))) + v36*SA ... + + sqrtSA.*(v31 + CT.*(v32 + CT.*(v33 + CT.*(v34 + v35*CT))))) ... + + p.*(v37 + CT.*(v38 + CT.*(v39 + v40*CT)) ... + + SA.*(v41 + v42*CT) ... + + p.*(v43 + CT.*(v44 + v45*CT + v46*SA) ... + + p.*(v47 + v48*CT))); + +dvhatden_dCT = a01 + CT.*(a02 + a03*CT) ... + + SA.*(a04 + a05*CT ... + + sqrtSA.*(a06 + CT.*(a07 + a08*CT))) ... + + p.*(a09 + a10*CT + a11*SA ... + + p.*(a12 + a13*CT)); + +dvhatnum_dCT = a14 + CT.*(a15 + CT.*(a16 + a17*CT)) ... + + SA.*(a18 + CT.*(a19 + CT.*(a20 + a21*CT)) ... + + sqrtSA.*(a22 + CT.*(a23 + CT.*(a24 + a25*CT)))) ... + + p.*(a26 + CT.*(a27 + a28*CT) + a29*SA ... + + p.*(a30 + a31*CT + a32*SA + a33*p)); + +dvhatden_dSA = b01 + CT.*(b02 + b03*CT) ... + + sqrtSA.*(b04 + CT.*(b05 + CT.*(b06 + b07*CT))) ... + + p.*(b08 + b09*CT + b10*p) ; + +dvhatnum_dSA = b11 + CT.*(b12 + CT.*(b13 + CT.*(b14 + b15*CT))) ... + + sqrtSA.*(b16 + CT.*(b17 + CT.*(b18 + CT.*(b19 + b20*CT)))) + b21*SA ... + + p.*(b22 + CT.*(b23 + b24*p)); + +alpha_on_beta = (dvhatnum_dCT.*v_hat_denominator - dvhatden_dCT.*v_hat_numerator)./ ... + (dvhatden_dSA.*v_hat_numerator - dvhatnum_dSA.*v_hat_denominator); + +if transposed + alpha_on_beta = alpha_on_beta.'; +end + +end diff --git a/Toolbox/gsw_alpha_on_beta_CT.m b/Toolbox/gsw_alpha_on_beta_CT.m new file mode 100644 index 0000000..826c632 --- /dev/null +++ b/Toolbox/gsw_alpha_on_beta_CT.m @@ -0,0 +1,112 @@ +function alpha_on_beta_CT = gsw_alpha_on_beta_CT(SA,CT,p) + +% gsw_alpha_on_beta_CT alpha/beta (48-term equation) +%========================================================================== +% +% USAGE: +% alpha_on_beta_CT = gsw_alpha_on_beta_CT(SA,CT,p), or equivalently +% alpha_on_beta = gsw_alpha_on_beta(SA,CT,p) +% +% Note that gsw_alpha_on_beta_CT(SA,CT,p) is identical to +% gsw_alpha_on_beta(SA,CT,p). The extra "_CT" emphasises that the +% input temperature is Conservative Temperature, but the extra "_CT" part +% of the function name is not needed. +% +% DESCRIPTION: +% Calculates alpha divided by beta, where alpha is the thermal expansion +% coefficient and beta is the saline contraction coefficient of seawater +% from Absolute Salinity and Conservative Temperature. This function uses +% the computationally-efficient 48-term expression for density in terms of +% SA, CT and p (IOC et al., 2010). +% +% Note that the 48-term equation has been fitted in a restricted range of +% parameter space, and is most accurate inside the "oceanographic funnel" +% described in IOC et al. (2010). The GSW library function +% "gsw_infunnel(SA,CT,p)" is avaialble to be used if one wants to test if +% some of one's data lies outside this "funnel". +% +% INPUT: +% SA = Absolute Salinity [ g/kg ] +% CT = Conservative Temperature (ITS-90) [ deg C ] +% p = sea pressure [ dbar ] +% ( i.e. absolute pressure - 10.1325 dbar ) +% +% SA & CT need to have the same dimensions. +% p may have dimensions 1x1 or Mx1 or 1xN or MxN, where SA & CT are MxN. +% +% OUTPUT: +% alpha_on_beta_CT = thermal expansion coefficient with respect to +% Conservative Temperature divided by the saline +% contraction coefficient at constant Conservative +% Temperature [ kg g^-1 K^-1 ] +% +% AUTHOR: +% Paul Barker and Trevor McDougall [ help@teos-10.org ] +% +% VERSION NUMBER: 3.03 (10th May, 2013) +% +% REFERENCES: +% IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of +% seawater - 2010: Calculation and use of thermodynamic properties. +% Intergovernmental Oceanographic Commission, Manuals and Guides No. 56, +% UNESCO (English), 196 pp. Available from http://www.TEOS-10.org +% See appendix A.20 and appendix K of this TEOS-10 Manual. +% +% The software is available from http://www.TEOS-10.org +% +%========================================================================== + +%-------------------------------------------------------------------------- +% Check variables and resize if necessary +%-------------------------------------------------------------------------- + +if ~(nargin == 3) + error('gsw_alpha_on_beta_CT: Requires three inputs') +end %if +if ~(nargout == 1) + error('gsw_alpha_on_beta_CT: Requires one outputs') +end %if + +[ms,ns] = size(SA); +[mt,nt] = size(CT); +[mp,np] = size(p); + +if (mt ~= ms | nt ~= ns) + error('gsw_alpha_on_beta_CT: SA and CT must have same dimensions') +end + +if (mp == 1) & (np == 1) % p scalar - fill to size of SA + p = p*ones(size(SA)); +elseif (ns == np) & (mp == 1) % p is row vector, + p = p(ones(1,ms), :); % copy down each column. +elseif (ms == mp) & (np == 1) % p is column vector, + p = p(:,ones(1,ns)); % copy across each row. +elseif (ns == mp) & (np == 1) % p is a transposed row vector, + p = p.'; % transposed then + p = p(ones(1,ms), :); % copy down each column. +elseif (ms == mp) & (ns == np) + % ok +else + error('gsw_alpha_on_beta_CT: Inputs array dimensions arguments do not agree') +end %if + +if ms == 1 + SA = SA.'; + CT = CT.'; + p = p.'; + transposed = 1; +else + transposed = 0; +end + +%-------------------------------------------------------------------------- +% Start of the calculation +%-------------------------------------------------------------------------- + +alpha_on_beta_CT = gsw_alpha_on_beta(SA,CT,p); + +if transposed + alpha_on_beta_CT = alpha_on_beta_CT.'; +end + +end diff --git a/Toolbox/gsw_alpha_on_beta_CT_exact.m b/Toolbox/gsw_alpha_on_beta_CT_exact.m new file mode 100644 index 0000000..7e97edd --- /dev/null +++ b/Toolbox/gsw_alpha_on_beta_CT_exact.m @@ -0,0 +1,107 @@ +function alpha_on_beta_CT_exact = gsw_alpha_on_beta_CT_exact(SA,CT,p) + +% gsw_alpha_on_beta_CT_exact alpha/beta +%========================================================================== +% +% USAGE: +% alpha_on_beta_CT_exact = gsw_alpha_on_beta_CT_exact(SA,CT,p) +% +% DESCRIPTION: +% Calculates alpha divided by beta, where alpha is the thermal expansion +% coefficient and beta is the saline contraction coefficient of seawater +% from Absolute Salinity and Conservative Temperature. +% +% Note that this function uses the full Gibbs function. There is an +% alternative to calling this function, namely gsw_alpha_on_beta(SA,CT,p), +% which uses the computationally efficient 48-term expression for density +% in terms of SA, CT and p (IOC et al., 2010). +% +% INPUT: +% SA = Absolute Salinity [ g/kg ] +% CT = Conservative Temperature (ITS-90) [ deg C ] +% p = sea pressure [ dbar ] +% ( i.e. absolute pressure - 10.1325 dbar ) +% +% SA & CT need to have the same dimensions. +% p may have dimensions 1x1 or Mx1 or 1xN or MxN, where SA & CT are MxN. +% +% OUTPUT: +% alpha_on_beta_CT_exact = thermal expansion coefficient with respect to +% Conservative Temperature divided by the +% saline contraction coefficient at constant +% Conservative Temperature [ kg g^-1 K^-1 ] +% +% AUTHOR: +% Paul Barker and Trevor McDougall [ help@teos-10.org ] +% +% VERSION NUMBER: 3.03 (13th May, 2013) +% +% REFERENCES: +% IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of +% seawater - 2010: Calculation and use of thermodynamic properties. +% Intergovernmental Oceanographic Commission, Manuals and Guides No. 56, +% UNESCO (English), 196 pp. Available from http://www.TEOS-10.org +% See appendix A.20 and appendix K of this TEOS-10 Manual. +% +% The software is available from http://www.TEOS-10.org +% +%========================================================================== + +%-------------------------------------------------------------------------- +% Check variables and resize if necessary +%-------------------------------------------------------------------------- + +if ~(nargin == 3) + error('gsw_alpha_on_beta_CT_exact: Requires three inputs') +end %if +if ~(nargout == 1) + error('gsw_alpha_on_beta_CT_exact: Requires one outputs') +end %if + +[ms,ns] = size(SA); +[mt,nt] = size(CT); +[mp,np] = size(p); + +if (mt ~= ms | nt ~= ns) + error('gsw_alpha_on_beta_CT_exact: SA and CT must have same dimensions') +end + +if (mp == 1) & (np == 1) % p scalar - fill to size of SA + p = p*ones(size(SA)); +elseif (ns == np) & (mp == 1) % p is row vector, + p = p(ones(1,ms), :); % copy down each column. +elseif (ms == mp) & (np == 1) % p is column vector, + p = p(:,ones(1,ns)); % copy across each row. +elseif (ns == mp) & (np == 1) % p is a transposed row vector, + p = p.'; % transposed then + p = p(ones(1,ms), :); % copy down each column. +elseif (ms == mp) & (ns == np) + % ok +else + error('gsw_alpha_on_beta_CT_exact: Inputs array dimensions arguments do not agree') +end %if + +if ms == 1 + SA = SA.'; + CT = CT.'; + p = p.'; + transposed = 1; +else + transposed = 0; +end + +%-------------------------------------------------------------------------- +% Start of the calculation +%-------------------------------------------------------------------------- + +% This line ensures that SA is non-negative. +SA(SA < 0) = 0; + +[dummy, alpha_CT_exact, beta_CT_exact] = gsw_rho_alpha_beta_CT_exact(SA,CT,p); +alpha_on_beta_CT_exact = alpha_CT_exact./beta_CT_exact; + +if transposed + alpha_on_beta_CT_exact = alpha_on_beta_CT_exact.'; +end + +end diff --git a/Toolbox/gsw_atomic_weight.m b/Toolbox/gsw_atomic_weight.m index fa22e08..d6f9c74 100644 --- a/Toolbox/gsw_atomic_weight.m +++ b/Toolbox/gsw_atomic_weight.m @@ -19,7 +19,7 @@ % AUTHOR: % Trevor McDougall and Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (13th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of diff --git a/Toolbox/gsw_beta.m b/Toolbox/gsw_beta.m index 43f5a2b..d5187b4 100644 --- a/Toolbox/gsw_beta.m +++ b/Toolbox/gsw_beta.m @@ -11,11 +11,11 @@ % Calculates the saline (i.e. haline) contraction coefficient of seawater % at constant Conservative Temperature using the computationally-efficient % 48-term expression for density in terms of SA, CT and p -% (McDougall et al., 2013). +% (McDougall et al., 2010). % % Note that the 48-term equation has been fitted in a restricted range of % parameter space, and is most accurate inside the "oceanographic funnel" -% described in McDougall et al. (2013). The GSW library function +% described in McDougall et al. (2010). The GSW library function % "gsw_infunnel(SA,CT,p)" is avaialble to be used if one wants to test if % some of one's data lies outside this "funnel". % @@ -35,7 +35,7 @@ % AUTHOR: % Paul Barker and Trevor McDougall [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (13th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2012) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of @@ -44,11 +44,6 @@ % UNESCO (English), 196 pp. Available from http://www.TEOS-10.org % See Eqn. (2.19.3) of this TEOS-10 manual. % -% McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2013: A -% computationally efficient 48-term expression for the density of -% seawater in terms of Conservative Temperature, and related properties -% of seawater. To be submitted to J. Atm. Ocean. Technol., xx, yyy-zzz. -% % The software is available from http://www.TEOS-10.org % %========================================================================== diff --git a/Toolbox/gsw_beta_CT.m b/Toolbox/gsw_beta_CT.m index 63901cc..41d00d1 100644 --- a/Toolbox/gsw_beta_CT.m +++ b/Toolbox/gsw_beta_CT.m @@ -17,11 +17,11 @@ % Calculates the saline (i.e. haline) contraction coefficient of seawater % at constant Conservative Temperature using the computationally-efficient % 48-term expression for density in terms of SA, CT and p -% (McDougall et al., 2013). +% (McDougall et al., 2010). % % Note that the 48-term equation has been fitted in a restricted range of % parameter space, and is most accurate inside the "oceanographic funnel" -% described in McDougall et al. (2013). The GSW library function +% described in McDougall et al. (2010). The GSW library function % "gsw_infunnel(SA,CT,p)" is avaialble to be used if one wants to test if % some of one's data lies outside this "funnel". % @@ -41,7 +41,7 @@ % AUTHOR: % Paul Barker and Trevor McDougall [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (13th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of @@ -50,11 +50,6 @@ % UNESCO (English), 196 pp. Available from http://www.TEOS-10.org % See Eqn. (2.19.3) of this TEOS-10 manual. % -% McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2013: A -% computationally efficient 48-term expression for the density of -% seawater in terms of Conservative Temperature, and related properties -% of seawater. To be submitted to J. Atm. Ocean. Technol., xx, yyy-zzz. -% % The software is available from http://www.TEOS-10.org % %========================================================================== diff --git a/Toolbox/gsw_beta_CT_exact.m b/Toolbox/gsw_beta_CT_exact.m index 2d1bc34..587bc40 100644 --- a/Toolbox/gsw_beta_CT_exact.m +++ b/Toolbox/gsw_beta_CT_exact.m @@ -12,9 +12,9 @@ % at constant Conservative Temperature. % % Note that this function uses the full Gibbs function. There is an -% alternative to calling this function, namely gsw_beta_const_CT(SA,CT,p) +% alternative to calling this function, namely gsw_beta(SA,CT,p) % which uses the computationally efficient 48-term expression for density -% in terms of SA, CT and p (McDougall et al., (2011)). +% in terms of SA, CT and p (McDougall et al., (2010)). % % INPUT: % SA = Absolute Salinity [ g/kg ] @@ -32,7 +32,7 @@ % AUTHOR: % Trevor McDougall and Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (13th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of @@ -41,11 +41,6 @@ % UNESCO (English), 196 pp. Available from http://www.TEOS-10.org % See Eqn. (2.19.3) of this TEOS-10 manual. % -% McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2011: A -% computationally efficient 48-term expression for the density of -% seawater in terms of Conservative Temperature, and related properties -% of seawater. To be submitted to Ocean Science Discussions. -% % The software is available from http://www.TEOS-10.org % %========================================================================== diff --git a/Toolbox/gsw_brineSA_CT.m b/Toolbox/gsw_brineSA_CT.m index 96f8b55..f1fc91f 100644 --- a/Toolbox/gsw_brineSA_CT.m +++ b/Toolbox/gsw_brineSA_CT.m @@ -36,7 +36,7 @@ % AUTHOR: % Trevor McDougall and Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (13th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of diff --git a/Toolbox/gsw_brineSA_t.m b/Toolbox/gsw_brineSA_t.m index bf8fcbc..37f4ca3 100644 --- a/Toolbox/gsw_brineSA_t.m +++ b/Toolbox/gsw_brineSA_t.m @@ -36,7 +36,7 @@ % AUTHOR: % Trevor McDougall and Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (13th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of diff --git a/Toolbox/gsw_cabbeling.m b/Toolbox/gsw_cabbeling.m index 1853dc8..f0577fb 100644 --- a/Toolbox/gsw_cabbeling.m +++ b/Toolbox/gsw_cabbeling.m @@ -11,11 +11,11 @@ % Calculates the cabbeling coefficient of seawater with respect to % Conservative Temperature. This function uses the computationally- % efficient 48-term expression for density in terms of SA, CT and p -% (McDougall et al., 2013) +% (IOC et al., 2010) % % Note that the 48-term equation has been fitted in a restricted range of % parameter space, and is most accurate inside the "oceanographic funnel" -% described in McDougall et al. (2013). The GSW library function +% described in IOC et al. (2010). The GSW library function % "gsw_infunnel(SA,CT,p)" is avaialble to be used if one wants to test if % some of one's data lies outside this "funnel". % @@ -33,9 +33,9 @@ % Conservative Temperature. % % AUTHOR: -% David Jackett, Trevor McDougall and Paul Barker [ help@teos-10.org ] +% Trevor McDougall and Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (15th November, 2012) +% VERSION NUMBER: 3.03 (5th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of @@ -44,11 +44,6 @@ % UNESCO (English), 196 pp. Available from http://www.TEOS-10.org % See Eqns. (3.9.2) and (P.4) of this TEOS-10 manual. % -% McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2013: A -% computationally efficient 48-term expression for the density of -% seawater in terms of Conservative Temperature, and related properties -% of seawater. To be submitted to J. Atm. Ocean. Technol., xx, yyy-zzz. -% % The software is available from http://www.TEOS-10.org % %========================================================================== @@ -97,62 +92,203 @@ % Start of the calculation %-------------------------------------------------------------------------- -dCT = 1e-3; % increment in Conservative Temperature is 1e-3 deg C. -CT_l = CT - dCT; -CT_u = CT + dCT; -[dummy,alpha,beta] = gsw_rho_alpha_beta(SA,CT,p); -alpha_u = gsw_alpha(SA,CT_u,p); -alpha_l = gsw_alpha(SA,CT_l,p); +v01 = 9.998420897506056e+2; +v02 = 2.839940833161907; +v03 = -3.147759265588511e-2; +v04 = 1.181805545074306e-3; +v05 = -6.698001071123802; +v06 = -2.986498947203215e-2; +v07 = 2.327859407479162e-4; +v08 = -3.988822378968490e-2; +v09 = 5.095422573880500e-4; +v10 = -1.426984671633621e-5; +v11 = 1.645039373682922e-7; +v12 = -2.233269627352527e-2; +v13 = -3.436090079851880e-4; +v14 = 3.726050720345733e-6; +v15 = -1.806789763745328e-4; +v16 = 6.876837219536232e-7; +v17 = -3.087032500374211e-7; +v18 = -1.988366587925593e-8; +v19 = -1.061519070296458e-11; +v20 = 1.550932729220080e-10; +v21 = 1.0; +v22 = 2.775927747785646e-3; +v23 = -2.349607444135925e-5; +v24 = 1.119513357486743e-6; +v25 = 6.743689325042773e-10; +v26 = -7.521448093615448e-3; +v27 = -2.764306979894411e-5; +v28 = 1.262937315098546e-7; +v29 = 9.527875081696435e-10; +v30 = -1.811147201949891e-11; +v31 = -3.303308871386421e-5; +v32 = 3.801564588876298e-7; +v33 = -7.672876869259043e-9; +v34 = -4.634182341116144e-11; +v35 = 2.681097235569143e-12; +v36 = 5.419326551148740e-6; +v37 = -2.742185394906099e-5; +v38 = -3.212746477974189e-7; +v39 = 3.191413910561627e-9; +v40 = -1.931012931541776e-12; +v41 = -1.105097577149576e-7; +v42 = 6.211426728363857e-10; +v43 = -1.119011592875110e-10; +v44 = -1.941660213148725e-11; +v45 = -1.864826425365600e-14; +v46 = 1.119522344879478e-14; +v47 = -1.200507748551599e-15; +v48 = 6.057902487546866e-17; -alpha_on_beta = alpha./beta; -alpha_CT = (alpha_u - alpha_l)./(CT_u - CT_l); +a01 = 2.839940833161907; +a02 = -6.295518531177023e-2; +a03 = 3.545416635222918e-3; +a04 = -2.986498947203215e-2; +a05 = 4.655718814958324e-4; +a06 = 5.095422573880500e-4; +a07 = -2.853969343267241e-5; +a08 = 4.935118121048767e-7; +a09 = -3.436090079851880e-4; +a10 = 7.452101440691467e-6; +a11 = 6.876837219536232e-7; +a12 = -1.988366587925593e-8; +a13 = -2.123038140592916e-11; -dSA = 1e-3; % increment in Absolute Salinity is 1e-3 g kg^-1 +a14 = 2.775927747785646e-3; +a15 = -4.699214888271850e-5; +a16 = 3.358540072460230e-6; +a17 = 2.697475730017109e-9; +a18 = -2.764306979894411e-5; +a19 = 2.525874630197091e-7; +a20 = 2.858362524508931e-9; +a21 = -7.244588807799565e-11; +a22 = 3.801564588876298e-7; +a23 = -1.534575373851809e-8; +a24 = -1.390254702334843e-10; +a25 = 1.072438894227657e-11; +a26 = -3.212746477974189e-7; +a27 = 6.382827821123254e-9; +a28 = -5.793038794625329e-12; +a29 = 6.211426728363857e-10; +a30 = -1.941660213148725e-11; +a31 = -3.729652850731201e-14; +a32 = 1.119522344879478e-14; +a33 = 6.057902487546866e-17; -SA_l = nan(size(SA)); -SA_l(SA >= dSA) = SA(SA >= dSA) - dSA; -SA_l(SA=dSA) = SA(SA>=dSA)-dSA; -% SA_l(SA=dSA) = SA(SA>=dSA)-dSA; +SA_l(SA= gsw_cv.SP_from_SK_ca); +if ~isempty(gsw_cf.ISP_from_SK) + fprintf(2,'gsw_SP_from_SK: Failed\n'); + gsw_cf.gsw_chks = 0; +end + %% Absolute Salinity (SA), Preformed Salinity (Sstar) and Conservative Temperature (CT) gsw_cf.SA_from_SP = gsw_SA_from_SP(gsw_cv.SP_chck_cast,gsw_cv.p_chck_cast,gsw_cv.long_chck_cast,gsw_cv.lat_chck_cast); @@ -286,6 +298,34 @@ gsw_cf.gsw_chks = 0; end +gsw_cf.entropy_from_t = gsw_entropy_from_t(gsw_cv.SA_chck_cast,gsw_cv.t_chck_cast,gsw_cv.p_chck_cast); +[gsw_cf.Ientropy_from_t] = find(abs(gsw_cv.entropy_from_t - gsw_cf.entropy_from_t) >= gsw_cv.entropy_from_t_ca); +if ~isempty(gsw_cf.Ientropy_from_t) + fprintf(2,'gsw_entropy_from_t: Failed\n'); + gsw_cf.gsw_chks = 0; +end + +gsw_cf.t_from_entropy = gsw_t_from_entropy(gsw_cv.SA_chck_cast,gsw_cf.entropy_from_t,gsw_cv.p_chck_cast); +[gsw_cf.It_from_entropy] = find(abs(gsw_cv.t_from_entropy - gsw_cf.t_from_entropy) >= gsw_cv.t_from_entropy_ca); +if ~isempty(gsw_cf.It_from_entropy) + fprintf(2,'gsw_t_from_entropy: Failed\n'); + gsw_cf.gsw_chks = 0; +end + +gsw_cf.adiabatic_lapse_rate_from_CT = gsw_adiabatic_lapse_rate_from_CT(gsw_cv.SA_chck_cast,gsw_cv.CT_chck_cast,gsw_cv.p_chck_cast); +[gsw_cf.Iadiabatic_lapse_rate_from_CT] = find(abs(gsw_cv.adiabatic_lapse_rate_from_CT - gsw_cf.adiabatic_lapse_rate_from_CT) >= gsw_cv.adiabatic_lapse_rate_from_CT_ca); +if ~isempty(gsw_cf.Iadiabatic_lapse_rate_from_CT) + fprintf(2,'gsw_adiabatic_lapse_rate_from_CT: Failed\n'); + gsw_cf.gsw_chks = 0; +end + +gsw_cf.adiabatic_lapse_rate_from_t = gsw_adiabatic_lapse_rate_from_t(gsw_cv.SA_chck_cast,gsw_cv.t_chck_cast,gsw_cv.p_chck_cast); +[gsw_cf.Iadiabatic_lapse_rate_from_t] = find(abs(gsw_cv.adiabatic_lapse_rate_from_t - gsw_cf.adiabatic_lapse_rate_from_t) >= gsw_cv.adiabatic_lapse_rate_from_t_ca); +if ~isempty(gsw_cf.Iadiabatic_lapse_rate_from_t) + fprintf(2,'gsw_adiabatic_lapse_rate_from_t: Failed\n'); + gsw_cf.gsw_chks = 0; +end + gsw_cf.molality_from_SA = gsw_molality_from_SA(gsw_cv.SA_chck_cast); [gsw_cf.Imolality_from_SA] = find(abs(gsw_cv.molality_from_SA - gsw_cf.molality_from_SA) >= gsw_cv.molality_from_SA_ca); if ~isempty(gsw_cf.Imolality_from_SA) @@ -335,6 +375,22 @@ gsw_cf.gsw_chks = 0; end +gsw_cf.alpha_on_beta = gsw_alpha_on_beta_CT(gsw_cv.SA_chck_cast,gsw_cv.CT_chck_cast,gsw_cv.p_chck_cast); +[gsw_cf.Ialpha_on_beta] = find(abs(gsw_cv.alpha_on_beta - gsw_cf.alpha_on_beta) >= gsw_cv.alpha_on_beta_ca); +if ~isempty(gsw_cf.Ialpha_on_beta) + fprintf(2,'gsw_alpha_on_beta_CT: Failed\n'); + gsw_cf.gsw_chks = 0; +end + +[gsw_cf.drho_dSA, gsw_cf.drho_dCT, gsw_cf.drho_dp] = gsw_rho_first_derivatives_CT(gsw_cv.SA_chck_cast,gsw_cv.CT_chck_cast,gsw_cv.p_chck_cast); +[gsw_cf.Irho_fd] = find(abs(gsw_cv.drho_dSA - gsw_cf.drho_dSA) >= gsw_cv.drho_dSA_ca | ... + abs(gsw_cv.drho_dCT - gsw_cf.drho_dCT) >= gsw_cv.drho_dCT_ca | ... + abs(gsw_cv.drho_dp - gsw_cf.drho_dp) >= gsw_cv.drho_dp_ca); +if ~isempty(gsw_cf.Irho_fd) + fprintf(2,'gsw_rho_first_derivatives_CT: Failed\n'); + gsw_cf.gsw_chks = 0; +end + gsw_cf.specvol = gsw_specvol_CT(gsw_cv.SA_chck_cast,gsw_cv.CT_chck_cast,gsw_cv.p_chck_cast); [gsw_cf.Ispecvol] = find(abs(gsw_cv.specvol - gsw_cf.specvol) >= gsw_cv.specvol_ca); if ~isempty(gsw_cf.Ispecvol) @@ -391,6 +447,48 @@ gsw_cf.gsw_chks = 0; end +gsw_cf.kappa = gsw_kappa_CT(gsw_cv.SA_chck_cast,gsw_cv.CT_chck_cast,gsw_cv.p_chck_cast); +[gsw_cf.Ikappa] = find(abs(gsw_cv.kappa - gsw_cf.kappa) >= gsw_cv.kappa_ca); +if ~isempty(gsw_cf.Ikappa) + fprintf(2,'gsw_kappa_CT: Failed\n'); + gsw_cf.gsw_chks = 0; +end + +gsw_cf.cabbeling = gsw_cabbeling_CT(gsw_cv.SA_chck_cast,gsw_cv.CT_chck_cast,gsw_cv.p_chck_cast); +[gsw_cf.Icabbeling] = find(abs(gsw_cv.cabbeling - gsw_cf.cabbeling) >= gsw_cv.cabbeling_ca); +if ~isempty(gsw_cf.Icabbeling) + fprintf(2,'gsw_cabbeling: Failed\n'); + gsw_cf.gsw_chks = 0; +end + +gsw_cf.thermobaric = gsw_thermobaric_CT(gsw_cv.SA_chck_cast,gsw_cv.CT_chck_cast,gsw_cv.p_chck_cast); +[gsw_cf.Ithermobaric] = find(abs(gsw_cv.thermobaric - gsw_cf.thermobaric) >= gsw_cv.thermobaric_ca); +if ~isempty(gsw_cf.Ithermobaric) + fprintf(2,'gsw_thermobaric: Failed\n'); + gsw_cf.gsw_chks = 0; +end + +gsw_cf.SA_from_rho = gsw_SA_from_rho_CT(gsw_cf.rho,gsw_cv.CT_chck_cast,gsw_cv.p_chck_cast); +[gsw_cf.ISA_from_rho] = find(abs(gsw_cv.SA_from_rho - gsw_cf.SA_from_rho) >= gsw_cv.SA_from_rho_ca); +if ~isempty(gsw_cf.ISA_from_rho) + fprintf(2,'gsw_SA_from_rho_CT: Failed\n'); + gsw_cf.gsw_chks = 0; +end + +gsw_cf.CT_from_rho = gsw_CT_from_rho(gsw_cf.rho,gsw_cv.SA_chck_cast,gsw_cv.p_chck_cast); +[gsw_cf.ICT_from_rho] = find(abs(gsw_cv.CT_from_rho - gsw_cf.CT_from_rho) >= gsw_cv.CT_from_rho_ca); +if ~isempty(gsw_cf.ICT_from_rho) + fprintf(2,'gsw_CT_from_rho: Failed\n'); + gsw_cf.gsw_chks = 0; +end + +gsw_cf.CT_maxdensity = gsw_CT_maxdensity(gsw_cv.SA_chck_cast,gsw_cv.p_chck_cast); +[gsw_cf.ICT_maxdensity] = find(abs(gsw_cv.CT_maxdensity - gsw_cf.CT_maxdensity) >= gsw_cv.CT_maxdensity_ca); +if ~isempty(gsw_cf.ICT_maxdensity) + fprintf(2,'gsw_CT_maxdensity: Failed\n'); + gsw_cf.gsw_chks = 0; +end + gsw_cf.internal_energy = gsw_internal_energy_CT(gsw_cv.SA_chck_cast,gsw_cv.CT_chck_cast,gsw_cv.p_chck_cast); [gsw_cf.Iinternal_energy] = find(abs(gsw_cv.internal_energy - gsw_cf.internal_energy) >= gsw_cv.internal_energy_ca); if ~isempty(gsw_cf.Iinternal_energy) @@ -419,24 +517,20 @@ gsw_cf.gsw_chks = 0; end -gsw_cf.SA_from_rho = gsw_SA_from_rho_CT(gsw_cf.rho,gsw_cv.CT_chck_cast,gsw_cv.p_chck_cast); -[gsw_cf.ISA_from_rho] = find(abs(gsw_cv.SA_from_rho - gsw_cf.SA_from_rho) >= gsw_cv.SA_from_rho_ca); -if ~isempty(gsw_cf.ISA_from_rho) - fprintf(2,'gsw_SA_from_rho_CT: Failed\n'); - gsw_cf.gsw_chks = 0; -end - -gsw_cf.CT_maxdensity = gsw_CT_maxdensity(gsw_cv.SA_chck_cast,gsw_cv.p_chck_cast); -[gsw_cf.ICT_maxdensity] = find(abs(gsw_cv.CT_maxdensity - gsw_cf.CT_maxdensity) >= gsw_cv.CT_maxdensity_ca); -if ~isempty(gsw_cf.ICT_maxdensity) - fprintf(2,'gsw_CT_maxdensity: Failed\n'); +[gsw_cf.h_SA, gsw_cf.h_CT] = gsw_enthalpy_first_derivatives_CT(gsw_cv.SA_chck_cast,gsw_cv.CT_chck_cast,gsw_cv.p_chck_cast); +[gsw_cf.Ienthalpy_first_deriv] = find(abs(gsw_cv.h_SA - gsw_cf.h_SA) >= gsw_cv.h_SA_ca | ... + abs(gsw_cv.h_CT - gsw_cf.h_CT) >= gsw_cv.h_CT_ca); +if ~isempty(gsw_cf.Ienthalpy_first_deriv) + fprintf(2,'gsw_enthalpy_first_derivatives: Failed\n'); gsw_cf.gsw_chks = 0; end -gsw_cf.CT_from_rho = gsw_CT_from_rho(gsw_cf.rho,gsw_cv.SA_chck_cast,gsw_cv.p_chck_cast); -[gsw_cf.ICT_from_rho] = find(abs(gsw_cv.CT_from_rho - gsw_cf.CT_from_rho) >= gsw_cv.CT_from_rho_ca); -if ~isempty(gsw_cf.ICT_from_rho) - fprintf(2,'gsw_CT_from_rho: Failed\n'); +[gsw_cf.h_SA_SA, gsw_cf.h_SA_CT, gsw_cf.h_CT_CT] = gsw_enthalpy_second_derivatives_CT(gsw_cv.SA_chck_cast,gsw_cv.CT_chck_cast,gsw_cv.p_chck_cast); +[gsw_cf.Ienthalpy_second_deriv] = find(abs(gsw_cv.h_SA_SA - gsw_cf.h_SA_SA) >= gsw_cv.h_SA_SA_ca | ... + abs(gsw_cv.h_SA_CT - gsw_cf.h_SA_CT) >= gsw_cv.h_SA_CT_ca | ... + abs(gsw_cv.h_CT_CT - gsw_cf.h_CT_CT) >= gsw_cv.h_CT_CT_ca); +if ~isempty(gsw_cf.Ienthalpy_second_deriv) + fprintf(2,'gsw_enthalpy_second_derivatives: Failed\n'); gsw_cf.gsw_chks = 0; end @@ -469,21 +563,7 @@ fprintf(1,'.'); end -%% neutral and non-linear properties, based on the 48-term expression for density - -gsw_cf.cabbeling = gsw_cabbeling(gsw_cv.SA_chck_cast,gsw_cv.CT_chck_cast,gsw_cv.p_chck_cast); -[gsw_cf.Icabbeling] = find(abs(gsw_cv.cabbeling - gsw_cf.cabbeling) >= gsw_cv.cabbeling_ca); -if ~isempty(gsw_cf.Icabbeling) - fprintf(2,'gsw_cabbeling: Failed\n'); - gsw_cf.gsw_chks = 0; -end - -gsw_cf.thermobaric = gsw_thermobaric(gsw_cv.SA_chck_cast,gsw_cv.CT_chck_cast,gsw_cv.p_chck_cast); -[gsw_cf.Ithermobaric] = find(abs(gsw_cv.thermobaric - gsw_cf.thermobaric) >= gsw_cv.thermobaric_ca); -if ~isempty(gsw_cf.Ithermobaric) - fprintf(2,'gsw_thermobaric: Failed\n'); - gsw_cf.gsw_chks = 0; -end +%% neutral properties, based on the 48-term expression for density if gsw_cf.gsw_chks == 1 ; fprintf(1,'.'); @@ -587,29 +667,11 @@ gsw_cf.gsw_chks = 0; end -[gsw_cf.h_SA, gsw_cf.h_CT, gsw_cf.h_P] = gsw_enthalpy_first_derivatives(gsw_cv.SA_chck_cast,gsw_cv.CT_chck_cast,gsw_cv.p_chck_cast); -[gsw_cf.Ienthalpy_first_deriv] = find(abs(gsw_cv.h_SA - gsw_cf.h_SA) >= gsw_cv.h_SA_ca | ... - abs(gsw_cv.h_CT - gsw_cf.h_CT) >= gsw_cv.h_CT_ca | ... - abs(gsw_cv.h_P - gsw_cf.h_P) >= gsw_cv.h_P_ca); -if ~isempty(gsw_cf.Ienthalpy_first_deriv) - fprintf(2,'gsw_enthalpy_first_derivatives: Failed\n'); - gsw_cf.gsw_chks = 0; -end - -[gsw_cf.h_SA_SA, gsw_cf.h_SA_CT, gsw_cf.h_CT_CT] = gsw_enthalpy_second_derivatives(gsw_cv.SA_chck_cast,gsw_cv.CT_chck_cast,gsw_cv.p_chck_cast); -[gsw_cf.Ienthalpy_second_deriv] = find(abs(gsw_cv.h_SA_SA - gsw_cf.h_SA_SA) >= gsw_cv.h_SA_SA_ca | ... - abs(gsw_cv.h_SA_CT - gsw_cf.h_SA_CT) >= gsw_cv.h_SA_CT_ca | ... - abs(gsw_cv.h_CT_CT - gsw_cf.h_CT_CT) >= gsw_cv.h_CT_CT_ca); -if ~isempty(gsw_cf.Ienthalpy_second_deriv) - fprintf(2,'gsw_enthalpy_second_derivatives: Failed\n'); - gsw_cf.gsw_chks = 0; -end - [gsw_cf.eta_SA, gsw_cf.eta_CT] = gsw_entropy_first_derivatives(gsw_cv.SA_chck_cast,gsw_cv.CT_chck_cast); [gsw_cf.Ientropy_first_deriv] = find(abs(gsw_cv.eta_SA - gsw_cf.eta_SA) >= gsw_cv.eta_SA_ca | ... abs(gsw_cv.eta_CT - gsw_cf.eta_CT) >= gsw_cv.eta_CT_ca); if ~isempty(gsw_cf.Ientropy_first_deriv) - fprintf(2,'gsw_enthalpy_first_derivatives: Failed\n'); + fprintf(2,'gsw_entropy_first_derivatives: Failed\n'); gsw_cf.gsw_chks = 0; end @@ -673,7 +735,6 @@ gsw_cf.gsw_chks = 0; end - %% isobaric melting enthalpy and isobaric gsw_cf.latentheat_melting = gsw_latentheat_melting(gsw_cv.SA_chck_cast,gsw_cv.p_chck_cast); @@ -729,7 +790,6 @@ gsw_cf.gsw_chks = 0; end - %% TEOS-10 constants gsw_cf.T0 = gsw_T0; @@ -827,6 +887,22 @@ gsw_chks = 0; end +gsw_cf.alpha_on_beta_CT_exact = gsw_alpha_on_beta_CT_exact(gsw_cv.SA_chck_cast,gsw_cv.CT_chck_cast,gsw_cv.p_chck_cast); +[gsw_cf.Ialpha_on_beta_CT_exact] = find(abs(gsw_cv.alpha_on_beta_CT_exact - gsw_cf.alpha_on_beta_CT_exact) >= gsw_cv.alpha_on_beta_CT_exact_ca); +if ~isempty(gsw_cf.Ialpha_on_beta_CT_exact) + fprintf(2,'gsw_alpha_on_beta_CT_exact: Failed\n'); + gsw_cf.gsw_chks = 0; +end + +[gsw_cf.drho_dSA_CT_exact, gsw_cf.drho_dCT_CT_exact, gsw_cf.drho_dp_CT_exact] = gsw_rho_first_derivatives_CT_exact(gsw_cv.SA_chck_cast,gsw_cv.CT_chck_cast,gsw_cv.p_chck_cast); +[gsw_cf.Irho_fd_CT_exact] = find(abs(gsw_cv.drho_dSA_CT_exact - gsw_cf.drho_dSA_CT_exact) >= gsw_cv.drho_dSA_CT_exact_ca | ... + abs(gsw_cv.drho_dCT_CT_exact - gsw_cf.drho_dCT_CT_exact) >= gsw_cv.drho_dCT_CT_exact_ca | ... + abs(gsw_cv.drho_dp_CT_exact - gsw_cf.drho_dp_CT_exact) >= gsw_cv.drho_dp_CT_exact_ca); +if ~isempty(gsw_cf.Irho_fd_CT_exact) + fprintf(2,'gsw_rho_first_derivatives_CT_exact: Failed\n'); + gsw_cf.gsw_chks = 0; +end + gsw_cf.specvol_CT_exact = gsw_specvol_CT_exact(gsw_cv.SA_chck_cast,gsw_cv.CT_chck_cast,gsw_cv.p_chck_cast); [gsw_cf.Ispecvol_CT_exact] = find(abs(gsw_cv.specvol_CT_exact - gsw_cf.specvol_CT_exact) >= gsw_cv.specvol_CT_exact_ca); if ~isempty(gsw_cf.Ispecvol_CT_exact) @@ -883,6 +959,48 @@ gsw_cf.gsw_chks = 0; end +gsw_cf.kappa_CT_exact = gsw_kappa_CT_exact(gsw_cv.SA_chck_cast,gsw_cv.CT_chck_cast,gsw_cv.p_chck_cast); +[gsw_cf.Ikappa_CT_exact] = find(abs(gsw_cv.kappa_CT_exact - gsw_cf.kappa_CT_exact) >= gsw_cv.kappa_CT_exact_ca); +if ~isempty(gsw_cf.Ikappa_CT_exact) + fprintf(2,'gsw_kappa_CT_exact: Failed\n'); + gsw_cf.gsw_chks = 0; +end + +gsw_cf.cabbeling_CT_exact = gsw_cabbeling_CT_exact(gsw_cv.SA_chck_cast,gsw_cv.CT_chck_cast,gsw_cv.p_chck_cast); +[gsw_cf.Icabbeling_CT_exact] = find(abs(gsw_cv.cabbeling_CT_exact - gsw_cf.cabbeling_CT_exact) >= gsw_cv.cabbeling_CT_exact_ca); +if ~isempty(gsw_cf.Icabbeling_CT_exact) + fprintf(2,'gsw_cabbeling_CT_exact: Failed\n'); + gsw_cf.gsw_chks = 0; +end + +gsw_cf.thermobaric_CT_exact = gsw_thermobaric_CT_exact(gsw_cv.SA_chck_cast,gsw_cv.CT_chck_cast,gsw_cv.p_chck_cast); +[gsw_cf.Ithermobaric_CT_exact] = find(abs(gsw_cv.thermobaric_CT_exact - gsw_cf.thermobaric_CT_exact) >= gsw_cv.thermobaric_CT_exact_ca); +if ~isempty(gsw_cf.Ithermobaric_CT_exact) + fprintf(2,'gsw_thermobaric_CT_exact: Failed\n'); + gsw_cf.gsw_chks = 0; +end + +gsw_cf.SA_from_rho_CT_exact = gsw_SA_from_rho_CT_exact(gsw_cf.rho_CT_exact,gsw_cv.CT_chck_cast,gsw_cv.p_chck_cast); +[gsw_cf.ISA_from_rho_CT_exact] = find(abs(gsw_cv.SA_from_rho_CT_exact - gsw_cf.SA_from_rho_CT_exact) >= gsw_cv.SA_from_rho_CT_exact_ca); +if ~isempty(gsw_cf.ISA_from_rho_CT_exact) + fprintf(2,'gsw_SA_from_rho_CT_exact: Failed\n'); + gsw_cf.gsw_chks = 0; +end + +gsw_cf.CT_from_rho_exact = gsw_CT_from_rho_exact(gsw_cf.rho_CT_exact,gsw_cv.SA_chck_cast,gsw_cv.p_chck_cast); +[gsw_cf.ICT_from_rho_exact] = find(abs(gsw_cv.CT_from_rho_exact - gsw_cf.CT_from_rho_exact) >= gsw_cv.CT_from_rho_exact_ca); +if ~isempty(gsw_cf.ICT_from_rho_exact) + fprintf(2,'gsw_CT_from_rho_exact: Failed\n'); + gsw_cf.gsw_chks = 0; +end + +gsw_cf.CT_maxdensity_exact = gsw_CT_maxdensity_exact(gsw_cv.SA_chck_cast,gsw_cv.p_chck_cast); +[gsw_cf.ICT_maxdensity_exact] = find(abs(gsw_cv.CT_maxdensity_exact - gsw_cf.CT_maxdensity_exact) >= gsw_cv.CT_maxdensity_exact_ca); +if ~isempty(gsw_cf.ICT_maxdensity_exact) + fprintf(2,'gsw_CT_maxdensity_exact: Failed\n'); + gsw_cf.gsw_chks = 0; +end + gsw_cf.internal_energy_CT_exact = gsw_internal_energy_CT_exact(gsw_cv.SA_chck_cast,gsw_cv.CT_chck_cast,gsw_cv.p_chck_cast); [gsw_cf.Iinternal_energy_CT_exact] = find(abs(gsw_cv.internal_energy_CT_exact - gsw_cf.internal_energy_CT_exact) >= gsw_cv.internal_energy_CT_exact_ca); if ~isempty(gsw_cf.Iinternal_energy_CT_exact) @@ -911,28 +1029,24 @@ gsw_cf.gsw_chks = 0; end -gsw_cf.SA_from_rho_CT_exact = gsw_SA_from_rho_CT_exact(gsw_cf.rho_CT_exact,gsw_cv.CT_chck_cast,gsw_cv.p_chck_cast); -[gsw_cf.ISA_from_rho_CT_exact] = find(abs(gsw_cv.SA_from_rho_CT_exact - gsw_cf.SA_from_rho_CT_exact) >= gsw_cv.SA_from_rho_CT_exact_ca); -if ~isempty(gsw_cf.ISA_from_rho_CT_exact) - fprintf(2,'gsw_SA_from_rho_CT_exact: Failed\n'); - gsw_cf.gsw_chks = 0; -end - -gsw_cf.CT_from_rho_exact = gsw_CT_from_rho_exact(gsw_cf.rho_CT_exact,gsw_cv.SA_chck_cast,gsw_cv.p_chck_cast); -[gsw_cf.ICT_from_rho_exact] = find(abs(gsw_cv.CT_from_rho_exact - gsw_cf.CT_from_rho_exact) >= gsw_cv.CT_from_rho_exact_ca); -if ~isempty(gsw_cf.ICT_from_rho_exact) - fprintf(2,'gsw_CT_from_rho_exact: Failed\n'); +[gsw_cf.h_SA_CT_exact, gsw_cf.h_CT_CT_exact] = gsw_enthalpy_first_derivatives_CT_exact(gsw_cv.SA_chck_cast,gsw_cv.CT_chck_cast,gsw_cv.p_chck_cast); +[gsw_cf.Ienthalpy_first_deriv_CT_exact] = find(abs(gsw_cv.h_SA_CT_exact - gsw_cf.h_SA_CT_exact) >= gsw_cv.h_SA_CT_exact_ca | ... + abs(gsw_cv.h_CT_CT_exact - gsw_cf.h_CT_CT_exact) >= gsw_cv.h_CT_CT_exact_ca); +if ~isempty(gsw_cf.Ienthalpy_first_deriv_CT_exact) + fprintf(2,'gsw_enthalpy_first_derivatives_CT_exact: Failed\n'); gsw_cf.gsw_chks = 0; end -gsw_cf.CT_maxdensity_exact = gsw_CT_maxdensity_exact(gsw_cv.SA_chck_cast,gsw_cv.p_chck_cast); -[gsw_cf.ICT_maxdensity_exact] = find(abs(gsw_cv.CT_maxdensity_exact - gsw_cf.CT_maxdensity_exact) >= gsw_cv.CT_maxdensity_exact_ca); -if ~isempty(gsw_cf.ICT_maxdensity_exact) - fprintf(2,'gsw_CT_maxdensity_exact: Failed\n'); +[gsw_cf.h_SA_SA_CT_exact, gsw_cf.h_SA_CT_CT_exact, gsw_cf.h_CT_CT_CT_exact] = gsw_enthalpy_second_derivatives_CT_exact(gsw_cv.SA_chck_cast,gsw_cv.CT_chck_cast,gsw_cv.p_chck_cast); +[gsw_cf.Ienthalpy_second_deriv_CT_exact] = find(abs(gsw_cv.h_SA_SA_CT_exact - gsw_cf.h_SA_SA_CT_exact) >= gsw_cv.h_SA_SA_CT_exact_ca | ... + abs(gsw_cv.h_SA_CT_CT_exact - gsw_cf.h_SA_CT_CT_exact) >= gsw_cv.h_SA_CT_CT_exact_ca | ... + abs(gsw_cv.h_CT_CT_CT_exact - gsw_cf.h_CT_CT_CT_exact) >= gsw_cv.h_CT_CT_CT_exact_ca); +if ~isempty(gsw_cf.Ienthalpy_second_deriv_CT_exact) + fprintf(2,'gsw_enthalpy_second_derivatives_CT_exact: Failed\n'); gsw_cf.gsw_chks = 0; end -%% basic thermodynamic properties interms of in-situ t, derived from the exact Gibbs function +%% Labrortory functions gsw_cf.rho_t_exact = gsw_rho_t_exact(gsw_cv.SA_chck_cast,gsw_cv.t_chck_cast,gsw_cv.p_chck_cast); [gsw_cf.Irho_t_exact] = find(abs(gsw_cv.rho_t_exact - gsw_cf.rho_t_exact) >= gsw_cv.rho_t_exact_ca); @@ -941,6 +1055,30 @@ gsw_cf.gsw_chks = 0; end +gsw_cf.SA_from_rho_t_exact = gsw_SA_from_rho_t_exact(gsw_cf.rho_t_exact,gsw_cv.t_chck_cast,gsw_cv.p_chck_cast); +[gsw_cf.ISA_from_rho_t_exact] = find(abs(gsw_cv.SA_from_rho_t_exact - gsw_cf.SA_from_rho_t_exact) >= gsw_cv.SA_from_rho_t_exact_ca); +if ~isempty(gsw_cf.ISA_from_rho_t_exact) + fprintf(2,'gsw_SA_from_rho_t_exact: Failed\n'); + gsw_cf.gsw_chks = 0; +end + +gsw_cf.deltaSA_from_rho_t_exact = gsw_deltaSA_from_rho_t_exact(gsw_cf.rho_t_exact,gsw_cv.SP_chck_cast,gsw_cv.t_chck_cast,gsw_cv.p_chck_cast); +[gsw_cf.IdeltaSA_from_rho_t_exact] = find(abs(gsw_cv.deltaSA_from_rho_t_exact - gsw_cf.deltaSA_from_rho_t_exact) >= gsw_cv.deltaSA_from_rho_t_exact_ca); +if ~isempty(gsw_cf.IdeltaSA_from_rho_t_exact) + fprintf(2,'gsw_deltaSA_from_rho_t_exact: Failed\n'); + gsw_cf.gsw_chks = 0; +end + + +%% basic thermodynamic properties interms of in-situ t, derived from the exact Gibbs function + +% gsw_cf.rho_t_exact = gsw_rho_t_exact(gsw_cv.SA_chck_cast,gsw_cv.t_chck_cast,gsw_cv.p_chck_cast); +% [gsw_cf.Irho_t_exact] = find(abs(gsw_cv.rho_t_exact - gsw_cf.rho_t_exact) >= gsw_cv.rho_t_exact_ca); +% if ~isempty(gsw_cf.Irho_t_exact) +% fprintf(2,'gsw_rho_t_exact: Failed\n'); +% gsw_cf.gsw_chks = 0; +% end + gsw_cf.pot_rho_t_exact = gsw_pot_rho_t_exact(gsw_cv.SA_chck_cast,gsw_cv.t_chck_cast,gsw_cv.p_chck_cast,gsw_cv.pr); [gsw_cf.Ipot_rho_t_exact] = find(abs(gsw_cv.pot_rho_t_exact - gsw_cf.pot_rho_t_exact) >= gsw_cv.pot_rho_t_exact_ca); if ~isempty(gsw_cf.Ipot_rho_t_exact) @@ -1015,7 +1153,6 @@ fprintf(1,'.'); end - gsw_cf.sound_speed_t_exact = gsw_sound_speed_t_exact(gsw_cv.SA_chck_cast,gsw_cv.t_chck_cast,gsw_cv.p_chck_cast); [gsw_cf.Isound_speed_t_exact] = find(abs(gsw_cv.sound_speed_t_exact - gsw_cf.sound_speed_t_exact) >= gsw_cv.sound_speed_t_exact_ca); if ~isempty(gsw_cf.Isound_speed_t_exact) @@ -1058,12 +1195,12 @@ gsw_chks = 0; end -gsw_cf.SA_from_rho_t_exact = gsw_SA_from_rho_t_exact(gsw_cf.rho_t_exact,gsw_cv.t_chck_cast,gsw_cv.p_chck_cast); -[gsw_cf.ISA_from_rho_t_exact] = find(abs(gsw_cv.SA_from_rho_t_exact - gsw_cf.SA_from_rho_t_exact) >= gsw_cv.SA_from_rho_t_exact_ca); -if ~isempty(gsw_cf.ISA_from_rho_t_exact) - fprintf(2,'gsw_SA_from_rho_t_exact: Failed\n'); - gsw_cf.gsw_chks = 0; -end +% gsw_cf.SA_from_rho_t_exact = gsw_SA_from_rho_t_exact(gsw_cf.rho_t_exact,gsw_cv.t_chck_cast,gsw_cv.p_chck_cast); +% [gsw_cf.ISA_from_rho_t_exact] = find(abs(gsw_cv.SA_from_rho_t_exact - gsw_cf.SA_from_rho_t_exact) >= gsw_cv.SA_from_rho_t_exact_ca); +% if ~isempty(gsw_cf.ISA_from_rho_t_exact) +% fprintf(2,'gsw_SA_from_rho_t_exact: Failed\n'); +% gsw_cf.gsw_chks = 0; +% end gsw_cf.t_from_rho_exact = gsw_t_from_rho_exact(gsw_cf.rho_t_exact,gsw_cv.SA_chck_cast,gsw_cv.p_chck_cast); [gsw_cf.It_from_rho_exact] = find(abs(gsw_cv.t_from_rho_exact - gsw_cf.t_from_rho_exact) >= gsw_cv.t_from_rho_exact_ca); @@ -1079,13 +1216,6 @@ gsw_cf.gsw_chks = 0; end -gsw_cf.entropy_t_exact = gsw_entropy_t_exact(gsw_cv.SA_chck_cast,gsw_cv.t_chck_cast,gsw_cv.p_chck_cast); -[gsw_cf.Ientropy_t_exact] = find(abs(gsw_cv.entropy_t_exact - gsw_cf.entropy_t_exact) >= gsw_cv.entropy_t_exact_ca); -if ~isempty(gsw_cf.Ientropy_t_exact) - fprintf(2,'gsw_entropy_t_exact: Failed\n'); - gsw_cf.gsw_chks = 0; -end - gsw_cf.cp_t_exact = gsw_cp_t_exact(gsw_cv.SA_chck_cast,gsw_cv.t_chck_cast,gsw_cv.p_chck_cast); [gsw_cf.Icp_t_exact] = find(abs(gsw_cv.cp_t_exact - gsw_cf.cp_t_exact) >= gsw_cv.cp_t_exact_ca); if ~isempty(gsw_cf.Icp_t_exact) @@ -1100,9 +1230,9 @@ gsw_chks = 0; end -gsw_cf.chem_potential_t_exact = gsw_chem_potential_relative_t_exact(gsw_cv.SA_chck_cast,gsw_cv.t_chck_cast,gsw_cv.p_chck_cast); -[gsw_cf.Ichem_potential_t_exact] = find(abs(gsw_cv.chem_potential_t_exact - gsw_cf.chem_potential_t_exact) >= gsw_cv.chem_potential_t_exact_ca); -if ~isempty(gsw_cf.Ichem_potential_t_exact) +gsw_cf.chem_potential_relative_t_exact = gsw_chem_potential_relative_t_exact(gsw_cv.SA_chck_cast,gsw_cv.t_chck_cast,gsw_cv.p_chck_cast); +[gsw_cf.Ichem_potential_relative_t_exact] = find(abs(gsw_cv.chem_potential_relative_t_exact - gsw_cf.chem_potential_relative_t_exact) >= gsw_cv.chem_potential_relative_t_exact_ca); +if ~isempty(gsw_cf.Ichem_potential_relative_t_exact) fprintf(2,'gsw_chem_potential_relative_t_exact: Failed\n'); gsw_chks = 0; end @@ -1132,13 +1262,6 @@ gsw_cf.gsw_chks = 0; end -gsw_cf.adiabatic_lapse_rate_t_exact = gsw_adiabatic_lapse_rate_t_exact(gsw_cv.SA_chck_cast,gsw_cv.t_chck_cast,gsw_cv.p_chck_cast); -[gsw_cf.Iadiabatic_lapse_rate_t_exact] = find(abs(gsw_cv.adiabatic_lapse_rate_t_exact - gsw_cf.adiabatic_lapse_rate_t_exact) >= gsw_cv.adiabatic_lapse_rate_t_exact_ca); -if ~isempty(gsw_cf.Iadiabatic_lapse_rate_t_exact) - fprintf(2,'gsw_adiabatic_lapse_rate_t_exact: Failed\n'); - gsw_cf.gsw_chks = 0; -end - gsw_cf.osmotic_coefficient_t_exact = gsw_osmotic_coefficient_t_exact(gsw_cv.SA_chck_cast,gsw_cv.t_chck_cast,gsw_cv.p_chck_cast); [gsw_cf.Iosmotic_coefficient_t_exact] = find(abs(gsw_cv.osmotic_coefficient_t_exact - gsw_cf.osmotic_coefficient_t_exact) >= gsw_cv.osmotic_coefficient_t_exact_ca); if ~isempty(gsw_cf.Iosmotic_coefficient_t_exact) @@ -1158,9 +1281,9 @@ end % library -gsw_cf.fdelta = gsw_Fdelta(gsw_cv.p_chck_cast,gsw_cv.long_chck_cast,gsw_cv.lat_chck_cast); -[gsw_cf.Ifdelta] = find(abs(gsw_cv.fdelta - gsw_cf.fdelta) >= gsw_cv.fdelta_ca); -if ~isempty(gsw_cf.Ifdelta) +gsw_cf.Fdelta = gsw_Fdelta(gsw_cv.p_chck_cast,gsw_cv.long_chck_cast,gsw_cv.lat_chck_cast); +[gsw_cf.IFdelta] = find(abs(gsw_cv.Fdelta - gsw_cf.Fdelta) >= gsw_cv.Fdelta_ca); +if ~isempty(gsw_cf.IFdelta) fprintf(2,'gsw_Fdelta: Failed. \n'); gsw_cf.gsw_chks = 0; end @@ -1170,10 +1293,10 @@ gsw_cf.lat_chck_cast_temp(I,:) = gsw_cv.lat_chck_cast(1,:); end [I] = find(~isnan(gsw_cv.p_chck_cast)); -gsw_cf.delta_sa_ref = nan(45,3); -gsw_cf.delta_sa_ref(I) = gsw_deltaSA_atlas(gsw_cv.p_chck_cast(I),gsw_cf.long_chck_cast_temp(I),gsw_cf.lat_chck_cast_temp(I)); -[gsw_cf.Idelta_sa_ref] = find(abs(gsw_cv.delta_sa_ref - gsw_cf.delta_sa_ref) >= gsw_cv.delta_sa_ref_ca); -if ~isempty(gsw_cf.Idelta_sa_ref) +gsw_cf.deltaSA_atlas = nan(45,3); +gsw_cf.deltaSA_atlas(I) = gsw_deltaSA_atlas(gsw_cv.p_chck_cast(I),gsw_cf.long_chck_cast_temp(I),gsw_cf.lat_chck_cast_temp(I)); +[gsw_cf.IdeltaSA_atlas] = find(abs(gsw_cv.deltaSA_atlas - gsw_cf.deltaSA_atlas) >= gsw_cv.deltaSA_atlas_ca); +if ~isempty(gsw_cf.IdeltaSA_atlas) fprintf(2,'gsw_deltaSA_atlas: Failed. \n'); gsw_cf.gsw_chks = 0; end diff --git a/Toolbox/gsw_cp0.m b/Toolbox/gsw_cp0.m index b335b54..a0f5919 100644 --- a/Toolbox/gsw_cp0.m +++ b/Toolbox/gsw_cp0.m @@ -17,7 +17,7 @@ % AUTHOR: % Trevor McDougall and Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (13th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of diff --git a/Toolbox/gsw_deltaSA_from_SP.m b/Toolbox/gsw_deltaSA_from_SP.m index 2b530cd..61c34ca 100644 --- a/Toolbox/gsw_deltaSA_from_SP.m +++ b/Toolbox/gsw_deltaSA_from_SP.m @@ -29,7 +29,7 @@ % AUTHOR: % Trevor McDougall & Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (7th January, 2013) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of diff --git a/Toolbox/gsw_depth_from_z.m b/Toolbox/gsw_depth_from_z.m index b90c51b..6f160fe 100644 --- a/Toolbox/gsw_depth_from_z.m +++ b/Toolbox/gsw_depth_from_z.m @@ -19,7 +19,7 @@ % AUTHOR: % Winston [ god@teos-10.org ] % -% VERSION NUMBER: 3.02 (15th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % This software is available from http://www.TEOS-10.org % diff --git a/Toolbox/gsw_distance.m b/Toolbox/gsw_distance.m index 024a8b4..28eb02e 100644 --- a/Toolbox/gsw_distance.m +++ b/Toolbox/gsw_distance.m @@ -43,7 +43,7 @@ % MODIFIED: % 4th April, 2011 by Paul Barker and Trevor McDougall. % -% VERSION NUMBER: 3.02 (15th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCE: % http://www.eos.ubc.ca/~rich/map.html diff --git a/Toolbox/gsw_dynamic_enthalpy.m b/Toolbox/gsw_dynamic_enthalpy.m index 10935b6..57d372f 100644 --- a/Toolbox/gsw_dynamic_enthalpy.m +++ b/Toolbox/gsw_dynamic_enthalpy.m @@ -10,12 +10,12 @@ % DESCRIPTION: % Calculates dynamic enthalpy of seawater using the computationally- % efficient 48-term expression for density in terms of SA, CT and p -% (McDougall et al., 2011). Dynamic enthalpy is defined as enthalpy minus +% (IOC et al., 2010). Dynamic enthalpy is defined as enthalpy minus % potential enthalpy (Young, 2010). % % Note that the 48-term equation has been fitted in a restricted range of % parameter space, and is most accurate inside the "oceanographic funnel" -% described in McDougall et al. (2013). The GSW library function +% described in IOC et al. (2010). The GSW library function % "gsw_infunnel(SA,CT,p)" is avaialble to be used if one wants to test if % some of one's data lies outside this "funnel". % @@ -34,7 +34,7 @@ % AUTHOR: % Trevor McDougall and Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (15th November, 2012) +% VERSION NUMBER: 3.03 (12th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of @@ -43,10 +43,10 @@ % UNESCO (English), 196 pp. Available from http://www.TEOS-10.org % See section 3.2 of this TEOS-10 Manual. % -% McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2013: A -% computationally efficient 48-term expression for the density of -% seawater in terms of Conservative Temperature, and related properties -% of seawater. To be submitted to J. Atm. Ocean. Technol., xx, yyy-zzz. +% McDougall, T. J., 2003: Potential enthalpy: A conservative oceanic +% variable for evaluating heat content and heat fluxes. Journal of +% Physical Oceanography, 33, 945-963. +% See Eqns. (18) and (22) % % Young, W.R., 2010: Dynamic enthalpy, Conservative Temperature, and the % seawater Boussinesq approximation. Journal of Physical Oceanography, @@ -190,16 +190,6 @@ + (M./(2*b2)).*log(1 + p.*(2*b1 + b2.*p)./b0) ... + part.*log(1 + (b2.*p.*(B - A))./(A.*(B + b2.*p)))); -%-------------------------------------------------------------------------- -% This function calculates dynamic_enthalpy using the computationally- -% efficient 48-term expression for density in terms of SA, CT and p. If -% one wanted to compute dynamic_enthalpy from SA, CT, and p with the full -% TEOS-10 Gibbs function, the following lines of code will enable this. -% -% dynamic_enthalpy = gsw_dynamic_enthalpy_CT_exact(SA,CT,p) -% -%-----------------This is the end of the alternative code------------------ - if transposed dynamic_enthalpy = dynamic_enthalpy.'; end diff --git a/Toolbox/gsw_dynamic_enthalpy_CT.m b/Toolbox/gsw_dynamic_enthalpy_CT.m index 3f00436..9cc9218 100644 --- a/Toolbox/gsw_dynamic_enthalpy_CT.m +++ b/Toolbox/gsw_dynamic_enthalpy_CT.m @@ -16,12 +16,12 @@ % DESCRIPTION: % Calculates dynamic enthalpy of seawater using the computationally- % efficient 48-term expression for density in terms of SA, CT and p -% (McDougall et al., 2013). Dynamic enthalpy is defined as enthalpy minus +% (IOC et al., 2010). Dynamic enthalpy is defined as enthalpy minus % potential enthalpy (Young, 2010). % % Note that the 48-term equation has been fitted in a restricted range of % parameter space, and is most accurate inside the "oceanographic funnel" -% described in McDougall et al. (2013). The GSW library function +% described in IOC et al. (2010). The GSW library function % "gsw_infunnel(SA,CT,p)" is avaialble to be used if one wants to test if % some of one's data lies outside this "funnel". % @@ -40,7 +40,7 @@ % AUTHOR: % Trevor McDougall and Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (15th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of @@ -49,10 +49,10 @@ % UNESCO (English), 196 pp. Available from http://www.TEOS-10.org % See section 3.2 of this TEOS-10 Manual. % -% McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2013: A -% computationally efficient 48-term expression for the density of -% seawater in terms of Conservative Temperature, and related properties -% of seawater. To be submitted to J. Atm. Ocean. Technol., xx, yyy-zzz. +% McDougall, T. J., 2003: Potential enthalpy: A conservative oceanic +% variable for evaluating heat content and heat fluxes. Journal of +% Physical Oceanography, 33, 945-963. +% See Eqns. (18) and (22) % % Young, W.R., 2010: Dynamic enthalpy, Conservative Temperature, and the % seawater Boussinesq approximation. Journal of Physical Oceanography, diff --git a/Toolbox/gsw_dynamic_enthalpy_CT_exact.m b/Toolbox/gsw_dynamic_enthalpy_CT_exact.m index a0b1f0a..ba15aa5 100644 --- a/Toolbox/gsw_dynamic_enthalpy_CT_exact.m +++ b/Toolbox/gsw_dynamic_enthalpy_CT_exact.m @@ -15,7 +15,7 @@ % alternative to calling this function, namely % gsw_dynamic_enthalpy(SA,CT,p), which uses the computationally % efficient 48-term expression for density in terms of SA, CT and p -% (McDougall et al., 2013). +% (IOC et al., 2010). % % INPUT: % SA = Absolute Salinity [ g/kg ] @@ -32,7 +32,7 @@ % AUTHOR: % Trevor McDougall and Paul Barker. [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (15th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of @@ -41,10 +41,10 @@ % UNESCO (English), 196 pp. Available from http://www.TEOS-10.org % See apendix A.30 of this TEOS-10 Manual. % -% McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2013: A -% computationally efficient 48-term expression for the density of -% seawater in terms of Conservative Temperature, and related properties -% of seawater. To be submitted to J. Atm. Ocean. Technol., xx, yyy-zzz. +% McDougall, T. J., 2003: Potential enthalpy: A conservative oceanic +% variable for evaluating heat content and heat fluxes. Journal of +% Physical Oceanography, 33, 945-963. +% See Eqns. (18) and (22) % % Young, W.R., 2010: Dynamic enthalpy, Conservative Temperature, and the % seawater Boussinesq approximation. Journal of Physical Oceanography, diff --git a/Toolbox/gsw_enthalpy.m b/Toolbox/gsw_enthalpy.m index 345289d..417c62b 100644 --- a/Toolbox/gsw_enthalpy.m +++ b/Toolbox/gsw_enthalpy.m @@ -10,11 +10,11 @@ % DESCRIPTION: % Calculates specific enthalpy of seawater using the computationally- % efficient 48-term expression for density in terms of SA, CT and p -% (McDougall et al., 2013) +% (IOC et al., 2010) % % Note that the 48-term equation has been fitted in a restricted range of % parameter space, and is most accurate inside the "oceanographic funnel" -% described in McDougall et al. (2013). The GSW library function +% described in IOC et al. (2010). The GSW library function % "gsw_infunnel(SA,CT,p)" is avaialble to be used if one wants to test if % some of one's data lies outside this "funnel". % @@ -34,7 +34,7 @@ % Trevor McDougall, David Jackett, Claire Roberts-Thomson and Paul Barker. % [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (15th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of @@ -43,10 +43,10 @@ % UNESCO (English), 196 pp. Available from http://www.TEOS-10.org % See Eqn. (A.30.6) of this TEOS-10 Manual. % -% McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2013: A -% computationally efficient 48-term expression for the density of -% seawater in terms of Conservative Temperature, and related properties -% of seawater. To be submitted to J. Atm. Ocean. Technol., xx, yyy-zzz. +% McDougall, T. J., 2003: Potential enthalpy: A conservative oceanic +% variable for evaluating heat content and heat fluxes. Journal of +% Physical Oceanography, 33, 945-963. +% See Eqns. (18) and (22) % % The software is available from http://www.TEOS-10.org % diff --git a/Toolbox/gsw_enthalpy_CT.m b/Toolbox/gsw_enthalpy_CT.m index c27d90e..ed30eb5 100644 --- a/Toolbox/gsw_enthalpy_CT.m +++ b/Toolbox/gsw_enthalpy_CT.m @@ -16,11 +16,11 @@ % DESCRIPTION: % Calculates specific enthalpy of seawater using the computationally- % efficient 48-term expression for density in terms of SA, CT and p -% (McDougall et al., 2013) +% (IOC et al., 2010) % % Note that the 48-term equation has been fitted in a restricted range of % parameter space, and is most accurate inside the "oceanographic funnel" -% described in McDougall et al. (2013). The GSW library function +% described in IOC et al. (2010). The GSW library function % "gsw_infunnel(SA,CT,p)" is avaialble to be used if one wants to test if % some of one's data lies outside this "funnel". % @@ -40,7 +40,7 @@ % Trevor McDougall, David Jackett, Claire Roberts-Thomson and Paul Barker. % [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (15th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of @@ -49,10 +49,10 @@ % UNESCO (English), 196 pp. Available from http://www.TEOS-10.org % See Eqn. (A.30.6) of this TEOS-10 Manual. % -% McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2013: A -% computationally efficient 48-term expression for the density of -% seawater in terms of Conservative Temperature, and related properties -% of seawater. To be submitted to J. Atm. Ocean. Technol., xx, yyy-zzz. +% McDougall, T. J., 2003: Potential enthalpy: A conservative oceanic +% variable for evaluating heat content and heat fluxes. Journal of +% Physical Oceanography, 33, 945-963. +% See Eqns. (18) and (22) % % The software is available from http://www.TEOS-10.org % diff --git a/Toolbox/gsw_enthalpy_CT_exact.m b/Toolbox/gsw_enthalpy_CT_exact.m index 7ca1531..8ae2173 100644 --- a/Toolbox/gsw_enthalpy_CT_exact.m +++ b/Toolbox/gsw_enthalpy_CT_exact.m @@ -13,7 +13,7 @@ % Note that this function uses the full Gibbs function. There is an % alternative to calling this function, namely gsw_enthalpy_CT(SA,CT,p), % which uses the computationally-efficient 48-term expression for density -% in terms of SA, CT and p (McDougall et al., 2013). +% in terms of SA, CT and p (IOC et al., 2010). % % INPUT: % SA = Absolute Salinity [ g/kg ] @@ -30,7 +30,7 @@ % AUTHOR: % Trevor McDougall and Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (15th November, 2012) +% VERSION NUMBER: 3.03 (12th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of @@ -39,10 +39,10 @@ % UNESCO (English), 196 pp. Available from http://www.TEOS-10.org % See apendix A.11 of this TEOS-10 Manual. % -% McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2013: A -% computationally efficient 48-term expression for the density of -% seawater in terms of Conservative Temperature, and related properties -% of seawater. To be submitted to J. Atm. Ocean. Technol., xx, yyy-zzz. +% McDougall, T. J., 2003: Potential enthalpy: A conservative oceanic +% variable for evaluating heat content and heat fluxes. Journal of +% Physical Oceanography, 33, 945-963. +% See Eqns. (18) and (22) % % The software is available from http://www.TEOS-10.org % @@ -92,7 +92,6 @@ % Start of the calculation %-------------------------------------------------------------------------- - t = gsw_t_from_CT(SA,CT,p); enthalpy_CT_exact = gsw_enthalpy_t_exact(SA,t,p); diff --git a/Toolbox/gsw_enthalpy_diff.m b/Toolbox/gsw_enthalpy_diff.m index fcdcbc3..907cb9c 100644 --- a/Toolbox/gsw_enthalpy_diff.m +++ b/Toolbox/gsw_enthalpy_diff.m @@ -12,13 +12,13 @@ % two different pressures, p_deep (the deeper pressure) and p_shallow % (the shallower pressure), at the same values of SA and CT. This % function uses the computationally-efficient 48-term expression for -% density in terms of SA, CT and p (McDougall et al., 2013). The output +% density in terms of SA, CT and p (IOC et al., 2010). The output % (enthalpy_diff_CT) is the specific enthalpy evaluated at (SA,CT,p_deep) % minus the specific enthalpy at (SA,CT,p_shallow). % % Note that the 48-term equation has been fitted in a restricted range of % parameter space, and is most accurate inside the "oceanographic funnel" -% described in McDougall et al. (2013). The GSW library function +% described in IOC et al. (2010). The GSW library function % "gsw_infunnel(SA,CT,p)" is avaialble to be used if one wants to test if % some of one's data lies outside this "funnel". % @@ -40,7 +40,7 @@ % AUTHOR: % Trevor McDougall & Paul Barker. [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (15th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of @@ -49,10 +49,10 @@ % UNESCO (English), 196 pp. Available from http://www.TEOS-10.org % See Eqns. (3.32.2) and (A.30.6) of this TEOS-10 Manual. % -% McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2013: A -% computationally efficient 48-term expression for the density of -% seawater in terms of Conservative Temperature, and related properties -% of seawater. To be submitted to J. Atm. Ocean. Technol., xx, yyy-zzz. +% McDougall, T. J., 2003: Potential enthalpy: A conservative oceanic +% variable for evaluating heat content and heat fluxes. Journal of +% Physical Oceanography, 33, 945-963. +% See Eqns. (18) and (22) % % The software is available from http://www.TEOS-10.org % diff --git a/Toolbox/gsw_enthalpy_diff_CT.m b/Toolbox/gsw_enthalpy_diff_CT.m index 966b5f0..5c9f72b 100644 --- a/Toolbox/gsw_enthalpy_diff_CT.m +++ b/Toolbox/gsw_enthalpy_diff_CT.m @@ -18,13 +18,13 @@ % two different pressures, p_deep (the deeper pressure) and p_shallow % (the shallower pressure), at the same values of SA and CT. This % function uses the computationally-efficient 48-term expression for -% density in terms of SA, CT and p (McDougall et al., 2013). The output +% density in terms of SA, CT and p (IOC et al., 2010). The output % (enthalpy_diff_CT) is the specific enthalpy evaluated at (SA,CT,p_deep) % minus the specific enthalpy at (SA,CT,p_shallow). % % Note that the 48-term equation has been fitted in a restricted range of % parameter space, and is most accurate inside the "oceanographic funnel" -% described in McDougall et al. (2013). The GSW library function +% described in IOC et al. (2010). The GSW library function % "gsw_infunnel(SA,CT,p)" is avaialble to be used if one wants to test if % some of one's data lies outside this "funnel". % @@ -46,7 +46,7 @@ % AUTHOR: % Trevor McDougall & Paul Barker. [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (15th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of @@ -55,10 +55,10 @@ % UNESCO (English), 196 pp. Available from http://www.TEOS-10.org % See Eqns. (3.32.2) and (A.30.6) of this TEOS-10 Manual. % -% McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2013: A -% computationally efficient 48-term expression for the density of -% seawater in terms of Conservative Temperature, and related properties -% of seawater. To be submitted to J. Atm. Ocean. Technol., xx, yyy-zzz. +% McDougall, T. J., 2003: Potential enthalpy: A conservative oceanic +% variable for evaluating heat content and heat fluxes. Journal of +% Physical Oceanography, 33, 945-963. +% See Eqns. (18) and (22) % % The software is available from http://www.TEOS-10.org % diff --git a/Toolbox/gsw_enthalpy_diff_CT_exact.m b/Toolbox/gsw_enthalpy_diff_CT_exact.m index 0f8d6a3..1fa93f7 100644 --- a/Toolbox/gsw_enthalpy_diff_CT_exact.m +++ b/Toolbox/gsw_enthalpy_diff_CT_exact.m @@ -17,7 +17,7 @@ % alternative to calling this function, namely % gsw_enthalpy_diff_CT(SA,CT,p), which uses the computationally % efficient 48-term expression for density in terms of SA, CT and p -% (McDougall et al., 2013). +% (IOC et al., 2010). % % INPUT: % SA = Absolute Salinity [ g/kg ] @@ -37,7 +37,7 @@ % AUTHOR: % Trevor McDougall and Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (15th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of @@ -46,10 +46,10 @@ % UNESCO (English), 196 pp. Available from http://www.TEOS-10.org % See Eqns. (3.32.2) of this TEOS-10 Manual. % -% McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2013: A -% computationally efficient 48-term expression for the density of -% seawater in terms of Conservative Temperature, and related properties -% of seawater. To be submitted to J. Atm. Ocean. Technol., xx, yyy-zzz. +% McDougall, T. J., 2003: Potential enthalpy: A conservative oceanic +% variable for evaluating heat content and heat fluxes. Journal of +% Physical Oceanography, 33, 945-963. +% See Eqns. (18) and (22) % % The software is available from http://www.TEOS-10.org % diff --git a/Toolbox/gsw_enthalpy_first_derivatives.m b/Toolbox/gsw_enthalpy_first_derivatives.m index 2bde70f..6e7294e 100644 --- a/Toolbox/gsw_enthalpy_first_derivatives.m +++ b/Toolbox/gsw_enthalpy_first_derivatives.m @@ -1,18 +1,26 @@ -function [h_SA, h_CT, h_P] = gsw_enthalpy_first_derivatives(SA,CT,p) +function [h_SA, h_CT] = gsw_enthalpy_first_derivatives(SA,CT,p) % gsw_enthalpy_first_derivatives first derivatives of enthalpy %========================================================================== % % USAGE: -% [h_SA, h_CT, h_P] = gsw_enthalpy_first_derivatives(SA,CT,p) +% [h_SA, h_CT] = gsw_enthalpy_first_derivatives(SA,CT,p) % % DESCRIPTION: -% Calculates the following three derivatives of specific enthalpy (h) +% Calculates the following two derivatives of specific enthalpy (h) of +% seawater using the computationally-efficient 48-term expression for +% density in terms of SA, CT and p (IOC et al., 2010). % (1) h_SA, the derivative with respect to Absolute Salinity at % constant CT and p, and % (2) h_CT, derivative with respect to CT at constant SA and p. -% (3) h_P, derivative with respect to pressure (in Pa) at constant -% SA and CT. +% Note that h_P is specific volume (1/rho) it can be calulated by calling +% gsw_specvol(SA,CT,p). +% +% Note that the 48-term equation has been fitted in a restricted range of +% parameter space, and is most accurate inside the "oceanographic funnel" +% described in IOC et al. (2010). The GSW library function +% "gsw_infunnel(SA,CT,p)" is avaialble to be used if one wants to test if +% some of one's data lies outside this "funnel". % % INPUT: % SA = Absolute Salinity [ g/kg ] @@ -29,15 +37,11 @@ % [ J/(kg (g/kg))] i.e. [ J/g ] % h_CT = The first derivative of specific enthalpy with respect to % CT at constant SA and p. [ J/(kg K) ] -% h_P = The first partial derivative of specific enthalpy with -% respect to pressure (in Pa) at fixed SA and CT. Note that -% h_P is specific volume (1/rho). % % AUTHOR: -% Trevor McDougall. [ help@teos-10.org ] +% Trevor McDougall and Paul Barker. [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (15th November, 2012) -% This function is unchanged from version 2.0 (24th September, 2010). +% VERSION NUMBER: 3.03 (20th May, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of @@ -46,6 +50,11 @@ % UNESCO (English), 196 pp. Available from http://www.TEOS-10.org. % See Eqns. (A.11.18), (A.11.15) and (A.11.12) of this TEOS-10 Manual. % +% McDougall, T. J., 2003: Potential enthalpy: A conservative oceanic +% variable for evaluating heat content and heat fluxes. Journal of +% Physical Oceanography, 33, 945-963. +% See Eqns. (18) and (22) +% % This software is available from http://www.TEOS-10.org % %========================================================================== @@ -58,8 +67,8 @@ error('gsw_enthalpy_first_derivatives: Requires three inputs') end %if -if ~(nargout == 3) - error('gsw_enthalpy_first_derivatives: Requires three outputs') +if ~(nargout == 2) + error('gsw_enthalpy_first_derivatives: Requires two outputs') end %if [ms,ns] = size(SA); @@ -98,70 +107,30 @@ % Start of the calculation %-------------------------------------------------------------------------- -cp0 = 3991.86795711963; % from Eqn. (3.3.3) of IOC et al. (2010). -n0 = 0; -n1 = 1; - -t = gsw_t_from_CT(SA,CT,p); -pt0 = gsw_pt_from_CT(SA,CT); - -temp_ratio = (273.15 + t)./(273.15 + pt0); - -h_CT = cp0.*temp_ratio; % from Eqn. (A.11.15) of IOC et al. (2010). - -h_P = gsw_gibbs(n0,n0,n1,SA,t,p); %from Eqn. (A.11.12) of IOC et al. (2010). - -db2Pa = 1e-4; -sfac = 0.0248826675584615; % sfac = 1/(40*(35.16504/35)). - -x = sqrt(sfac.*SA); -y = 0.025*t; -z = db2Pa*p; %Note.The input pressure (p) is sea pressure in units of dbar. - -g_SA_mod_t = 8645.36753595126 + z.*(-6620.98308089678 + ... - z.*(769.588305957198 + z.*(-193.0648640214916 + (31.6816345533648 - 5.24960313181984.*z).*z))) + ... - x.*(-7296.43987145382 + x.*(8103.20462414788 + ... - y.*(2175.341332000392 + y.*(-274.2290036817964 + ... - y.*(197.4670779425016 + y.*(-68.5590309679152 + 9.98788038278032.*y))) - 90.6734234051316.*z) + ... - x.*(-5458.34205214835 - 980.14153344888.*y + ... - x.*(2247.60742726704 - 340.1237483177863.*x + 220.542973797483.*y) + 180.142097805543.*z) + ... - z.*(-219.1676534131548 + (-16.32775915649044 - 120.7020447884644.*z).*z)) + ... - z.*(598.378809221703 + z.*(-156.8822727844005 + (204.1334828179377 - 10.23755797323846.*z).*z)) + ... - y.*(-1480.222530425046 + z.*(-525.876123559641 + (249.57717834054571 - 88.449193048287.*z).*z) + ... - y.*(-129.1994027934126 + z.*(1149.174198007428 + z.*(-162.5751787551336 + 76.9195462169742.*z)) + ... - y.*(-30.0682112585625 - 1380.9597954037708.*z + y.*(2.626801985426835 + 703.695562834065.*z))))) + ... - y.*(1187.3715515697959 + z.*(1458.233059470092 + ... - z.*(-687.913805923122 + z.*(249.375342232496 + z.*(-63.313928772146 + 14.09317606630898.*z)))) + ... - y.*(1760.062705994408 + y.*(-450.535298526802 + ... - y.*(182.8520895502518 + y.*(-43.3206481750622 + 4.26033941694366.*y) + ... - z.*(-595.457483974374 + (149.452282277512 - 72.9745838003176.*z).*z)) + ... - z.*(1388.489628266536 + z.*(-409.779283929806 + (227.123395681188 - 22.2565468652826.*z).*z))) + ... - z.*(-1721.528607567954 + z.*(674.819060538734 + ... - z.*(-356.629112415276 + (88.4080716616 - 15.84003094423364.*z).*z))))); - -g_SA_mod_t = 0.5.*sfac.*g_SA_mod_t; - -y_pt = 0.025*pt0; - -g_SA_mod_pt = 8645.36753595126 + ... - x.*(-7296.43987145382 + x.*(8103.20462414788 + ... - y_pt.*(2175.341332000392 + y_pt.*(-274.2290036817964 + ... - y_pt.*(197.4670779425016 + y_pt.*(-68.5590309679152 + 9.98788038278032.*y_pt)))) + ... - x.*(-5458.34205214835 - 980.14153344888.*y_pt + ... - x.*(2247.60742726704 - 340.1237483177863.*x + 220.542973797483.*y_pt))) + ... - y_pt.*(-1480.222530425046 + y_pt.*(-129.1994027934126 + ... - y_pt.*(-30.0682112585625 + y_pt.*2.626801985426835)))) + ... - y_pt.*(1187.3715515697959 + y_pt.*(1760.062705994408 + y_pt.*(-450.535298526802 + ... - y_pt.*(182.8520895502518 + y_pt.*(-43.3206481750622 + 4.26033941694366.*y_pt))))); - -g_SA_mod_pt = 0.5*sfac*g_SA_mod_pt; - -h_SA = g_SA_mod_t - temp_ratio.*g_SA_mod_pt; +SA(SA<0) = 0; +dSA = 0.01; % increment in Absolute Salinity is 1e-2 g kg^-1 +SA_l = nan(size(SA)); +SA_l(SA >= dSA) = SA(SA >= dSA) - dSA; +SA_l(SA= dSA) = SA(SA >= dSA) - dSA; +SA_l(SA0.5 & SA<1); + + h_SA_SA(SA>0.5 & SA<1) = SA_taper.*(h_SA_SA_exact(SA>0.5 & SA<1)) + (1-SA_taper).*h_SA_SA_48(SA>0.5 & SA<1); + + h_SA_SA(SA<=0.5) = h_SA_SA_exact(SA<=0.5); end -h_SA_CT = cp0.*part - factor.*h_CT_CT; +[hSA_l,dummy] = gsw_enthalpy_first_derivatives(SA,CT_l,p); +[hSA_u,dummy] = gsw_enthalpy_first_derivatives(SA,CT_u,p); + +h_SA_CT = (hSA_u - hSA_l)./(CT_u - CT_l); + +hCT_l = gsw_dynamic_enthalpy(SA,CT_l,p); +hCT = gsw_dynamic_enthalpy(SA,CT,p); +hCT_u = gsw_dynamic_enthalpy(SA,CT_u,p); + +h_CT_CT = 4.*(hCT_u - 2.*hCT + hCT_l)./((CT_u - CT_l).^2); if transposed h_SA_SA = h_SA_SA.'; diff --git a/Toolbox/gsw_enthalpy_second_derivatives_CT.m b/Toolbox/gsw_enthalpy_second_derivatives_CT.m new file mode 100644 index 0000000..ee9c151 --- /dev/null +++ b/Toolbox/gsw_enthalpy_second_derivatives_CT.m @@ -0,0 +1,127 @@ +function [h_SA_SA, h_SA_CT, h_CT_CT] = gsw_enthalpy_second_derivatives_CT(SA,CT,p) + +% gsw_enthalpy_second_derivatives_CT second derivatives of enthalpy +% (48-term equation) +% ========================================================================= +% +% USAGE: +% [h_SA_SA, h_SA_CT, h_CT_CT] = gsw_enthalpy_second_derivatives_CT(SA,CT,p) +%, or equivalently +% [h_SA_SA, h_SA_CT, h_CT_CT] = gsw_enthalpy_second_derivatives(SA,CT,p) +% +% Note that gsw_enthalpy_second_derivatives_CT(SA,CT,p) is identical to +% gsw_enthalpy_second_derivatives(SA,CT,p). The extra "_CT" emphasises +% that the input temperature is Conservative Temperature, but the extra +% "_CT" part of the function name is not needed. +% +% DESCRIPTION: +% Calculates the following three second-order derivatives of specific +% enthalpy (h),using the computationally-efficient 48-term expression for +% density in terms of SA, CT and p (McDougall et al., 2013). +% (1) h_SA_SA, second-order derivative with respect to Absolute Salinity +% at constant CT & p. +% (2) h_SA_CT, second-order derivative with respect to SA & CT at +% constant p. +% (3) h_CT_CT, second-order derivative with respect to CT at constant SA +% and p. +% +% Note that the 48-term equation has been fitted in a restricted range of +% parameter space, and is most accurate inside the "oceanographic funnel" +% described in IOC et al. (2010). The GSW library function +% "gsw_infunnel(SA,CT,p)" is avaialble to be used if one wants to test if +% some of one's data lies outside this "funnel". +% +% INPUT: +% SA = Absolute Salinity [ g/kg ] +% CT = Conservative Temperature (ITS-90) [ deg C ] +% p = sea pressure [ dbar ] +% ( i.e. absolute pressure - 10.1325 dbar ) +% +% SA & CT need to have the same dimensions. +% p may have dimensions 1x1 or Mx1 or 1xN or MxN, where SA & CT are MxN. +% +% OUTPUT: +% h_SA_SA = The second derivative of specific enthalpy with respect to +% Absolute Salinity at constant CT & p. [ J/(kg (g/kg)^2) ] +% h_SA_CT = The second derivative of specific enthalpy with respect to +% SA and CT at constant p. [ J/(kg K(g/kg)) ] +% h_CT_CT = The second derivative of specific enthalpy with respect to +% CT at constant SA and p. [ J/(kg K^2) ] +% +% AUTHOR: +% Trevor McDougall and Paul Barker. [ help@teos-10.org ] +% +% VERSION NUMBER: 3.03 (26th April, 2013) +% +% REFERENCES: +% IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of +% seawater - 2010: Calculation and use of thermodynamic properties. +% Intergovernmental Oceanographic Commission, Manuals and Guides No. 56, +% UNESCO (English), 196 pp. Available from http://www.TEOS-10.org. +% +% McDougall, T. J., 2003: Potential enthalpy: A conservative oceanic +% variable for evaluating heat content and heat fluxes. Journal of +% Physical Oceanography, 33, 945-963. +% See Eqns. (18) and (22) +% +% This software is available from http://www.TEOS-10.org +% +%========================================================================== + +%-------------------------------------------------------------------------- +% Check variables and resize if necessary +%-------------------------------------------------------------------------- + +if ~(nargin == 3) + error('gsw_enthalpy_second_derivatives: Requires three inputs') +end %if + +if ~(nargout == 3) + error('gsw_enthalpy_second_derivatives: Requires three outputs') +end %if + +[ms,ns] = size(SA); +[mt,nt] = size(CT); +[mp,np] = size(p); + +if (ms ~= mt | ns ~= nt ) + error('gsw_enthalpy_second_derivatives: SA and CT do not have the same dimensions') +end %if + +if (mp == 1) & (np == 1) % p scalar - fill to size of SA + p = p*ones(size(SA)); +elseif (ns == np) & (mp == 1) % p is row vector, + p = p(ones(1,ms), :); % copy down each column. +elseif (ms == mp) & (np == 1) % p is column vector, + p = p(:,ones(1,ns)); % copy across each row. +elseif (ns == mp) & (np == 1) % p is a transposed row vector, + p = p.'; % transposed then + p = p(ones(1,ms), :); % copy down each column. +elseif (ms == mp) & (ns == np) + % ok +else + error('gsw_enthalpy_second_derivatives: The dimensions of p do not agree') +end %if + +if ms == 1 + SA = SA.'; + CT = CT.'; + p = p.'; + transposed = 1; +else + transposed = 0; +end + +%-------------------------------------------------------------------------- +% Start of the calculation +%-------------------------------------------------------------------------- + +[h_SA_SA, h_SA_CT, h_CT_CT] = gsw_enthalpy_second_derivatives(SA,CT,p); + +if transposed + h_SA_SA = h_SA_SA.'; + h_SA_CT = h_SA_CT.'; + h_CT_CT = h_CT_CT.'; +end + +end diff --git a/Toolbox/gsw_enthalpy_second_derivatives_CT_exact.m b/Toolbox/gsw_enthalpy_second_derivatives_CT_exact.m new file mode 100644 index 0000000..13f8e37 --- /dev/null +++ b/Toolbox/gsw_enthalpy_second_derivatives_CT_exact.m @@ -0,0 +1,164 @@ +function [h_SA_SA, h_SA_CT, h_CT_CT] = gsw_enthalpy_second_derivatives_CT_exact(SA,CT,p) + +% gsw_enthalpy_second_derivatives_CT_exact second derivatives of enthalpy +% ========================================================================= +% +% USAGE: +% [h_SA_SA, h_SA_CT, h_CT_CT] = gsw_enthalpy_second_derivatives_CT_exact(SA,CT,p) +% +% DESCRIPTION: +% Calculates the following three second-order derivatives of specific +% enthalpy (h), +% (1) h_SA_SA, second-order derivative with respect to Absolute Salinity +% at constant CT & p. +% (2) h_SA_CT, second-order derivative with respect to SA & CT at +% constant p. +% (3) h_CT_CT, second-order derivative with respect to CT at constant SA +% and p. +% +% Note that this function uses the full Gibbs function. There is an +% alternative to calling this function, namely +% gsw_enthalpy_second_derivatives(SA,CT,p) which uses the computationally +% efficient 48-term expression for density in terms of SA, CT and p +% (IOC et al., 2010). +% +% INPUT: +% SA = Absolute Salinity [ g/kg ] +% CT = Conservative Temperature (ITS-90) [ deg C ] +% p = sea pressure [ dbar ] +% ( i.e. absolute pressure - 10.1325 dbar ) +% +% SA & CT need to have the same dimensions. +% p may have dimensions 1x1 or Mx1 or 1xN or MxN, where SA & CT are MxN. +% +% OUTPUT: +% h_SA_SA = The second derivative of specific enthalpy with respect to +% Absolute Salinity at constant CT & p. [ J/(kg (g/kg)^2) ] +% h_SA_CT = The second derivative of specific enthalpy with respect to +% SA and CT at constant p. [ J/(kg K(g/kg)) ] +% h_CT_CT = The second derivative of specific enthalpy with respect to +% CT at constant SA and p. [ J/(kg K^2) ] +% +% AUTHOR: +% Trevor McDougall and Paul Barker. [ help@teos-10.org ] +% +% VERSION NUMBER: 3.03 (12th April, 2013) +% +% REFERENCES: +% IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of +% seawater - 2010: Calculation and use of thermodynamic properties. +% Intergovernmental Oceanographic Commission, Manuals and Guides No. 56, +% UNESCO (English), 196 pp. Available from http://www.TEOS-10.org. +% +% McDougall, T. J., 2003: Potential enthalpy: A conservative oceanic +% variable for evaluating heat content and heat fluxes. Journal of +% Physical Oceanography, 33, 945-963. +% See Eqns. (18) and (22) +% +% This software is available from http://www.TEOS-10.org +% +%========================================================================== + +%-------------------------------------------------------------------------- +% Check variables and resize if necessary +%-------------------------------------------------------------------------- + +if ~(nargin == 3) + error('gsw_enthalpy_second_derivatives_CT_exact: Requires three inputs') +end %if + +if ~(nargout == 3) + error('gsw_enthalpy_second_derivatives_CT_exact: Requires three outputs') +end %if + +[ms,ns] = size(SA); +[mt,nt] = size(CT); +[mp,np] = size(p); + +if (ms ~= mt | ns ~= nt ) + error('gsw_enthalpy_second_derivatives_CT_exact: SA and CT do not have the same dimensions') +end %if + +if (mp == 1) & (np == 1) % p scalar - fill to size of SA + p = p*ones(size(SA)); +elseif (ns == np) & (mp == 1) % p is row vector, + p = p(ones(1,ms), :); % copy down each column. +elseif (ms == mp) & (np == 1) % p is column vector, + p = p(:,ones(1,ns)); % copy across each row. +elseif (ns == mp) & (np == 1) % p is a transposed row vector, + p = p.'; % transposed then + p = p(ones(1,ms), :); % copy down each column. +elseif (ms == mp) & (ns == np) + % ok +else + error('gsw_enthalpy_second_derivatives_CT_exact: The dimensions of p do not agree') +end %if + +if ms == 1 + SA = SA.'; + CT = CT.'; + p = p.'; + transposed = 1; +else + transposed = 0; +end + +%-------------------------------------------------------------------------- +% Start of the calculation +%-------------------------------------------------------------------------- + +cp0 = 3991.86795711963; % from Eqn. 3.3.3 of IOC et al. (2010). +n0 = 0; +n1 = 1; +n2 = 2; +pr0 = zeros(size(SA)); + +pt0 = gsw_pt_from_CT(SA,CT); +rec_abs_pt0 = 1./(273.15 + pt0); +t = gsw_pt_from_t(SA,pt0,pr0,p); +temp_ratio = (273.15 + t).*rec_abs_pt0; + +rec_gTT_pt0 = 1./gsw_gibbs(n0,n2,n0,SA,pt0,pr0); +rec_gTT_t = 1./gsw_gibbs(n0,n2,n0,SA,t,p); +gST_pt0 = gsw_gibbs(n1,n1,n0,SA,pt0,pr0); +gST_t = gsw_gibbs(n1,n1,n0,SA,t,p); +gS_pt0 = gsw_gibbs(n1,n0,n0,SA,pt0,pr0); + +% h_CT_CT is naturally well-behaved as SA approaches zero. +h_CT_CT = cp0.*cp0.* ... + (temp_ratio.*rec_gTT_pt0 - rec_gTT_t).*(rec_abs_pt0.*rec_abs_pt0); + +part = (temp_ratio.*gST_pt0.*rec_gTT_pt0 - gST_t.*rec_gTT_t).*rec_abs_pt0; +factor = gS_pt0./cp0; + +% h_SA_SA has a singularity at SA = 0, and blows up as SA approaches zero. +h_SA_SA = gsw_gibbs(n2,n0,n0,SA,t,p) ... + - temp_ratio.*gsw_gibbs(n2,n0,n0,SA,pt0,pr0) ... + + temp_ratio.*gST_pt0.*gST_pt0.*rec_gTT_pt0 ... + - gST_t.*gST_t.*rec_gTT_t ... + - 2.0.*gS_pt0.*part + (factor.*factor).*h_CT_CT; + +% h_SA_CT should not blow up as SA approaches zero. The following lines +% of code ensure that the h_SA_CT output of this function does not blow +% up in this limit. That is, when SA < 1e-100 g/kg, we force the h_SA_CT +% output to be the same as if SA = 1e-100 g/kg. +if any(SA < 1e-100) + SA(SA < 1e-100) = 1e-100; + rec_gTT_pt0 = 1./gsw_gibbs(n0,n2,n0,SA,pt0,pr0); + rec_gTT_t = 1./gsw_gibbs(n0,n2,n0,SA,t,p); + gST_pt0 = gsw_gibbs(n1,n1,n0,SA,pt0,pr0); + gST_t = gsw_gibbs(n1,n1,n0,SA,t,p); + gS_pt0 = gsw_gibbs(n1,n0,n0,SA,pt0,pr0); + part = (temp_ratio.*gST_pt0.*rec_gTT_pt0 - gST_t.*rec_gTT_t).*rec_abs_pt0; + factor = gS_pt0./cp0; +end + +h_SA_CT = cp0.*part - factor.*h_CT_CT; + +if transposed + h_SA_SA = h_SA_SA.'; + h_SA_CT = h_SA_CT.'; + h_CT_CT = h_CT_CT.'; +end + +end diff --git a/Toolbox/gsw_entropy_first_derivatives.m b/Toolbox/gsw_entropy_first_derivatives.m index 5cca328..4e04196 100644 --- a/Toolbox/gsw_entropy_first_derivatives.m +++ b/Toolbox/gsw_entropy_first_derivatives.m @@ -32,8 +32,7 @@ % AUTHOR: % Trevor McDougall. [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (15th November, 2012) -% This function is unchanged from version 2.0 (24th September, 2010). +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of diff --git a/Toolbox/gsw_entropy_from_CT.m b/Toolbox/gsw_entropy_from_CT.m index 2c98a30..dd7e895 100644 --- a/Toolbox/gsw_entropy_from_CT.m +++ b/Toolbox/gsw_entropy_from_CT.m @@ -22,7 +22,7 @@ % AUTHOR: % Trevor McDougall and Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (15th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of diff --git a/Toolbox/gsw_entropy_from_pt.m b/Toolbox/gsw_entropy_from_pt.m index 48455c3..6cebd48 100644 --- a/Toolbox/gsw_entropy_from_pt.m +++ b/Toolbox/gsw_entropy_from_pt.m @@ -22,7 +22,7 @@ % AUTHOR: % Trevor McDougall and Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (15th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of diff --git a/Toolbox/gsw_entropy_t_exact.m b/Toolbox/gsw_entropy_from_t.m similarity index 80% rename from Toolbox/gsw_entropy_t_exact.m rename to Toolbox/gsw_entropy_from_t.m index ee084fc..6b16eba 100644 --- a/Toolbox/gsw_entropy_t_exact.m +++ b/Toolbox/gsw_entropy_from_t.m @@ -1,10 +1,10 @@ -function entropy_t_exact = gsw_entropy_t_exact(SA,t,p) +function entropy = gsw_entropy_from_t(SA,t,p) -% gsw_entropy_t_exact specific entropy of seawater +% gsw_entropy_from_t specific entropy of seawater %========================================================================== % % USAGE: -% entropy_t_exact = gsw_entropy_t_exact(SA,t,p) +% entropy = gsw_entropy_from_t(SA,t,p) % % DESCRIPTION: % Calculates specific entropy of seawater. @@ -19,12 +19,12 @@ % p may have dimensions 1x1 or Mx1 or 1xN or MxN, where SA & t are MxN. % % OUTPUT: -% entropy_t_exact = specific entropy [ J/(kg*K) ] +% entropy = specific entropy [ J/(kg*K) ] % % AUTHOR: % David Jackett, Trevor McDougall and Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (15th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of @@ -41,7 +41,7 @@ %-------------------------------------------------------------------------- if ~(nargin == 3) - error('gsw_entropy_t_exact: Requires three inputs') + error('gsw_entropy_from_t: Requires three inputs') end %if [ms,ns] = size(SA); @@ -49,7 +49,7 @@ [mp,np] = size(p); if (mt ~= ms | nt ~= ns) - error('gsw_entropy_t_exact: SA and t must have same dimensions') + error('gsw_entropy_from_t: SA and t must have same dimensions') end if (mp == 1) & (np == 1) % p scalar - fill to size of SA @@ -64,7 +64,7 @@ elseif (ms == mp) & (ns == np) % ok else - error('gsw_entropy_t_exact: Inputs array dimensions arguments do not agree') + error('gsw_entropy_from_t: Inputs array dimensions arguments do not agree') end %if if ms == 1 @@ -83,10 +83,10 @@ n0 = 0; n1 = 1; -entropy_t_exact = -gsw_gibbs(n0,n1,n0,SA,t,p); +entropy = -gsw_gibbs(n0,n1,n0,SA,t,p); if transposed - entropy_t_exact = entropy_t_exact.'; + entropy = entropy.'; end end \ No newline at end of file diff --git a/Toolbox/gsw_entropy_second_derivatives.m b/Toolbox/gsw_entropy_second_derivatives.m index 733f0e7..453f77d 100644 --- a/Toolbox/gsw_entropy_second_derivatives.m +++ b/Toolbox/gsw_entropy_second_derivatives.m @@ -37,8 +37,7 @@ % AUTHOR: % Trevor McDougall and Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (15th November, 2012) -% This function is unchanged from version 2.0 (24th September, 2010). +% VERSION NUMBER: 3.03 (16th April, 2012) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of diff --git a/Toolbox/gsw_f.m b/Toolbox/gsw_f.m index 153447f..0e2e7a5 100644 --- a/Toolbox/gsw_f.m +++ b/Toolbox/gsw_f.m @@ -24,7 +24,7 @@ % MODIFIED: % 28th July, 2010 by Paul Barker % -% VERSION NUMBER: 3.02 (15th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % This function is unchanged from version 2.0 (28th July, 2010). % % REFERENCE: diff --git a/Toolbox/gsw_geo_strf_Cunningham.m b/Toolbox/gsw_geo_strf_Cunningham.m index 8d3f1de..8861e46 100644 --- a/Toolbox/gsw_geo_strf_Cunningham.m +++ b/Toolbox/gsw_geo_strf_Cunningham.m @@ -13,8 +13,7 @@ % difference between the horizontal velocity at the pressure concerned, % p, and the horizontal velocity on the pressure surface, p_ref. This % function calculates specific volume anomaly using the computationally -% efficient 48-term expression for specific volume of McDougall et al. -% (2013). +% efficient 48-term expression for specific volume of IOC et al. (2010). % % Note that p_ref, is the reference pressure to which the streamfunction % is referenced. When p_ref is zero, "gsw_geo_strf_Cunningham" returns @@ -24,7 +23,7 @@ % % Note that the 48-term equation has been fitted in a restricted range of % parameter space, and is most accurate inside the "oceanographic funnel" -% described in McDougall et al. (2013). The GSW library function +% described in IOC et al. (2010). The GSW library function % "gsw_infunnel(SA,CT,p)" is avaialble to be used if one wants to test if % some of one's data lies outside this "funnel". % @@ -48,7 +47,7 @@ % AUTHOR: % Trevor McDougall and Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (15th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % Cunningham, S.A., 2000: Circulation and volume flux of the North @@ -61,11 +60,6 @@ % UNESCO (English), 196 pp. Available from http://www.TEOS-10.org % See section 3.29 of this TEOS-10 Manual. % -% McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2013: A -% computationally efficient 48-term expression for the density of -% seawater in terms of Conservative Temperature, and related properties -% of seawater. To be submitted to J. Atm. Ocean. Technol., xx, yyy-zzz. -% % The software is available from http://www.TEOS-10.org % %========================================================================== @@ -75,7 +69,7 @@ %-------------------------------------------------------------------------- if ~(nargin == 4) - error('gsw_geo_strf_Cunningham: Requires four inputs') + error('gsw_geo_strf_Cunningham: Requires four inputs') end %if unique_p_ref = unique(p_ref); diff --git a/Toolbox/gsw_geo_strf_Montgomery.m b/Toolbox/gsw_geo_strf_Montgomery.m index f7ee54f..9b52847 100644 --- a/Toolbox/gsw_geo_strf_Montgomery.m +++ b/Toolbox/gsw_geo_strf_Montgomery.m @@ -17,7 +17,7 @@ % for the specific volume anomaly are SA = SSO = 35.16504 g/kg and % CT = 0 deg C. This function calculates specific volume anomaly using % the computationally efficient 48-term expression for specific volume of -% McDougall et al. (2013). +% IOC et al. (2010). % % Note that p_ref, is the reference pressure to which the streamfunction % is referenced. When p_ref is zero, "gsw_geo_strf_Montgomery" returns @@ -27,7 +27,7 @@ % % Note that the 48-term equation has been fitted in a restricted range of % parameter space, and is most accurate inside the "oceanographic funnel" -% described in McDougall et al. (2013). The GSW library function +% described in IOC et al. (2010). The GSW library function % "gsw_infunnel(SA,CT,p)" is avaialble to be used if one wants to test if % some of one's data lies outside this "funnel". % @@ -51,7 +51,7 @@ % AUTHOR: % Trevor McDougall and Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (15th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of @@ -60,11 +60,6 @@ % UNESCO (English), 196 pp. Available from http://www.TEOS-10.org % See section 3.28 of this TEOS-10 Manual. % -% McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2013: A -% computationally efficient 48-term expression for the density of -% seawater in terms of Conservative Temperature, and related properties -% of seawater. To be submitted to J. Atm. Ocean. Technol., xx, yyy-zzz. -% % Montgomery, R. B., 1937: A suggested method for representing gradient % flow in isentropic surfaces. Bull. Amer. Meteor. Soc. 18, 210-212. % @@ -77,7 +72,7 @@ %-------------------------------------------------------------------------- if ~(nargin == 4) - error('gsw_geo_strf_Montgomery: Requires four inputs') + error('gsw_geo_strf_Montgomery: Requires four inputs') end %if unique_p_ref = unique(p_ref); diff --git a/Toolbox/gsw_geo_strf_dyn_height.m b/Toolbox/gsw_geo_strf_dyn_height.m index 21e1ca8..8b249b3 100644 --- a/Toolbox/gsw_geo_strf_dyn_height.m +++ b/Toolbox/gsw_geo_strf_dyn_height.m @@ -20,7 +20,7 @@ % reference values used for the specific volume anomaly are % SSO = 35.16504 g/kg and CT = 0 deg C. This function calculates % specific volume anomaly using the computationally efficient 48-term -% expression for specific volume of McDougall et al. (2011). +% expression for specific volume of IOC et al. (2010). % % This function evaluates the pressure integral of specific volume using % SA and CT “interpolated” with respect to pressure using a scheme based @@ -32,7 +32,7 @@ % % Note that the 48-term equation has been fitted in a restricted range of % parameter space, and is most accurate inside the "oceanographic funnel" -% described in McDougall et al. (2011). For dynamical oceanography we may +% described in IOC et al. (2010). For dynamical oceanography we may % take the 48-term rational function expression for density as essentially % reflecting the full accuracy of TEOS-10. The GSW library function % "gsw_infunnel(SA,CT,p)" is avaialble to be used if one wants to test if @@ -60,7 +60,7 @@ % AUTHOR: % Paul Barker, Jeff Dunn and Trevor McDougall [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (15th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of @@ -69,11 +69,6 @@ % UNESCO (English), 196 pp. Available from http://www.TEOS-10.org % See Eqn. (3.7.3) and section 3.27 of this TEOS-10 Manual. % -% McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2013: A -% computationally efficient 48-term expression for the density of -% seawater in terms of Conservative Temperature, and related properties -% of seawater. To be submitted to J. Atm. Ocean. Technol., xx, yyy-zzz. -% % Reiniger, R. F. and C. K. Ross, 1968: A method of interpolation with % application to oceanographic data. Deep-Sea Res. 15, 185-193. % @@ -481,7 +476,9 @@ return; end -if nargin<3 | isempty(maxdis); maxdis = 1; end +if nargin<3 | isempty(maxdis); + maxdis = 1; +end if ndeps < 4 | maxdis == -1 sidx = (1:nlvl)'; @@ -588,9 +585,15 @@ yi = []; return; end -if size(x,1) == 1; x =x'; end -if size(y,1) == 1; y =y'; end -if size(xi,1) == 1; xi =xi'; end +if size(x,1) == 1; + x =x'; +end +if size(y,1) == 1; + y = y'; +end +if size(xi,1) == 1; + xi =xi'; +end tidx = (1:length(xi))'; yi = repmat(NaN,size(tidx)); if x(nobs)>x(1) diff --git a/Toolbox/gsw_geo_strf_dyn_height_pc.m b/Toolbox/gsw_geo_strf_dyn_height_pc.m index 5d29368..92c973a 100644 --- a/Toolbox/gsw_geo_strf_dyn_height_pc.m +++ b/Toolbox/gsw_geo_strf_dyn_height_pc.m @@ -24,11 +24,11 @@ % given at the mid-point pressures, p_mid, of each layer in which SA and % CT are vertically piecewice constant (pc). This function calculates % specific volume anomaly using the computationally-efficient 48-term -% expression for specific volume of McDougall et al. (2013). +% expression for specific volume of IOC et al. (2010). % % Note that the 48-term equation has been fitted in a restricted range of % parameter space, and is most accurate inside the "oceanographic funnel" -% described in McDougall et al. (2013). The GSW library function +% described in IOC et al. (2010). The GSW library function % "gsw_infunnel(SA,CT,p)" is avaialble to be used if one wants to test if % some of one's data lies outside this "funnel". % @@ -51,7 +51,7 @@ % AUTHOR: % Trevor McDougall and Claire Roberts-Thomson [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (15th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of @@ -60,11 +60,6 @@ % UNESCO (English), 196 pp. Available from http://www.TEOS-10.org % See Eqns. (3.32.2) and (A.30.6) of this TEOS-10 Manual. % -% McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2013: A -% computationally efficient 48-term expression for the density of -% seawater in terms of Conservative Temperature, and related properties -% of seawater. To be submitted to J. Atm. Ocean. Technol., xx, yyy-zzz. -% % McDougall, T. J. and A. Klocker, 2010: An approximate geostrophic % streamfunction for use in density surfaces. Ocean Modelling, 32, % 105-117. diff --git a/Toolbox/gsw_geo_strf_isopycnal.m b/Toolbox/gsw_geo_strf_isopycnal.m index 9c25872..7cbdb84 100644 --- a/Toolbox/gsw_geo_strf_isopycnal.m +++ b/Toolbox/gsw_geo_strf_isopycnal.m @@ -21,7 +21,7 @@ % variable being Neutral_Density (gamma_n). This function calculates % specific volume anomaly using the computationally efficient 48-term % expression for specific volume anomaly in terms of SA, CT and p -% (McDougall et al., 2011). +% (IOC et al., 2010). % % The first three input arguments are a series of vertical profiles. The % fourth argument, p_ref, is the reference pressure to which the stream @@ -74,7 +74,7 @@ % AUTHOR: % Trevor McDougall and Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (15th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of @@ -89,11 +89,6 @@ % Klocker, A., T. J. McDougall and D. R. Jackett, 2009: A new method % for forming approximately neutral surfaces. Ocean Sci., 5, 155-172. % -% McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2013: A -% computationally efficient 48-term expression for the density of -% seawater in terms of Conservative Temperature, and related properties -% of seawater. To be submitted to J. Atm. Ocean. Technol., xx, yyy-zzz. -% % McDougall, T. J. and A. Klocker, 2010: An approximate geostrophic % streamfunction for use in density surfaces. Ocean Modelling, 32, % 105-117. diff --git a/Toolbox/gsw_geo_strf_isopycnal_pc.m b/Toolbox/gsw_geo_strf_isopycnal_pc.m index 6f6ccfc..6b79969 100644 --- a/Toolbox/gsw_geo_strf_isopycnal_pc.m +++ b/Toolbox/gsw_geo_strf_isopycnal_pc.m @@ -21,7 +21,7 @@ % interpolation of a one-dimensional look-up table, with the interpolating % variable being Neutral Density (gamma_n) or sigma_2. This function % calculates specific volume anomaly using the computationally efficient -% 48-term expression for specific volume of McDougall et al. (2011). +% 48-term expression for specific volume of IOC et al. (2010). % % INPUT: % SA = Absolute Salinity [ g/kg ] @@ -52,7 +52,7 @@ % AUTHOR: % Trevor McDougall and Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (15th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of @@ -67,11 +67,6 @@ % Klocker, A., T. J. McDougall and D. R. Jackett, 2009: A new method % for forming approximately neutral surfaces. Ocean Sci., 5, 155-172. % -% McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2013: A -% computationally efficient 48-term expression for the density of -% seawater in terms of Conservative Temperature, and related properties -% of seawater. To be submitted to J. Atm. Ocean. Technol., xx, yyy-zzz. -% % McDougall, T. J. and A. Klocker, 2010: An approximate geostrophic % streamfunction for use in density surfaces. Ocean Modelling, 32, % 105-117. diff --git a/Toolbox/gsw_geostrophic_velocity.m b/Toolbox/gsw_geostrophic_velocity.m index d7eef4a..ba225b8 100644 --- a/Toolbox/gsw_geostrophic_velocity.m +++ b/Toolbox/gsw_geostrophic_velocity.m @@ -59,7 +59,7 @@ % AUTHOR: % Paul Barker, Trevor McDougall and Phil Morgan [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (15th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % Cunningham, S. A., 2000: Circulation and volume flux of the North @@ -78,11 +78,6 @@ % Klocker, A., T. J. McDougall and D. R. Jackett, 2009: A new method for % forming approximately neutral surfaces. Ocean Sci., 5, 155-172. % -% McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2013: A -% computationally efficient 48-term expression for the density of -% seawater in terms of Conservative Temperature, and related properties -% of seawater. To be submitted to J. Atm. Ocean. Technol., xx, yyy-zzz. -% % McDougall, T. J. and A. Klocker, 2010: An approximate geostrophic % streamfunction for use in density surfaces. Ocean Modelling, 32, % 105-117. diff --git a/Toolbox/gsw_grav.m b/Toolbox/gsw_grav.m index f609111..07fd193 100644 --- a/Toolbox/gsw_grav.m +++ b/Toolbox/gsw_grav.m @@ -27,7 +27,7 @@ % AUTHOR: % Trevor McDougall & Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (15th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of diff --git a/Toolbox/gsw_internal_energy.m b/Toolbox/gsw_internal_energy.m index 2093048..201dad7 100644 --- a/Toolbox/gsw_internal_energy.m +++ b/Toolbox/gsw_internal_energy.m @@ -10,11 +10,11 @@ % DESCRIPTION: % Calculates specific internal energy of seawater using the % computationally-efficient 48-term expression for density in terms of SA, -% CT and p (McDougall et al., 2013). +% CT and p (IOC et al., 2010). % % Note that the 48-term equation has been fitted in a restricted range of % parameter space, and is most accurate inside the "oceanographic funnel" -% described in McDougall et al. (2013). The GSW library function +% described in IOC et al. (2010). The GSW library function % "gsw_infunnel(SA,CT,p)" is avaialble to be used if one wants to test if % some of one's data lies outside this "funnel". % @@ -33,7 +33,7 @@ % AUTHOR: % Trevor McDougall and Paul Barker. [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (15th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of @@ -41,11 +41,6 @@ % Intergovernmental Oceanographic Commission, Manuals and Guides No. 56, % UNESCO (English), 196 pp. Available from http://www.TEOS-10.org % -% McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2013: A -% computationally efficient 48-term expression for the density of -% seawater in terms of Conservative Temperature, and related properties -% of seawater. To be submitted to J. Atm. Ocean. Technol., xx, yyy-zzz. -% % The software is available from http://www.TEOS-10.org % %========================================================================== diff --git a/Toolbox/gsw_internal_energy_CT.m b/Toolbox/gsw_internal_energy_CT.m index 34982b9..b804e7f 100644 --- a/Toolbox/gsw_internal_energy_CT.m +++ b/Toolbox/gsw_internal_energy_CT.m @@ -16,11 +16,11 @@ % DESCRIPTION: % Calculates specific internal energy of seawater using the % computationally-efficient 48-term expression for density in terms of SA, -% CT and p (McDougall et al., 2013). +% CT and p (IOC et al., 2010). % % Note that the 48-term equation has been fitted in a restricted range of % parameter space, and is most accurate inside the "oceanographic funnel" -% described in McDougall et al. (2013). The GSW library function +% described in IOC et al. (2010). The GSW library function % "gsw_infunnel(SA,CT,p)" is avaialble to be used if one wants to test if % some of one's data lies outside this "funnel". % @@ -39,7 +39,7 @@ % AUTHOR: % Trevor McDougall and Paul Barker. [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (15th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of @@ -47,11 +47,6 @@ % Intergovernmental Oceanographic Commission, Manuals and Guides No. 56, % UNESCO (English), 196 pp. Available from http://www.TEOS-10.org % -% McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2013: A -% computationally efficient 48-term expression for the density of -% seawater in terms of Conservative Temperature, and related properties -% of seawater. To be submitted to J. Atm. Ocean. Technol., xx, yyy-zzz. -% % The software is available from http://www.TEOS-10.org % %========================================================================== diff --git a/Toolbox/gsw_internal_energy_CT_exact.m b/Toolbox/gsw_internal_energy_CT_exact.m index b64a1b8..04d4a1e 100644 --- a/Toolbox/gsw_internal_energy_CT_exact.m +++ b/Toolbox/gsw_internal_energy_CT_exact.m @@ -25,7 +25,7 @@ % AUTHOR: % Trevor McDougall [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (15th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of diff --git a/Toolbox/gsw_ionic_strength_from_SA.m b/Toolbox/gsw_ionic_strength_from_SA.m index 03f91e7..2049636 100644 --- a/Toolbox/gsw_ionic_strength_from_SA.m +++ b/Toolbox/gsw_ionic_strength_from_SA.m @@ -18,7 +18,7 @@ % AUTHOR: % Trevor McDougall and Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (15th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of diff --git a/Toolbox/gsw_isopycnal_slope_ratio.m b/Toolbox/gsw_isopycnal_slope_ratio.m index 926d8d0..3ddb577 100644 --- a/Toolbox/gsw_isopycnal_slope_ratio.m +++ b/Toolbox/gsw_isopycnal_slope_ratio.m @@ -11,11 +11,11 @@ % DESCRIPTION: % Calculates the ratio of alpha/beta at pressure, p, to that at reference % pressure, p_ref. This function uses the computationally-efficient 48-term -% expression for density in terms of SA, CT & p (McDougall et al., 2011). +% expression for density in terms of SA, CT & p (IOC et al., 2010). % % Note that the 48-term equation has been fitted in a restricted range of % parameter space, and is most accurate inside the "oceanographic funnel" -% described in McDougall et al. (2011). The GSW library function +% described in IOC et al. (2010). The GSW library function % "gsw_infunnel(SA,CT,p)" is avaialble to be used if one wants to test if % some of one's data lies outside this "funnel". % @@ -39,7 +39,7 @@ % AUTHOR: % Trevor McDougall, Paul Barker & David Jackett [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (15th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of @@ -48,11 +48,6 @@ % UNESCO (English), 196 pp. Available from http://www.TEOS-10.org. % See Eqn. (3.17.2) of this TEOS-10 Manual. % -% McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2013: A -% computationally efficient 48-term expression for the density of -% seawater in terms of Conservative Temperature, and related properties -% of seawater. To be submitted to J. Atm. Ocean. Technol., xx, yyy-zzz. -% % This software is available from http://www.TEOS-10.org % %========================================================================== diff --git a/Toolbox/gsw_isopycnal_vs_ntp_CT_ratio.m b/Toolbox/gsw_isopycnal_vs_ntp_CT_ratio.m index 16e2393..6f09866 100644 --- a/Toolbox/gsw_isopycnal_vs_ntp_CT_ratio.m +++ b/Toolbox/gsw_isopycnal_vs_ntp_CT_ratio.m @@ -19,11 +19,11 @@ % vertical. The reference sea pressure of the potential density surface % must have a constant value. This function uses the computationally % efficient 48-term expression for density in terms of SA, CT and p -% (McDougall et al., 2013). +% (IOC et al., 2010). % % Note that the 48-term equation has been fitted in a restricted range of % parameter space, and is most accurate inside the "oceanographic funnel" -% described in McDougall et al. (2013). The GSW library function +% described in IOC et al. (2010). The GSW library function % "gsw_infunnel(SA,CT,p)" is avaialble to be used if one wants to test if % some of one's data lies outside this "funnel". % @@ -51,7 +51,7 @@ % AUTHOR: % Trevor McDougall, Paul Barker & David Jackett [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (15th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of @@ -63,11 +63,6 @@ % McDougall, T. J., 1987: Neutral surfaces. Journal of Physical % Oceanography, 17, 1950-1964. See Eqn. (29) of this paper. % -% McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2013: A -% computationally efficient 48-term expression for the density of -% seawater in terms of Conservative Temperature, and related properties -% of seawater. To be submitted to J. Atm. Ocean. Technol., xx, yyy-zzz. -% % The software is available from http://www.TEOS-10.org % %========================================================================== diff --git a/Toolbox/gsw_kappa.m b/Toolbox/gsw_kappa.m new file mode 100644 index 0000000..fa5cdf0 --- /dev/null +++ b/Toolbox/gsw_kappa.m @@ -0,0 +1,201 @@ +function kappa = gsw_kappa(SA,CT,p) + +% gsw_kappa isentropic compressibility (48-term equation) +%========================================================================== +% +% USAGE: +% kappa = gsw_kappa(SA,CT,p) +% +% DESCRIPTION: +% Calculates the isentropic compressibility of seawater. This function +% has inputs of Absolute Salinity and Conservative Temperature. This +% function uses the computationally-efficient 48-term expression for +% density in terms of SA, CT and p (IOC et al., 2010). +% +% Note that the 48-term equation has been fitted in a restricted range of +% parameter space, and is most accurate inside the "oceanographic funnel" +% described in IOC et al. (2010). The GSW library function +% "gsw_infunnel(SA,CT,p)" is avaialble to be used if one wants to test if +% some of one's data lies outside this "funnel". +% +% INPUT: +% SA = Absolute Salinity [ g/kg ] +% CT = Conservative Temperature (ITS-90) [ deg C ] +% p = sea pressure [ dbar ] +% ( i.e. absolute pressure - 10.1325 dbar ) +% +% SA & CT need to have the same dimensions. +% p may have dimensions 1x1 or Mx1 or 1xN or MxN, where SA & CT are MxN. +% +% OUTPUT: +% kappa = isentropic compressibility of seawater [ 1/Pa ] +% +% AUTHOR: +% Paul Barker and Trevor McDougall [ help@teos-10.org ] +% +% VERSION NUMBER: 3.03 (29th April, 2013) +% +% REFERENCES: +% IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of +% seawater - 2010: Calculation and use of thermodynamic properties. +% Intergovernmental Oceanographic Commission, Manuals and Guides No. 56, +% UNESCO (English), 196 pp. Available from http://www.TEOS-10.org +% See Eqn. (2.17.1) of this TEOS-10 Manual. +% +% The software is available from http://www.TEOS-10.org +% +%========================================================================== + +%-------------------------------------------------------------------------- +% Check variables and resize if necessary +%-------------------------------------------------------------------------- + +if ~(nargin == 3) + error('gsw_kappa: Requires three inputs') +end %if + +[ms,ns] = size(SA); +[mt,nt] = size(CT); +[mp,np] = size(p); + +if (mt ~= ms | nt ~= ns) + error('gsw_kappa: SA and CT must have same dimensions') +end + +if (mp == 1) & (np == 1) % p scalar - fill to size of SA + p = p*ones(size(SA)); +elseif (ns == np) & (mp == 1) % p is row vector, + p = p(ones(1,ms), :); % copy down each column. +elseif (ms == mp) & (np == 1) % p is column vector, + p = p(:,ones(1,ns)); % copy across each row. +elseif (ns == mp) & (np == 1) % p is a transposed row vector, + p = p.'; % transposed then + p = p(ones(1,ms), :); % copy down each column. +elseif (ms == mp) & (ns == np) + % ok +else + error('gsw_kappa: Inputs array dimensions arguments do not agree') +end %if + +if ms == 1 + SA = SA.'; + CT = CT.'; + p = p.'; + transposed = 1; +else + transposed = 0; +end + +%-------------------------------------------------------------------------- +% Start of the calculation +%-------------------------------------------------------------------------- + +% This line ensures that SA is non-negative. +SA(SA < 0) = 0; + + +v01 = 9.998420897506056e+2; +v02 = 2.839940833161907; +v03 = -3.147759265588511e-2; +v04 = 1.181805545074306e-3; +v05 = -6.698001071123802; +v06 = -2.986498947203215e-2; +v07 = 2.327859407479162e-4; +v08 = -3.988822378968490e-2; +v09 = 5.095422573880500e-4; +v10 = -1.426984671633621e-5; +v11 = 1.645039373682922e-7; +v12 = -2.233269627352527e-2; +v13 = -3.436090079851880e-4; +v14 = 3.726050720345733e-6; +v15 = -1.806789763745328e-4; +v16 = 6.876837219536232e-7; +v17 = -3.087032500374211e-7; +v18 = -1.988366587925593e-8; +v19 = -1.061519070296458e-11; +v20 = 1.550932729220080e-10; + +v21 = 1.0; +v22 = 2.775927747785646e-3; +v23 = -2.349607444135925e-5; +v24 = 1.119513357486743e-6; +v25 = 6.743689325042773e-10; +v26 = -7.521448093615448e-3; +v27 = -2.764306979894411e-5; +v28 = 1.262937315098546e-7; +v29 = 9.527875081696435e-10; +v30 = -1.811147201949891e-11; +v31 = -3.303308871386421e-5; +v32 = 3.801564588876298e-7; +v33 = -7.672876869259043e-9; +v34 = -4.634182341116144e-11; +v35 = 2.681097235569143e-12; +v36 = 5.419326551148740e-6; +v37 = -2.742185394906099e-5; +v38 = -3.212746477974189e-7; +v39 = 3.191413910561627e-9; +v40 = -1.931012931541776e-12; +v41 = -1.105097577149576e-7; +v42 = 6.211426728363857e-10; +v43 = -1.119011592875110e-10; +v44 = -1.941660213148725e-11; +v45 = -1.864826425365600e-14; +v46 = 1.119522344879478e-14; +v47 = -1.200507748551599e-15; +v48 = 6.057902487546866e-17; + +c01 = -2.233269627352527e-2; +c02 = -3.436090079851880e-4; +c03 = 3.726050720345733e-6; +c04 = -1.806789763745328e-4; +c05 = 6.876837219536232e-7; +c06 = -6.174065000748422e-7; +c07 = -3.976733175851186e-8; +c08 = -2.123038140592916e-11; +c09 = 3.101865458440160e-10; + +c10 = -2.742185394906099e-5; +c11 = -3.212746477974189e-7; +c12 = 3.191413910561627e-9; +c13 = -1.931012931541776e-12; +c14 = -1.105097577149576e-7; +c15 = 6.211426728363857e-10; +c16 = -2.238023185750219e-10; +c17 = -3.883320426297450e-11; +c18 = -3.729652850731201e-14; +c19 = 2.239044689758956e-14; +c20 = -3.601523245654798e-15; +c21 = 1.817370746264060e-16; + +sqrtSA = sqrt(SA); + +v_hat_denominator = v01 + CT.*(v02 + CT.*(v03 + v04*CT)) ... + + SA.*(v05 + CT.*(v06 + v07*CT) ... + + sqrtSA.*(v08 + CT.*(v09 + CT.*(v10 + v11*CT)))) ... + + p.*(v12 + CT.*(v13 + v14*CT) + SA.*(v15 + v16*CT) ... + + p.*(v17 + CT.*(v18 + v19*CT) + v20*SA)); + +v_hat_numerator = v21 + CT.*(v22 + CT.*(v23 + CT.*(v24 + v25*CT))) ... + + SA.*(v26 + CT.*(v27 + CT.*(v28 + CT.*(v29 + v30*CT))) + v36*SA ... + + sqrtSA.*(v31 + CT.*(v32 + CT.*(v33 + CT.*(v34 + v35*CT))))) ... + + p.*(v37 + CT.*(v38 + CT.*(v39 + v40*CT)) ... + + SA.*(v41 + v42*CT) ... + + p.*(v43 + CT.*(v44 + v45*CT + v46*SA) ... + + p.*(v47 + v48*CT))); + +dvden_dp = c01 + CT.*(c02 + c03*CT) ... + + SA.*(c04 + c05*CT) ... + + p.*(c06 + CT.*(c07 + c08*CT) + c09*SA); + +dvnum_dp = c10 + CT.*(c11 + CT.*(c12 + c13*CT)) ... + + SA.*(c14 + c15*CT) ... + + p.*(c16 + CT.*(c17 + c18*CT + c19*SA) ... + + p.*(c20 + c21*CT)); + +kappa = 1e-4.*(dvden_dp./v_hat_denominator - dvnum_dp./v_hat_numerator); + +if transposed + kappa = kappa.'; +end + +end \ No newline at end of file diff --git a/Toolbox/gsw_kappa_CT.m b/Toolbox/gsw_kappa_CT.m new file mode 100644 index 0000000..0333fef --- /dev/null +++ b/Toolbox/gsw_kappa_CT.m @@ -0,0 +1,102 @@ +function kappa = gsw_kappa_CT(SA,CT,p) + +% gsw_kappa isentropic compressibility (48-term equation) +%========================================================================== +% +% USAGE: +% kappa = gsw_kappa(SA,CT,p) +% +% DESCRIPTION: +% Calculates the isentropic compressibility of seawater. This function +% has inputs of Absolute Salinity and Conservative Temperature. This +% function uses the computationally-efficient 48-term expression for +% density in terms of SA, CT and p (IOC et al., 2010). +% +% Note that the 48-term equation has been fitted in a restricted range of +% parameter space, and is most accurate inside the "oceanographic funnel" +% described in IOC et al. (2010). The GSW library function +% "gsw_infunnel(SA,CT,p)" is avaialble to be used if one wants to test if +% some of one's data lies outside this "funnel". +% +% INPUT: +% SA = Absolute Salinity [ g/kg ] +% CT = Conservative Temperature (ITS-90) [ deg C ] +% p = sea pressure [ dbar ] +% ( i.e. absolute pressure - 10.1325 dbar ) +% +% SA & CT need to have the same dimensions. +% p may have dimensions 1x1 or Mx1 or 1xN or MxN, where SA & CT are MxN. +% +% OUTPUT: +% kappa = isentropic compressibility of seawater [ 1/Pa ] +% +% AUTHOR: +% Paul Barker and Trevor McDougall [ help@teos-10.org ] +% +% VERSION NUMBER: 3.03 (26th Febuary, 2013) +% +% REFERENCES: +% IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of +% seawater - 2010: Calculation and use of thermodynamic properties. +% Intergovernmental Oceanographic Commission, Manuals and Guides No. 56, +% UNESCO (English), 196 pp. Available from http://www.TEOS-10.org +% See Eqn. (2.17.1) of this TEOS-10 Manual. +% +% The software is available from http://www.TEOS-10.org +% +%========================================================================== + +%-------------------------------------------------------------------------- +% Check variables and resize if necessary +%-------------------------------------------------------------------------- + +if ~(nargin == 3) + error('gsw_kappa: Requires three inputs') +end %if + +[ms,ns] = size(SA); +[mt,nt] = size(CT); +[mp,np] = size(p); + +if (mt ~= ms | nt ~= ns) + error('gsw_kappa: SA and CT must have same dimensions') +end + +if (mp == 1) & (np == 1) % p scalar - fill to size of SA + p = p*ones(size(SA)); +elseif (ns == np) & (mp == 1) % p is row vector, + p = p(ones(1,ms), :); % copy down each column. +elseif (ms == mp) & (np == 1) % p is column vector, + p = p(:,ones(1,ns)); % copy across each row. +elseif (ns == mp) & (np == 1) % p is a transposed row vector, + p = p.'; % transposed then + p = p(ones(1,ms), :); % copy down each column. +elseif (ms == mp) & (ns == np) + % ok +else + error('gsw_kappa: Inputs array dimensions arguments do not agree') +end %if + +if ms == 1 + SA = SA.'; + CT = CT.'; + p = p.'; + transposed = 1; +else + transposed = 0; +end + +%-------------------------------------------------------------------------- +% Start of the calculation +%-------------------------------------------------------------------------- + +% This line ensures that SA is non-negative. +SA(SA < 0) = 0; + +kappa = gsw_kappa(SA,CT,p); + +if transposed + kappa = kappa.'; +end + +end \ No newline at end of file diff --git a/Toolbox/gsw_kappa_CT_exact.m b/Toolbox/gsw_kappa_CT_exact.m new file mode 100644 index 0000000..8f6508c --- /dev/null +++ b/Toolbox/gsw_kappa_CT_exact.m @@ -0,0 +1,102 @@ +function kappa_CT_exact = gsw_kappa_CT_exact(SA,CT,p) + +% gsw_kappa_CT_exact isentropic compressibility +%========================================================================== +% +% USAGE: +% kappa_CT_exact = gsw_kappa_CT_exact(SA,CT,p) +% +% DESCRIPTION: +% Calculates the isentropic compressibility of seawater. +% +% INPUT: +% SA = Absolute Salinity [ g/kg ] +% CT = Conservative Temperature (ITS-90) [ deg C ] +% p = sea pressure [ dbar ] +% ( i.e. absolute pressure - 10.1325 dbar ) +% +% SA & CT need to have the same dimensions. +% p may have dimensions 1x1 or Mx1 or 1xN or MxN, where SA & CT are MxN. +% +% OUTPUT: +% kappa_CT_exact = isentropic compressibility [ 1/Pa ] +% Note. The output units are 1/Pa not 1/dbar. +% +% AUTHOR: +% Trevor McDougall and Paul Barker [ help@teos-10.org ] +% +% VERSION NUMBER: 3.03 (28th Febuary, 2013) +% +% REFERENCES: +% IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of +% seawater - 2010: Calculation and use of thermodynamic properties. +% Intergovernmental Oceanographic Commission, Manuals and Guides No. 56, +% UNESCO (English), 196 pp. Available from http://www.TEOS-10.org +% See Eqns. (2.16.1) and the row for kappa in Table P.1 of appendix P +% of this TEOS-10 Manual. +% +% The software is available from http://www.TEOS-10.org +% +%========================================================================== + +%-------------------------------------------------------------------------- +% Check variables and resize if necessary +%-------------------------------------------------------------------------- + +if ~(nargin == 3) + error('gsw_kappa_CT_exact: Requires three inputs') +end %if + +[ms,ns] = size(SA); +[mt,nt] = size(CT); +[mp,np] = size(p); + +if (mt ~= ms | nt ~= ns) + error('gsw_kappa_CT_exact: SA and CT must have same dimensions') +end + +if (mp == 1) & (np == 1) % p scalar - fill to size of SA + p = p*ones(size(SA)); +elseif (ns == np) & (mp == 1) % p is row vector, + p = p(ones(1,ms), :); % copy down each column. +elseif (ms == mp) & (np == 1) % p is column vector, + p = p(:,ones(1,ns)); % copy across each row. +elseif (ns == mp) & (np == 1) % p is a transposed row vector, + p = p.'; % transposed then + p = p(ones(1,ms), :); % copy down each column. +elseif (ms == mp) & (ns == np) + % ok +else + error('gsw_kappa_CT_exact: Inputs array dimensions arguments do not agree') +end %if + +if ms == 1 + SA = SA.'; + CT = CT.'; + p = p.'; + transposed = 1; +else + transposed = 0; +end + +%-------------------------------------------------------------------------- +% Start of the calculation +%-------------------------------------------------------------------------- + +n0 = 0; +n1 = 1; +n2 = 2; + +t = gsw_t_from_CT(SA,CT,p); + +g_tt = gsw_gibbs(n0,n2,n0,SA,t,p); +g_tp = gsw_gibbs(n0,n1,n1,SA,t,p); + +kappa_CT_exact = (g_tp.*g_tp - g_tt.*gsw_gibbs(n0,n0,n2,SA,t,p))./ ... + (gsw_gibbs(n0,n0,n1,SA,t,p).*g_tt); + +if transposed + kappa_CT_exact = kappa_CT_exact.'; +end + +end \ No newline at end of file diff --git a/Toolbox/gsw_latentheat_evap_CT.m b/Toolbox/gsw_latentheat_evap_CT.m index f66138a..8937c07 100644 --- a/Toolbox/gsw_latentheat_evap_CT.m +++ b/Toolbox/gsw_latentheat_evap_CT.m @@ -25,7 +25,7 @@ % AUTHOR: % Paul Barker, Trevor McDougall & Rainer Feistel [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (15th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of diff --git a/Toolbox/gsw_latentheat_evap_t.m b/Toolbox/gsw_latentheat_evap_t.m index a6d8ac3..fc44444 100644 --- a/Toolbox/gsw_latentheat_evap_t.m +++ b/Toolbox/gsw_latentheat_evap_t.m @@ -24,7 +24,7 @@ % AUTHOR: % Paul Barker, Trevor McDougall & Rainer Feistel [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (15th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of diff --git a/Toolbox/gsw_latentheat_melting.m b/Toolbox/gsw_latentheat_melting.m index dd037ab..bd0e8a1 100644 --- a/Toolbox/gsw_latentheat_melting.m +++ b/Toolbox/gsw_latentheat_melting.m @@ -25,7 +25,7 @@ % AUTHOR: % Paul Barker, Trevor McDougall & Rainer Feistel [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (15th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of diff --git a/Toolbox/gsw_molality_from_SA.m b/Toolbox/gsw_molality_from_SA.m index 962375c..d94d644 100644 --- a/Toolbox/gsw_molality_from_SA.m +++ b/Toolbox/gsw_molality_from_SA.m @@ -18,7 +18,7 @@ % AUTHOR: % Trevor McDougall and Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (15th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of diff --git a/Toolbox/gsw_ntp_pt_vs_CT_ratio.m b/Toolbox/gsw_ntp_pt_vs_CT_ratio.m index b2fea36..35d0236 100644 --- a/Toolbox/gsw_ntp_pt_vs_CT_ratio.m +++ b/Toolbox/gsw_ntp_pt_vs_CT_ratio.m @@ -15,11 +15,11 @@ % neutral tangent plane. The potential temperature is the regular one % which has a reference sea pressure of 0 dbar. Part of the calculation % uses the computationally-efficient 48-term expression for density in -% terms of SA, CT and p (McDougall et al., 2013). +% terms of SA, CT and p (IOC et al., 2010). % % Note that the 48-term equation has been fitted in a restricted range of % parameter space, and is most accurate inside the "oceanographic funnel" -% described in McDougall et al. (2013). The GSW library function +% described in IOC et al. (2010). The GSW library function % "gsw_infunnel(SA,CT,p)" is avaialble to be used if one wants to test if % some of one's data lies outside this "funnel". % @@ -41,7 +41,7 @@ % AUTHOR: % Trevor McDougall and Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (15th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of @@ -50,11 +50,6 @@ % UNESCO (English), 196 pp. Available from http://www.TEOS-10.org. % See Eqn. (A.14.5) of this TEOS-10 Manual. % -% McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2013: A -% computationally efficient 48-term expression for the density of -% seawater in terms of Conservative Temperature, and related properties -% of seawater. To be submitted to J. Atm. Ocean. Technol., xx, yyy-zzz. -% % This software is available from http://www.TEOS-10.org % %========================================================================== diff --git a/Toolbox/gsw_p_from_Abs_Pressure.m b/Toolbox/gsw_p_from_Abs_Pressure.m index b0b2169..436b60e 100644 --- a/Toolbox/gsw_p_from_Abs_Pressure.m +++ b/Toolbox/gsw_p_from_Abs_Pressure.m @@ -19,7 +19,7 @@ % AUTHOR: % Trevor McDougall and Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (15th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of diff --git a/Toolbox/gsw_p_from_z.m b/Toolbox/gsw_p_from_z.m index 6441a44..dd2ac7f 100644 --- a/Toolbox/gsw_p_from_z.m +++ b/Toolbox/gsw_p_from_z.m @@ -1,23 +1,25 @@ -function p = gsw_p_from_z(z,lat,geo_strf_dyn_height) +function p = gsw_p_from_z(z,lat,geo_strf_dyn_height,sea_surface_geopotental) % gsw_p_from_z pressure from height %========================================================================== % % USAGE: -% p = gsw_p_from_z(z,lat,{geo_strf_dyn_height}) +% p = gsw_p_from_z(z,lat,{geo_strf_dyn_height},{sea_surface_geopotental}) % % DESCRIPTION: % Calculates sea pressure from height using computationally-efficient -% 48-term expression for density, in terms of SA, CT and p (McDougall et -% al., 2011). Dynamic height anomaly, geo_strf_dyn_height, if provided, -% must be computed with its p_ref = 0 (the surface). +% 48-term expression for density, in terms of SA, CT and p (IOC et +% al., 2010). Dynamic height anomaly, geo_strf_dyn_height, if provided, +% must be computed with its p_ref = 0 (the surface). Also if provided, +% sea_surface_geopotental is the geopotential at zero sea pressure. This +% function solves Eqn.(3.32.3) of IOC et al. (2010) iteratively for p. % % Note. Height (z) is NEGATIVE in the ocean. Depth is -z. % Depth is not used in the GSW computer software library. % % Note that the 48-term equation has been fitted in a restricted range of % parameter space, and is most accurate inside the "oceanographic funnel" -% described in McDougall et al. (2011). The GSW library function +% described in IOC et al. (2010). The GSW library function % "gsw_infunnel(SA,CT,p)" is avaialble to be used if one wants to test if % some of one's data lies outside this "funnel". % @@ -32,10 +34,11 @@ % geo_strf_dyn_height = dynamic height anomaly [ m^2/s^2 ] % Note that the reference pressure, p_ref, of geo_strf_dyn_height must % be zero (0) dbar. +% sea_surface_geopotental = geopotential at zero sea pressure. [ m ] % % lat may have dimensions 1x1 or Mx1 or 1xN or MxN, where z is MxN. -% geo_strf_dyn_height, if provided, must have dimensions MxN, which is -% the same as z. +% geo_strf_dyn_height and geo_strf_dyn_height, if provided, must have +% dimensions MxN, which are the same as z. % % OUTPUT: % p = sea pressure [ dbar ] @@ -45,7 +48,7 @@ % Trevor McDougall, Claire Roberts-Thomson and Paul Barker. % [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (15th November, 2012) +% VERSION NUMBER: 3.03 (19th July, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of @@ -53,14 +56,10 @@ % Intergovernmental Oceanographic Commission, Manuals and Guides No. 56, % UNESCO (English), 196 pp. Available from http://www.TEOS-10.org % -% McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2013: A -% computationally efficient 48-term expression for the density of -% seawater in terms of Conservative Temperature, and related properties -% of seawater. To be submitted to J. Atm. Ocean. Technol., xx, yyy-zzz. -% % McDougall T.J. and S.J. Wotherspoon, 2012: A simple modification of % Newton’s method to achieve convergence of order "1 + sqrt(2)". -% Submitted to Applied Mathematics and Computation. +% Submitted to Applied Mathematics and Computation. +% % Moritz (2000) Goedetic reference system 1980. J. Geodesy, 74, 128-133. % % Saunders, P. M., 1981: Practical conversion of pressure to depth. @@ -74,21 +73,33 @@ % Check variables and resize if necessary %-------------------------------------------------------------------------- -if ~(nargin == 2 | nargin == 3) - error('gsw_p_from_z: Requires two or three inputs') +if ~(nargin == 2 | nargin == 3 | nargin == 4) + error('gsw_p_from_z: Requires two, three or four inputs') end %if +if any(z > 5) + error('gsw_p_from_z: The input z should be negative and values must be less than 5 m.') +end + if ~exist('geo_strf_dyn_height','var') geo_strf_dyn_height = zeros(size(z)); end +if ~exist('sea_surface_geopotental','var') + sea_surface_geopotental = zeros(size(z)); +end + [mz,nz] = size(z); [ml,nl] = size(lat); [mdh,ndh] = size(geo_strf_dyn_height); +[msg,nsg] = size(sea_surface_geopotental); if (mz ~= mdh) | (nz ~= ndh) error('gsw_p_from_z: height & dynamic height anomaly need to have the same dimensions') end +if (mdh ~= msg) | (ndh ~= nsg) + error('gsw_p_from_z: dynamic height anomaly & the geopotential at zero sea pressure need to have the same dimensions') +end if (ml == 1) & (nl == 1) % lat is a scalar - fill to size of z lat = lat*ones(size(z)); @@ -109,6 +120,7 @@ z = z.'; lat = lat.'; geo_strf_dyn_height = geo_strf_dyn_height.'; + sea_surface_geopotental = sea_surface_geopotental.'; transposed = 1; else transposed = 0; @@ -119,11 +131,14 @@ %-------------------------------------------------------------------------- db2Pa = 1e4; -gamma = 2.26e-7; -DEG2RAD = pi/180; -X = sin(lat*DEG2RAD); -sin2 = X.*X; -gs = 9.780327*(1.0 + (5.2792e-3 + (2.32e-5*sin2)).*sin2); +gamma = 2.26e-7; % If the graviational acceleration were to be regarded as + % being depth-independent, which is often the case in + % ocean models, then gamma would be set to be zero here, + % and the code below works perfectly well. +deg2rad = pi/180; +X = sin(lat*deg2rad); +sin2 = X.*X; +gs = 9.780327*(1.0 + (5.2792e-3 + (2.32e-5*sin2)).*sin2); % get the first estimate of p from Saunders (1981) c1 = 5.25e-3*sin2 + 5.92e-3; @@ -132,7 +147,8 @@ df_dp = db2Pa * gsw_specvol_SSO_0_p(p); % initial value of the derivative of f -f = gsw_enthalpy_SSO_0_p(p) + gs.*(z - 0.5*gamma*(z.*z)) - geo_strf_dyn_height; +f = gsw_enthalpy_SSO_0_p(p) + gs.*(z - 0.5*gamma*(z.*z)) ... + - (geo_strf_dyn_height + sea_surface_geopotental); p_old = p; p = p_old - f./df_dp; p_mid = 0.5*(p + p_old); diff --git a/Toolbox/gsw_pot_enthalpy_from_pt.m b/Toolbox/gsw_pot_enthalpy_from_pt.m index f242cdf..8c1f844 100644 --- a/Toolbox/gsw_pot_enthalpy_from_pt.m +++ b/Toolbox/gsw_pot_enthalpy_from_pt.m @@ -22,7 +22,7 @@ % AUTHOR: % David Jackett, Trevor McDougall and Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (15th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % This function is unchanged from version 2.0 (24th September, 2010). % % REFERENCES: diff --git a/Toolbox/gsw_pt0_from_t.m b/Toolbox/gsw_pt0_from_t.m index 004f608..cad7bcb 100644 --- a/Toolbox/gsw_pt0_from_t.m +++ b/Toolbox/gsw_pt0_from_t.m @@ -33,8 +33,7 @@ % Trevor McDougall, David Jackett, Claire Roberts-Thomson and Paul Barker. % [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (15th November, 2012) -% This function is unchanged from version 2.0 (24th September, 2010). +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of @@ -43,11 +42,6 @@ % UNESCO (English), 196 pp. Available from http://www.TEOS-10.org % See section 3.1 of this TEOS-10 Manual. % -% McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2013: A -% computationally efficient 48-term expression for the density of -% seawater in terms of Conservative Temperature, and related properties -% of seawater. To be submitted to J. Atm. Ocean. Technol., xx, yyy-zzz. -% % McDougall T.J. and S.J. Wotherspoon, 2012: A simple modification of % Newton’s method to achieve convergence of order "1 + sqrt(2)". % Submitted to Applied Mathematics and Computation. diff --git a/Toolbox/gsw_pt_first_derivatives.m b/Toolbox/gsw_pt_first_derivatives.m index 305301e..2d6147a 100644 --- a/Toolbox/gsw_pt_first_derivatives.m +++ b/Toolbox/gsw_pt_first_derivatives.m @@ -31,8 +31,7 @@ % AUTHOR: % Trevor McDougall and Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (15th November, 2012) -% This function is unchanged from version 2.0 (24th September, 2010). +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of @@ -41,11 +40,6 @@ % UNESCO (English), 196 pp. Available from http://www.TEOS-10.org. % See Eqns. (A.12.6), (A.12.3), (P.6) and (P.8) of this TEOS-10 Manual. % -% McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2013: A -% computationally efficient 48-term expression for the density of -% seawater in terms of Conservative Temperature, and related properties -% of seawater. To be submitted to J. Atm. Ocean. Technol., xx, yyy-zzz. -% % This software is available from http://www.TEOS-10.org % %========================================================================== diff --git a/Toolbox/gsw_pt_from_CT.m b/Toolbox/gsw_pt_from_CT.m index 28160be..b4409e1 100644 --- a/Toolbox/gsw_pt_from_CT.m +++ b/Toolbox/gsw_pt_from_CT.m @@ -27,8 +27,7 @@ % Trevor McDougall, David Jackett, Claire Roberts-Thomson and Paul Barker. % [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (15th November, 2012) -% This function is unchanged from version 2.0 (24th September, 2010). +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of @@ -37,11 +36,6 @@ % UNESCO (English), 196 pp. Available from http://www.TEOS-10.org % See sections 3.1 and 3.3 of this TEOS-10 Manual. % -% McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2013: A -% computationally efficient 48-term expression for the density of -% seawater in terms of Conservative Temperature, and related properties -% of seawater. To be submitted to J. Atm. Ocean. Technol., xx, yyy-zzz. -% % McDougall T.J. and S.J. Wotherspoon, 2012: A simple modification of % Newton’s method to achieve convergence of order "1 + sqrt(2)". % Submitted to Applied Mathematics and Computation. diff --git a/Toolbox/gsw_pt_from_CT_plus.m b/Toolbox/gsw_pt_from_CT_plus.m deleted file mode 100644 index 1880085..0000000 --- a/Toolbox/gsw_pt_from_CT_plus.m +++ /dev/null @@ -1,127 +0,0 @@ -function pt = gsw_pt_from_CT_plus(SA,CT_plus,r) - -% gsw_pt_from_CT_plus potential temperature from CT_plus -%========================================================================== -% -% USAGE: -% pt = gsw_pt_from_CT_plus(SA,CT_plus,r) -% -% DESCRIPTION: -% Calculates potential temperature (with a reference sea pressure of -% zero dbar) from CT_plus. CT_plus is the version of Conservative -% Temperature which has an amplified difference from potential -% temperature (pt). That is, CT_plus obeys -% -% (pt - CT_plus) = r*(pt - CT) -% -% This function uses NNN iterations through a modified Newton-Raphson -% (N-R) iterative solution proceedure, starting from a first guess as -% described in the Notes (paper?) -% -% INPUT: -% SA = Absolute Salinity [ g/kg ] -% CT = Conservative Temperature (ITS-90) [ deg C ] -% r = amplification factor [ unitless ] -% -% SA & CT need to have the same dimensions and r should be a solitary -% number. -% -% OUTPUT: -% pt = potential temperature referenced to a sea pressure -% of zero dbar (ITS-90) [ deg C ] -% -% AUTHOR: -% Trevor McDougall and Paul Barker. -% [ help@teos-10.org ] -% -% VERSION NUMBER: 3.02 (20th December, 2012) -% It is not envisaged that this function become part of GSW. -% -% REFERENCES: -% IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of -% seawater - 2010: Calculation and use of thermodynamic properties. -% Intergovernmental Oceanographic Commission, Manuals and Guides No. 56, -% UNESCO (English), 196 pp. Available from http://www.TEOS-10.org -% See sections 3.1 and 3.3 of this TEOS-10 Manual. -% -% McDougall T.J., P.M. Barker and R. Feistel, 2013: A computationally -% efficient 48-term expression for the density of seawater in terms of -% Conservative Temperature, and related properties of seawater. -% To be submitted to J. Atm. Ocean. Technol., xx, yyy-zzz. -% -% McDougall T.J. and S.J. Wotherspoon, 2012: A simple modification of -% Newton’s method to achieve convergence of order "1 + sqrt(2)". -% Submitted to Applied Mathematics and Computation. -% -% The software is available from http://www.TEOS-10.org -% -%========================================================================== - -%-------------------------------------------------------------------------- -% Check variables and resize if necessary -%-------------------------------------------------------------------------- - -if ~(nargin == 3) - error('gsw_pt_from_CT_plus: Requires three inputs') -end - -[ms,ns] = size(SA); -[mt,nt] = size(CT_plus); - -if (mt ~= ms | nt ~= ns) - error('gsw_pt_from_CT: SA and CT must have same dimensions') -end - -if ~isscalar(r) - error('gsw_pt_from_CT: r must be a scalar') -end - -if ms == 1 - SA = SA.'; - CT_plus = CT_plus.'; - transposed = 1; -else - transposed = 0; -end - -%-------------------------------------------------------------------------- -% Start of the calculation -%-------------------------------------------------------------------------- - -% This line ensures that SA is non-negative. -SA(SA < 0) = 0; - -cp0 = 3991.86795711963; % from Eqn. (3.3.3) of IOC et al. (2010). -SSO = 35.16504; % this is the Reference Salinity of the Standard Ocean -a = 0.05*(1 - SA/SSO); - -pt = (1 - a).*CT_plus./(1 + (r - 1).*a); % the starting estimate of pt - -df_dpt = 1 ; % the starting estimate of df_dpt - -% start the 2 iterations through the modified Newton-Rapshon iterative -% method (McDougall and Wotherspoon, 2012). - -for Number_of_iterations = 1:2 - pt_old = pt; - f = pt - CT_plus -r*(pt - gsw_CT_from_pt(SA,pt)); - pt = pt_old - f./df_dpt; % 1/2-way through a modified N-R loop - ptm = 0.5*(pt + pt_old); - -% This routine calls gibbs_pt0_pt0(SA,pt0) to get the second derivative -% of the Gibbs function with respect to temperature at zero sea pressure. - - dCT_pt = -(ptm + 273.15).*gsw_gibbs_pt0_pt0(SA,ptm)./cp0; - df_dpt = 1 - r*(1 - dCT_pt); - pt = pt_old - f./df_dpt; % end of a full modified N-R iteration -end - -% After 2 iterations this calulation is at machine precission for this -% calculation which is 2 x 10 ^-13 (for r = 10). - -if transposed - pt = pt.'; -end - - -end diff --git a/Toolbox/gsw_pt_from_CT_plus2.m b/Toolbox/gsw_pt_from_CT_plus2.m deleted file mode 100644 index 235f19c..0000000 --- a/Toolbox/gsw_pt_from_CT_plus2.m +++ /dev/null @@ -1,126 +0,0 @@ -function pt = gsw_pt_from_CT_plus(SA,CT_plus,r) - -% gsw_pt_from_CT_plus potential temperature from CT_plus -%========================================================================== -% -% USAGE: -% pt = gsw_pt_from_CT_plus(SA,CT_plus,r) -% -% DESCRIPTION: -% Calculates potential temperature (with a reference sea pressure of -% zero dbar) from CT_plus. CT_plus is the version of Conservative -% Temperature which has an amplified difference from potential -% temperature (pt). That is, CT_plus obeys -% -% (pt - CT_plus) = r*(pt - CT) -% -% This function uses NNN iterations through a modified Newton-Raphson -% (N-R) iterative solution proceedure, starting from a first guess as -% described in the Notes (paper?) -% -% INPUT: -% SA = Absolute Salinity [ g/kg ] -% CT = Conservative Temperature (ITS-90) [ deg C ] -% r = amplification factor [ unitless ] -% -% SA & CT need to have the same dimensions and r should be a solitary -% number. -% -% OUTPUT: -% pt = potential temperature referenced to a sea pressure -% of zero dbar (ITS-90) [ deg C ] -% -% AUTHOR: -% Trevor McDougall and Paul Barker. -% [ help@teos-10.org ] -% -% VERSION NUMBER: 3.02 (20th December, 2012) -% It is not envisaged that this function become part of GSW. -% -% REFERENCES: -% IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of -% seawater - 2010: Calculation and use of thermodynamic properties. -% Intergovernmental Oceanographic Commission, Manuals and Guides No. 56, -% UNESCO (English), 196 pp. Available from http://www.TEOS-10.org -% See sections 3.1 and 3.3 of this TEOS-10 Manual. -% -% McDougall T.J., P.M. Barker and R. Feistel, 2013: A computationally -% efficient 48-term expression for the density of seawater in terms of -% Conservative Temperature, and related properties of seawater. -% To be submitted to J. Atm. Ocean. Technol., xx, yyy-zzz. -% -% McDougall T.J. and S.J. Wotherspoon, 2012: A simple modification of -% Newton’s method to achieve convergence of order "1 + sqrt(2)". -% Submitted to Applied Mathematics and Computation. -% -% The software is available from http://www.TEOS-10.org -% -%========================================================================== - -%-------------------------------------------------------------------------- -% Check variables and resize if necessary -%-------------------------------------------------------------------------- - -if ~(nargin == 3) - error('gsw_pt_from_CT_plus: Requires three inputs') -end - -[ms,ns] = size(SA); -[mt,nt] = size(CT_plus); - -if (mt ~= ms | nt ~= ns) - error('gsw_pt_from_CT: SA and CT must have same dimensions') -end - -if ~isscalar(r) - error('gsw_pt_from_CT: r must be a scalar') -end - -if ms == 1 - SA = SA.'; - CT_plus = CT_plus.'; - transposed = 1; -else - transposed = 0; -end - -%-------------------------------------------------------------------------- -% Start of the calculation -%-------------------------------------------------------------------------- - -% This line ensures that SA is non-negative. -SA(SA < 0) = 0; - -cp0 = 3991.86795711963; % from Eqn. (3.3.3) of IOC et al. (2010). -SSO = 35.16504; % this is the Reference Salinity of the Standard Ocean -a = 0.05*(1 - SA/SSO); - -pt = (1 - a).*CT_plus./(1 + (r - 1).*a); % the starting estimate of pt - -df_dpt = 1 ; % the starting estimate of df_dpt - -% start the NNN iterations through the modified Newton-Rapshon iterative -% method (McDougall and Wotherspoon, 2012). - -for Number_of_iterations = 1:2 -pt_old = pt; -f = pt - CT_plus -r*(pt - gsw_CT_from_pt(SA,pt)); -pt = pt_old - f./df_dpt; % 1/2-way through the modified N-R loop -ptm = 0.5*(pt + pt_old); - -% This routine calls gibbs_pt0_pt0(SA,pt0) to get the second derivative -% of the Gibbs function with respect to temperature at zero sea pressure. - -dCT_pt = -(ptm + 273.15).*gsw_gibbs_pt0_pt0(SA,ptm)./cp0; -df_dpt = 1 - r*(1 - dCT_pt); -pt = pt_old - f./df_dpt; % end of 1st full modified N-R iteration - - -end - -if transposed - pt = pt.'; -end - - -end diff --git a/Toolbox/gsw_pt_from_entropy.m b/Toolbox/gsw_pt_from_entropy.m index 772ce8d..1fa8971 100644 --- a/Toolbox/gsw_pt_from_entropy.m +++ b/Toolbox/gsw_pt_from_entropy.m @@ -26,7 +26,7 @@ % AUTHOR: % Trevor McDougall and Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (15th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of diff --git a/Toolbox/gsw_pt_from_t.m b/Toolbox/gsw_pt_from_t.m index 2283025..adcc541 100644 --- a/Toolbox/gsw_pt_from_t.m +++ b/Toolbox/gsw_pt_from_t.m @@ -36,8 +36,7 @@ % Trevor McDougall, David Jackett, Claire Roberts-Thomson and Paul Barker. % [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (15th November, 2012) -% This function is unchanged from version 2.0 (24th September, 2010). +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of @@ -46,11 +45,6 @@ % UNESCO (English), 196 pp. Available from http://www.TEOS-10.org % See section 3.1 of this TEOS-10 Manual. % -% McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2013: A -% computationally efficient 48-term expression for the density of -% seawater in terms of Conservative Temperature, and related properties -% of seawater. To be submitted to J. Atm. Ocean. Technol., xx, yyy-zzz. -% % McDougall T.J. and S.J. Wotherspoon, 2012: A simple modification of % Newton’s method to achieve convergence of order "1 + sqrt(2)". % Submitted to Applied Mathematics and Computation. diff --git a/Toolbox/gsw_pt_second_derivatives.m b/Toolbox/gsw_pt_second_derivatives.m index f8f54f6..f6fcf2e 100644 --- a/Toolbox/gsw_pt_second_derivatives.m +++ b/Toolbox/gsw_pt_second_derivatives.m @@ -40,8 +40,7 @@ % AUTHOR: % Trevor McDougall and Paul Barker. [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (15th November, 2012) -% This function is unchanged from version 2.0 (24th September, 2010). +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of @@ -50,11 +49,6 @@ % UNESCO (English), 196 pp. Available from http://www.TEOS-10.org. % See Eqns. (A.12.9) and (A.12.10) of this TEOS-10 Manual. % -% McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2013: A -% computationally efficient 48-term expression for the density of -% seawater in terms of Conservative Temperature, and related properties -% of seawater. To be submitted to J. Atm. Ocean. Technol., xx, yyy-zzz. -% % This software is available from http://www.TEOS-10.org % %========================================================================== diff --git a/Toolbox/gsw_rho.m b/Toolbox/gsw_rho.m index 63fb835..816adb2 100644 --- a/Toolbox/gsw_rho.m +++ b/Toolbox/gsw_rho.m @@ -9,7 +9,7 @@ % DESCRIPTION: % Calculates in-situ density from Absolute Salinity and Conservative % Temperature, using the computationally-efficient 48-term expression for -% density in terms of SA, CT and p (McDougall et al., 2013). +% density in terms of SA, CT and p (IOC et al., 2010). % % Note that potential density with respect to reference pressure, pr, is % obtained by calling this function with the pressure argument being pr @@ -17,7 +17,7 @@ % % Note that the 48-term equation has been fitted in a restricted range of % parameter space, and is most accurate inside the "oceanographic funnel" -% described in McDougall et al. (2013). The GSW library function +% described in IOC et al. (2010). The GSW library function % "gsw_infunnel(SA,CT,p)" is avaialble to be used if one wants to test if % some of one's data lies outside this "funnel". % @@ -36,7 +36,7 @@ % AUTHOR: % Paul Barker and Trevor McDougall [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (15th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of @@ -45,11 +45,6 @@ % UNESCO (English), 196 pp. Available from http://www.TEOS-10.org % See appendix A.20 and appendix K of this TEOS-10 Manual. % -% McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2013: A -% computationally efficient 48-term expression for the density of -% seawater in terms of Conservative Temperature, and related properties -% of seawater. To be submitted to J. Atm. Ocean. Technol., xx, yyy-zzz. -% % The software is available from http://www.TEOS-10.org % %========================================================================== diff --git a/Toolbox/gsw_rho_CT.m b/Toolbox/gsw_rho_CT.m index fd971f1..13124cc 100644 --- a/Toolbox/gsw_rho_CT.m +++ b/Toolbox/gsw_rho_CT.m @@ -15,7 +15,7 @@ % DESCRIPTION: % Calculates in-situ density from Absolute Salinity and Conservative % Temperature, using the computationally-efficient 48-term expression for -% density in terms of SA, CT and p (McDougall et al., 2011). +% density in terms of SA, CT and p (IOC et al., 2010). % % Note that potential density with respect to reference pressure, p_ref, is % obtained by calling this function with the pressure argument being p_ref @@ -23,7 +23,7 @@ % % Note that the 48-term equation has been fitted in a restricted range of % parameter space, and is most accurate inside the "oceanographic funnel" -% described in McDougall et al. (2011). The GSW library function +% described in IOC et al. (2010). The GSW library function % "gsw_infunnel(SA,CT,p)" is avaialble to be used if one wants to test if % some of one's data lies outside this "funnel". % @@ -42,7 +42,7 @@ % AUTHOR: % Paul Barker and Trevor McDougall [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (15th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of @@ -51,11 +51,6 @@ % UNESCO (English), 196 pp. Available from http://www.TEOS-10.org % See appendix A.20 and appendix K of this TEOS-10 Manual. % -% McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2013: A -% computationally efficient 48-term expression for the density of -% seawater in terms of Conservative Temperature, and related properties -% of seawater. To be submitted to J. Atm. Ocean. Technol., xx, yyy-zzz. -% % The software is available from http://www.TEOS-10.org % %========================================================================== diff --git a/Toolbox/gsw_rho_CT_exact.m b/Toolbox/gsw_rho_CT_exact.m index 3a9a503..705f7cc 100644 --- a/Toolbox/gsw_rho_CT_exact.m +++ b/Toolbox/gsw_rho_CT_exact.m @@ -15,9 +15,9 @@ % (i.e. "gsw_rho_CT_exact(SA,CT,p_ref)"). % % Note that this function uses the full Gibbs function. There is an -% alternative to calling this function, namely gsw_rho_CT(SA,CT,p), +% alternative to calling this function, namely gsw_rho(SA,CT,p), % which uses the computationally efficient 48-term expression for density -% in terms of SA, CT and p (McDougall et al., 2013). +% in terms of SA, CT and p (IOC et al., 2010). % % INPUT: % SA = Absolute Salinity [ g/kg ] @@ -34,7 +34,7 @@ % AUTHOR: % Trevor McDougall and Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (15th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of @@ -43,11 +43,6 @@ % UNESCO (English), 196 pp. Available from http://www.TEOS-10.org % See Eqn. (2.8.2) of this TEOS-10 Manual. % -% McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2013: A -% computationally efficient 48-term expression for the density of -% seawater in terms of Conservative Temperature, and related properties -% of seawater. To be submitted to J. Atm. Ocean. Technol., xx, yyy-zzz. -% % The software is available from http://www.TEOS-10.org % %========================================================================== diff --git a/Toolbox/gsw_rho_alpha_beta.m b/Toolbox/gsw_rho_alpha_beta.m index 781823d..b287440 100644 --- a/Toolbox/gsw_rho_alpha_beta.m +++ b/Toolbox/gsw_rho_alpha_beta.m @@ -12,7 +12,7 @@ % and the appropriate saline contraction coefficient of seawater from % Absolute Salinity and Conservative Temperature. This function uses the % computationally-efficient 48-term expression for density in terms of -% SA, CT and p (McDougall et al., 2013). +% SA, CT and p (IOC et al., 2010). % % Note that potential density (pot_rho) with respect to reference pressure % p_ref is obtained by calling this function with the pressure argument @@ -20,7 +20,7 @@ % % Note that the 48-term equation has been fitted in a restricted range of % parameter space, and is most accurate inside the "oceanographic funnel" -% described in McDougall et al. (2013). The GSW library function +% described in IOC et al. (2010). The GSW library function % "gsw_infunnel(SA,CT,p)" is avaialble to be used if one wants to test if % some of one's data lies outside this "funnel". % @@ -43,7 +43,7 @@ % AUTHOR: % Paul Barker and Trevor McDougall [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (15th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of @@ -52,11 +52,6 @@ % UNESCO (English), 196 pp. Available from http://www.TEOS-10.org % See appendix A.20 and appendix K of this TEOS-10 Manual. % -% McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2013: A -% computationally efficient 48-term expression for the density of -% seawater in terms of Conservative Temperature, and related properties -% of seawater. To be submitted to J. Atm. Ocean. Technol., xx, yyy-zzz. -% % The software is available from http://www.TEOS-10.org % %========================================================================== @@ -68,6 +63,7 @@ if ~(nargin == 3) error('gsw_rho_alpha_beta: Requires three inputs') end %if + if ~(nargout == 3 | nargout == 4) error('gsw_rho_alpha_beta: Requires three outputs') end %if diff --git a/Toolbox/gsw_rho_alpha_beta_CT.m b/Toolbox/gsw_rho_alpha_beta_CT.m index af4ec22..64311c9 100644 --- a/Toolbox/gsw_rho_alpha_beta_CT.m +++ b/Toolbox/gsw_rho_alpha_beta_CT.m @@ -19,7 +19,7 @@ % and the appropriate saline contraction coefficient of seawater from % Absolute Salinity and Conservative Temperature. This function uses the % computationally-efficient 48-term expression for density in terms of -% SA, CT and p (McDougall et al., 2013). +% SA, CT and p (IOC et al., 2010). % % Note that potential density (pot_rho) with respect to reference pressure % p_ref is obtained by calling this function with the pressure argument @@ -27,7 +27,7 @@ % % Note that the 48-term equation has been fitted in a restricted range of % parameter space, and is most accurate inside the "oceanographic funnel" -% described in McDougall et al. (2013). The GSW library function +% described in IOC et al. (2010). The GSW library function % "gsw_infunnel(SA,CT,p)" is avaialble to be used if one wants to test if % some of one's data lies outside this "funnel". % @@ -50,7 +50,7 @@ % AUTHOR: % Paul Barker and Trevor McDougall [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (15th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of @@ -59,11 +59,6 @@ % UNESCO (English), 196 pp. Available from http://www.TEOS-10.org % See appendix A.20 and appendix K of this TEOS-10 Manual. % -% McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2013: A -% computationally efficient 48-term expression for the density of -% seawater in terms of Conservative Temperature, and related properties -% of seawater. To be submitted to J. Atm. Ocean. Technol., xx, yyy-zzz. -% % The software is available from http://www.TEOS-10.org % %========================================================================== @@ -75,6 +70,7 @@ if ~(nargin == 3) error('gsw_rho_alpha_beta_CT: Requires three inputs') end %if + if ~(nargout == 3 | nargout == 4) error('gsw_rho_alpha_beta_CT: Requires three outputs') end %if diff --git a/Toolbox/gsw_rho_alpha_beta_CT_exact.m b/Toolbox/gsw_rho_alpha_beta_CT_exact.m index 5c89a5d..77a36c7 100644 --- a/Toolbox/gsw_rho_alpha_beta_CT_exact.m +++ b/Toolbox/gsw_rho_alpha_beta_CT_exact.m @@ -15,8 +15,8 @@ % Note that this function uses the full Gibbs function. There is an % alternative to calling this function, namely % gsw_rho_alpha_beta(SA,CT,p), which uses the computationally-efficient -% 48-term expression for density in terms of SA, CT and p (McDougall et -% al., 2013). +% 48-term expression for density in terms of SA, CT and p (IOC et +% al., 2010). % % INPUT: % SA = Absolute Salinity [ g/kg ] @@ -37,7 +37,7 @@ % AUTHOR: % Trevor McDougall and Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (15th November, 2012) +% VERSION NUMBER: 3.03 (16th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of @@ -46,11 +46,6 @@ % UNESCO (English), 196 pp. Available from http://www.TEOS-10.org % See sections (2.8), (2.18) and (2.19) of this TEOS-10 Manual. % -% McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2013: A -% computationally efficient 48-term expression for the density of -% seawater in terms of Conservative Temperature, and related properties -% of seawater. To be submitted to J. Atm. Ocean. Technol., xx, yyy-zzz. -% % The software is available from http://www.TEOS-10.org % %========================================================================== @@ -62,6 +57,7 @@ if ~(nargin == 3) error('gsw_rho_alpha_beta_CT_exact: Requires three inputs') end %if + if ~(nargout == 3) error('gsw_rho_alpha_beta_CT_exact: Requires three outputs') end %if diff --git a/Toolbox/gsw_rho_first_derivatives.m b/Toolbox/gsw_rho_first_derivatives.m new file mode 100644 index 0000000..29a870f --- /dev/null +++ b/Toolbox/gsw_rho_first_derivatives.m @@ -0,0 +1,299 @@ +function [drho_dSA, drho_dCT, drho_dP] = gsw_rho_first_derivatives(SA,CT,p) + +% gsw_rho_first_derivatives SA, CT and p partial derivatives +% of density (48-term equation) +%========================================================================== +% +% USAGE: +% [drho_dSA, drho_dCT, drho_dP] = gsw_rho_first_derivatives(SA,CT,p) +% +% DESCRIPTION: +% Calculates the three (3) partial derivatives of in situ density with +% respect to Absolute Salinity, Conservative Temperature and pressure. +% Note that the pressure derivative is done with respect to pressure in +% Pa, not dbar. This function uses the computationally-efficient 48-term +% expression for density in terms of SA, CT and p. +% +% Note that the 48-term equation has been fitted in a restricted range of +% parameter space, and is most accurate inside the "oceanographic funnel" +% described in IOC et al. (2010). The GSW library function +% "gsw_infunnel(SA,CT,p)" is avaialble to be used if one wants to test if +% some of one's data lies outside this "funnel". +% +% INPUT: +% SA = Absolute Salinity [ g/kg ] +% CT = Conservative Temperature (ITS-90) [ deg C ] +% p = sea pressure [ dbar ] +% ( i.e. absolute pressure - 10.1325 dbar ) +% +% SA & CT need to have the same dimensions. +% p may have dimensions 1x1 or Mx1 or 1xN or MxN, where SA & CT are MxN. +% +% OUTPUT: +% drho_dSA = partial derivatives of density [ kg^2/(g m^3) ] +% with respect to Absolute Salinity +% drho_dCT = partial derivatives of density [ kg/(K m^3) ] +% with respect to Conservative Temperature +% drho_dP = partial derivatives of density [ kg/(Pa m^3) ] +% with respect to pressure in Pa +% +% AUTHOR: +% Paul Barker and Trevor McDougall [ help@teos-10.org ] +% +% VERSION NUMBER: 3.03 (29th April, 2013) +% +% REFERENCES: +% IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of +% seawater - 2010: Calculation and use of thermodynamic properties. +% Intergovernmental Oceanographic Commission, Manuals and Guides No. 56, +% UNESCO (English), 196 pp. Available from http://www.TEOS-10.org +% See appendix A.20 and appendix K of this TEOS-10 Manual. +% +% The software is available from http://www.TEOS-10.org +% +%========================================================================== + +%-------------------------------------------------------------------------- +% Check variables and resize if necessary +%-------------------------------------------------------------------------- + +if ~(nargin == 3) + error('gsw_rho_first_derivatives: Requires three inputs') +end %if +if ~(nargout == 3 | nargout == 4) + error('gsw_rho_first_derivatives: Requires three outputs') +end %if + +[ms,ns] = size(SA); +[mt,nt] = size(CT); +[mp,np] = size(p); + +if (mt ~= ms | nt ~= ns) + error('gsw_rho_first_derivatives: SA and CT must have same dimensions') +end + +if (mp == 1) & (np == 1) % p scalar - fill to size of SA + p = p*ones(size(SA)); +elseif (ns == np) & (mp == 1) % p is row vector, + p = p(ones(1,ms), :); % copy down each column. +elseif (ms == mp) & (np == 1) % p is column vector, + p = p(:,ones(1,ns)); % copy across each row. +elseif (ns == mp) & (np == 1) % p is a transposed row vector, + p = p.'; % transposed then + p = p(ones(1,ms), :); % copy down each column. +elseif (ms == mp) & (ns == np) + % ok +else + error('gsw_rho_first_derivatives: Inputs array dimensions arguments do not agree') +end %if + +if ms == 1 + SA = SA.'; + CT = CT.'; + p = p.'; + transposed = 1; +else + transposed = 0; +end + +%-------------------------------------------------------------------------- +% Start of the calculation +%-------------------------------------------------------------------------- + +% This line ensures that SA is non-negative. +SA(SA < 0) = 0; + +v01 = 9.998420897506056e+2; +v02 = 2.839940833161907; +v03 = -3.147759265588511e-2; +v04 = 1.181805545074306e-3; +v05 = -6.698001071123802; +v06 = -2.986498947203215e-2; +v07 = 2.327859407479162e-4; +v08 = -3.988822378968490e-2; +v09 = 5.095422573880500e-4; +v10 = -1.426984671633621e-5; +v11 = 1.645039373682922e-7; +v12 = -2.233269627352527e-2; +v13 = -3.436090079851880e-4; +v14 = 3.726050720345733e-6; +v15 = -1.806789763745328e-4; +v16 = 6.876837219536232e-7; +v17 = -3.087032500374211e-7; +v18 = -1.988366587925593e-8; +v19 = -1.061519070296458e-11; +v20 = 1.550932729220080e-10; +v21 = 1.0; +v22 = 2.775927747785646e-3; +v23 = -2.349607444135925e-5; +v24 = 1.119513357486743e-6; +v25 = 6.743689325042773e-10; +v26 = -7.521448093615448e-3; +v27 = -2.764306979894411e-5; +v28 = 1.262937315098546e-7; +v29 = 9.527875081696435e-10; +v30 = -1.811147201949891e-11; +v31 = -3.303308871386421e-5; +v32 = 3.801564588876298e-7; +v33 = -7.672876869259043e-9; +v34 = -4.634182341116144e-11; +v35 = 2.681097235569143e-12; +v36 = 5.419326551148740e-6; +v37 = -2.742185394906099e-5; +v38 = -3.212746477974189e-7; +v39 = 3.191413910561627e-9; +v40 = -1.931012931541776e-12; +v41 = -1.105097577149576e-7; +v42 = 6.211426728363857e-10; +v43 = -1.119011592875110e-10; +v44 = -1.941660213148725e-11; +v45 = -1.864826425365600e-14; +v46 = 1.119522344879478e-14; +v47 = -1.200507748551599e-15; +v48 = 6.057902487546866e-17; + +a01 = 2.839940833161907; +a02 = -6.295518531177023e-2; +a03 = 3.545416635222918e-3; +a04 = -2.986498947203215e-2; +a05 = 4.655718814958324e-4; +a06 = 5.095422573880500e-4; +a07 = -2.853969343267241e-5; +a08 = 4.935118121048767e-7; +a09 = -3.436090079851880e-4; +a10 = 7.452101440691467e-6; +a11 = 6.876837219536232e-7; +a12 = -1.988366587925593e-8; +a13 = -2.123038140592916e-11; +a14 = 2.775927747785646e-3; +a15 = -4.699214888271850e-5; +a16 = 3.358540072460230e-6; +a17 = 2.697475730017109e-9; +a18 = -2.764306979894411e-5; +a19 = 2.525874630197091e-7; +a20 = 2.858362524508931e-9; +a21 = -7.244588807799565e-11; +a22 = 3.801564588876298e-7; +a23 = -1.534575373851809e-8; +a24 = -1.390254702334843e-10; +a25 = 1.072438894227657e-11; +a26 = -3.212746477974189e-7; +a27 = 6.382827821123254e-9; +a28 = -5.793038794625329e-12; +a29 = 6.211426728363857e-10; +a30 = -1.941660213148725e-11; +a31 = -3.729652850731201e-14; +a32 = 1.119522344879478e-14; +a33 = 6.057902487546866e-17; + +b01 = -6.698001071123802; +b02 = -2.986498947203215e-2; +b03 = 2.327859407479162e-4; +b04 = -5.983233568452735e-2; +b05 = 7.643133860820750e-4; +b06 = -2.140477007450431e-5; +b07 = 2.467559060524383e-7; +b08 = -1.806789763745328e-4; +b09 = 6.876837219536232e-7; +b10 = 1.550932729220080e-10; +b11 = -7.521448093615448e-3; +b12 = -2.764306979894411e-5; +b13 = 1.262937315098546e-7; +b14 = 9.527875081696435e-10; +b15 = -1.811147201949891e-11; +b16 = -4.954963307079632e-5; +b17 = 5.702346883314446e-7; +b18 = -1.150931530388857e-8; +b19 = -6.951273511674217e-11; +b20 = 4.021645853353715e-12; +b21 = 1.083865310229748e-5; +b22 = -1.105097577149576e-7; +b23 = 6.211426728363857e-10; +b24 = 1.119522344879478e-14; + +c01 = -2.233269627352527e-2; +c02 = -3.436090079851880e-4; +c03 = 3.726050720345733e-6; +c04 = -1.806789763745328e-4; +c05 = 6.876837219536232e-7; +c06 = -6.174065000748422e-7; +c07 = -3.976733175851186e-8; +c08 = -2.123038140592916e-11; +c09 = 3.101865458440160e-10; +c10 = -2.742185394906099e-5; +c11 = -3.212746477974189e-7; +c12 = 3.191413910561627e-9; +c13 = -1.931012931541776e-12; +c14 = -1.105097577149576e-7; +c15 = 6.211426728363857e-10; +c16 = -2.238023185750219e-10; +c17 = -3.883320426297450e-11; +c18 = -3.729652850731201e-14; +c19 = 2.239044689758956e-14; +c20 = -3.601523245654798e-15; +c21 = 1.817370746264060e-16; + +sqrtSA = sqrt(SA); + +v_hat_denominator = v01 + CT.*(v02 + CT.*(v03 + v04*CT)) ... + + SA.*(v05 + CT.*(v06 + v07*CT) ... + + sqrtSA.*(v08 + CT.*(v09 + CT.*(v10 + v11*CT)))) ... + + p.*(v12 + CT.*(v13 + v14*CT) + SA.*(v15 + v16*CT) ... + + p.*(v17 + CT.*(v18 + v19*CT) + v20*SA)); + +v_hat_numerator = v21 + CT.*(v22 + CT.*(v23 + CT.*(v24 + v25*CT))) ... + + SA.*(v26 + CT.*(v27 + CT.*(v28 + CT.*(v29 + v30*CT))) + v36*SA ... + + sqrtSA.*(v31 + CT.*(v32 + CT.*(v33 + CT.*(v34 + v35*CT))))) ... + + p.*(v37 + CT.*(v38 + CT.*(v39 + v40*CT)) ... + + SA.*(v41 + v42*CT) ... + + p.*(v43 + CT.*(v44 + v45*CT + v46*SA) ... + + p.*(v47 + v48*CT))); + +dvhatden_dSA = b01 + CT.*(b02 + b03*CT) ... + + sqrtSA.*(b04 + CT.*(b05 + CT.*(b06 + b07*CT))) ... + + p.*(b08 + b09*CT + b10*p) ; + +dvhatnum_dSA = b11 + CT.*(b12 + CT.*(b13 + CT.*(b14 + b15*CT))) ... + + sqrtSA.*(b16 + CT.*(b17 + CT.*(b18 + CT.*(b19 + b20*CT)))) + b21*SA ... + + p.*(b22 + CT.*(b23 + b24*p)); + +dvhatden_dCT = a01 + CT.*(a02 + a03*CT) ... + + SA.*(a04 + a05*CT ... + + sqrtSA.*(a06 + CT.*(a07 + a08*CT))) ... + + p.*(a09 + a10*CT + a11*SA ... + + p.*(a12 + a13*CT)); + +dvhatnum_dCT = a14 + CT.*(a15 + CT.*(a16 + a17*CT)) ... + + SA.*(a18 + CT.*(a19 + CT.*(a20 + a21*CT)) ... + + sqrtSA.*(a22 + CT.*(a23 + CT.*(a24 + a25*CT)))) ... + + p.*(a26 + CT.*(a27 + a28*CT) + a29*SA ... + + p.*(a30 + a31*CT + a32*SA + a33*p)); + +dvhatden_dp = c01 + CT.*(c02 + c03*CT) ... + + SA.*(c04 + c05*CT) ... + + p.*(c06 + CT.*(c07 + c08*CT) + c09*SA); + +dvhatnum_dp = c10 + CT.*(c11 + CT.*(c12 + c13*CT)) ... + + SA.*(c14 + c15*CT) ... + + p.*(c16 + CT.*(c17 + c18*CT + c19*SA) ... + + p.*(c20 + c21*CT)); + +rec_num = ones(size(v_hat_numerator))./v_hat_numerator; + +rho = rec_num.*v_hat_denominator; + +drho_dSA = (dvhatden_dSA - dvhatnum_dSA.*rho).*rec_num; + +drho_dCT = (dvhatden_dCT - dvhatnum_dCT.*rho).*rec_num; + +Pa2db = 1e-4; % factor to convert from Pa to dbar + +drho_dP = Pa2db.*(dvhatden_dp - dvhatnum_dp.*rho).*rec_num; + +if transposed + drho_dSA = drho_dSA.'; + drho_dCT = drho_dCT.'; + drho_dP = drho_dP.'; +end + +end diff --git a/Toolbox/gsw_rho_first_derivatives_CT.m b/Toolbox/gsw_rho_first_derivatives_CT.m new file mode 100644 index 0000000..9d0b4c3 --- /dev/null +++ b/Toolbox/gsw_rho_first_derivatives_CT.m @@ -0,0 +1,121 @@ +function [drho_dSA, drho_dCT, drho_dP] = gsw_rho_first_derivatives_CT(SA,CT,p) + +% gsw_rho_first_derivatives_CT SA, CT and p partial derivatives +% of density (48-term equation) +%========================================================================== +% +% USAGE: +% [drho_dSA, drho_dCT, drho_dP] = gsw_rho_first_derivatives_CT(SA,CT,p), +% or equivalently +% [drho_dSA, drho_dCT, drho_dP] = gsw_rho_first_derivatives(SA,CT,p) +% +% Note that gsw_rho_first_derivatives(SA,CT,p) is identical to +% gsw_rho_first_derivatives_CT(SA,CT,p). The extra "_CT" emphasises that +% the input temperature is Conservative Temperature, but the extra "_CT" +% part of the function name is not needed. +% +% +% DESCRIPTION: +% Calculates the three (3) partial derivatives of in situ density with +% respect to Absolute Salinity, Conservative Temperature and pressure. +% Note that the pressure derivative is done with respect to pressure in +% Pa, not dbar. This function uses the computationally-efficient 48-term +% expression for density in terms of SA, CT and p. +% +% +% Note that the 48-term equation has been fitted in a restricted range of +% parameter space, and is most accurate inside the "oceanographic funnel" +% described in IOC et al. (2010). The GSW library function +% "gsw_infunnel(SA,CT,p)" is avaialble to be used if one wants to test if +% some of one's data lies outside this "funnel". +% +% INPUT: +% SA = Absolute Salinity [ g/kg ] +% CT = Conservative Temperature (ITS-90) [ deg C ] +% p = sea pressure [ dbar ] +% ( i.e. absolute pressure - 10.1325 dbar ) +% +% SA & CT need to have the same dimensions. +% p may have dimensions 1x1 or Mx1 or 1xN or MxN, where SA & CT are MxN. +% +% +% OUTPUT: +% drho_dSA = partial derivatives of density [ kg^2/(g m^3) ] +% with respect to Absolute Salinity +% drho_dCT = partial derivatives of density [ kg/(K m^3) ] +% with respect to Conservative Temperature +% drho_dP = partial derivatives of density [ kg/(Pa m^3) ] +% with respect to pressure in Pa +% +% AUTHOR: +% Paul Barker and Trevor McDougall [ help@teos-10.org ] +% +% VERSION NUMBER: 3.03 (29th April, 2013) +% +% REFERENCES: +% IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of +% seawater - 2010: Calculation and use of thermodynamic properties. +% Intergovernmental Oceanographic Commission, Manuals and Guides No. 56, +% UNESCO (English), 196 pp. Available from http://www.TEOS-10.org +% See appendix A.20 and appendix K of this TEOS-10 Manual. +% +% The software is available from http://www.TEOS-10.org +% +%========================================================================== + +%-------------------------------------------------------------------------- +% Check variables and resize if necessary +%-------------------------------------------------------------------------- + +if ~(nargin == 3) + error('gsw_rho_first_derivatives_CT: Requires three inputs') +end %if +if ~(nargout == 3 | nargout == 4) + error('gsw_rho_first_derivatives_CT: Requires three outputs') +end %if + +[ms,ns] = size(SA); +[mt,nt] = size(CT); +[mp,np] = size(p); + +if (mt ~= ms | nt ~= ns) + error('gsw_rho_first_derivatives_CT: SA and CT must have same dimensions') +end + +if (mp == 1) & (np == 1) % p scalar - fill to size of SA + p = p*ones(size(SA)); +elseif (ns == np) & (mp == 1) % p is row vector, + p = p(ones(1,ms), :); % copy down each column. +elseif (ms == mp) & (np == 1) % p is column vector, + p = p(:,ones(1,ns)); % copy across each row. +elseif (ns == mp) & (np == 1) % p is a transposed row vector, + p = p.'; % transposed then + p = p(ones(1,ms), :); % copy down each column. +elseif (ms == mp) & (ns == np) + % ok +else + error('gsw_rho_first_derivatives_CT: Inputs array dimensions arguments do not agree') +end %if + +if ms == 1 + SA = SA.'; + CT = CT.'; + p = p.'; + transposed = 1; +else + transposed = 0; +end + +%-------------------------------------------------------------------------- +% Start of the calculation +%-------------------------------------------------------------------------- + +[drho_dSA, drho_dCT, drho_dP] = gsw_rho_first_derivatives(SA,CT,p); + +if transposed + drho_dSA = drho_dSA.'; + drho_dCT = drho_dCT.'; + drho_dP = drho_dP.'; +end + +end diff --git a/Toolbox/gsw_rho_first_derivatives_CT_exact.m b/Toolbox/gsw_rho_first_derivatives_CT_exact.m new file mode 100644 index 0000000..0417e89 --- /dev/null +++ b/Toolbox/gsw_rho_first_derivatives_CT_exact.m @@ -0,0 +1,172 @@ +function [drho_dSA, drho_dCT, drho_dP] = gsw_rho_first_derivatives_CT_exact(SA,CT,p) + +% gsw_rho_first_derivatives_CT_exact SA, CT and p partial derivatives +% of density +%========================================================================== +% +% USAGE: +% [drho_dSA, drho_dCT, drho_dP] = gsw_rho_first_derivatives_CT_exact(SA,CT,p) +% +% DESCRIPTION: +% Calculates the three (3) partial derivatives of in situ density with +% respect to Absolute Salinity, Conservative Temperature and pressure. +% Note that the pressure derivative is done with respect to pressure in +% Pa, not dbar. +% +% Note that this function uses the full Gibbs function. There is an +% alternative to calling this function, namely +% gsw_rho_first_derivatives(SA,CT,p), which uses the computationally +% efficient 48-term expression for density in terms of SA, CT and p +% (IOC et al., 2010). +% +% INPUT: +% SA = Absolute Salinity [ g/kg ] +% CT = Conservative Temperature (ITS-90) [ deg C ] +% p = sea pressure [ dbar ] +% ( i.e. absolute pressure - 10.1325 dbar ) +% +% SA & CT need to have the same dimensions. +% p may have dimensions 1x1 or Mx1 or 1xN or MxN, where SA & CT are MxN. +% +% OUTPUT: +% drho_dSA = partial derivatives of density [ kg^2/(g m^3) ] +% with respect to Absolute Salinity +% drho_dCT = partial derivatives of density [ kg/(K m^3) ] +% with respect to Conservative Temperature +% drho_dP = partial derivatives of density [ kg/(Pa m^3) ] +% with respect to pressure in Pa +% +% AUTHOR: +% Paul Barker and Trevor McDougall [ help@teos-10.org ] +% +% VERSION NUMBER: 3.03 (10th May, 2013) +% +% REFERENCES: +% IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of +% seawater - 2010: Calculation and use of thermodynamic properties. +% Intergovernmental Oceanographic Commission, Manuals and Guides No. 56, +% UNESCO (English), 196 pp. Available from http://www.TEOS-10.org +% See appendix A.20 and appendix K of this TEOS-10 Manual. +% +% The software is available from http://www.TEOS-10.org +% +%========================================================================== + +%-------------------------------------------------------------------------- +% Check variables and resize if necessary +%-------------------------------------------------------------------------- + +if ~(nargin == 3) + error('gsw_rho_first_derivatives_CT_exact: Requires three inputs') +end %if +if ~(nargout == 3 | nargout == 4) + error('gsw_rho_first_derivatives_CT_exact: Requires three outputs') +end %if + +[ms,ns] = size(SA); +[mt,nt] = size(CT); +[mp,np] = size(p); + +if (mt ~= ms | nt ~= ns) + error('gsw_rho_first_derivatives_CT_exact: SA and CT must have same dimensions') +end + +if (mp == 1) & (np == 1) % p scalar - fill to size of SA + p = p*ones(size(SA)); +elseif (ns == np) & (mp == 1) % p is row vector, + p = p(ones(1,ms), :); % copy down each column. +elseif (ms == mp) & (np == 1) % p is column vector, + p = p(:,ones(1,ns)); % copy across each row. +elseif (ns == mp) & (np == 1) % p is a transposed row vector, + p = p.'; % transposed then + p = p(ones(1,ms), :); % copy down each column. +elseif (ms == mp) & (ns == np) + % ok +else + error('gsw_rho_first_derivatives_CT_exact: Inputs array dimensions arguments do not agree') +end %if + +if ms == 1 + SA = SA.'; + CT = CT.'; + p = p.'; + transposed = 1; +else + transposed = 0; +end + +%-------------------------------------------------------------------------- +% Start of the calculation +%-------------------------------------------------------------------------- + +% This line ensures that SA is non-negative. +SA(SA < 0) = 0; + +t = gsw_t_from_CT(SA,CT,p); + +n0 = 0; +n1 = 1; +n2 = 2; +db2Pa = 1e-4; +sfac = 0.0248826675584615; % sfac = 1/(40*(35.16504/35)). + +pt0 = gsw_pt0_from_t(SA,t,p); + +x2 = sfac.*SA; +x = sqrt(x2); +y = 0.025*t; +y_pt = 0.025*pt0; +z = db2Pa*p; %Note.The input pressure (p) is sea pressure in units of dbar. + +g_SA_T_mod = 1187.3715515697959 + z.*(1458.233059470092 + ... + z.*(-687.913805923122 + z.*(249.375342232496 + z.*(-63.313928772146 + 14.09317606630898.*z)))) + ... + x.*(-1480.222530425046 + x.*(2175.341332000392 + x.*(-980.14153344888 + 220.542973797483.*x) + ... + y.*(-548.4580073635929 + y.*(592.4012338275047 + y.*(-274.2361238716608 + 49.9394019139016.*y))) - ... + 90.6734234051316.*z) + z.*(-525.876123559641 + (249.57717834054571 - 88.449193048287.*z).*z) + ... + y.*(-258.3988055868252 + z.*(2298.348396014856 + z.*(-325.1503575102672 + 153.8390924339484.*z)) + ... + y.*(-90.2046337756875 - 4142.8793862113125.*z + y.*(10.50720794170734 + 2814.78225133626.*z)))) + ... + y.*(3520.125411988816 + y.*(-1351.605895580406 + ... + y.*(731.4083582010072 + y.*(-216.60324087531103 + 25.56203650166196.*y) + ... + z.*(-2381.829935897496 + (597.809129110048 - 291.8983352012704.*z).*z)) + ... + z.*(4165.4688847996085 + z.*(-1229.337851789418 + (681.370187043564 - 66.7696405958478.*z).*z))) + ... + z.*(-3443.057215135908 + z.*(1349.638121077468 + ... + z.*(-713.258224830552 + (176.8161433232 - 31.68006188846728.*z).*z)))); +g_SA_T_mod = 0.5*sfac*0.025*g_SA_T_mod; + +g_SA_mod = 8645.36753595126 + ... + x.*(-7296.43987145382 + x.*(8103.20462414788 + ... + y_pt.*(2175.341332000392 + y_pt.*(-274.2290036817964 + ... + y_pt.*(197.4670779425016 + y_pt.*(-68.5590309679152 + 9.98788038278032.*y_pt)))) + ... + x.*(-5458.34205214835 - 980.14153344888.*y_pt + ... + x.*(2247.60742726704 - 340.1237483177863.*x + 220.542973797483.*y_pt))) + ... + y_pt.*(-1480.222530425046 + ... + y_pt.*(-129.1994027934126 + ... + y_pt.*(-30.0682112585625 + y_pt.*(2.626801985426835 ))))) + ... + y_pt.*(1187.3715515697959 + ... + y_pt.*(1760.062705994408 + y_pt.*(-450.535298526802 + ... + y_pt.*(182.8520895502518 + y_pt.*(-43.3206481750622 + 4.26033941694366.*y_pt))))); +g_SA_mod = 0.5*sfac*g_SA_mod; + +g_p = gsw_gibbs(n0,n0,n1,SA,t,p); + +g_psq_g_tt = g_p.*g_p.*gsw_gibbs(n0,n2,n0,SA,t,p); + +g_tp = gsw_gibbs(n0,n1,n1,SA,t,p); + +factora = g_SA_T_mod - g_SA_mod./(273.15+pt0); + +factor = factora./g_psq_g_tt; + +drho_dSA = g_tp.*factor - gsw_gibbs(n1,n0,n1,SA,t,p)./(g_p.*g_p); + +drho_dCT = g_tp.*gsw_cp0./((273.15+pt0).*g_psq_g_tt); + +drho_dP = (g_tp.^2 - gsw_gibbs(n0,n2,n0,SA,t,p).*gsw_gibbs(n0,n0,n2,SA,t,p))./(g_psq_g_tt); + +if transposed + drho_dSA = drho_dSA.'; + drho_dCT = drho_dCT.'; + drho_dP = drho_dP.'; +end + +end diff --git a/Toolbox/gsw_sigma0.m b/Toolbox/gsw_sigma0.m index d87c3b8..c27090d 100644 --- a/Toolbox/gsw_sigma0.m +++ b/Toolbox/gsw_sigma0.m @@ -5,18 +5,18 @@ %========================================================================== % % USAGE: -% sigma0 = gsw_sigma0(SA,CT,p) +% sigma0 = gsw_sigma0(SA,CT) % % DESCRIPTION: % Calculates potential density anomaly with reference pressure of 0 dbar, % this being this particular potential density minus 1000 kg/m^3. This % function has inputs of Absolute Salinity and Conservative Temperature. % This function uses the computationally-efficient 48-term expression for -% density in terms of SA, CT and p (McDougall et al., 2013). +% density in terms of SA, CT and p (IOC et al., 2010). % % Note that the 48-term equation has been fitted in a restricted range of % parameter space, and is most accurate inside the "oceanographic funnel" -% described in McDougall et al. (2013). The GSW library function +% described in IOC et al. (2010). The GSW library function % "gsw_infunnel(SA,CT,p)" is avaialble to be used if one wants to test if % some of one's data lies outside this "funnel". % @@ -34,7 +34,7 @@ % AUTHOR: % Paul Barker and Trevor McDougall [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (16th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of @@ -43,11 +43,6 @@ % UNESCO (English), 196 pp. Available from http://www.TEOS-10.org % See Eqn. (A.30.1) of this TEOS-10 Manual. % -% McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2013: A -% computationally efficient 48-term expression for the density of -% seawater in terms of Conservative Temperature, and related properties -% of seawater. To be submitted to J. Atm. Ocean. Technol., xx, yyy-zzz. -% % The software is available from http://www.TEOS-10.org % %========================================================================== diff --git a/Toolbox/gsw_sigma0_CT.m b/Toolbox/gsw_sigma0_CT.m index 83c45d5..51d5212 100644 --- a/Toolbox/gsw_sigma0_CT.m +++ b/Toolbox/gsw_sigma0_CT.m @@ -18,11 +18,11 @@ % this being this particular potential density minus 1000 kg/m^3. This % function has inputs of Absolute Salinity and Conservative Temperature. % This function uses the computationally-efficient 48-term expression for -% density in terms of SA, CT and p (McDougall et al., 2013). +% density in terms of SA, CT and p (IOC et al., 2010). % % Note that the 48-term equation has been fitted in a restricted range of % parameter space, and is most accurate inside the "oceanographic funnel" -% described in McDougall et al. (2013). The GSW library function +% described in IOC et al. (2010). The GSW library function % "gsw_infunnel(SA,CT,p)" is avaialble to be used if one wants to test if % some of one's data lies outside this "funnel". % @@ -40,7 +40,7 @@ % AUTHOR: % Paul Barker and Trevor McDougall [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (16th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of @@ -49,11 +49,6 @@ % UNESCO (English), 196 pp. Available from http://www.TEOS-10.org % See Eqn. (A.30.1) of this TEOS-10 Manual. % -% McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2013: A -% computationally efficient 48-term expression for the density of -% seawater in terms of Conservative Temperature, and related properties -% of seawater. To be submitted to J. Atm. Ocean. Technol., xx, yyy-zzz. -% % The software is available from http://www.TEOS-10.org % %========================================================================== diff --git a/Toolbox/gsw_sigma0_CT_exact.m b/Toolbox/gsw_sigma0_CT_exact.m index 72cd506..f39ab20 100644 --- a/Toolbox/gsw_sigma0_CT_exact.m +++ b/Toolbox/gsw_sigma0_CT_exact.m @@ -13,9 +13,9 @@ % function has inputs of Absolute Salinity and Conservative Temperature. % % Note that this function uses the full Gibbs function. There is an -% alternative to calling this function, namely gsw_sigma0_CT(SA,CT,p), +% alternative to calling this function, namely gsw_sigma0(SA,CT,p), % which uses the computationally efficient 48-term expression for density -% in terms of SA, CT and p (McDougall et al., 2013). +% in terms of SA, CT and p (IOC et al., 2010). % % INPUT: % SA = Absolute Salinity [ g/kg ] @@ -31,7 +31,7 @@ % AUTHOR: % Trevor McDougall & Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (16th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of @@ -40,11 +40,6 @@ % UNESCO (English), 196 pp. Available from http://www.TEOS-10.org % See Eqn. (A.30.1) of this TEOS-10 Manual. % -% McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2013: A -% computationally efficient 48-term expression for the density of -% seawater in terms of Conservative Temperature, and related properties -% of seawater. To be submitted to J. Atm. Ocean. Technol., xx, yyy-zzz. -% % The software is available from http://www.TEOS-10.org % %========================================================================== diff --git a/Toolbox/gsw_sigma1.m b/Toolbox/gsw_sigma1.m index b3e4750..26f40fe 100644 --- a/Toolbox/gsw_sigma1.m +++ b/Toolbox/gsw_sigma1.m @@ -15,7 +15,7 @@ % % Note that the 48-term equation has been fitted in a restricted range of % parameter space, and is most accurate inside the "oceanographic funnel" -% described in McDougall et al. (2013). The GSW library function +% described in IOC et al. (2010). The GSW library function % "gsw_infunnel(SA,CT,p)" is avaialble to be used if one wants to test if % some of one's data lies outside this "funnel". % @@ -33,7 +33,7 @@ % AUTHOR: % Paul Barker and Trevor McDougall [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (16th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of @@ -42,11 +42,6 @@ % UNESCO (English), 196 pp. Available from http://www.TEOS-10.org % See Eqn. (A.30.1) of this TEOS-10 Manual. % -% McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2013: A -% computationally efficient 48-term expression for the density of -% seawater in terms of Conservative Temperature, and related properties -% of seawater. To be submitted to J. Atm. Ocean. Technol., xx, yyy-zzz. -% % The software is available from http://www.TEOS-10.org % %========================================================================== diff --git a/Toolbox/gsw_sigma1_CT.m b/Toolbox/gsw_sigma1_CT.m index a87c88d..99164c4 100644 --- a/Toolbox/gsw_sigma1_CT.m +++ b/Toolbox/gsw_sigma1_CT.m @@ -21,7 +21,7 @@ % % Note that the 48-term equation has been fitted in a restricted range of % parameter space, and is most accurate inside the "oceanographic funnel" -% described in McDougall et al. (2013). The GSW library function +% described in IOC et al. (2010). The GSW library function % "gsw_infunnel(SA,CT,p)" is avaialble to be used if one wants to test if % some of one's data lies outside this "funnel". % @@ -39,7 +39,7 @@ % AUTHOR: % Paul Barker and Trevor McDougall [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (16th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of @@ -48,11 +48,6 @@ % UNESCO (English), 196 pp. Available from http://www.TEOS-10.org % See Eqn. (A.30.1) of this TEOS-10 Manual. % -% McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2013: A -% computationally efficient 48-term expression for the density of -% seawater in terms of Conservative Temperature, and related properties -% of seawater. To be submitted to J. Atm. Ocean. Technol., xx, yyy-zzz. -% % The software is available from http://www.TEOS-10.org % %========================================================================== diff --git a/Toolbox/gsw_sigma1_CT_exact.m b/Toolbox/gsw_sigma1_CT_exact.m index bb25664..4685e70 100644 --- a/Toolbox/gsw_sigma1_CT_exact.m +++ b/Toolbox/gsw_sigma1_CT_exact.m @@ -14,9 +14,9 @@ % Temperature. % % Note that this function uses the full Gibbs function. There is an -% alternative to calling this function, namely gsw_sigma1_CT(SA,CT,p), +% alternative to calling this function, namely gsw_sigma1(SA,CT,p), % which uses the computationally efficient 48-term expression for density -% in terms of SA, CT and p (McDougall et al., 2013). +% in terms of SA, CT and p (IOC et al., 2010). % % INPUT: % SA = Absolute Salinity [ g/kg ] @@ -32,7 +32,7 @@ % AUTHOR: % Trevor McDougall & Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (16th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of @@ -41,11 +41,6 @@ % UNESCO (English), 196 pp. Available from http://www.TEOS-10.org % See Eqn. (A.30.1) of this TEOS-10 Manual. % -% McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2013: A -% computationally efficient 48-term expression for the density of -% seawater in terms of Conservative Temperature, and related properties -% of seawater. To be submitted to J. Atm. Ocean. Technol., xx, yyy-zzz. -% % The software is available from http://www.TEOS-10.org % %========================================================================== diff --git a/Toolbox/gsw_sigma2.m b/Toolbox/gsw_sigma2.m index 5b75d88..a17f465 100644 --- a/Toolbox/gsw_sigma2.m +++ b/Toolbox/gsw_sigma2.m @@ -15,7 +15,7 @@ % % Note that the 48-term equation has been fitted in a restricted range of % parameter space, and is most accurate inside the "oceanographic funnel" -% described in McDougall et al. (2013). The GSW library function +% described in IOC et al. (2010). The GSW library function % "gsw_infunnel(SA,CT,p)" is avaialble to be used if one wants to test if % some of one's data lies outside this "funnel". % @@ -33,7 +33,7 @@ % AUTHOR: % Paul Barker and Trevor McDougall [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (16th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of @@ -42,11 +42,6 @@ % UNESCO (English), 196 pp. Available from http://www.TEOS-10.org % See Eqn. (A.30.1) of this TEOS-10 Manual. % -% McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2013: A -% computationally efficient 48-term expression for the density of -% seawater in terms of Conservative Temperature, and related properties -% of seawater. To be submitted to J. Atm. Ocean. Technol., xx, yyy-zzz. -% % The software is available from http://www.TEOS-10.org % %========================================================================== diff --git a/Toolbox/gsw_sigma2_CT.m b/Toolbox/gsw_sigma2_CT.m index 6dccced..918fae4 100644 --- a/Toolbox/gsw_sigma2_CT.m +++ b/Toolbox/gsw_sigma2_CT.m @@ -21,7 +21,7 @@ % % Note that the 48-term equation has been fitted in a restricted range of % parameter space, and is most accurate inside the "oceanographic funnel" -% described in McDougall et al. (2013). The GSW library function +% described in IOC et al. (2010). The GSW library function % "gsw_infunnel(SA,CT,p)" is avaialble to be used if one wants to test if % some of one's data lies outside this "funnel". % @@ -39,7 +39,7 @@ % AUTHOR: % Paul Barker and Trevor McDougall [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (16th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of @@ -48,11 +48,6 @@ % UNESCO (English), 196 pp. Available from http://www.TEOS-10.org % See Eqn. (A.30.1) of this TEOS-10 Manual. % -% McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2013: A -% computationally efficient 48-term expression for the density of -% seawater in terms of Conservative Temperature, and related properties -% of seawater. To be submitted to J. Atm. Ocean. Technol., xx, yyy-zzz. -% % The software is available from http://www.TEOS-10.org % %========================================================================== diff --git a/Toolbox/gsw_sigma2_CT_exact.m b/Toolbox/gsw_sigma2_CT_exact.m index 0a59ea6..de33119 100644 --- a/Toolbox/gsw_sigma2_CT_exact.m +++ b/Toolbox/gsw_sigma2_CT_exact.m @@ -14,9 +14,9 @@ % Temperature. % % Note that this function uses the full Gibbs function. There is an -% alternative to calling this function, namely gsw_sigma2_CT(SA,CT,p), +% alternative to calling this function, namely gsw_sigma2(SA,CT,p), % which uses the computationally efficient 48-term expression for density -% in terms of SA, CT and p (McDougall et al., 2013). +% in terms of SA, CT and p (IOC et al., 2010). % % INPUT: % SA = Absolute Salinity [ g/kg ] @@ -32,7 +32,7 @@ % AUTHOR: % Trevor McDougall & Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (16th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of @@ -41,11 +41,6 @@ % UNESCO (English), 196 pp. Available from http://www.TEOS-10.org % See Eqn. (A.30.1) of this TEOS-10 Manual. % -% McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2011: A -% computationally efficient 48-term expression for the density of -% seawater in terms of Conservative Temperature, and related properties -% of seawater. To be submitted to Ocean Science Discussions. -% % The software is available from http://www.TEOS-10.org % %========================================================================== diff --git a/Toolbox/gsw_sigma3.m b/Toolbox/gsw_sigma3.m index b0a5037..3c5f28a 100644 --- a/Toolbox/gsw_sigma3.m +++ b/Toolbox/gsw_sigma3.m @@ -15,7 +15,7 @@ % % Note that the 48-term equation has been fitted in a restricted range of % parameter space, and is most accurate inside the "oceanographic funnel" -% described in McDougall et al. (2013). The GSW library function +% described in IOC et al. (2010). The GSW library function % "gsw_infunnel(SA,CT,p)" is avaialble to be used if one wants to test if % some of one's data lies outside this "funnel". % @@ -33,7 +33,7 @@ % AUTHOR: % Paul Barker and Trevor McDougall [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (16th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of @@ -42,11 +42,6 @@ % UNESCO (English), 196 pp. Available from http://www.TEOS-10.org % See Eqn. (A.30.1) of this TEOS-10 Manual. % -% McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2013: A -% computationally efficient 48-term expression for the density of -% seawater in terms of Conservative Temperature, and related properties -% of seawater. To be submitted to J. Atm. Ocean. Technol., xx, yyy-zzz. -% % The software is available from http://www.TEOS-10.org % %========================================================================== diff --git a/Toolbox/gsw_sigma3_CT.m b/Toolbox/gsw_sigma3_CT.m index 3745a3b..3a82fc9 100644 --- a/Toolbox/gsw_sigma3_CT.m +++ b/Toolbox/gsw_sigma3_CT.m @@ -21,7 +21,7 @@ % % Note that the 48-term equation has been fitted in a restricted range of % parameter space, and is most accurate inside the "oceanographic funnel" -% described in McDougall et al. (2013). The GSW library function +% described in IOC et al. (2010). The GSW library function % "gsw_infunnel(SA,CT,p)" is avaialble to be used if one wants to test if % some of one's data lies outside this "funnel". % @@ -39,7 +39,7 @@ % AUTHOR: % Paul Barker and Trevor McDougall [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (16th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of @@ -48,11 +48,6 @@ % UNESCO (English), 196 pp. Available from http://www.TEOS-10.org % See Eqn. (A.30.1) of this TEOS-10 Manual. % -% McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2013: A -% computationally efficient 48-term expression for the density of -% seawater in terms of Conservative Temperature, and related properties -% of seawater. To be submitted to J. Atm. Ocean. Technol., xx, yyy-zzz. -% % The software is available from http://www.TEOS-10.org % %========================================================================== diff --git a/Toolbox/gsw_sigma3_CT_exact.m b/Toolbox/gsw_sigma3_CT_exact.m index 8b71716..c5445e5 100644 --- a/Toolbox/gsw_sigma3_CT_exact.m +++ b/Toolbox/gsw_sigma3_CT_exact.m @@ -14,9 +14,9 @@ % Temperature. % % Note that this function uses the full Gibbs function. There is an -% alternative to calling this function, namely gsw_sigma3_CT(SA,CT,p), +% alternative to calling this function, namely gsw_sigma3(SA,CT,p), % which uses the computationally efficient 48-term expression for density -% in terms of SA, CT and p (McDougall et al., 2013). +% in terms of SA, CT and p (IOC et al., 2010). % % INPUT: % SA = Absolute Salinity [ g/kg ] @@ -32,7 +32,7 @@ % AUTHOR: % Trevor McDougall & Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (16th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of @@ -41,11 +41,6 @@ % UNESCO (English), 196 pp. Available from http://www.TEOS-10.org % See Eqn. (A.30.1) of this TEOS-10 Manual. % -% McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2013: A -% computationally efficient 48-term expression for the density of -% seawater in terms of Conservative Temperature, and related properties -% of seawater. To be submitted to J. Atm. Ocean. Technol., xx, yyy-zzz. -% % The software is available from http://www.TEOS-10.org % %========================================================================== diff --git a/Toolbox/gsw_sigma4.m b/Toolbox/gsw_sigma4.m index 053ca37..32c888b 100644 --- a/Toolbox/gsw_sigma4.m +++ b/Toolbox/gsw_sigma4.m @@ -15,7 +15,7 @@ % % Note that the 48-term equation has been fitted in a restricted range of % parameter space, and is most accurate inside the "oceanographic funnel" -% described in McDougall et al. (2013). The GSW library function +% described in IOC et al. (2010). The GSW library function % "gsw_infunnel(SA,CT,p)" is avaialble to be used if one wants to test if % some of one's data lies outside this "funnel". % @@ -33,7 +33,7 @@ % AUTHOR: % Paul Barker and Trevor McDougall [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (16th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of @@ -42,11 +42,6 @@ % UNESCO (English), 196 pp. Available from http://www.TEOS-10.org % See Eqn. (A.30.1) of this TEOS-10 Manual. % -% McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2013: A -% computationally efficient 48-term expression for the density of -% seawater in terms of Conservative Temperature, and related properties -% of seawater. To be submitted to J. Atm. Ocean. Technol., xx, yyy-zzz. -% % The software is available from http://www.TEOS-10.org % %========================================================================== diff --git a/Toolbox/gsw_sigma4_CT.m b/Toolbox/gsw_sigma4_CT.m index 8885a4f..8bcc209 100644 --- a/Toolbox/gsw_sigma4_CT.m +++ b/Toolbox/gsw_sigma4_CT.m @@ -21,7 +21,7 @@ % % Note that the 48-term equation has been fitted in a restricted range of % parameter space, and is most accurate inside the "oceanographic funnel" -% described in McDougall et al. (2013). The GSW library function +% described in IOC et al. (2010). The GSW library function % "gsw_infunnel(SA,CT,p)" is avaialble to be used if one wants to test if % some of one's data lies outside this "funnel". % @@ -39,7 +39,7 @@ % AUTHOR: % Paul Barker and Trevor McDougall [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (16th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of @@ -48,11 +48,6 @@ % UNESCO (English), 196 pp. Available from http://www.TEOS-10.org % See Eqn. (A.30.1) of this TEOS-10 Manual. % -% McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2013: A -% computationally efficient 48-term expression for the density of -% seawater in terms of Conservative Temperature, and related properties -% of seawater. To be submitted to J. Atm. Ocean. Technol., xx, yyy-zzz. -% % The software is available from http://www.TEOS-10.org % %========================================================================== diff --git a/Toolbox/gsw_sigma4_CT_exact.m b/Toolbox/gsw_sigma4_CT_exact.m index e652b3d..e8b440c 100644 --- a/Toolbox/gsw_sigma4_CT_exact.m +++ b/Toolbox/gsw_sigma4_CT_exact.m @@ -14,9 +14,9 @@ % Temperature. % % Note that this function uses the full Gibbs function. There is an -% alternative to calling this function, namely gsw_sigma4_CT(SA,CT,p), +% alternative to calling this function, namely gsw_sigma4(SA,CT,p), % which uses the computationally efficient 48-term expression for density -% in terms of SA, CT and p (McDougall et al., 2013). +% in terms of SA, CT and p (IOC et al., 2010). % % INPUT: % SA = Absolute Salinity [ g/kg ] @@ -32,7 +32,7 @@ % AUTHOR: % Trevor McDougall & Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (16th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of @@ -41,11 +41,6 @@ % UNESCO (English), 196 pp. Available from http://www.TEOS-10.org % See Eqn. (A.30.1) of this TEOS-10 Manual. % -% McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2013: A -% computationally efficient 48-term expression for the density of -% seawater in terms of Conservative Temperature, and related properties -% of seawater. To be submitted to J. Atm. Ocean. Technol., xx, yyy-zzz. -% % The software is available from http://www.TEOS-10.org % %========================================================================== diff --git a/Toolbox/gsw_sound_speed.m b/Toolbox/gsw_sound_speed.m index 93b6c2f..f1b2ac5 100644 --- a/Toolbox/gsw_sound_speed.m +++ b/Toolbox/gsw_sound_speed.m @@ -11,11 +11,11 @@ % Calculates the speed of sound in seawater. This function has inputs of % Absolute Salinity and Conservative Temperature. This function uses the % computationally-efficient 48-term expression for density in terms of SA, -% CT and p (McDougall et al., 2013). +% CT and p (IOC et al., 2010). % % Note that the 48-term equation has been fitted in a restricted range of % parameter space, and is most accurate inside the "oceanographic funnel" -% described in McDougall et al. (2013). The GSW library function +% described in IOC et al. (2010). The GSW library function % "gsw_infunnel(SA,CT,p)" is avaialble to be used if one wants to test if % some of one's data lies outside this "funnel". % @@ -34,7 +34,7 @@ % AUTHOR: % Paul Barker and Trevor McDougall [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (16th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of @@ -43,11 +43,6 @@ % UNESCO (English), 196 pp. Available from http://www.TEOS-10.org % See Eqn. (2.17.1) of this TEOS-10 Manual. % -% McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2013: A -% computationally efficient 48-term expression for the density of -% seawater in terms of Conservative Temperature, and related properties -% of seawater. To be submitted to J. Atm. Ocean. Technol., xx, yyy-zzz. -% % The software is available from http://www.TEOS-10.org % %========================================================================== diff --git a/Toolbox/gsw_sound_speed_CT.m b/Toolbox/gsw_sound_speed_CT.m index 56d68d6..eb81834 100644 --- a/Toolbox/gsw_sound_speed_CT.m +++ b/Toolbox/gsw_sound_speed_CT.m @@ -17,11 +17,11 @@ % Calculates the speed of sound in seawater. This function has inputs of % Absolute Salinity and Conservative Temperature. This function uses the % computationally-efficient 48-term expression for density in terms of SA, -% CT and p (McDougall et al., 2013). +% CT and p (IOC et al., 2010). % % Note that the 48-term equation has been fitted in a restricted range of % parameter space, and is most accurate inside the "oceanographic funnel" -% described in McDougall et al. (2013). The GSW library function +% described in IOC et al. (2010). The GSW library function % "gsw_infunnel(SA,CT,p)" is avaialble to be used if one wants to test if % some of one's data lies outside this "funnel". % @@ -40,7 +40,7 @@ % AUTHOR: % Paul Barker and Trevor McDougall [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (16th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of @@ -49,11 +49,6 @@ % UNESCO (English), 196 pp. Available from http://www.TEOS-10.org % See Eqn. (2.17.1) of this TEOS-10 Manual. % -% McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2013: A -% computationally efficient 48-term expression for the density of -% seawater in terms of Conservative Temperature, and related properties -% of seawater. To be submitted to J. Atm. Ocean. Technol., xx, yyy-zzz. -% % The software is available from http://www.TEOS-10.org % %========================================================================== diff --git a/Toolbox/gsw_sound_speed_CT_exact.m b/Toolbox/gsw_sound_speed_CT_exact.m index 80f5931..1a2ffab 100644 --- a/Toolbox/gsw_sound_speed_CT_exact.m +++ b/Toolbox/gsw_sound_speed_CT_exact.m @@ -4,7 +4,7 @@ %========================================================================== % % USAGE: -% sound_speed_CT = gsw_sound_speed_CT(SA,CT,p) +% sound_speed_CT_exact = gsw_sound_speed_CT_exact(SA,CT,p) % % DESCRIPTION: % Calculates the speed of sound in seawater from Absolute Salinity and @@ -25,7 +25,7 @@ % AUTHOR: % David Jackett, Paul Barker and Trevor McDougall [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (16th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of diff --git a/Toolbox/gsw_specvol.m b/Toolbox/gsw_specvol.m index 5d6706b..061cb1a 100644 --- a/Toolbox/gsw_specvol.m +++ b/Toolbox/gsw_specvol.m @@ -9,11 +9,11 @@ % DESCRIPTION: % Calculates specific volume from Absolute Salinity, Conservative % Temperature and pressure, using the computationally-efficient 48-term -% expression for density (McDougall et al., 2013). +% expression for density (IOC et al., 2010). % % Note that the 48-term equation has been fitted in a restricted range of % parameter space, and is most accurate inside the "oceanographic funnel" -% described in McDougall et al. (2013). The GSW library function +% described in IOC et al. (2010). The GSW library function % "gsw_infunnel(SA,CT,p)" is avaialble to be used if one wants to test if % some of one's data lies outside this "funnel". % @@ -32,7 +32,7 @@ % AUTHOR: % Paul Barker and Trevor McDougall [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (16th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of @@ -41,11 +41,6 @@ % UNESCO (English), 196 pp. Available from http://www.TEOS-10.org % See Eqn. (2.7.2) of this TEOS-10 Manual. % -% McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2013: A -% computationally efficient 48-term expression for the density of -% seawater in terms of Conservative Temperature, and related properties -% of seawater. To be submitted to J. Atm. Ocean. Technol., xx, yyy-zzz. -% % The software is available from http://www.TEOS-10.org % %========================================================================== diff --git a/Toolbox/gsw_specvol_CT.m b/Toolbox/gsw_specvol_CT.m index 2eb8b19..25a17da 100644 --- a/Toolbox/gsw_specvol_CT.m +++ b/Toolbox/gsw_specvol_CT.m @@ -15,11 +15,11 @@ % DESCRIPTION: % Calculates specific volume from Absolute Salinity, Conservative % Temperature and pressure, using the computationally-efficient 48-term -% expression for density (McDougall et al., 2013). +% expression for density (IOC et al., 2010). % % Note that the 48-term equation has been fitted in a restricted range of % parameter space, and is most accurate inside the "oceanographic funnel" -% described in McDougall et al. (2013). The GSW library function +% described in IOC et al. (2010). The GSW library function % "gsw_infunnel(SA,CT,p)" is avaialble to be used if one wants to test if % some of one's data lies outside this "funnel". % @@ -38,7 +38,7 @@ % AUTHOR: % Paul Barker and Trevor McDougall [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (16th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of @@ -47,11 +47,6 @@ % UNESCO (English), 196 pp. Available from http://www.TEOS-10.org % See Eqn. (2.7.2) of this TEOS-10 Manual. % -% McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2013: A -% computationally efficient 48-term expression for the density of -% seawater in terms of Conservative Temperature, and related properties -% of seawater. To be submitted to J. Atm. Ocean. Technol., xx, yyy-zzz. -% % The software is available from http://www.TEOS-10.org % %========================================================================== diff --git a/Toolbox/gsw_specvol_CT_exact.m b/Toolbox/gsw_specvol_CT_exact.m index 015331c..52177b6 100644 --- a/Toolbox/gsw_specvol_CT_exact.m +++ b/Toolbox/gsw_specvol_CT_exact.m @@ -13,7 +13,7 @@ % Note that this function uses the full Gibbs function. There is an % alternative to calling this function, namely gsw_specvol_CT(SA,CT,p), % which uses the computationally efficient 48-term expression for density -% in terms of SA, CT and p (McDougall et al., 2013). +% in terms of SA, CT and p (IOC et al., 2010). % % INPUT: % SA = Absolute Salinity [ g/kg ] @@ -30,7 +30,7 @@ % AUTHOR: % Trevor McDougall and Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (16th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of @@ -39,11 +39,6 @@ % UNESCO (English), 196 pp. Available from http://www.TEOS-10.org % See Eqn. (2.7.2) of this TEOS-10 Manual. % -% McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2013: A -% computationally efficient 48-term expression for the density of -% seawater in terms of Conservative Temperature, and related properties -% of seawater. To be submitted to J. Atm. Ocean. Technol., xx, yyy-zzz. -% % The software is available from http://www.TEOS-10.org % %========================================================================== diff --git a/Toolbox/gsw_specvol_anom.m b/Toolbox/gsw_specvol_anom.m index f5d6800..6aec197 100644 --- a/Toolbox/gsw_specvol_anom.m +++ b/Toolbox/gsw_specvol_anom.m @@ -9,13 +9,13 @@ % DESCRIPTION: % Calculates specific volume anomaly from Absolute Salinity, Conservative % Temperature and pressure. It uses the computationally-efficient 48-term -% expression for density as a function of SA, CT and p (McDougall et al., -% 2011). The reference value of Absolute Salinity is SSO and the reference +% expression for density as a function of SA, CT and p (IOC et al., +% 2010). The reference value of Absolute Salinity is SSO and the reference % value of Conservative Temperature is equal to 0 degress C. % % Note that the 48-term equation has been fitted in a restricted range of % parameter space, and is most accurate inside the "oceanographic funnel" -% described in McDougall et al. (2011). The GSW library function +% described in IOC et al. (2010). The GSW library function % "gsw_infunnel(SA,CT,p)" is avaialble to be used if one wants to test if % some of one's data lies outside this "funnel". % @@ -34,7 +34,7 @@ % AUTHOR: % Paul Barker and Trevor McDougall [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (16th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of @@ -43,11 +43,6 @@ % UNESCO (English), 196 pp. Available from http://www.TEOS-10.org % See Eqn. (3.7.3) of this TEOS-10 Manual. % -% McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2013: A -% computationally efficient 48-term expression for the density of -% seawater in terms of Conservative Temperature, and related properties -% of seawater. To be submitted to J. Atm. Ocean. Technol., xx, yyy-zzz. -% % The software is available from http://www.TEOS-10.org % %========================================================================== diff --git a/Toolbox/gsw_specvol_anom_CT.m b/Toolbox/gsw_specvol_anom_CT.m index fdd9b44..260070a 100644 --- a/Toolbox/gsw_specvol_anom_CT.m +++ b/Toolbox/gsw_specvol_anom_CT.m @@ -15,13 +15,13 @@ % DESCRIPTION: % Calculates specific volume anomaly from Absolute Salinity, Conservative % Temperature and pressure. It uses the computationally-efficient 48-term -% expression for density as a function of SA, CT and p (McDougall et al., -% 2013). The reference value of Absolute Salinity is SSO and the reference +% expression for density as a function of SA, CT and p (IOC et al., +% 2010). The reference value of Absolute Salinity is SSO and the reference % value of Conservative Temperature is equal to 0 degress C. % % Note that the 48-term equation has been fitted in a restricted range of % parameter space, and is most accurate inside the "oceanographic funnel" -% described in McDougall et al. (2013). The GSW library function +% described in IOC et al. (2010). The GSW library function % "gsw_infunnel(SA,CT,p)" is avaialble to be used if one wants to test if % some of one's data lies outside this "funnel". % @@ -40,7 +40,7 @@ % AUTHOR: % Paul Barker and Trevor McDougall [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (16th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of @@ -49,11 +49,6 @@ % UNESCO (English), 196 pp. Available from http://www.TEOS-10.org % See Eqn. (3.7.3) of this TEOS-10 Manual. % -% McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2013: A -% computationally efficient 48-term expression for the density of -% seawater in terms of Conservative Temperature, and related properties -% of seawater. To be submitted to J. Atm. Ocean. Technol., xx, yyy-zzz. -% % The software is available from http://www.TEOS-10.org % %========================================================================== diff --git a/Toolbox/gsw_specvol_anom_CT_exact.m b/Toolbox/gsw_specvol_anom_CT_exact.m index b3d7471..21a16b4 100644 --- a/Toolbox/gsw_specvol_anom_CT_exact.m +++ b/Toolbox/gsw_specvol_anom_CT_exact.m @@ -13,10 +13,9 @@ % 0 degress C. % % Note that this function uses the full Gibbs function. There is an -% alternative to calling this function, namely -% gsw_specvol_anom_CT(SA,CT,p), which uses the computationally efficient -% 48-term expression for density in terms of SA, CT and p -% (McDougall et al., 2013). +% alternative to calling this function, namely gsw_specvol_anom(SA,CT,p), +% which uses the computationally efficient 48-term expression for density +% in terms of SA, CT and p (IOC et al., 2010). % % INPUT: % SA = Absolute Salinity [ g/kg ] @@ -33,7 +32,7 @@ % AUTHOR: % Trevor McDougall and Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (16th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of @@ -42,11 +41,6 @@ % UNESCO (English), 196 pp. Available from http://www.TEOS-10.org % See Eqn. (3.7.3) of this TEOS-10 Manual. % -% McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2013: A -% computationally efficient 48-term expression for the density of -% seawater in terms of Conservative Temperature, and related properties -% of seawater. To be submitted to J. Atm. Ocean. Technol., xx, yyy-zzz. -% % The software is available from http://www.TEOS-10.org % %========================================================================== diff --git a/Toolbox/gsw_steric_height.m b/Toolbox/gsw_steric_height.m index 7876f2f..1149ca9 100644 --- a/Toolbox/gsw_steric_height.m +++ b/Toolbox/gsw_steric_height.m @@ -43,10 +43,10 @@ % The reference values used for the specific volume anomaly are % SSO = 35.16504 g/kg and CT = 0 deg C. This function calculates % specific volume anomaly using the computationally efficient 48-term -% expression for specific volume of McDougall et al. (2013). Note that the +% expression for specific volume of IOC et al. (2010). Note that the % 48-term equation has been fitted in a restricted range of parameter % space, and is most accurate inside the "oceanographic funnel" described -% in McDougall et al. (2013) and IOC et al. (2010). For dynamical +% in IOC et al. (2010) and IOC et al. (2010). For dynamical % oceanography we may take the 48-term rational function expression for % density as essentially reflecting the full accuracy of TEOS-10. The GSW % internal library function "gsw_infunnel(SA,CT,p)" is avaialble to be @@ -75,7 +75,7 @@ % AUTHOR: % Trevor McDougall and Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (16th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % Griffies, S. M., 2004: Fundamentals of Ocean Climate Models. Princeton, @@ -87,11 +87,6 @@ % UNESCO (English), 196 pp. Available from http://www.TEOS-10.org % See Eqn. (3.7.3) and section 3.27 of this TEOS-10 Manual. % -% McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2013: A -% computationally efficient 48-term expression for the density of -% seawater in terms of Conservative Temperature, and related properties -% of seawater. To be submitted to J. Atm. Ocean. Technol., xx, yyy-zzz. -% % The software is available from http://www.TEOS-10.org % %========================================================================== diff --git a/Toolbox/gsw_t90_from_t48.m b/Toolbox/gsw_t90_from_t48.m index 949baa2..410f1b1 100644 --- a/Toolbox/gsw_t90_from_t48.m +++ b/Toolbox/gsw_t90_from_t48.m @@ -20,7 +20,7 @@ % AUTHOR: % Paul Barker and Trevor McDougall [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (16th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % This function is unchanged from version 2.0 (24th September, 2010). % % REFERENCES: diff --git a/Toolbox/gsw_t90_from_t68.m b/Toolbox/gsw_t90_from_t68.m index 70a8336..e85b1ad 100644 --- a/Toolbox/gsw_t90_from_t68.m +++ b/Toolbox/gsw_t90_from_t68.m @@ -20,7 +20,7 @@ % AUTHOR: % Paul Barker and Trevor McDougall [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (16th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % This function is unchanged from version 2.0 (24th September, 2010). % % REFERENCES: diff --git a/Toolbox/gsw_t_freezing.m b/Toolbox/gsw_t_freezing.m index 17188c8..52cc09c 100644 --- a/Toolbox/gsw_t_freezing.m +++ b/Toolbox/gsw_t_freezing.m @@ -30,7 +30,7 @@ % AUTHOR: % Trevor McDougall, Paul Barker and Rainer Feistal [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (16th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of diff --git a/Toolbox/gsw_t_from_CT.m b/Toolbox/gsw_t_from_CT.m index 1c48586..310129d 100644 --- a/Toolbox/gsw_t_from_CT.m +++ b/Toolbox/gsw_t_from_CT.m @@ -25,7 +25,7 @@ % AUTHOR: % Trevor McDougall and Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (16th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % This function is unchanged from version 2.0 (24th September, 2010). % % REFERENCES: diff --git a/Toolbox/gsw_t_from_entropy.m b/Toolbox/gsw_t_from_entropy.m new file mode 100644 index 0000000..dc70710 --- /dev/null +++ b/Toolbox/gsw_t_from_entropy.m @@ -0,0 +1,95 @@ +function t = gsw_t_from_entropy(SA,entropy,p) + +% gsw_t_from_entropy in-situ temperature +% as a function of entropy +% ========================================================================= +% +% USAGE: +% t = gsw_t_from_entropy(SA,entropy,p) +% +% DESCRIPTION: +% Calculates in-situ temperature with entropy as an input variable. +% +% INPUT: +% SA = Absolute Salinity [ g/kg ] +% entropy = specific entropy [ J/(kg*K) ] +% p = sea pressure [ dbar ] +% ( i.e. absolute pressure - 10.1325 dbar ) +% +% SA & entropy need to have the same dimensions. +% p may have dimensions 1x1 or Mx1 or 1xN or MxN, where SA & entropy are +% MxN. +% +% OUTPUT: +% t = in-situ temperature (ITS-90) [ deg C ] +% +% AUTHOR: +% Trevor McDougall and Paul Barker [ help@teos-10.org ] +% +% VERSION NUMBER: 3.03 (29th April, 2013) +% +% REFERENCES: +% IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of +% seawater - 2010: Calculation and use of thermodynamic properties. +% Intergovernmental Oceanographic Commission, Manuals and Guides No. 56, +% UNESCO (English), 196 pp. Available from http://www.TEOS-10.org +% See appendix A.10 of this TEOS-10 Manual. +% +% The software is available from http://www.TEOS-10.org +% +%========================================================================== + +%-------------------------------------------------------------------------- +% Check variables and resize if necessary +%-------------------------------------------------------------------------- + +if ~(nargin == 3) + error('gsw_t_from_entropy: Requires 3 inputs, Absolute Salinity, entropy and pressure') +end %if + +[ms,ns] = size(SA); +[me,ne] = size(entropy); +[mp,np] = size(p); + +if (ms ~= me | ns ~= ne ) + error('gsw_t_from_entropy: Input arguments do not have the same dimensions') +end %if + +if (mp == 1) & (np == 1) % p scalar - fill to size of SA + p = p*ones(size(SA)); +elseif (ns == np) & (mp == 1) % p is row vector, + p = p(ones(1,ms), :); % copy down each column. +elseif (ms == mp) & (np == 1) % p is column vector, + p = p(:,ones(1,ns)); % copy across each row. +elseif (ns == mp) & (np == 1) % p is a transposed row vector, + p = p.'; % transposed then + p = p(ones(1,ms), :); % copy down each column. +elseif (ms == mp) & (ns == np) + % ok +else + error('gsw_adiabatic_lapse_rate_from_CT: Inputs array dimensions arguments do not agree') +end %if + +if ms == 1 + SA = SA.'; + entropy = entropy.'; + p = p.'; + transposed = 1; +else + transposed = 0; +end + +%-------------------------------------------------------------------------- +% Start of the calculation +%-------------------------------------------------------------------------- + +pt = gsw_pt_from_entropy(SA,entropy); +% Note that pt is potential temperature with a reference pressure of zero. +p0 = zeros(size(SA)); +t = gsw_pt_from_t(SA,pt,p0,p); + +if transposed + t = t.'; +end + +end diff --git a/Toolbox/gsw_t_from_pt0.m b/Toolbox/gsw_t_from_pt0.m new file mode 100644 index 0000000..ff56dc1 --- /dev/null +++ b/Toolbox/gsw_t_from_pt0.m @@ -0,0 +1,102 @@ +function t = gsw_t_from_pt0(SA,pt0,p) + +% gsw_t_from_pt0 in-situ temperature from potential +% temperature with a p_ref = 0 dbar +% ========================================================================= +% +% USAGE: +% t = gsw_t_from_pt0(SA,pt0,p) +% +% DESCRIPTION: +% Calculates in-situ temperature from potential temperature with a +% reference pressure of 0 dbar. +% +% It is also possible to calculate in-situ temperature from potential +% temparature using the function gsw_pt_from_t. In this case it would be +% called with Absolute Salinity, SA, potential temperature referenced to +% 0 dbar, pt0, and the in-situ pressure (i.e. gsw_pt_from_t(SA,pt0,0,p) ). +% +% INPUT: +% SA = Absolute Salinity [ g/kg ] +% pt0 = potential temperature with reference pressure = 0 dbar [ deg C ] +% p = sea pressure [ dbar ] +% ( i.e. absolute pressure - 10.1325 dbar ) +% +% SA & pt0 need to have the same dimensions. p may have dimensions 1x1 or +% Mx1 or 1xN or MxN, where SA & pt0 are MxN. +% +% OUTPUT: +% t = in-situ temperature (ITS-90) [ deg C ] +% +% AUTHOR: +% Trevor McDougall and Paul Barker. [ help@teos-10.org ] +% +% VERSION NUMBER: 3.03 (22nd May, 2013) +% +% REFERENCES: +% IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of +% seawater - 2010: Calculation and use of thermodynamic properties. +% Intergovernmental Oceanographic Commission, Manuals and Guides No. 56, +% UNESCO (English), 196 pp. Available from http://www.TEOS-10.org +% See section 3.1 of this TEOS-10 Manual. +% +% McDougall T.J. and S.J. Wotherspoon, 2012: A simple modification of +% Newton’s method to achieve convergence of order "1 + sqrt(2)". +% Submitted to Applied Mathematics and Computation. +% +% The software is available from http://www.TEOS-10.org +% +%========================================================================== + +%-------------------------------------------------------------------------- +% Check variables and resize if necessary +%-------------------------------------------------------------------------- + +if ~(nargin == 3) + error('gsw_t_from_pt0: Requires either three inputs.') +end %if + +[ms,ns] = size(SA); +[mt,nt] = size(pt0); +[mp,np] = size(p); + +if (ms ~= mt | ns ~= nt ) + error('gsw_t_from_pt0: Input arguments do not have the same dimensions') +end %if + +if (mp == 1) & (np == 1) % p scalar - fill to size of SA + p = p*ones(size(SA)); +elseif (ns == np) & (mp == 1) % p is row vector, + p = p(ones(1,ms), :); % copy down each column. +elseif (ms == mp) & (np == 1) % p is column vector, + p = p(:,ones(1,ns)); % copy across each row. +elseif (ns == mp) & (np == 1) % p is a transposed row vector, + p = p.'; % transposed then + p = p(ones(1,ms), :); % copy down each column. +elseif (ms == mp) & (ns == np) + % ok +else + error('gsw_t_from_pt0: Inputs array dimensions arguments do not agree') +end %if + +if ms == 1 + SA = SA.'; + pt0 = pt0.'; + p = p.'; + transposed = 1; +else + transposed = 0; +end + +%-------------------------------------------------------------------------- +% Start of the calculation +%-------------------------------------------------------------------------- + +p0 = zeros(size(SA)); +t = gsw_pt_from_t(SA,pt0,p0,p); + +if transposed + t = t.'; +end + +end diff --git a/Toolbox/gsw_thermobaric.m b/Toolbox/gsw_thermobaric.m index c870017..4e0ced1 100644 --- a/Toolbox/gsw_thermobaric.m +++ b/Toolbox/gsw_thermobaric.m @@ -10,11 +10,11 @@ % Calculates the thermobaric coefficient of seawater with respect to % Conservative Temperature. This routine calculates rho from the % computationally-efficient 48-term expression for density in terms of -% SA, CT and p (McDougall et al., 2013). +% SA, CT and p (IOC et al., 2010). % % Note that the 48-term equation has been fitted in a restricted range of % parameter space, and is most accurate inside the "oceanographic funnel" -% described in McDougall et al. (2013). The GSW library function +% described in IOC et al. (2010). The GSW library function % "gsw_infunnel(SA,CT,p)" is avaialble to be used if one wants to test if % some of one's data lies outside this "funnel". % @@ -34,9 +34,9 @@ % pressure in Pa not dbar. % % AUTHOR: -% David Jackett, Trevor McDougall and Paul Barker [ help@teos-10.org ] +% Trevor McDougall and Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (16th November, 2012) +% VERSION NUMBER: 3.03 (5th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of @@ -45,11 +45,6 @@ % UNESCO (English), 196 pp. Available from http://www.TEOS-10.org % See Eqns. (3.8.2) and (P.2) of this TEOS-10 manual. % -% McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2013: A -% computationally efficient 48-term expression for the density of -% seawater in terms of Conservative Temperature, and related properties -% of seawater. To be submitted to J. Atm. Ocean. Technol., xx, yyy-zzz. -% % The software is available from http://www.TEOS-10.org % %========================================================================== @@ -97,45 +92,219 @@ %-------------------------------------------------------------------------- % Start of the calculation %-------------------------------------------------------------------------- +% This line ensures that SA is non-negative. +SA(SA < 0) = 0; -db2Pa = 1e4; -dp = 1e-1; % pressure increment is 1e-1 dbar (10 Pa) +v01 = 9.998420897506056e+2; +v02 = 2.839940833161907; +v03 = -3.147759265588511e-2; +v04 = 1.181805545074306e-3; +v05 = -6.698001071123802; +v06 = -2.986498947203215e-2; +v07 = 2.327859407479162e-4; +v08 = -3.988822378968490e-2; +v09 = 5.095422573880500e-4; +v10 = -1.426984671633621e-5; +v11 = 1.645039373682922e-7; +v12 = -2.233269627352527e-2; +v13 = -3.436090079851880e-4; +v14 = 3.726050720345733e-6; +v15 = -1.806789763745328e-4; +v16 = 6.876837219536232e-7; +v17 = -3.087032500374211e-7; +v18 = -1.988366587925593e-8; +v19 = -1.061519070296458e-11; +v20 = 1.550932729220080e-10; -p_u = zeros(size(p)); -p_u(p >= dp) = p(p >= dp) - dp; +v21 = 1.0; +v22 = 2.775927747785646e-3; +v23 = -2.349607444135925e-5; +v24 = 1.119513357486743e-6; +v25 = 6.743689325042773e-10; +v26 = -7.521448093615448e-3; +v27 = -2.764306979894411e-5; +v28 = 1.262937315098546e-7; +v29 = 9.527875081696435e-10; +v30 = -1.811147201949891e-11; +v31 = -3.303308871386421e-5; +v32 = 3.801564588876298e-7; +v33 = -7.672876869259043e-9; +v34 = -4.634182341116144e-11; +v35 = 2.681097235569143e-12; +v36 = 5.419326551148740e-6; +v37 = -2.742185394906099e-5; +v38 = -3.212746477974189e-7; +v39 = 3.191413910561627e-9; +v40 = -1.931012931541776e-12; +v41 = -1.105097577149576e-7; +v42 = 6.211426728363857e-10; +v43 = -1.119011592875110e-10; +v44 = -1.941660213148725e-11; +v45 = -1.864826425365600e-14; +v46 = 1.119522344879478e-14; +v47 = -1.200507748551599e-15; +v48 = 6.057902487546866e-17; -p_l = dp*ones(size(p)); -p_l(p >= dp) = p(p >= dp) + dp; +a01 = 2.839940833161907; +a02 = -6.295518531177023e-2; +a03 = 3.545416635222918e-3; +a04 = -2.986498947203215e-2; +a05 = 4.655718814958324e-4; +a06 = 5.095422573880500e-4; +a07 = -2.853969343267241e-5; +a08 = 4.935118121048767e-7; +a09 = -3.436090079851880e-4; +a10 = 7.452101440691467e-6; +a11 = 6.876837219536232e-7; +a12 = -1.988366587925593e-8; +a13 = -2.123038140592916e-11; -[dummy,alpha,beta] = gsw_rho_alpha_beta(SA,CT,p); -[dummy,alpha_u,beta_u] = gsw_rho_alpha_beta(SA,CT,p_u); -[dummy,alpha_l,beta_l] = gsw_rho_alpha_beta(SA,CT,p_l); +a14 = 2.775927747785646e-3; +a15 = -4.699214888271850e-5; +a16 = 3.358540072460230e-6; +a17 = 2.697475730017109e-9; +a18 = -2.764306979894411e-5; +a19 = 2.525874630197091e-7; +a20 = 2.858362524508931e-9; +a21 = -7.244588807799565e-11; +a22 = 3.801564588876298e-7; +a23 = -1.534575373851809e-8; +a24 = -1.390254702334843e-10; +a25 = 1.072438894227657e-11; +a26 = -3.212746477974189e-7; +a27 = 6.382827821123254e-9; +a28 = -5.793038794625329e-12; +a29 = 6.211426728363857e-10; +a30 = -1.941660213148725e-11; +a31 = -3.729652850731201e-14; +a32 = 1.119522344879478e-14; +a33 = 6.057902487546866e-17; -alpha_p = (alpha_u - alpha_l)./(p_u - p_l); -beta_p = (beta_u - beta_l)./(p_u - p_l); +b01 = -6.698001071123802; +b02 = -2.986498947203215e-2; +b03 = 2.327859407479162e-4; +b04 = -5.983233568452735e-2; +b05 = 7.643133860820750e-4; +b06 = -2.140477007450431e-5; +b07 = 2.467559060524383e-7; +b08 = -1.806789763745328e-4; +b09 = 6.876837219536232e-7; +b10 = 1.550932729220080e-10; +b11 = -7.521448093615448e-3; +b12 = -2.764306979894411e-5; +b13 = 1.262937315098546e-7; +b14 = 9.527875081696435e-10; +b15 = -1.811147201949891e-11; +b16 = -4.954963307079632e-5; +b17 = 5.702346883314446e-7; +b18 = -1.150931530388857e-8; +b19 = -6.951273511674217e-11; +b20 = 4.021645853353715e-12; +b21 = 1.083865310229748e-5; +b22 = -1.105097577149576e-7; +b23 = 6.211426728363857e-10; +b24 = 1.119522344879478e-14; -thermobaric = alpha_p - (alpha./beta).*beta_p; -thermobaric = thermobaric./db2Pa; % To have units of 1/(K Pa) +c01 = -2.233269627352527e-2; +c02 = -3.436090079851880e-4; +c03 = 3.726050720345733e-6; +c04 = -1.806789763745328e-4; +c05 = 6.876837219536232e-7; +c06 = -6.174065000748422e-7; +c07 = -3.976733175851186e-8; +c08 = -2.123038140592916e-11; +c09 = 3.101865458440160e-10; -%-------------------------------------------------------------------------- -% This function calculates thermobaric_CT using the computationally -% efficient 48-term expression for density in terms of SA, CT and p. If -% one wanted to compute thermobaric_CT with the full TEOS-10 Gibbs function -% expression for density, the following lines of code will do this. -% -% pr0 = zeros(size(p)); -% pt = gsw_pt_from_CT(SA,CT); -% t_l = gsw_pt_from_t(SA,pt,pr0,p_l); -% t_u = gsw_pt_from_t(SA,pt,pr0,p_u); -% t = 0.5*(t_l + t_u); -% alpha = gsw_alpha_wrt_CT_t_exact(SA,t,p); -% beta = gsw_beta_const_CT_t_exact(SA,t,p); -% alpha_p = (gsw_alpha_wrt_CT_t_exact(SA,t_u,p_u) - gsw_alpha_wrt_CT_t_exact(SA,t_l,p_l))./(p_u - p_l); -% beta_p = (gsw_beta_const_CT_t_exact(SA,t_u,p_u) - gsw_beta_const_CT_t_exact(SA,t_l,p_l))./(p_u - p_l); -% thermobaric = alpha_p - (alpha./beta).*beta_p; -% thermobaric = thermobaric./db2Pa; % To have units of 1/(K Pa) -% -%----------------This is the end of the alternative code------------------- +c10 = -2.742185394906099e-5; +c11 = -3.212746477974189e-7; +c12 = 3.191413910561627e-9; +c13 = -1.931012931541776e-12; +c14 = -1.105097577149576e-7; +c15 = 6.211426728363857e-10; +c16 = -2.238023185750219e-10; +c17 = -3.883320426297450e-11; +c18 = -3.729652850731201e-14; +c19 = 2.239044689758956e-14; +c20 = -3.601523245654798e-15; +c21 = 1.817370746264060e-16; + +sqrtSA = sqrt(SA); + +v_hat_denominator = v01 + CT.*(v02 + CT.*(v03 + v04*CT)) ... + + SA.*(v05 + CT.*(v06 + v07*CT) ... + + sqrtSA.*(v08 + CT.*(v09 + CT.*(v10 + v11*CT)))) ... + + p.*(v12 + CT.*(v13 + v14*CT) + SA.*(v15 + v16*CT) ... + + p.*(v17 + CT.*(v18 + v19*CT) + v20*SA)); + +v_hat_numerator = v21 + CT.*(v22 + CT.*(v23 + CT.*(v24 + v25*CT))) ... + + SA.*(v26 + CT.*(v27 + CT.*(v28 + CT.*(v29 + v30*CT))) + v36*SA ... + + sqrtSA.*(v31 + CT.*(v32 + CT.*(v33 + CT.*(v34 + v35*CT))))) ... + + p.*(v37 + CT.*(v38 + CT.*(v39 + v40*CT)) ... + + SA.*(v41 + v42*CT) ... + + p.*(v43 + CT.*(v44 + v45*CT + v46*SA) ... + + p.*(v47 + v48*CT))); + +dvhatden_dCT = a01 + CT.*(a02 + a03*CT) ... + + SA.*(a04 + a05*CT ... + + sqrtSA.*(a06 + CT.*(a07 + a08*CT))) ... + + p.*(a09 + a10*CT + a11*SA ... + + p.*(a12 + a13*CT)); + +dvhatnum_dCT = a14 + CT.*(a15 + CT.*(a16 + a17*CT)) ... + + SA.*(a18 + CT.*(a19 + CT.*(a20 + a21*CT)) ... + + sqrtSA.*(a22 + CT.*(a23 + CT.*(a24 + a25*CT)))) ... + + p.*(a26 + CT.*(a27 + a28*CT) + a29*SA ... + + p.*(a30 + a31*CT + a32*SA + a33*p)); + +dvhatden_dSA = b01 + CT.*(b02 + b03*CT) ... + + sqrtSA.*(b04 + CT.*(b05 + CT.*(b06 + b07*CT))) ... + + p.*(b08 + b09*CT + b10*p) ; + +dvhatnum_dSA = b11 + CT.*(b12 + CT.*(b13 + CT.*(b14 + b15*CT))) ... + + sqrtSA.*(b16 + CT.*(b17 + CT.*(b18 + CT.*(b19 + b20*CT)))) + b21*SA ... + + p.*(b22 + CT.*(b23 + b24*p)); + +dvhatden_dp = c01 + CT.*(c02 + c03*CT) ... + + SA.*(c04 + c05*CT) ... + + p.*(c06 + CT.*(c07 + c08*CT) + c09*SA); + +dvhatnum_dp = c10 + CT.*(c11 + CT.*(c12 + c13*CT)) ... + + SA.*(c14 + c15*CT) ... + + p.*(c16 + CT.*(c17 + c18*CT + c19*SA) ... + + p.*(c20 + c21*CT)); + +dvhatden_dpdCT = c02 + 2*c03*CT + c05*SA ... + + p.*(c07 + 2*c08*CT); + +dvhatnum_dpdCT = c11 + CT.*(2*c12 + 3*c13*CT) + c15*SA ... + + p.*(c17 + CT.*2*c18 + c19*SA + c21*p); + +dvhatden_dpdSA = c04 + c05*CT + c09*p; + +dvhatnum_dpdSA = c14 + c15*CT + c19*CT.*p; + +p1a = (dvhatnum_dpdCT./v_hat_numerator); +p1b = (dvhatnum_dCT.*dvhatden_dp)./(v_hat_numerator.*v_hat_denominator); +p1c = (dvhatnum_dp.*dvhatden_dCT)./(v_hat_numerator.*v_hat_denominator); +p1d = (dvhatden_dp.*dvhatden_dCT)./(v_hat_denominator.^2); +p1e = (dvhatden_dpdCT./v_hat_denominator); + +Part1 = p1a - p1b - p1c + 2*p1d - p1e; + +factor2 = (v_hat_denominator.*dvhatnum_dCT - v_hat_numerator.*dvhatden_dCT)./ ... + (v_hat_denominator.*dvhatnum_dSA - v_hat_numerator.*dvhatden_dSA); + +p2a = (dvhatnum_dpdSA./v_hat_numerator); +p2b = (dvhatnum_dSA.*dvhatden_dp)./(v_hat_numerator.*v_hat_denominator); +p2c = (dvhatnum_dp.*dvhatden_dSA)./(v_hat_numerator.*v_hat_denominator); +p2d = (dvhatden_dp.*dvhatden_dSA)./(v_hat_denominator.^2); +p2e = (dvhatden_dpdSA./v_hat_denominator); + +Part2 = p2a - p2b - p2c + 2*p2d - p2e; + +db2Pa = 1e-4; % To have units of 1/(K Pa) + +thermobaric = (Part1 - factor2.*Part2)*db2Pa; if transposed thermobaric = thermobaric.'; diff --git a/Toolbox/gsw_thermobaric_CT.m b/Toolbox/gsw_thermobaric_CT.m new file mode 100644 index 0000000..7c9fc59 --- /dev/null +++ b/Toolbox/gsw_thermobaric_CT.m @@ -0,0 +1,110 @@ +function thermobaric_CT = gsw_thermobaric_CT(SA,CT,p) + +% gsw_thermobaric_CT thermobaric coefficient (48-term equation) +%========================================================================== +% +% USAGE: +% thermobaric_CT = gsw_thermobaric_CT(SA,CT,p), or equivalently +% thermobaric = gsw_thermobaric(SA,CT,p) +% +% Note that gsw_thermobaric_CT(SA,CT,p) is identical to +% gsw_thermobaric(SA,CT,p). The extra "_CT" emphasises that the +% input temperature is Conservative Temperature, but the extra "_CT" part +% of the function name is not needed. +% +% DESCRIPTION: +% Calculates the thermobaric coefficient of seawater with respect to +% Conservative Temperature. This routine calculates rho from the +% computationally-efficient 48-term expression for density in terms of +% SA, CT and p (IOC et al., 2010). +% +% Note that the 48-term equation has been fitted in a restricted range of +% parameter space, and is most accurate inside the "oceanographic funnel" +% described in IOC et al. (2010). The GSW library function +% "gsw_infunnel(SA,CT,p)" is avaialble to be used if one wants to test if +% some of one's data lies outside this "funnel". +% +% INPUT: +% SA = Absolute Salinity [ g/kg ] +% CT = Conservative Temperature (ITS-90) [ deg C ] +% p = sea pressure [ dbar ] +% ( i.e. absolute pressure - 10.1325 dbar ) +% +% SA & CT need to have the same dimensions. +% p may have dimensions 1x1 or Mx1 or 1xN or MxN, where SA & CT are MxN. +% +% OUTPUT: +% thermobaric_CT = thermobaric coefficient with [ 1/(K Pa) ] +% respect to Conservative Temperature. +% Note. The pressure derivative is taken with respect to +% pressure in Pa not dbar. +% +% AUTHOR: +% Trevor McDougall and Paul Barker [ help@teos-10.org ] +% +% VERSION NUMBER: 3.03 (5th April, 2013) +% +% REFERENCES: +% IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of +% seawater - 2010: Calculation and use of thermodynamic properties. +% Intergovernmental Oceanographic Commission, Manuals and Guides No. 56, +% UNESCO (English), 196 pp. Available from http://www.TEOS-10.org +% See Eqns. (3.8.2) and (P.2) of this TEOS-10 manual. +% +% The software is available from http://www.TEOS-10.org +% +%========================================================================== + +%-------------------------------------------------------------------------- +% Check variables and resize if necessary +%-------------------------------------------------------------------------- + +if ~(nargin == 3) + error('gsw_thermobaric_CT: Requires three inputs') +end %if + +[ms,ns] = size(SA); +[mt,nt] = size(CT); +[mp,np] = size(p); + +if (mt ~= ms | nt ~= ns) + error('gsw_thermobaric_CT: SA and CT must have same dimensions') +end + +if (mp == 1) & (np == 1) % p scalar - fill to size of SA + p = p*ones(size(SA)); +elseif (ns == np) & (mp == 1) % p is row vector, + p = p(ones(1,ms), :); % copy down each column. +elseif (ms == mp) & (np == 1) % p is column vector, + p = p(:,ones(1,ns)); % copy across each row. +elseif (ns == mp) & (np == 1) % p is a transposed row vector, + p = p.'; % transposed then + p = p(ones(1,ms), :); % copy down each column. +elseif (ms == mp) & (ns == np) + % ok +else + error('gsw_thermobaric_CT: Inputs array dimensions arguments do not agree') +end %if + +if ms == 1 + SA = SA.'; + CT = CT.'; + p = p.'; + transposed = 1; +else + transposed = 0; +end + +%-------------------------------------------------------------------------- +% Start of the calculation +%-------------------------------------------------------------------------- +% This line ensures that SA is non-negative. +SA(SA < 0) = 0; + +thermobaric_CT = gsw_thermobaric(SA,CT,p); + +if transposed + thermobaric_CT = thermobaric_CT.'; +end + +end diff --git a/Toolbox/gsw_thermobaric_CT_exact.m b/Toolbox/gsw_thermobaric_CT_exact.m new file mode 100644 index 0000000..3ebb693 --- /dev/null +++ b/Toolbox/gsw_thermobaric_CT_exact.m @@ -0,0 +1,114 @@ +function thermobaric_CT_exact = gsw_thermobaric_CT_exact(SA,CT,p) + +% gsw_thermobaric_CT_exact thermobaric coefficient +%========================================================================== +% +% USAGE: +% thermobaric_CT_exact = gsw_thermobaric_CT_exact(SA,CT,p) +% +% DESCRIPTION: +% Calculates the thermobaric coefficient of seawater with respect to +% Conservative Temperature. This routine calculates the thermobaric +% coefficient with the full TEOS-10 Gibbs function expression for density. +% This function uses finite differences to calculate the temperature and +% pressure derivatives. +% +% Note that this function uses the full Gibbs function. There is an +% alternative to calling this function, namely gsw_thermobaric(SA,CT,p) +% which uses the computationally efficient 48-term expression for density +% in terms of SA, CT and p (IOC et al., 2010). +% +% INPUT: +% SA = Absolute Salinity [ g/kg ] +% CT = Conservative Temperature (ITS-90) [ deg C ] +% p = sea pressure [ dbar ] +% ( i.e. absolute pressure - 10.1325 dbar ) +% +% SA & CT need to have the same dimensions. +% p may have dimensions 1x1 or Mx1 or 1xN or MxN, where SA & CT are MxN. +% +% OUTPUT: +% thermobaric_CT_exact = thermobaric coefficient with [ 1/(K Pa) ] +% respect to Conservative Temperature. +% Note. The pressure derivative is taken with respect to +% pressure in Pa not dbar. +% +% AUTHOR: +% Trevor McDougall and Paul Barker [ help@teos-10.org ] +% +% VERSION NUMBER: 3.03 (5th April, 2013) +% +% REFERENCES: +% IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of +% seawater - 2010: Calculation and use of thermodynamic properties. +% Intergovernmental Oceanographic Commission, Manuals and Guides No. 56, +% UNESCO (English), 196 pp. Available from http://www.TEOS-10.org +% See Eqns. (3.8.2) and (P.2) of this TEOS-10 manual. +% +% The software is available from http://www.TEOS-10.org +% +%========================================================================== + +%-------------------------------------------------------------------------- +% Check variables and resize if necessary +%-------------------------------------------------------------------------- + +if ~(nargin == 3) + error('gsw_thermobaric_CT_exact: Requires three inputs') +end %if + +[ms,ns] = size(SA); +[mt,nt] = size(CT); +[mp,np] = size(p); + +if (mt ~= ms | nt ~= ns) + error('gsw_thermobaric_CT_exact: SA and CT must have same dimensions') +end + +if (mp == 1) & (np == 1) % p scalar - fill to size of SA + p = p*ones(size(SA)); +elseif (ns == np) & (mp == 1) % p is row vector, + p = p(ones(1,ms), :); % copy down each column. +elseif (ms == mp) & (np == 1) % p is column vector, + p = p(:,ones(1,ns)); % copy across each row. +elseif (ns == mp) & (np == 1) % p is a transposed row vector, + p = p.'; % transposed then + p = p(ones(1,ms), :); % copy down each column. +elseif (ms == mp) & (ns == np) + % ok +else + error('gsw_thermobaric_CT_exact: Inputs array dimensions arguments do not agree') +end %if + +if ms == 1 + SA = SA.'; + CT = CT.'; + p = p.'; + transposed = 1; +else + transposed = 0; +end + +%-------------------------------------------------------------------------- +% Start of the calculation +%-------------------------------------------------------------------------- + +beta = gsw_beta_CT_exact(SA,CT,p); + +dp = 0.1; % pressure increment is 0.1 dbar (1000 Pa) +p_u = p - dp; +p_l = p + dp; + +alpha_on_beta_u = gsw_alpha_on_beta_CT_exact(SA,CT,p_u); +alpha_on_beta_l = gsw_alpha_on_beta_CT_exact(SA,CT,p_l); + +thermobaric_CT_exact = beta.*(alpha_on_beta_u - alpha_on_beta_l)./(p_u - p_l); +Pa2db = 1e-4; % To have units of 1/(K Pa) +thermobaric_CT_exact = thermobaric_CT_exact.*Pa2db; + + +if transposed + thermobaric_CT_exact = thermobaric_CT_exact.'; +end + +end diff --git a/Toolbox/gsw_uPS.m b/Toolbox/gsw_uPS.m index a4ecd94..c949727 100644 --- a/Toolbox/gsw_uPS.m +++ b/Toolbox/gsw_uPS.m @@ -16,7 +16,7 @@ % AUTHOR: % Trevor McDougall and Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (16th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of diff --git a/Toolbox/gsw_valence_factor.m b/Toolbox/gsw_valence_factor.m index ea621bd..ffa5249 100644 --- a/Toolbox/gsw_valence_factor.m +++ b/Toolbox/gsw_valence_factor.m @@ -20,7 +20,7 @@ % AUTHOR: % Trevor McDougall and Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (16th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of diff --git a/Toolbox/gsw_ver.m b/Toolbox/gsw_ver.m index a202699..8ecdbf3 100644 --- a/Toolbox/gsw_ver.m +++ b/Toolbox/gsw_ver.m @@ -1,6 +1,6 @@ function gsw_ver -% gsw_ver GSW Oceanographic toolbox version number +% gsw_ver GSW Oceanographic Toolbox version number %========================================================================== % % USAGE: @@ -8,12 +8,12 @@ % % DESCRIPTION: % This function displays the version number of the GSW Oceanographic -% toolbox. +% Toolbox. % % AUTHOR: % Paul Barker and Trevor McDougall [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (16th November, 2012) +% VERSION NUMBER: 3.03 (8th March, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of diff --git a/Toolbox/gsw_z_from_depth.m b/Toolbox/gsw_z_from_depth.m index af0e395..2f4568a 100644 --- a/Toolbox/gsw_z_from_depth.m +++ b/Toolbox/gsw_z_from_depth.m @@ -19,7 +19,7 @@ % AUTHOR: % Winston [ god@teos-10.org ] % -% VERSION NUMBER: 3.02 (16th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % This software is available from http://www.TEOS-10.org % diff --git a/Toolbox/gsw_z_from_p.m b/Toolbox/gsw_z_from_p.m index be8d49f..eedcb8f 100644 --- a/Toolbox/gsw_z_from_p.m +++ b/Toolbox/gsw_z_from_p.m @@ -1,23 +1,25 @@ -function z = gsw_z_from_p(p,lat,geo_strf_dyn_height) +function z = gsw_z_from_p(p,lat,geo_strf_dyn_height,sea_surface_geopotental) % gsw_z_from_p height from pressure %========================================================================== % % USAGE: -% z = gsw_z_from_p(p,lat,{geo_strf_dyn_height}) +% z = gsw_z_from_p(p,lat,{geo_strf_dyn_height},{sea_surface_geopotental}) % % DESCRIPTION: % Calculates height from sea pressure using the computationally-efficient -% 48-term expression for density in terms of SA, CT and p (McDougall et -% al., 2013). Dynamic height anomaly, geo_strf_dyn_height, if provided, -% must be computed with its p_ref = 0 (the surface). +% 48-term expression for density in terms of SA, CT and p (IOC et al., +% 2010). Dynamic height anomaly, geo_strf_dyn_height, if provided, +% must be computed with its p_ref = 0 (the surface). Also if provided, +% sea_surface_geopotental is the geopotential at zero sea pressure. This +% function solves Eqn.(3.32.3) of IOC et al. (2010). % % Note. Height z is NEGATIVE in the ocean. i.e. Depth is -z. % Depth is not used in the GSW computer software library. % % Note that the 48-term equation has been fitted in a restricted range of % parameter space, and is most accurate inside the "oceanographic funnel" -% described in McDougall et al. (2013). The GSW library function +% described in IOC et al. (2010). The GSW library function % "gsw_infunnel(SA,CT,p)" is avaialble to be used if one wants to test if % some of one's data lies outside this "funnel". % @@ -30,10 +32,11 @@ % geo_strf_dyn_height = dynamic height anomaly [ m^2/s^2 ] % Note that the refernce pressure, p_ref, of geo_strf_dyn_height must be % zero (0) dbar. +% sea_surface_geopotental = geopotential at zero sea pressure [ m^2/s^2 ] % % lat may have dimensions 1x1 or Mx1 or 1xN or MxN, where p is MxN. -% geo_strf_dyn_height, if provided, must have dimensions MxN which is -% the same as p. +% geo_strf_dyn_height and geo_strf_dyn_height, if provided, must have +% dimensions MxN, which are the same as p. % % OUTPUT: % z = height [ m ] @@ -45,7 +48,7 @@ % Trevor McDougall, Claire Roberts-Thomson & Paul Barker. % [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (16th November, 2012) +% VERSION NUMBER: 3.03 (19th July, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of @@ -53,11 +56,6 @@ % Intergovernmental Oceanographic Commission, Manuals and Guides No. 56, % UNESCO (English), 196 pp. Available from http://www.TEOS-10.org % -% McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2013: A -% computationally efficient 48-term expression for the density of -% seawater in terms of Conservative Temperature, and related properties -% of seawater. To be submitted to J. Atm. Ocean. Technol., xx, yyy-zzz. -% % Moritz (2000) Goedetic reference system 1980. J. Geodesy, 74, 128-133. % % This software is available from http://www.TEOS-10.org @@ -68,21 +66,29 @@ % Check variables and resize if necessary %-------------------------------------------------------------------------- -if ~(nargin == 2 | nargin == 3) - error('gsw_z_from_p: Requires two or three inputs') +if ~(nargin == 2 | nargin == 3 | nargin == 4) + error('gsw_z_from_p: Requires two, three or four inputs') end %if if ~exist('geo_strf_dyn_height','var') geo_strf_dyn_height = zeros(size(p)); end +if ~exist('sea_surface_geopotental','var') + sea_surface_geopotental = zeros(size(p)); +end [mp,np] = size(p); [ml,nl] = size(lat); [mdh,ndh] = size(geo_strf_dyn_height); +[msg,nsg] = size(sea_surface_geopotental); if (mp ~= mdh) | (np ~= ndh) error('gsw_z_from_p: pressure & dynamic height anomaly need to have the same dimensions') end +if (mdh ~= msg) | (ndh ~= nsg) + error('gsw_z_from_p: dynamic height anomaly & the geopotential at zero sea pressure need to have the same dimensions') +end + if (ml == 1) & (nl == 1) % lat scalar - fill to size of p lat = lat*ones(size(p)); @@ -103,6 +109,7 @@ p = p.'; lat = lat.'; geo_strf_dyn_height = geo_strf_dyn_height.'; + sea_surface_geopotental = sea_surface_geopotental.'; transposed = 1; else transposed = 0; @@ -112,14 +119,17 @@ % Start of the calculation %-------------------------------------------------------------------------- -gamma = 2.26e-7 ; -DEG2RAD = pi/180; -X = sin(lat*DEG2RAD); -sin2 = X.*X; -B = 9.780327*(1.0 + (5.2792e-3 + (2.32e-5*sin2)).*sin2); -A = -0.5*gamma*B ; -C = gsw_enthalpy_SSO_0_p(p) - geo_strf_dyn_height; -z = -2*C./(B + sqrt(B.*B - 4.*A.*C)); +gamma = 2.26e-7; % If the graviational acceleration were to be regarded as + % being depth-independent, which is often the case in + % ocean models, then gamma would be set to be zero here, + % and the code below works perfectly well. +deg2rad = pi/180; +X = sin(lat*deg2rad); +sin2 = X.*X; +B = 9.780327*(1.0 + (5.2792e-3 + (2.32e-5*sin2)).*sin2); +A = -0.5*gamma*B; +C = gsw_enthalpy_SSO_0_p(p) - (geo_strf_dyn_height + sea_surface_geopotental); +z = -2*C./(B + sqrt(B.*B - 4.*A.*C)); if transposed z = z.'; diff --git a/Toolbox/library/gsw_Fdelta.m b/Toolbox/library/gsw_Fdelta.m index 57ee5cc..7169fb3 100644 --- a/Toolbox/library/gsw_Fdelta.m +++ b/Toolbox/library/gsw_Fdelta.m @@ -34,7 +34,7 @@ % AUTHOR: % Trevor McDougall & Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (7th January, 2013) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of diff --git a/Toolbox/library/gsw_Hill_ratio_at_SP2.m b/Toolbox/library/gsw_Hill_ratio_at_SP2.m index d938d7a..611ba0c 100644 --- a/Toolbox/library/gsw_Hill_ratio_at_SP2.m +++ b/Toolbox/library/gsw_Hill_ratio_at_SP2.m @@ -23,7 +23,7 @@ % AUTHOR: % Trevor McDougall and Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (16th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % Hill, K.D., T.M. Dauphinee & D.J. Woods, 1986: The extension of the @@ -107,11 +107,11 @@ %-------------------------------------------------------------------------- SP_est = a0 + (a1 + (a2 + (a3 + (a4 + a5.*Rtx0).*Rtx0).*Rtx0).*Rtx0).*Rtx0 ... + ft68.*(b0 + (b1 + (b2+ (b3 + (b4 + b5.*Rtx0).*Rtx0).*Rtx0).*Rtx0).*Rtx0); - Rtx = Rtx0 - (SP_est - SP2)./dSP_dRtx; - Rtxm = 0.5*(Rtx + Rtx0); +Rtx = Rtx0 - (SP_est - SP2)./dSP_dRtx; +Rtxm = 0.5*(Rtx + Rtx0); dSP_dRtx = a1 + (2*a2 + (3*a3 + (4*a4 + 5*a5.*Rtxm).*Rtxm).*Rtxm).*Rtxm... + ft68.*(b1 + (2*b2 + (3*b3 + (4*b4 + 5*b5.*Rtxm).*Rtxm).*Rtxm).*Rtxm); - Rtx = Rtx0 - (SP_est - SP2)./dSP_dRtx; +Rtx = Rtx0 - (SP_est - SP2)./dSP_dRtx; % This is the end of one full iteration of the modified Newton-Raphson % iterative equation solver. The error in Rtx at this point is equivalent diff --git a/Toolbox/library/gsw_SAAR.m b/Toolbox/library/gsw_SAAR.m index 8a0ede0..2b6829f 100644 --- a/Toolbox/library/gsw_SAAR.m +++ b/Toolbox/library/gsw_SAAR.m @@ -43,7 +43,7 @@ % Paul Barker and Trevor McDougall % Aknowlegments. Matlab programming assisance from Sunke Schmidtko. % -% VERSION NUMBER: 3.02 (7th January, 2013) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of @@ -255,7 +255,7 @@ % Paul Barker and Trevor McDougall % Aknowlegments. Matlab programming assisance from Sjoerd Groeskamp. % -% VERSION NUMBER: 3.02 (7th January, 2013) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of @@ -329,7 +329,7 @@ % MODIFIED: % Paul Barker and Trevor McDougall % -% VERSION NUMBER: 3.02 (7th January, 2013) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of diff --git a/Toolbox/library/gsw_SA_from_SP_Baltic.m b/Toolbox/library/gsw_SA_from_SP_Baltic.m index c729745..7306d65 100644 --- a/Toolbox/library/gsw_SA_from_SP_Baltic.m +++ b/Toolbox/library/gsw_SA_from_SP_Baltic.m @@ -24,7 +24,7 @@ % AUTHOR: % David Jackett, Trevor McDougall & Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (7th January, 2013) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % Feistel, R., S. Weinreben, H. Wolf, S. Seitz, P. Spitzer, B. Adel, diff --git a/Toolbox/library/gsw_SP_from_SA_Baltic.m b/Toolbox/library/gsw_SP_from_SA_Baltic.m index 245a5d0..4ccb90b 100644 --- a/Toolbox/library/gsw_SP_from_SA_Baltic.m +++ b/Toolbox/library/gsw_SP_from_SA_Baltic.m @@ -23,7 +23,7 @@ % AUTHOR: % David Jackett, Trevor McDougall & Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (7th January, 2013) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % Feistel, R., S. Weinreben, H. Wolf, S. Seitz, P. Spitzer, B. Adel, diff --git a/Toolbox/library/gsw_data_v3_0.mat b/Toolbox/library/gsw_data_v3_0.mat index 2cbb759..a977039 100644 Binary files a/Toolbox/library/gsw_data_v3_0.mat and b/Toolbox/library/gsw_data_v3_0.mat differ diff --git a/Toolbox/library/gsw_deltaSA_atlas.m b/Toolbox/library/gsw_deltaSA_atlas.m index 9c16b5d..90f00ca 100644 --- a/Toolbox/library/gsw_deltaSA_atlas.m +++ b/Toolbox/library/gsw_deltaSA_atlas.m @@ -1,6 +1,6 @@ function [deltaSA_atlas, in_ocean] = gsw_deltaSA_atlas(p,long,lat) -% gsw_deltaSA_atlas Absolute Salinity anomaly atlas value +% gsw_deltaSA_atlas Absolute Salinity Anomaly atlas value % (excluding the Baltic Sea) %========================================================================== % @@ -8,11 +8,11 @@ % [deltaSA_atlas, in_ocean] = gsw_deltaSA_atlas(p,long,lat) % % DESCRIPTION: -% Calculates the Absolute Salinity anomaly atlas value, SA - SR, in +% Calculates the Absolute Salinity Anomaly atlas value, SA - SR, in % the open ocean by spatially interpolating the global reference data set % of deltaSA_atlas to the location of the seawater sample. % -% The Absolute Salinity anomaly atlas value in the Baltic Sea is +% The Absolute Salinity Anomaly atlas value in the Baltic Sea is % evaluated separately, since it is a function of Practical Salinity, not % of space. The present function returns a deltaSA_atlas of zero for % data in the Baltic Sea. The correct way of calculating Absolute @@ -28,7 +28,7 @@ % p, long & lat need to be vectors and have the same dimensions. % % OUTPUT: -% deltaSA_atlas = Absolute Salinity anomaly atlas value [ g/kg ] +% deltaSA_atlas = Absolute Salinity Anomaly atlas value [ g/kg ] % in_ocean = 0, if long and lat are a long way from the ocean % = 1, if long and lat are in the ocean % Note. This flag is only set when the observation is well and truly on @@ -41,7 +41,7 @@ % MODIFIED: % Paul Barker and Trevor McDougall % -% VERSION NUMBER: 3.02 (7th January, 2013) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of @@ -238,7 +238,7 @@ % Replaces NaN's with nanmean of the 4 adjacent neighbours % % INPUT: -% dsa = Absolute Salinity anomaly of the 4 adjacent neighbours [ g/kg ] +% dsa = Absolute Salinity Anomaly of the 4 adjacent neighbours [ g/kg ] % % OUTPUT: % deltaSA_atlas = nanmean of the 4 adjacent neighbours [ g/kg ] @@ -249,7 +249,7 @@ % MODIFIED: % Paul Barker and Trevor McDougall % -% VERSION NUMBER: 3.02 (7th January, 2013) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of @@ -306,7 +306,7 @@ % over the appropriate side of the barrier % % INPUT: -% dsa = Absolute Salinity anomaly [ g/kg ] +% dsa = Absolute Salinity Anomaly [ g/kg ] % long = Longitudes of data in decimal degrees east [ 0 ... +360 ] % lat = Latitudes of data in decimal degrees north [ -90 ... +90 ] % longs_ref = Longitudes of regular grid in decimal degrees east [ 0 ... +360 ] @@ -315,7 +315,7 @@ % dlats_ref = Latitude difference of regular grid in decimal degrees [ deg latitude ] % % OUTPUT: -% deltaSA_atlas = Reference Absolute Salinity anomaly [ g/kg ] +% deltaSA_atlas = Reference Absolute Salinity Anomaly [ g/kg ] % % AUTHOR: % David Jackett @@ -323,7 +323,7 @@ % MODIFIED: % Paul Barker and Trevor McDougall % -% VERSION NUMBER: 3.02 (7th January, 2013) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of diff --git a/Toolbox/library/gsw_enthalpy_SSO_0_p.m b/Toolbox/library/gsw_enthalpy_SSO_0_p.m index 922d2d9..deb4b78 100644 --- a/Toolbox/library/gsw_enthalpy_SSO_0_p.m +++ b/Toolbox/library/gsw_enthalpy_SSO_0_p.m @@ -9,7 +9,7 @@ % version of the Gibbs function, that is, a streamlined version of the % code "gsw_enthalpy(SA,CT,p)". % -% VERSION NUMBER: 3.02 (16th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2013: A diff --git a/Toolbox/library/gsw_entropy_part.m b/Toolbox/library/gsw_entropy_part.m index f6c31fa..3fe74ee 100644 --- a/Toolbox/library/gsw_entropy_part.m +++ b/Toolbox/library/gsw_entropy_part.m @@ -10,7 +10,7 @@ % but are not needed when calculating potential temperature from in-situ % temperature. % -% VERSION NUMBER: 3.02 (16th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % This function is unchanged from version 2.0 (24th September, 2010). % %========================================================================== diff --git a/Toolbox/library/gsw_entropy_part_zerop.m b/Toolbox/library/gsw_entropy_part_zerop.m index 3f11232..ac5b074 100644 --- a/Toolbox/library/gsw_entropy_part_zerop.m +++ b/Toolbox/library/gsw_entropy_part_zerop.m @@ -12,7 +12,7 @@ % The inputs to "gsw_entropy_part_zerop(SA,pt0)" are Absolute Salinity % and potential temperature with reference sea pressure of zero dbar. % -% VERSION NUMBER: 3.02 (16th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % This function is unchanged from version 2.0 (24th September, 2010). % %========================================================================== diff --git a/Toolbox/library/gsw_gibbs.m b/Toolbox/library/gsw_gibbs.m index 3b444f1..35b9826 100644 --- a/Toolbox/library/gsw_gibbs.m +++ b/Toolbox/library/gsw_gibbs.m @@ -48,7 +48,7 @@ % MODIFIED: % Trevor McDougall and Paul Barker % -% VERSION NUMBER: 3.02 (16th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % This function is unchanged from version 2.0 (24th September, 2010). % % REFERENCES: diff --git a/Toolbox/library/gsw_gibbs_pt0_pt0.m b/Toolbox/library/gsw_gibbs_pt0_pt0.m index 46bd528..b484c6f 100644 --- a/Toolbox/library/gsw_gibbs_pt0_pt0.m +++ b/Toolbox/library/gsw_gibbs_pt0_pt0.m @@ -9,7 +9,7 @@ % "gsw_pt_from_CT(SA,CT)" ,"gsw_pt0_from_t(SA,t,p)" and % "gsw_pt_from_entropy(SA,entropy)". % -% VERSION NUMBER: 3.02 (16th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % This function is unchanged from version 2.0 (24th September, 2010). % %========================================================================== diff --git a/Toolbox/library/gsw_infunnel.m b/Toolbox/library/gsw_infunnel.m index 31638a6..5a19659 100644 --- a/Toolbox/library/gsw_infunnel.m +++ b/Toolbox/library/gsw_infunnel.m @@ -26,7 +26,7 @@ % AUTHOR: % Trevor McDougall and Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (16th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2013: A % computationally efficient 48-term expression for the density of diff --git a/Toolbox/library/gsw_interp_SA_CT.m b/Toolbox/library/gsw_interp_SA_CT.m index 22572ef..393bb28 100644 --- a/Toolbox/library/gsw_interp_SA_CT.m +++ b/Toolbox/library/gsw_interp_SA_CT.m @@ -5,7 +5,7 @@ % This function interpolates the cast with respect to the interpolating % variable p. This function finds the values of SA, CT at p_i on this cast. % -% VERSION NUMBER: 3.02 (16th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % This fuction was adapted from Matlab's interp1q. %========================================================================== @@ -28,7 +28,7 @@ siz = size(xi); if ~isscalar(xi) [xxi, k] = sort(xi); - [dum, j] = sort([x;xxi]); + [dummy, j] = sort([x;xxi]); r(j) = 1:length(j); r = r(length(x)+1:end) - (1:length(xxi)); r(k) = r; diff --git a/Toolbox/library/gsw_interp_ref_cast.m b/Toolbox/library/gsw_interp_ref_cast.m index a3ecc39..283311d 100644 --- a/Toolbox/library/gsw_interp_ref_cast.m +++ b/Toolbox/library/gsw_interp_ref_cast.m @@ -13,7 +13,7 @@ % the interpolation will take place in sigma 2 space, any other input % will result in the programme working in gamma_n space. % -% VERSION NUMBER: 3.02 (16th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCE: % Jackett, D. R. and T. J. McDougall, 1997: A neutral density variable @@ -64,7 +64,7 @@ siz = size(xi); if ~isscalar(xi) [xxi, k] = sort(xi); - [dum, j] = sort([x;xxi]); + [dummy, j] = sort([x;xxi]); r(j) = 1:length(j); r = r(length(x)+1:end) - (1:length(xxi)); r(k) = r; diff --git a/Toolbox/library/gsw_specvol_SSO_0_p.m b/Toolbox/library/gsw_specvol_SSO_0_p.m index f592e25..689389b 100644 --- a/Toolbox/library/gsw_specvol_SSO_0_p.m +++ b/Toolbox/library/gsw_specvol_SSO_0_p.m @@ -9,7 +9,7 @@ % version of specific volume, that is, a streamlined version of the code % "gsw_specvol(SA,CT,p)". % -% VERSION NUMBER: 3.02 (16th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2013: A diff --git a/Toolbox/gsw_Helmholtz_energy_t_exact.m b/Toolbox/thermodynamics_from_t/gsw_Helmholtz_energy_t_exact.m similarity index 98% rename from Toolbox/gsw_Helmholtz_energy_t_exact.m rename to Toolbox/thermodynamics_from_t/gsw_Helmholtz_energy_t_exact.m index f77ad68..3eb440c 100644 --- a/Toolbox/gsw_Helmholtz_energy_t_exact.m +++ b/Toolbox/thermodynamics_from_t/gsw_Helmholtz_energy_t_exact.m @@ -24,7 +24,7 @@ % AUTHOR: % Trevor McDougall [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (15th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of diff --git a/Toolbox/gsw_SA_from_rho_t_exact.m b/Toolbox/thermodynamics_from_t/gsw_SA_from_rho_t_exact.m similarity index 97% rename from Toolbox/gsw_SA_from_rho_t_exact.m rename to Toolbox/thermodynamics_from_t/gsw_SA_from_rho_t_exact.m index f7f21af..ddaed14 100644 --- a/Toolbox/gsw_SA_from_rho_t_exact.m +++ b/Toolbox/thermodynamics_from_t/gsw_SA_from_rho_t_exact.m @@ -1,7 +1,7 @@ function SA = gsw_SA_from_rho_t_exact(rho,t,p) % gsw_SA_from_rho_t_exact Absolute Salinity from density measurements -% ========================================================================= +%========================================================================== % % USAGE: % SA = gsw_SA_from_rho_t_exact(rho,t,p) @@ -29,7 +29,7 @@ % AUTHOR: % Trevor McDougall & Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (15th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of diff --git a/Toolbox/thermodynamics_from_t/gsw_adiabatic_lapse_rate_t_exact.m b/Toolbox/thermodynamics_from_t/gsw_adiabatic_lapse_rate_t_exact.m new file mode 100644 index 0000000..a8c9d25 --- /dev/null +++ b/Toolbox/thermodynamics_from_t/gsw_adiabatic_lapse_rate_t_exact.m @@ -0,0 +1,49 @@ +function adiabatic_lapse_rate = gsw_adiabatic_lapse_rate_t_exact(SA,t,p) + +% gsw_adiabatic_lapse_rate_from_t adiabatic lapse rate +%========================================================================== +% +% This function has changed its name, it is now called +% gsw_adiabatic_lapse_rate_from_t. +% +% USAGE: +% adiabatic_lapse_rate = gsw_adiabatic_lapse_rate_from_t(SA,t,p) +% +% DESCRIPTION: +% Calculates the adiabatic lapse rate of sea water +% +% INPUT: +% SA = Absolute Salinity [ g/kg ] +% t = in-situ temperature (ITS-90) [ deg C ] +% p = sea pressure [ dbar ] +% ( i.e. absolute pressure - 10.1325 dbar ) +% +% SA & t need to have the same dimensions. +% p may have dimensions 1x1 or Mx1 or 1xN or MxN, where SA & t are MxN. +% +% OUTPUT: +% adiabatic_lapse_rate = adiabatic lapse rate [ K/Pa ] +% Note. The output is in unit of degress Celsius per Pa, +% (or equivilently K/Pa) not in units of K/dbar. +% +% AUTHOR: +% Trevor McDougall and Paul Barker [ help@teos-10.org ] +% +% VERSION NUMBER: 3.03 (29th April, 2013) +% +% REFERENCES: +% IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of +% seawater - 2010: Calculation and use of thermodynamic properties. +% Intergovernmental Oceanographic Commission, Manuals and Guides No. 56, +% UNESCO (English), 196 pp. Available from http://www.TEOS-10.org. +% See Eqn. (2.22.1) of this TEOS-10 Manual. +% +% The software is available from http://www.TEOS-10.org +% +%========================================================================== + +warning('The function "gsw_adiabatic_lapse_rate_t_exact" has changed to "gsw_adiabatic_lapse_rate_from_t"'); + +adiabatic_lapse_rate = gsw_adiabatic_lapse_rate_from_t(SA,t,p); + +end diff --git a/Toolbox/gsw_alpha_wrt_CT_t_exact.m b/Toolbox/thermodynamics_from_t/gsw_alpha_wrt_CT_t_exact.m similarity index 98% rename from Toolbox/gsw_alpha_wrt_CT_t_exact.m rename to Toolbox/thermodynamics_from_t/gsw_alpha_wrt_CT_t_exact.m index f66a698..da1f9a9 100644 --- a/Toolbox/gsw_alpha_wrt_CT_t_exact.m +++ b/Toolbox/thermodynamics_from_t/gsw_alpha_wrt_CT_t_exact.m @@ -27,7 +27,7 @@ % AUTHOR: % David Jackett, Trevor McDougall and Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (13th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of diff --git a/Toolbox/gsw_alpha_wrt_pt_t_exact.m b/Toolbox/thermodynamics_from_t/gsw_alpha_wrt_pt_t_exact.m similarity index 98% rename from Toolbox/gsw_alpha_wrt_pt_t_exact.m rename to Toolbox/thermodynamics_from_t/gsw_alpha_wrt_pt_t_exact.m index 294b9d5..8eadb5c 100644 --- a/Toolbox/gsw_alpha_wrt_pt_t_exact.m +++ b/Toolbox/thermodynamics_from_t/gsw_alpha_wrt_pt_t_exact.m @@ -28,7 +28,7 @@ % AUTHOR: % David Jackett, Trevor McDougall and Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (13th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of diff --git a/Toolbox/gsw_alpha_wrt_t_exact.m b/Toolbox/thermodynamics_from_t/gsw_alpha_wrt_t_exact.m similarity index 98% rename from Toolbox/gsw_alpha_wrt_t_exact.m rename to Toolbox/thermodynamics_from_t/gsw_alpha_wrt_t_exact.m index 399cf46..9a1d528 100644 --- a/Toolbox/gsw_alpha_wrt_t_exact.m +++ b/Toolbox/thermodynamics_from_t/gsw_alpha_wrt_t_exact.m @@ -27,7 +27,7 @@ % AUTHOR: % David Jackett, Trevor McDougall and Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (13th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of diff --git a/Toolbox/gsw_beta_const_CT_t_exact.m b/Toolbox/thermodynamics_from_t/gsw_beta_const_CT_t_exact.m similarity index 99% rename from Toolbox/gsw_beta_const_CT_t_exact.m rename to Toolbox/thermodynamics_from_t/gsw_beta_const_CT_t_exact.m index d3a7ad4..ec13df8 100644 --- a/Toolbox/gsw_beta_const_CT_t_exact.m +++ b/Toolbox/thermodynamics_from_t/gsw_beta_const_CT_t_exact.m @@ -27,7 +27,7 @@ % AUTHOR: % Trevor McDougall and Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (13th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of diff --git a/Toolbox/gsw_beta_const_pt_t_exact.m b/Toolbox/thermodynamics_from_t/gsw_beta_const_pt_t_exact.m similarity index 99% rename from Toolbox/gsw_beta_const_pt_t_exact.m rename to Toolbox/thermodynamics_from_t/gsw_beta_const_pt_t_exact.m index f525e38..4b09de2 100644 --- a/Toolbox/gsw_beta_const_pt_t_exact.m +++ b/Toolbox/thermodynamics_from_t/gsw_beta_const_pt_t_exact.m @@ -28,7 +28,7 @@ % AUTHOR: % Trevor McDougall and Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (13th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of diff --git a/Toolbox/gsw_beta_const_t_exact.m b/Toolbox/thermodynamics_from_t/gsw_beta_const_t_exact.m similarity index 98% rename from Toolbox/gsw_beta_const_t_exact.m rename to Toolbox/thermodynamics_from_t/gsw_beta_const_t_exact.m index 6dc0ee6..3c6d3c9 100644 --- a/Toolbox/gsw_beta_const_t_exact.m +++ b/Toolbox/thermodynamics_from_t/gsw_beta_const_t_exact.m @@ -27,7 +27,7 @@ % AUTHOR: % David Jackett, Trevor McDougall and Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (13th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of diff --git a/Toolbox/gsw_chem_potential_relative_t_exact.m b/Toolbox/thermodynamics_from_t/gsw_chem_potential_relative_t_exact.m similarity index 95% rename from Toolbox/gsw_chem_potential_relative_t_exact.m rename to Toolbox/thermodynamics_from_t/gsw_chem_potential_relative_t_exact.m index 6b82070..8d63c20 100644 --- a/Toolbox/gsw_chem_potential_relative_t_exact.m +++ b/Toolbox/thermodynamics_from_t/gsw_chem_potential_relative_t_exact.m @@ -19,13 +19,12 @@ % p may have dimensions 1x1 or Mx1 or 1xN or MxN, where SA & t are MxN. % % OUTPUT: -% chem_potential_relative_t_exact = relative chemical potential -% [ J/kg ] +% chem_potential_relative_t_exact = relative chemical potential [ J/g ] % % AUTHOR: % Trevor McDougall and Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (13th November, 2012) +% VERSION NUMBER: 3.03 (15th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of diff --git a/Toolbox/gsw_chem_potential_salt_t_exact.m b/Toolbox/thermodynamics_from_t/gsw_chem_potential_salt_t_exact.m similarity index 98% rename from Toolbox/gsw_chem_potential_salt_t_exact.m rename to Toolbox/thermodynamics_from_t/gsw_chem_potential_salt_t_exact.m index 7ae7d49..27054bd 100644 --- a/Toolbox/gsw_chem_potential_salt_t_exact.m +++ b/Toolbox/thermodynamics_from_t/gsw_chem_potential_salt_t_exact.m @@ -21,12 +21,12 @@ % % OUTPUT: % chem_potential_salt_t_exact = chemical potential of salt in seawater -% [ J/kg ] +% [ J/g ] % % AUTHOR: % Trevor McDougall and Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (13th November, 2012) +% VERSION NUMBER: 3.03 (15th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of diff --git a/Toolbox/gsw_chem_potential_water_t_exact.m b/Toolbox/thermodynamics_from_t/gsw_chem_potential_water_t_exact.m similarity index 95% rename from Toolbox/gsw_chem_potential_water_t_exact.m rename to Toolbox/thermodynamics_from_t/gsw_chem_potential_water_t_exact.m index c3a6cae..768a1ab 100644 --- a/Toolbox/gsw_chem_potential_water_t_exact.m +++ b/Toolbox/thermodynamics_from_t/gsw_chem_potential_water_t_exact.m @@ -21,12 +21,12 @@ % % OUTPUT: % chem_potential_water_t_exact = chemical potential of water in seawater -% [ J/kg ] +% [ J/g ] % % AUTHOR: % Trevor McDougall and Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (13th November, 2012) +% VERSION NUMBER: 3.03 (15th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of @@ -134,7 +134,11 @@ y.*(-30.0682112585625 - 1380.9597954037708.*z + y.*(2.626801985426835 + 703.695562834065.*z))))) + ... y.*(1187.3715515697959); -chem_potential_water_t_exact = g03_g + g08_g - 0.5.*sfac.*SA.*g_SA_part; +kg2g = 1e-3; + +chem_potential_water_t_exact = kg2g*(g03_g + g08_g - 0.5.*sfac.*SA.*g_SA_part); +% Note. The kg2g, a factor of 1e-3, is needed to convert the output of this function into units of J/g. +% See section (2.9) of the TEOS-10 Manual. if transposed chem_potential_water_t_exact = chem_potential_water_t_exact.'; diff --git a/Toolbox/gsw_cp_t_exact.m b/Toolbox/thermodynamics_from_t/gsw_cp_t_exact.m similarity index 98% rename from Toolbox/gsw_cp_t_exact.m rename to Toolbox/thermodynamics_from_t/gsw_cp_t_exact.m index 568ba8d..1b35532 100644 --- a/Toolbox/gsw_cp_t_exact.m +++ b/Toolbox/thermodynamics_from_t/gsw_cp_t_exact.m @@ -24,7 +24,7 @@ % AUTHOR: % David Jackett, Trevor McDougall and Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (14th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of diff --git a/Toolbox/thermodynamics_from_t/gsw_deltaSA_from_rho_t_exact.m b/Toolbox/thermodynamics_from_t/gsw_deltaSA_from_rho_t_exact.m new file mode 100644 index 0000000..70a19d1 --- /dev/null +++ b/Toolbox/thermodynamics_from_t/gsw_deltaSA_from_rho_t_exact.m @@ -0,0 +1,112 @@ +function deltaSA = gsw_deltaSA_from_rho_t_exact(rho,SP,t,p) + +% gsw_deltaSA_from_rho_t_exact Absolute Salinity Anomaly +% from density measurements +%========================================================================== +% +% USAGE: +% deltaSA = gsw_deltaSA_from_rho_t_exact(rho,SP,t,p) +% +% DESCRIPTION: +% Calculates the Absolute Salinity Anomaly of a seawater sample, for given +% values of its density, practical salinity, in-situ temperature and sea +% pressure (in dbar). +% +% INPUT: +% rho = density of a seawater sample (e.g. 1026 kg/m^3) [ kg/m^3 ] +% Note. This input has not had 1000 kg/m^3 subtracted from it. +% That is, it is 'density', not 'density anomaly'. +% SP = Practical Salinity (PSS-78) [ unitless ] +% t = in-situ temperature (ITS-90) [ deg C ] +% p = sea pressure [ dbar ] +% ( i.e. absolute pressure - 10.1325 dbar ) +% +% rho, SA & t need to have the same dimensions. +% p may have dimensions 1x1 or Mx1 or 1xN or MxN, where rho, SA & t are +% MxN. +% +% OUTPUT: +% deltaSA = Absolute Salinity Anomaly [ g/kg ] +% Note. This is expressed on the Reference-Composition Salinity +% Scale of Millero et al. (2008). +% +% AUTHOR: +% Trevor McDougall & Paul Barker [ help@teos-10.org ] +% +% VERSION NUMBER: 3.03 (28th Febuary, 2013) +% +% REFERENCES: +% IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of +% seawater - 2010: Calculation and use of thermodynamic properties. +% Intergovernmental Oceanographic Commission, Manuals and Guides No. 56, +% UNESCO (English), 196 pp. Available from http://www.TEOS-10.org +% See section 2.5 of this TEOS-10 Manual. +% +% McDougall, T.J. and S.J. Wotherspoon, 2012: A simple modification of +% Newton’s method to achieve convergence of order "1 + sqrt(2)". +% Submitted to Applied Mathematics and Computation. +% +% Millero, F. J., R. Feistel, D. G. Wright, and T. J. McDougall, 2008: +% The composition of Standard Seawater and the definition of the +% Reference-Composition Salinity Scale, Deep-Sea Res. I, 55, 50-72. +% +% The software is available from http://www.TEOS-10.org +% +%========================================================================== + +%-------------------------------------------------------------------------- +% Check variables and resize if necessary +%-------------------------------------------------------------------------- + +if ~(nargin==4) + error('gsw_deltaSA_from_rho_t_exact: Requires four inputs') +end %if + +[md,nd] = size(rho); +[ms,ns] = size(SP); +[mt,nt] = size(t); +[mp,np] = size(p); + +if (mt ~= md | mt ~= ms | nt ~= ns | nt ~= nd) + error('gsw_deltaSA_from_rho_t_exact: rho, SP and t must have same dimensions') +end + +if (mp == 1) & (np == 1) % p scalar - fill to size of rho + p = p*ones(size(rho)); +elseif (nd == np) & (mp == 1) % p is row vector, + p = p(ones(1,md), :); % copy down each column. +elseif (md == mp) & (np == 1) % p is column vector, + p = p(:,ones(1,nd)); % copy across each row. +elseif (nd == mp) & (np == 1) % p is a transposed row vector, + p = p.'; % transposed then + p = p(ones(1,md), :); % copy down each column. +elseif (md == mp) & (nd == np) + % ok +else + error('gsw_deltaSA_from_rho_t_exact: Inputs array dimensions arguments do not agree') +end %if + +if md == 1 + rho = rho.'; + SP = SP.'; + t = t.'; + p = p.'; + transposed = 1; +else + transposed = 0; +end + +%-------------------------------------------------------------------------- +% Start of the calculation +%-------------------------------------------------------------------------- + +SA = gsw_SA_from_rho_t_exact(rho,t,p); +SR = gsw_SR_from_SP(SP); + +deltaSA = SA - SR; + +if transposed + deltaSA = deltaSA.'; +end + +end diff --git a/Toolbox/gsw_dynamic_enthalpy_t_exact.m b/Toolbox/thermodynamics_from_t/gsw_dynamic_enthalpy_t_exact.m similarity index 98% rename from Toolbox/gsw_dynamic_enthalpy_t_exact.m rename to Toolbox/thermodynamics_from_t/gsw_dynamic_enthalpy_t_exact.m index 8d4fca0..b4744ac 100644 --- a/Toolbox/gsw_dynamic_enthalpy_t_exact.m +++ b/Toolbox/thermodynamics_from_t/gsw_dynamic_enthalpy_t_exact.m @@ -29,7 +29,7 @@ % AUTHOR: % Trevor McDougall and Paul Barker. [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (15th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of diff --git a/Toolbox/gsw_enthalpy_t_exact.m b/Toolbox/thermodynamics_from_t/gsw_enthalpy_t_exact.m similarity index 98% rename from Toolbox/gsw_enthalpy_t_exact.m rename to Toolbox/thermodynamics_from_t/gsw_enthalpy_t_exact.m index 1e67a76..a332c61 100644 --- a/Toolbox/gsw_enthalpy_t_exact.m +++ b/Toolbox/thermodynamics_from_t/gsw_enthalpy_t_exact.m @@ -24,7 +24,7 @@ % AUTHOR: % David Jackett, Trevor McDougall and Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (15th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of diff --git a/Toolbox/thermodynamics_from_t/gsw_entropy_t_exact.m b/Toolbox/thermodynamics_from_t/gsw_entropy_t_exact.m new file mode 100644 index 0000000..c2e133d --- /dev/null +++ b/Toolbox/thermodynamics_from_t/gsw_entropy_t_exact.m @@ -0,0 +1,46 @@ +function entropy = gsw_entropy_t_exact(SA,t,p) + +% gsw_entropy_from_t specific entropy of seawater +%========================================================================== +% +% This function has changed its name, it is now called +% gsw_entropy_from_t. +% +% USAGE: +% entropy = gsw_entropy_from_t(SA,t,p) +% +% DESCRIPTION: +% Calculates specific entropy of seawater. +% +% INPUT: +% SA = Absolute Salinity [ g/kg ] +% t = in-situ temperature (ITS-90) [ deg C ] +% p = sea pressure [ dbar ] +% ( i.e. absolute pressure - 10.1325 dbar ) +% +% SA & t need to have the same dimensions. +% p may have dimensions 1x1 or Mx1 or 1xN or MxN, where SA & t are MxN. +% +% OUTPUT: +% entropy = specific entropy [ J/(kg*K) ] +% +% AUTHOR: +% David Jackett, Trevor McDougall and Paul Barker [ help@teos-10.org ] +% +% VERSION NUMBER: 3.03 (11th March, 2013) +% +% REFERENCES: +% IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of +% seawater - 2010: Calculation and use of thermodynamic properties. +% Intergovernmental Oceanographic Commission, Manuals and Guides No. 56, +% UNESCO (English), 196 pp. Available from http://www.TEOS-10.org +% +% The software is available from http://www.TEOS-10.org +% +%========================================================================== + +warning('The function "entropy_t_exact" has changed to "gsw_entropy_from_t"'); + +entropy = gsw_entropy_from_t(SA,t,p); + +end \ No newline at end of file diff --git a/Toolbox/gsw_internal_energy_t_exact.m b/Toolbox/thermodynamics_from_t/gsw_internal_energy_t_exact.m similarity index 98% rename from Toolbox/gsw_internal_energy_t_exact.m rename to Toolbox/thermodynamics_from_t/gsw_internal_energy_t_exact.m index 49b2976..575be92 100644 --- a/Toolbox/gsw_internal_energy_t_exact.m +++ b/Toolbox/thermodynamics_from_t/gsw_internal_energy_t_exact.m @@ -24,7 +24,7 @@ % AUTHOR: % Trevor McDougall [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (15th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of diff --git a/Toolbox/gsw_isochoric_heat_cap_t_exact.m b/Toolbox/thermodynamics_from_t/gsw_isochoric_heat_cap_t_exact.m similarity index 98% rename from Toolbox/gsw_isochoric_heat_cap_t_exact.m rename to Toolbox/thermodynamics_from_t/gsw_isochoric_heat_cap_t_exact.m index 4339f2f..89dad60 100644 --- a/Toolbox/gsw_isochoric_heat_cap_t_exact.m +++ b/Toolbox/thermodynamics_from_t/gsw_isochoric_heat_cap_t_exact.m @@ -24,7 +24,7 @@ % AUTHOR: % Trevor McDougall [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (15th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of diff --git a/Toolbox/gsw_kappa_const_t_exact.m b/Toolbox/thermodynamics_from_t/gsw_kappa_const_t_exact.m similarity index 98% rename from Toolbox/gsw_kappa_const_t_exact.m rename to Toolbox/thermodynamics_from_t/gsw_kappa_const_t_exact.m index 62865c5..b252e85 100644 --- a/Toolbox/gsw_kappa_const_t_exact.m +++ b/Toolbox/thermodynamics_from_t/gsw_kappa_const_t_exact.m @@ -27,7 +27,7 @@ % AUTHOR: % David Jackett, Trevor McDougall and Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (15th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of diff --git a/Toolbox/gsw_kappa_t_exact.m b/Toolbox/thermodynamics_from_t/gsw_kappa_t_exact.m similarity index 98% rename from Toolbox/gsw_kappa_t_exact.m rename to Toolbox/thermodynamics_from_t/gsw_kappa_t_exact.m index 6a41730..37854b5 100644 --- a/Toolbox/gsw_kappa_t_exact.m +++ b/Toolbox/thermodynamics_from_t/gsw_kappa_t_exact.m @@ -25,7 +25,7 @@ % AUTHOR: % David Jackett, Trevor McDougall and Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (15th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of diff --git a/Toolbox/gsw_osmotic_coefficient_t_exact.m b/Toolbox/thermodynamics_from_t/gsw_osmotic_coefficient_t_exact.m similarity index 99% rename from Toolbox/gsw_osmotic_coefficient_t_exact.m rename to Toolbox/thermodynamics_from_t/gsw_osmotic_coefficient_t_exact.m index a60c585..6720164 100644 --- a/Toolbox/gsw_osmotic_coefficient_t_exact.m +++ b/Toolbox/thermodynamics_from_t/gsw_osmotic_coefficient_t_exact.m @@ -25,7 +25,7 @@ % AUTHOR: % Trevor McDougall and Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (15th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of diff --git a/Toolbox/gsw_osmotic_pressure_t_exact.m b/Toolbox/thermodynamics_from_t/gsw_osmotic_pressure_t_exact.m similarity index 98% rename from Toolbox/gsw_osmotic_pressure_t_exact.m rename to Toolbox/thermodynamics_from_t/gsw_osmotic_pressure_t_exact.m index 074d30f..9faeb7d 100644 --- a/Toolbox/gsw_osmotic_pressure_t_exact.m +++ b/Toolbox/thermodynamics_from_t/gsw_osmotic_pressure_t_exact.m @@ -24,7 +24,7 @@ % AUTHOR: % Trevor McDougall and Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (15th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of diff --git a/Toolbox/gsw_pot_rho_t_exact.m b/Toolbox/thermodynamics_from_t/gsw_pot_rho_t_exact.m similarity index 98% rename from Toolbox/gsw_pot_rho_t_exact.m rename to Toolbox/thermodynamics_from_t/gsw_pot_rho_t_exact.m index d5e628a..1306410 100644 --- a/Toolbox/gsw_pot_rho_t_exact.m +++ b/Toolbox/thermodynamics_from_t/gsw_pot_rho_t_exact.m @@ -30,7 +30,7 @@ % AUTHOR: % David Jackett, Trevor McDougall and Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (15th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of diff --git a/Toolbox/gsw_rho_t_exact.m b/Toolbox/thermodynamics_from_t/gsw_rho_t_exact.m similarity index 98% rename from Toolbox/gsw_rho_t_exact.m rename to Toolbox/thermodynamics_from_t/gsw_rho_t_exact.m index 8afe37e..80cd8f4 100644 --- a/Toolbox/gsw_rho_t_exact.m +++ b/Toolbox/thermodynamics_from_t/gsw_rho_t_exact.m @@ -26,7 +26,7 @@ % AUTHOR: % Paul Barker, David Jackett & Trevor McDougall [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (15th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of diff --git a/Toolbox/gsw_sigma0_pt0_exact.m b/Toolbox/thermodynamics_from_t/gsw_sigma0_pt0_exact.m similarity index 98% rename from Toolbox/gsw_sigma0_pt0_exact.m rename to Toolbox/thermodynamics_from_t/gsw_sigma0_pt0_exact.m index b4582d6..4b6c66c 100644 --- a/Toolbox/gsw_sigma0_pt0_exact.m +++ b/Toolbox/thermodynamics_from_t/gsw_sigma0_pt0_exact.m @@ -27,7 +27,7 @@ % AUTHOR: % Trevor McDougall & Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (16th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of diff --git a/Toolbox/gsw_sound_speed_t_exact.m b/Toolbox/thermodynamics_from_t/gsw_sound_speed_t_exact.m similarity index 98% rename from Toolbox/gsw_sound_speed_t_exact.m rename to Toolbox/thermodynamics_from_t/gsw_sound_speed_t_exact.m index 54b39c2..8f6b1ef 100644 --- a/Toolbox/gsw_sound_speed_t_exact.m +++ b/Toolbox/thermodynamics_from_t/gsw_sound_speed_t_exact.m @@ -24,7 +24,7 @@ % AUTHOR: % David Jackett, Paul Barker and Trevor McDougall [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (16th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of diff --git a/Toolbox/gsw_specvol_anom_t_exact.m b/Toolbox/thermodynamics_from_t/gsw_specvol_anom_t_exact.m similarity index 98% rename from Toolbox/gsw_specvol_anom_t_exact.m rename to Toolbox/thermodynamics_from_t/gsw_specvol_anom_t_exact.m index 6c37842..6914860 100644 --- a/Toolbox/gsw_specvol_anom_t_exact.m +++ b/Toolbox/thermodynamics_from_t/gsw_specvol_anom_t_exact.m @@ -27,7 +27,7 @@ % AUTHOR: % Trevor McDougall and Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (16th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of diff --git a/Toolbox/gsw_specvol_t_exact.m b/Toolbox/thermodynamics_from_t/gsw_specvol_t_exact.m similarity index 98% rename from Toolbox/gsw_specvol_t_exact.m rename to Toolbox/thermodynamics_from_t/gsw_specvol_t_exact.m index 3c5889b..f4d2a3a 100644 --- a/Toolbox/gsw_specvol_t_exact.m +++ b/Toolbox/thermodynamics_from_t/gsw_specvol_t_exact.m @@ -24,7 +24,7 @@ % AUTHOR: % David Jackett and Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (16th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of diff --git a/Toolbox/gsw_t_from_rho_exact.m b/Toolbox/thermodynamics_from_t/gsw_t_from_rho_exact.m similarity index 99% rename from Toolbox/gsw_t_from_rho_exact.m rename to Toolbox/thermodynamics_from_t/gsw_t_from_rho_exact.m index 86b6f6a..8671e82 100644 --- a/Toolbox/gsw_t_from_rho_exact.m +++ b/Toolbox/thermodynamics_from_t/gsw_t_from_rho_exact.m @@ -34,7 +34,7 @@ % AUTHOR: % Trevor McDougall & Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (16th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of diff --git a/Toolbox/gsw_t_maxdensity_exact.m b/Toolbox/thermodynamics_from_t/gsw_t_maxdensity_exact.m similarity index 98% rename from Toolbox/gsw_t_maxdensity_exact.m rename to Toolbox/thermodynamics_from_t/gsw_t_maxdensity_exact.m index 34404b5..fb498fd 100644 --- a/Toolbox/gsw_t_maxdensity_exact.m +++ b/Toolbox/thermodynamics_from_t/gsw_t_maxdensity_exact.m @@ -28,7 +28,7 @@ % AUTHOR: % Trevor McDougall & Paul Barker [ help@teos-10.org ] % -% VERSION NUMBER: 3.02 (16th November, 2012) +% VERSION NUMBER: 3.03 (29th April, 2013) % % REFERENCES: % IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of