FV3 Bundle
gsw_geo_strf_dyn_height_pc.f90
Go to the documentation of this file.
1 !==========================================================================
2 pure subroutine gsw_geo_strf_dyn_height_pc (sa, ct, delta_p, &
3  geo_strf_dyn_height_pc, p_mid)
4 !==========================================================================
5 !
6 ! Calculates dynamic height anomaly as the integral of specific volume
7 ! anomaly from the the sea surface pressure (0 Pa) to the pressure p.
8 ! This function, gsw_geo_strf_dyn_height_pc, is to used when the
9 ! Absolute Salinity and Conservative Temperature are piecewise constant in
10 ! the vertical over sucessive pressure intervals of delta_p (such as in
11 ! a forward "z-coordinate" ocean model). "geo_strf_dyn_height_pc" is
12 ! the dynamic height anomaly with respect to the sea surface. That is,
13 ! "geo_strf_dyn_height_pc" is the geostrophic streamfunction for the
14 ! difference between the horizontal velocity at the pressure concerned, p,
15 ! and the horizontal velocity at the sea surface. Dynamic height anomaly
16 ! is the geostrophic streamfunction in an isobaric surface. The reference
17 ! values used for the specific volume anomaly are SA = SSO = 35.16504 g/kg
18 ! and CT = 0 deg C. The output values of geo_strf_dyn_height_pc are
19 ! given at the mid-point pressures, p_mid, of each layer in which SA and
20 ! CT are vertically piecewice constant (pc). This function calculates
21 ! enthalpy using the computationally-efficient 75-term expression for
22 ! specific volume of Roquet et al., (2015).
23 !
24 ! SA = Absolute Salinity [ g/kg ]
25 ! CT = Conservative Temperature (ITS-90) [ deg C ]
26 ! delta_p = difference in sea pressure between the deep and [ dbar ]
27 ! shallow extents of each layer in which SA and CT
28 ! are vertically constant. delta_p must be positive.
29 !
30 ! Note. sea pressure is absolute pressure minus 10.1325 dbar.
31 !
32 ! geo_strf_dyn_height_pc = dynamic height anomaly [ m^2/s^2 ]
33 ! p_mid = mid-point pressure in each layer [ dbar ]
34 !--------------------------------------------------------------------------
35 
37 
39 
40 use gsw_mod_kinds
41 
42 implicit none
43 
44 real (r8), intent(in) :: sa(:), ct(:), delta_p(:)
45 real (r8), intent(out) :: geo_strf_dyn_height_pc(:), p_mid(:)
46 
47 integer :: i, np
48 real (r8), allocatable :: delta_h(:), delta_h_half(:), dyn_height_deep(:)
49 real (r8), allocatable :: p_deep(:), p_shallow(:)
50 
51 character (*), parameter :: func_name = "gsw_geo_strf_dyn_height_pc"
52 
53 if (any(delta_p .lt. 0.0_r8)) then
54  geo_strf_dyn_height_pc = gsw_error_code(1,func_name)
55  p_mid = geo_strf_dyn_height_pc
56  return
57 end if
58 
59 np = size(delta_p)
60 allocate (delta_h(np),delta_h_half(np),dyn_height_deep(np))
61 allocate (p_deep(np),p_shallow(np))
62 
63 p_deep(1) = delta_p(1)
64 do i = 2, np
65  p_deep(i) = p_deep(i-1) + delta_p(i)
66 end do
67 p_shallow = p_deep - delta_p
68 
69 delta_h = gsw_enthalpy_diff(sa,ct,p_shallow,p_deep)
70 
71 dyn_height_deep(1) = -delta_h(1)
72 do i = 2, np
73  dyn_height_deep(i) = dyn_height_deep(i-1) - delta_h(i)
74 end do
75 ! This is Phi minus Phi_0 of Eqn. (3.32.2) of IOC et al. (2010).
76 
77 p_mid = 0.5_r8*(p_shallow + p_deep)
78 delta_h_half = gsw_enthalpy_diff(sa,ct,p_mid,p_deep)
79 
80 geo_strf_dyn_height_pc = gsw_enthalpy_sso_0(p_mid) + &
81  dyn_height_deep + delta_h_half
82 
83 return
84 end subroutine
85 
86 !--------------------------------------------------------------------------
elemental real(r8) function, public gsw_error_code(err_num, func_name, error_code)
pure subroutine gsw_geo_strf_dyn_height_pc(sa, ct, delta_p, geo_strf_dyn_height_pc, p_mid)