3 n2_specvol, n2_alpha, n2_beta, dsa, dct, dp)
46 real (r8),
intent(in) :: sa(:), ct(:), p(:), lat(:)
47 real (r8),
intent(out) :: n2(:), n2_p(:), n2_specvol(:), n2_alpha(:)
48 real (r8),
intent(out) :: n2_beta(:), dsa(:), dct(:), dp(:)
50 integer :: i, ideep, ishallow, mp
52 real (r8) :: n2_deep, n2_shallow
53 real (r8),
allocatable :: alpha(:), beta(:), specvol(:), grav2(:)
55 character (*),
parameter :: func_name =
"gsw_nsquared_min" 58 if (
size(n2).lt.mp-1 .or.
size(n2_p).lt.mp-1 .or. &
59 size(n2_specvol).lt.mp-1 .or.
size(n2_alpha).lt.mp-1 .or. &
60 size(n2_beta).lt.mp-1 .or.
size(dsa).lt.mp-1 .or. &
61 size(dct).lt.mp-1 .or.
size(dp).lt.mp-1)
then 73 allocate(grav2(mp),specvol(mp),alpha(mp),beta(mp))
77 dp(1:mp-1) = p(2:mp) - p(1:mp-1)
78 dsa(1:mp-1) = sa(2:mp) - sa(1:mp-1)
79 dct(1:mp-1) = ct(2:mp) - ct(1:mp-1)
86 n2_shallow = grav2(ishallow)/(specvol(ishallow)*
db2pa*dp(i))* &
87 (beta(ishallow)*dsa(i) - alpha(ishallow)*dct(i))
88 n2_deep = grav2(ideep)/(specvol(ideep)*
db2pa*dp(i))* &
89 (beta(ideep)*dsa(i) - alpha(ideep)*dct(i))
90 if (n2_shallow .lt. n2_deep)
then 93 n2_specvol(i) = specvol(ishallow)
94 n2_alpha(i) = alpha(ishallow)
95 n2_beta(i) = beta(ishallow)
99 n2_specvol(i) = specvol(ideep)
100 n2_alpha(i) = alpha(ideep)
101 n2_beta(i) = beta(ideep)
103 ishallow = ishallow + 1
pure subroutine gsw_nsquared_min(sa, ct, p, lat, n2, n2_p, n2_specvol, n2_alpha, n2_beta, dsa, dct, dp)
real(r8), parameter db2pa
elemental real(r8) function, public gsw_error_code(err_num, func_name, error_code)