c-linear interpolation of SSP data
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=8), | intent(in) | :: | x(2) | |||
real(kind=8), | intent(in) | :: | t(2) | |||
real(kind=8), | intent(out) | :: | c | |||
real(kind=8), | intent(out) | :: | cimag | |||
real(kind=8), | intent(out) | :: | gradc(2) | |||
real(kind=8), | intent(out) | :: | crr | |||
real(kind=8), | intent(out) | :: | crz | |||
real(kind=8), | intent(out) | :: | czz | |||
real(kind=8), | intent(out) | :: | rho | |||
real(kind=8), | intent(in) | :: | freq | |||
character(len=3), | intent(in) | :: | Task |
SUBROUTINE cLinear( x, t, c, cimag, gradc, crr, crz, czz, rho, freq, Task ) !! c-linear interpolation of SSP data REAL (KIND=8), INTENT( IN ) :: freq REAL (KIND=8), INTENT( IN ) :: x( 2 ) ! r-z coordinate where sound speed is evaluated REAL (KIND=8), INTENT( IN ) :: t( 2 ) ! ray tangent; for edge cases of updating segments CHARACTER (LEN=3), INTENT( IN ) :: Task REAL (KIND=8), INTENT( OUT ) :: c, cimag, gradc( 2 ), crr, crz, czz, rho ! sound speed and its derivatives IF ( Task == 'INI' ) THEN ! read in SSP data Depth = x( 2 ) CALL ReadSSP( Depth, freq ) ELSE ! return SSP info CALL UpdateDepthSegmentT( x, t ) c = REAL( SSP%c( iSegz ) + ( x( 2 ) - SSP%z( iSegz ) ) * SSP%cz( iSegz ) ) cimag = AIMAG( SSP%c( iSegz ) + ( x( 2 ) - SSP%z( iSegz ) ) * SSP%cz( iSegz ) ) gradc = [ 0.0D0, REAL( SSP%cz( iSegz ) ) ] crr = 0.0d0 crz = 0.0d0 czz = 0.0d0 W = ( x( 2 ) - SSP%z( iSegz ) ) / ( SSP%z( iSegz + 1 ) - SSP%z( iSegz ) ) rho = ( 1.0D0 - W ) * SSP%rho( iSegz ) + W * SSP%rho( iSegz + 1 ) END IF END SUBROUTINE cLinear