3 h_sa_sa, h_sa_ct, h_ct_ct)
30 real (r8),
intent(in) :: sa, ct, p
31 real (r8),
intent(out),
optional :: h_sa_sa, h_sa_ct, h_ct_ct
33 real (r8) :: factor, gsa_pt0, gsat_pt0, gsat, part_b, pt0, h_ct_ct_val
34 real (r8) :: rec_abs_pt0, rec_gtt_pt0, rec_gtt, t, temp_ratio
35 real (r8) :: gsasa, gsasa_pt0
37 integer,
parameter :: n0=0, n1=1, n2=2
38 real (r8),
parameter :: pr0 = 0.0_r8, sa_small = 1e-100_r8
41 rec_abs_pt0 = 1.0_r8/(
gsw_t0 + pt0)
43 temp_ratio = (
gsw_t0 + t)*rec_abs_pt0
45 rec_gtt_pt0 = 1.0_r8/
gsw_gibbs(n0,n2,n0,sa,pt0,pr0)
46 rec_gtt = 1.0_r8/
gsw_gibbs(n0,n2,n0,sa,t,p)
50 (temp_ratio*rec_gtt_pt0 - rec_gtt)*(rec_abs_pt0*rec_abs_pt0)
52 if (
present(h_ct_ct)) h_ct_ct = h_ct_ct_val
54 if (.not.
present(h_sa_sa) .and. .not.
present(h_sa_ct))
return 60 part_b = (temp_ratio*gsat_pt0*rec_gtt_pt0 - gsat*rec_gtt)*rec_abs_pt0
63 if (
present(h_sa_sa))
then 66 gsasa_pt0 =
gsw_gibbs(n2,n0,n0,sa,pt0,pr0)
69 h_sa_sa = gsasa - temp_ratio*gsasa_pt0 &
70 + temp_ratio*gsat_pt0*gsat_pt0*rec_gtt_pt0 &
72 - 2.0_r8*gsa_pt0*part_b + (factor*factor)*h_ct_ct_val
75 if (.not.
present(h_sa_ct))
return 81 if (sa .lt. sa_small)
then 82 rec_gtt_pt0 = 1.0_r8/
gsw_gibbs(n0,n2,n0,sa_small,pt0,pr0)
83 rec_gtt = 1.0_r8/
gsw_gibbs(n0,n2,n0,sa_small,t,p)
84 gsat_pt0 =
gsw_gibbs(n1,n1,n0,sa_small,pt0,pr0)
86 gsa_pt0 =
gsw_gibbs(n1,n0,n0,sa_small,pt0,pr0)
87 part_b = (temp_ratio*gsat_pt0*rec_gtt_pt0 - gsat*rec_gtt)*rec_abs_pt0
91 h_sa_ct =
gsw_cp0*part_b - factor*h_ct_ct_val
elemental subroutine gsw_enthalpy_second_derivatives_ct_exact(sa, ct, p, h_sa_sa, h_sa_ct, h_ct_ct)
real(r8), parameter gsw_cp0
real(r8), parameter gsw_t0