FV3 Bundle
gsw_enthalpy_first_derivatives.f90
Go to the documentation of this file.
1 !==========================================================================
2 elemental subroutine gsw_enthalpy_first_derivatives (sa, ct, p, h_sa, h_ct)
3 !==========================================================================
4 !
5 ! Calculates the following two derivatives of specific enthalpy (h) of
6 ! seawater using the computationally-efficient expression for
7 ! specific volume in terms of SA, CT and p (Roquet et al., 2014).
8 ! (1) h_SA, the derivative with respect to Absolute Salinity at
9 ! constant CT and p, and
10 ! (2) h_CT, derivative with respect to CT at constant SA and p.
11 ! Note that h_P is specific volume (1/rho) it can be caclulated by calling
12 ! gsw_specvol(SA,CT,p).
13 !
14 ! SA = Absolute Salinity [ g/kg ]
15 ! CT = Conservative Temperature (ITS-90) [ deg C ]
16 ! p = sea pressure [ dbar ]
17 ! ( i.e. absolute pressure - 10.1325 dbar )
18 !
19 ! h_SA = The first derivative of specific enthalpy with respect to
20 ! Absolute Salinity at constant CT and p.
21 ! [ J/(kg (g/kg))] i.e. [ J/g ]
22 ! h_CT = The first derivative of specific enthalpy with respect to
23 ! CT at constant SA and p. [ J/(kg K) ]
24 !--------------------------------------------------------------------------
25 
27 
29 
30 use gsw_mod_kinds
31 
32 implicit none
33 
34 real (r8), intent(in) :: sa, ct, p
35 real (r8), intent(out), optional :: h_sa, h_ct
36 
37 real (r8) :: dynamic_h_ct_part, dynamic_h_sa_part, xs, ys, z
38 
39 xs = sqrt(gsw_sfac*sa + offset)
40 ys = ct*0.025_r8
41 z = p*1e-4_r8
42 
43 if (present(h_sa)) then
44 
45  dynamic_h_sa_part = z*(h101 + xs*(2.0_r8*h201 + xs*(3.0_r8*h301 &
46  + xs*(4.0_r8*h401 + xs*(5.0_r8*h501 + 6.0_r8*h601*xs)))) + ys*(h111 &
47  + xs*(2.0_r8*h211 + xs*(3.0_r8*h311 + xs*(4.0_r8*h411 &
48  + 5.0_r8*h511*xs))) + ys*(h121 + xs*(2.0_r8*h221 + xs*(3.0_r8*h321 &
49  + 4.0_r8*h421*xs)) + ys*(h131 + xs*(2.0_r8*h231 + 3.0_r8*h331*xs) &
50  + ys*(h141 + 2.0_r8*h241*xs + h151*ys)))) + z*(h102 &
51  + xs*(2.0_r8*h202 + xs*(3.0_r8*h302 + xs*(4.0_r8*h402 &
52  + 5.0_r8*h502*xs))) + ys*(h112 + xs*(2.0_r8*h212 + xs*(3.0_r8*h312 &
53  + 4.0_r8*h412*xs)) + ys*(h122 + xs*(2.0_r8*h222 + 3.0_r8*h322*xs) &
54  + ys*(h132 + 2.0_r8*h232*xs + h142*ys ))) + z*(h103 + xs*(2.0_r8*h203 &
55  + xs*(3.0_r8*h303 + 4.0_r8*h403*xs)) + ys*(h113 + xs*(2.0_r8*h213 &
56  + 3.0_r8*h313*xs) + ys*(h123 + 2.0_r8*h223*xs + h133*ys)) &
57  + z*(h104 + 2.0_r8*h204*xs + h114*ys + h105*z))))
58 
59  h_sa = 1e8_r8*0.5_r8*gsw_sfac*dynamic_h_sa_part/xs
60 
61 end if
62 
63 if (present(h_ct)) then
64 
65  dynamic_h_ct_part = z*(h011 + xs*(h111 + xs*(h211 + xs*(h311 + xs*(h411 &
66  + h511*xs)))) + ys*(2.0_r8*(h021 + xs*(h121 + xs*(h221 + xs*(h321 &
67  + h421*xs)))) + ys*(3.0_r8*(h031 + xs*(h131 + xs*(h231 + h331*xs))) &
68  + ys*(4.0_r8*(h041 + xs*(h141 + h241*xs)) + ys*(5.0_r8*(h051 &
69  + h151*xs) + 6.0_r8*h061*ys)))) + z*(h012 + xs*(h112 + xs*(h212 &
70  + xs*(h312 + h412*xs))) + ys*(2.0_r8*(h022 + xs*(h122 + xs*(h222 &
71  + h322*xs))) + ys*(3.0_r8*(h032 + xs*(h132 + h232*xs)) &
72  + ys*(4.0_r8*(h042 + h142*xs) + 5.0_r8*h052*ys))) + z*(h013 &
73  + xs*(h113 + xs*(h213 + h313*xs)) + ys*(2.0_r8*(h023 + xs*(h123 &
74  + h223*xs)) + ys*(3.0_r8*(h033 + h133*xs) + 4.0_r8*h043*ys)) &
75  + z*(h014 + h114*xs + 2.0_r8*h024*ys + h015*z ))))
76 
77  h_ct = gsw_cp0 + 1e8_r8*0.025_r8*dynamic_h_ct_part
78 
79 end if
80 
81 return
82 end subroutine
83 
84 !--------------------------------------------------------------------------
elemental subroutine gsw_enthalpy_first_derivatives(sa, ct, p, h_sa, h_ct)