3 n2_specvol, n2_alpha, n2_beta, dsa, dct, dp, n2_beta_ratio)
51 real (r8),
intent(in) :: sa(:), t(:), p(:), lat
52 real (r8),
intent(out) :: n2(:), n2_p(:), n2_specvol(:), n2_alpha(:)
53 real (r8),
intent(out) :: n2_beta(:), dsa(:), dct(:), dp(:)
54 real (r8),
intent(out) :: n2_beta_ratio(:)
56 integer :: i, ideep, ishallow, mp
58 real (r8) :: n2_deep, n2_shallow
59 real (r8),
allocatable :: alpha(:), beta(:), specvol(:), grav2(:)
60 real (r8),
allocatable :: ct(:), beta_ratio(:)
63 allocate(grav2(mp),specvol(mp),alpha(mp),beta(mp),ct(mp),beta_ratio(mp))
65 if (lat .lt. -90.0_r8 .or. lat .gt. +90.0_r8)
then 66 grav2 = (/ (9.7963_r8**2, i=1,mp) /)
73 dp = p(2:mp) - p(1:mp-1)
74 dsa = sa(2:mp) - sa(1:mp-1)
75 dct = ct(2:mp) - ct(1:mp-1)
84 n2_shallow = grav2(ishallow)/(specvol(ishallow)*
db2pa*dp(i))* &
85 (beta(ishallow)*dsa(i) - alpha(ishallow)*dct(i))
86 n2_deep = grav2(ideep)/(specvol(ideep)*
db2pa*dp(i))* &
87 (beta(ideep)*dsa(i) - alpha(ideep)*dct(i))
88 if (n2_shallow .lt. n2_deep)
then 91 n2_specvol(i) = specvol(ishallow)
92 n2_alpha(i) = alpha(ishallow)
93 n2_beta(i) = beta(ishallow)
94 n2_beta_ratio(i) = beta_ratio(ishallow)
98 n2_specvol(i) = specvol(ideep)
99 n2_alpha(i) = alpha(ideep)
100 n2_beta(i) = beta(ideep)
101 n2_beta_ratio(i) = beta_ratio(ideep)
103 ishallow = ishallow + 1
real(r8), parameter db2pa
pure subroutine gsw_nsquared_min_const_t(sa, t, p, lat, n2, n2_p, n2_specvol, n2_alpha, n2_beta, dsa, dct, dp, n2_beta_ratio)