FV3 Bundle
gsw_enthalpy_diff.f90
Go to the documentation of this file.
1 !==========================================================================
2 elemental function gsw_enthalpy_diff (sa, ct, p_shallow, p_deep)
3 !==========================================================================
4 !
5 ! Calculates the difference of the specific enthalpy of seawater between
6 ! two different pressures, p_deep (the deeper pressure) and p_shallow
7 ! (the shallower pressure), at the same values of SA and CT. This
8 ! function uses the computationally-efficient expression for specific
9 ! volume in terms of SA, CT and p (Roquet et al., 2014). The output
10 ! (enthalpy_diff_CT) is the specific enthalpy evaluated at (SA,CT,p_deep)
11 ! minus the specific enthalpy at (SA,CT,p_shallow).
12 !
13 ! SA = Absolute Salinity [ g/kg ]
14 ! CT = Conservative Temperature (ITS-90) [ deg C ]
15 ! p_shallow = upper sea pressure [ dbar ]
16 ! ( i.e. shallower absolute pressure - 10.1325 dbar )
17 ! p_deep = lower sea pressure [ dbar ]
18 ! ( i.e. deeper absolute pressure - 10.1325 dbar )
19 !
20 ! enthalpy_diff_CT = difference of specific enthalpy [ J/kg ]
21 ! (deep minus shallow)
22 !--------------------------------------------------------------------------
23 
25 
27 
28 use gsw_mod_kinds
29 
30 implicit none
31 
32 real (r8), intent(in) :: sa, ct, p_shallow, p_deep
33 
34 real (r8) :: gsw_enthalpy_diff
35 
36 real (r8) :: dynamic_enthalpy_shallow, dynamic_enthalpy_deep
37 real (r8) :: part_1, part_2, part_3, part_4, part_5, xs, ys, z_deep, z_shallow
38 
39 xs = sqrt(gsw_sfac*sa + offset)
40 ys = ct*0.025_r8
41 z_shallow = p_shallow*1e-4_r8
42 z_deep = p_deep*1e-4_r8
43 
44 part_1 = h001 + xs*(h101 + xs*(h201 + xs*(h301 + xs*(h401 &
45  + xs*(h501 + h601*xs))))) + ys*(h011 + xs*(h111 + xs*(h211 + xs*(h311 &
46  + xs*(h411 + h511*xs)))) + ys*(h021 + xs*(h121 + xs*(h221 + xs*(h321 &
47  + h421*xs))) + ys*(h031 + xs*(h131 + xs*(h231 + h331*xs)) + ys*(h041 &
48  + xs*(h141 + h241*xs) + ys*(h051 + h151*xs + h061*ys)))))
49 
50 part_2 = h002 + xs*(h102 + xs*(h202 + xs*(h302 + xs*(h402 + h502*xs)))) &
51  + ys*(h012 + xs*(h112 + xs*(h212 + xs*(h312 + h412*xs))) + ys*(h022 &
52  + xs*(h122 + xs*(h222 + h322*xs)) + ys*(h032 + xs*(h132 + h232*xs) &
53  + ys*(h042 + h142*xs + h052*ys))))
54 
55 part_3 = h003 + xs*(h103 + xs*(h203 + xs*(h303 + h403*xs))) + ys*(h013 &
56  + xs*(h113 + xs*(h213 + h313*xs)) + ys*(h023 + xs*(h123 + h223*xs) &
57  + ys*(h033 + h133*xs + h043*ys)))
58 
59 part_4 = h004 + xs*(h104 + h204*xs) + ys*(h014 + h114*xs + h024*ys)
60 
61 part_5 = h005 + h105*xs + h015*ys
62 
63 dynamic_enthalpy_shallow = z_shallow*(part_1 + z_shallow*(part_2 &
64  + z_shallow*(part_3 + z_shallow*(part_4 + z_shallow*(part_5 &
65  + z_shallow*(h006 + h007*z_shallow))))))
66 
67 dynamic_enthalpy_deep = z_deep*(part_1 + z_deep*(part_2 + z_deep*(part_3 &
68  + z_deep*(part_4 + z_deep*(part_5 + z_deep*(h006 + h007*z_deep))))))
69 
70 gsw_enthalpy_diff = (dynamic_enthalpy_deep &
71  - dynamic_enthalpy_shallow)*db2pa*1e4_r8
72 
73 return
74 end function
75 
76 !--------------------------------------------------------------------------
elemental real(r8) function gsw_enthalpy_diff(sa, ct, p_shallow, p_deep)