34 integer,
intent(in) :: nt, np
35 real (r8),
intent(in) :: t, p
39 real (r8) :: dzi, g0, g0p, g0pp, sqrec_pt
40 complex (r8) :: r2, r2p, r2pp, g, sqtau_t1, sqtau_t2, tau, tau_t1, tau_t2
42 real (r8),
parameter :: s0 = -3.32733756492168e3_r8
44 character (*),
parameter :: func_name =
"gsw_gibbs_ice" 50 if (nt.eq.0 .and. np.eq.0)
then 53 sqtau_t1 = tau_t1*tau_t1
55 sqtau_t2 = tau_t2*tau_t2
61 g =
r1*(tau*log((1.0_r8 + tau_t1)/(1.0_r8 - tau_t1)) &
62 +
t1*(log(1.0_r8 - sqtau_t1) - sqtau_t1)) &
63 + r2*(tau*log((1.0_r8 + tau_t2)/(1.0_r8 - tau_t2)) &
64 +
t2*(log(1.0_r8 - sqtau_t2) - sqtau_t2))
68 elseif (nt.eq.1 .and. np.eq.0)
then 75 g =
r1*(log((1.0_r8 + tau_t1)/(1.0_r8 - tau_t1)) - 2.0_r8*tau_t1) &
76 + r2*(log((1.0_r8 + tau_t2)/(1.0_r8 - tau_t2)) - 2.0_r8*tau_t2)
80 elseif (nt.eq.0 .and. np.eq.1)
then 83 sqtau_t2 = tau_t2*tau_t2
89 g = r2p*(tau*log((1.0_r8 + tau_t2)/(1.0_r8 - tau_t2)) &
90 +
t2*(log(1.0_r8 - sqtau_t2) - sqtau_t2))
94 elseif (nt.eq.1 .and. np.eq.1)
then 100 g = r2p*(log((1.0_r8 + tau_t2)/(1.0_r8 - tau_t2)) - 2.0_r8*tau_t2)
104 elseif (nt.eq.2 .and. np.eq.0)
then 108 g =
r1*(1.0_r8/(
t1 - tau) + 1.0_r8/(
t1 + tau) - 2.0_r8/
t1) &
109 + r2*(1.0_r8/(
t2 - tau) + 1.0_r8/(
t2 + tau) - 2.0_r8/
t2)
113 elseif (nt.eq.0 .and. np.eq.2)
then 118 sqtau_t2 = tau_t2*tau_t2
120 g0pp = sqrec_pt*(2.0_r8*
g02 + dzi*(6.0_r8*
g03 + 12.0_r8*
g04*dzi))
122 r2pp = 2.0_r8*
r22*sqrec_pt
124 g = r2pp*(tau*log((1.0_r8 + tau_t2)/(1.0_r8 - tau_t2)) &
125 +
t2*(log(1.0_r8 - sqtau_t2) - sqtau_t2))
complex(r8), parameter t1
elemental real(r8) function gsw_gibbs_ice(nt, np, t, p)
complex(r8), parameter r22
complex(r8), parameter t2
complex(r8), parameter r21
real(r8), parameter rec_pt
real(r8), parameter rec_t3p
real(r8), parameter db2pa
real(r8), parameter gsw_t0
complex(r8), parameter r1
complex(r8), parameter r20
elemental real(r8) function, public gsw_error_code(err_num, func_name, error_code)