FV3 Bundle
gsw_enthalpy_first_derivatives_ct_exact.f90
Go to the documentation of this file.
1 !==========================================================================
2 elemental subroutine gsw_enthalpy_first_derivatives_ct_exact (sa, ct, p, &
3  h_sa, h_ct)
4 !==========================================================================
5 !
6 ! Calculates the following two derivatives of specific enthalpy (h)
7 ! (1) h_SA, the derivative with respect to Absolute Salinity at
8 ! constant CT and p, and
9 ! (2) h_CT, derivative with respect to CT at constant SA and p.
10 ! Note that h_P is specific volume (1/rho) it can be calulated by calling
11 ! gsw_specvol_CT_exact(SA,CT,p). This function uses the full Gibbs function.
12 !
13 ! SA = Absolute Salinity [ g/kg ]
14 ! CT = Conservative Temperature (ITS-90) [ deg C ]
15 ! p = sea pressure [ dbar ]
16 ! ( i.e. absolute pressure - 10.1325 dbar )
17 !
18 ! h_SA = The first derivative of specific enthalpy with respect to
19 ! Absolute Salinity at constant CT and p.
20 ! [ J/(kg (g/kg))] i.e. [ J/g ]
21 ! h_CT = The first derivative of specific enthalpy with respect to
22 ! CT at constant SA and p. [ J/(kg K) ]
23 !--------------------------------------------------------------------------
24 
26 
28 
29 use gsw_mod_kinds
30 
31 implicit none
32 
33 real (r8), intent(in) :: sa, ct, p
34 real (r8), intent(out), optional :: h_sa, h_ct
35 
36 real (r8) :: g_sa_mod_pt, g_sa_mod_t, pt0, t, temp_ratio
37 real (r8) :: x, y, y_pt, z
38 
39 t = gsw_t_from_ct(sa,ct,p)
40 pt0 = gsw_pt_from_ct(sa,ct)
41 
42 temp_ratio = (gsw_t0 + t)/(gsw_t0 + pt0)
43 
44 if (present(h_ct)) h_ct = gsw_cp0*temp_ratio
45 
46 if (.not. present(h_sa)) return
47 
48 x = sqrt(gsw_sfac*sa)
49 y = 0.025_r8*t
50 z = rec_db2pa*p !note.the input pressure (p) is sea pressure in units of dbar.
51 
52 g_sa_mod_t = 8645.36753595126_r8 + z*(-6620.98308089678_r8 + &
53  z*(769.588305957198_r8 + z*(-193.0648640214916_r8 + (31.6816345533648_r8 - 5.24960313181984_r8*z)*z))) + &
54  x*(-7296.43987145382_r8 + x*(8103.20462414788_r8 + &
55  y*(2175.341332000392_r8 + y*(-274.2290036817964_r8 + &
56  y*(197.4670779425016_r8 + y*(-68.5590309679152_r8 + 9.98788038278032_r8*y))) - 90.6734234051316_r8*z) + &
57  x*(-5458.34205214835_r8 - 980.14153344888_r8*y + &
58  x*(2247.60742726704_r8 - 340.1237483177863_r8*x + 220.542973797483_r8*y) + 180.142097805543_r8*z) + &
59  z*(-219.1676534131548_r8 + (-16.32775915649044_r8 - 120.7020447884644_r8*z)*z)) + &
60  z*(598.378809221703_r8 + z*(-156.8822727844005_r8 + (204.1334828179377_r8 - 10.23755797323846_r8*z)*z)) + &
61  y*(-1480.222530425046_r8 + z*(-525.876123559641_r8 + (249.57717834054571_r8 - 88.449193048287_r8*z)*z) + &
62  y*(-129.1994027934126_r8 + z*(1149.174198007428_r8 + z*(-162.5751787551336_r8 + 76.9195462169742_r8*z)) + &
63  y*(-30.0682112585625_r8 - 1380.9597954037708_r8*z + y*(2.626801985426835_r8 + 703.695562834065_r8*z))))) + &
64  y*(1187.3715515697959_r8 + z*(1458.233059470092_r8 + &
65  z*(-687.913805923122_r8 + z*(249.375342232496_r8 + z*(-63.313928772146_r8 + 14.09317606630898_r8*z)))) + &
66  y*(1760.062705994408_r8 + y*(-450.535298526802_r8 + &
67  y*(182.8520895502518_r8 + y*(-43.3206481750622_r8 + 4.26033941694366_r8*y) + &
68  z*(-595.457483974374_r8 + (149.452282277512_r8 - 72.9745838003176_r8*z)*z)) + &
69  z*(1388.489628266536_r8 + z*(-409.779283929806_r8 + (227.123395681188_r8 - 22.2565468652826_r8*z)*z))) + &
70  z*(-1721.528607567954_r8 + z*(674.819060538734_r8 + &
71  z*(-356.629112415276_r8 + (88.4080716616_r8 - 15.84003094423364_r8*z)*z)))))
72 
73 g_sa_mod_t = 0.5_r8*gsw_sfac*g_sa_mod_t
74 
75 y_pt = 0.025_r8*pt0
76 
77 g_sa_mod_pt = 8645.36753595126_r8 + &
78  x*(-7296.43987145382_r8 + x*(8103.20462414788_r8 + &
79  y_pt*(2175.341332000392_r8 + y_pt*(-274.2290036817964_r8 + &
80  y_pt*(197.4670779425016_r8 + y_pt*(-68.5590309679152_r8 + 9.98788038278032_r8*y_pt)))) + &
81  x*(-5458.34205214835_r8 - 980.14153344888_r8*y_pt + &
82  x*(2247.60742726704_r8 - 340.1237483177863_r8*x + 220.542973797483_r8*y_pt))) + &
83  y_pt*(-1480.222530425046_r8 + y_pt*(-129.1994027934126_r8 + &
84  y_pt*(-30.0682112585625_r8 + y_pt*2.626801985426835_r8)))) + &
85  y_pt*(1187.3715515697959_r8 + y_pt*(1760.062705994408_r8 + y_pt*(-450.535298526802_r8 + &
86  y_pt*(182.8520895502518_r8 + y_pt*(-43.3206481750622_r8 + 4.26033941694366_r8*y_pt)))))
87 
88 g_sa_mod_pt = 0.5_r8*gsw_sfac*g_sa_mod_pt
89 
90 h_sa = g_sa_mod_t - temp_ratio*g_sa_mod_pt
91 
92 return
93 end subroutine
94 
95 !--------------------------------------------------------------------------
elemental subroutine gsw_enthalpy_first_derivatives_ct_exact(sa, ct, p, h_sa, h_ct)