# NAME

Physics::Water::SoundSpeed - Perl module to calculate the speed of sound in pure water and sea water as a function of temperature (and pressure)

# SYNOPSIS

``````    use Physics::Water::SoundSpeed;

\$Sound = new Physics::Water::SoundSpeed();``````

Simplist usage as a function of temperature

``````    \$ss = \$Sound->soundspeed(21);
print "The speed of sound in pure water is \$ss meters/sec at 21 degrees\n";``````

Or as a function of temperature and pressure

``````    \$ss = \$Sound->soundspeed(21,7);  # Input in degrees C / MPa
print "The speed of sound in pure water is \$ss meters/sec at 21 C and 7 MPa\n";``````

Both sound speed functions accept references to arrays and returns a reference to an array. Obviously arrays need to be the same size and the same size array (as a ref) is returned.

``````    @t_lst = ( 50,70 );
\$ss = \$Sound->soundspeed( \@t_lst );
print "The speed of sound at \$t_lst-> C is \$ss-> and at \$t_lst-> is \$ss->\n";

@p_lst = ( 0.1, 1);
\$ss = \$Sound->soundspeed( \@t_lst, \@p_lst ); # Returns a ref to array with sound speed for each pair of t and p``````

However you can enter a scalar (single value) for either the temperature or pressure and an array ref for the other input - good for isothermal or isobaric calcs. Such as

``````    \$ss = \$Sound->soundspeed( 10, \@p_lst ); # Isothermal calcs with temperature at 10 C

\$ss = \$Sound->soundspeed( \@p_lst, 0.1 ); # Isobaric calcs with pressure 0.1 MPa``````

Also there is function to calculate the speed of sound in sea water as a function of temperature, pressure and salinity. The inputs to this function must all be scalars. The equation by Chen and Millero is used.

``````    \$ss = \$obj->sound_speed_sea_tps( 5, 1, 35);
print "Speed Sound in Sea Water at 5 C, 1 MPa, 35 ppm -> \$ss\n";``````

Simple hydrostatic pressure from depth functions are available for fresh and sea water. These functions take either a scalar or a reference to array

``````    @dp = (0,50,100,150,200,250,300,350,400,450,500,600,700,800,900,1000); # In Meters
\$pr = \$obj->d2p_fresh( \@dp ); # Returned is a ref to array with pressure in MPa for each depth

\$pr = \$obj->d2p_sea( \@dp ); # Returned is a ref to array with pressure in MPa for each depth

\$pr = \$obj->d2p_sea( 50 );   # Returned is scalar for the given pressure

``````

SI Units (Meters, Seconds, MPa) are default however you can switch to us US Customary units when creating the object. US Customary units used are ft, sec, psi. Here is how to use the above functions in US Customary.

``````    \$Sound = new Physics::Water::SoundSpeed( 'units'=>'US' );  # Switch back using 'SI'

\$ss = \$Sound->soundspeed_t(72);
print "The speed of sound in pure water is \$ss ft/sec at 72 degrees F\n";
``````

Finally the defaults used in these calculation are

* Salinity for Sea Water 'ppm' => 35 ppm

* Standard Pressure 'stdpres' => 0.101325 MPa

* Density of pure water 'density_pure' => 1000 kg/m**3

* Density of sea water 'density_sea' => 1027 kg/m**3

These can be overwritten on object creation such as

``    \$Sound = new Physics::Water::SoundSpeed( 'ppm' => 35,'stdpres' => 0.101,'density_pure' => 1000,'density_sea' => 1027 );``

# DESCRIPTION

This module Physics::Water::SoundSpeed calculates the speed of sound in pure water for a given temperature and pressure and Sea water for a given temperature, pressure and salinity. Defaults units are SI Meters, Seconds, MPa

## EXPORT

None by default.

Pure Water

The calculations are based on those found in a technical report "Speed of Sound in Pure Water" by the National Physical Laboratory

http://resource.npl.co.uk/acoustics/techguides/soundpurewater/

More specifically for speed of sound as a fuction of temperature the Marczak equation is used.

W. Marczak (1997), Water as a standard in the measurements of speed of sound in liquids J. Acoust. Soc. Am. 102(5) pp 2776-2779.

For speed of sound as a function of temperature and pressure an equation developed by Belogol'skii, Sekoyan et al is used.

Sea Water

V.A. Belogol'skii, S.S. Sekoyan, L.M. Samorukova, S.R. Stefanov and V.I. Levtsov (1999), Pressure dependence of the sound velocity in distilled water, Measurement Techniques, Vol 42, No 4, pp 406-413.

For Sea Water Calculation see

http://resource.npl.co.uk/acoustics/techguides/soundseawater/content.html

Specifically the UNESCO equation by Chen and Millero is used for Sea Water calculations with salinity defaulted to 35 ppm.

C-T. Chen and F.J. Millero, Speed of sound in seawater at high pressures (1977) J. Acoust. Soc. Am. 62(5) pp 1129-1135

Sound Speed in water along isotherms and isobars plotted as a test using this module are available at

http://perlworks.com/cpan/Physics-Water-SoundSpeed/misc/Sound-Speed-in-Water.html

# AUTHOR

troxel@REMOVEME perlworks.com