3 ipv_vs_fnsquared_ratio, p_mid)
39 real (r8),
intent(in) :: sa(:), ct(:), p(:), p_ref
40 real (r8),
intent(out) :: ipv_vs_fnsquared_ratio(:), p_mid(:)
43 real (r8),
dimension(:),
allocatable :: dsa, sa_mid, dct, ct_mid, vp_ref
44 real (r8),
dimension(:),
allocatable :: alpha_mid, beta_mid, alpha_pref
45 real (r8),
dimension(:),
allocatable :: beta_pref, numerator, denominator
47 character (*),
parameter :: func_name =
"gsw_ipv_vs_fnsquared_ratio" 50 if (
size(ipv_vs_fnsquared_ratio).lt.nz-1 .or.
size(p_mid).lt.nz-1)
then 52 p_mid = ipv_vs_fnsquared_ratio(1)
56 allocate (dsa(nz-1), sa_mid(nz-1), dct(nz-1), ct_mid(nz-1))
57 allocate (vp_ref(nz-1), alpha_mid(nz-1), beta_mid(nz-1), alpha_pref(nz-1))
58 allocate (beta_pref(nz-1), numerator(nz-1), denominator(nz-1))
61 dsa(i) = sa(i) - sa(i+1)
62 dct(i) = ct(i) - ct(i+1)
63 sa_mid(i) = 0.5_r8*(sa(i) + sa(i+1))
64 ct_mid(i) = 0.5_r8*(ct(i) + ct(i+1))
65 p_mid(i) = 0.5_r8*(p(i) + p(i+1))
69 alpha_mid =
gsw_alpha(sa_mid,ct_mid,p_mid(1:nz-1))
70 beta_mid =
gsw_beta(sa_mid,ct_mid,p_mid(1:nz-1))
71 alpha_pref =
gsw_alpha(sa_mid,ct_mid,vp_ref)
72 beta_pref =
gsw_beta(sa_mid,ct_mid,vp_ref)
74 numerator = dct*alpha_pref - dsa*beta_pref
75 denominator = dct*alpha_mid - dsa*beta_mid
77 where (denominator /= 0.0_r8)
78 ipv_vs_fnsquared_ratio = numerator/denominator
83 deallocate (dsa, sa_mid, dct, ct_mid)
84 deallocate (vp_ref, alpha_mid, beta_mid, alpha_pref)
85 deallocate (beta_pref, numerator, denominator)
pure subroutine gsw_ipv_vs_fnsquared_ratio(sa, ct, p, p_ref, ipv_vs_fnsquared_ratio, p_mid)
elemental real(r8) function, public gsw_error_code(err_num, func_name, error_code)