FV3 Bundle
gsw_p_from_z.f90
Go to the documentation of this file.
1 !==========================================================================
2 elemental function gsw_p_from_z (z, lat, geo_strf_dyn_height, &
3  sea_surface_geopotental)
4 !==========================================================================
5 !
6 ! Calculates sea pressure from height using computationally-efficient
7 ! 75-term expression for density, in terms of SA, CT and p (Roquet et al.,
8 ! 2015). Dynamic height anomaly, geo_strf_dyn_height, if provided,
9 ! must be computed with its p_ref = 0 (the surface). Also if provided,
10 ! sea_surface_geopotental is the geopotential at zero sea pressure. This
11 ! function solves Eqn.(3.32.3) of IOC et al. (2010) iteratively for p.
12 !
13 ! Note. Height (z) is NEGATIVE in the ocean. Depth is -z.
14 ! Depth is not used in the GSW computer software library.
15 !
16 ! z = height [ m ]
17 ! lat = latitude in decimal degrees north [ -90 ... +90 ]
18 !
19 ! OPTIONAL:
20 ! geo_strf_dyn_height = dynamic height anomaly [ m^2/s^2 ]
21 ! Note that the reference pressure, p_ref, of geo_strf_dyn_height must
22 ! be zero (0) dbar.
23 ! sea_surface_geopotental = geopotential at zero sea pressure [ m^2/s^2 ]
24 !
25 ! p = sea pressure [ dbar ]
26 ! ( i.e. absolute pressure - 10.1325 dbar )
27 !==========================================================================
28 
30 
32 
33 use gsw_mod_kinds
34 
35 implicit none
36 
37 real (r8), intent(in) :: z, lat
38 real (r8), intent(in), optional :: geo_strf_dyn_height
39 real (r8), intent(in), optional :: sea_surface_geopotental
40 
41 real (r8) :: gsw_p_from_z
42 
43 real (r8) :: c1, df_dp, f, g, gs, p, p_mid, p_old, sin2
44 real (r8) :: gsdh, ssg
45 
46 if (present(geo_strf_dyn_height)) then
47  gsdh = geo_strf_dyn_height
48 else
49  gsdh = 0.0_r8
50 end if
51 
52 if (present(sea_surface_geopotental)) then
53  ssg = sea_surface_geopotental
54 else
55  ssg = 0.0_r8
56 end if
57 
58 g = gamma ! If the graviational acceleration were to be regarded as
59  ! being depth-independent, which is often the case in
60  ! ocean models, then g would be set to be zero here,
61  ! and the code below works perfectly well.
62 
63 sin2 = sin(lat*deg2rad)**2
64 gs = 9.780327_r8*(1.0_r8 + (5.2792e-3_r8 + (2.32e-5_r8*sin2))*sin2)
65 
66 ! Get the first estimate of p from Saunders (1981)
67 c1 = 5.25e-3_r8*sin2 + 5.92e-3_r8
68 p = -2.0_r8*z/((1.0_r8-c1) + sqrt((1.0_r8-c1)*(1.0_r8-c1) + 8.84e-6_r8*z))
69 
70 ! Initial value of the derivative of f
71 df_dp = db2pa*gsw_specvol_sso_0(p)
72 
73 f = gsw_enthalpy_sso_0(p) + gs*(z - 0.5_r8*g*(z*z)) - (gsdh + ssg)
74 p_old = p
75 p = p_old - f/df_dp
76 p_mid = 0.5_r8*(p + p_old)
77 df_dp = db2pa*gsw_specvol_sso_0(p_mid)
78 p = p_old - f/df_dp
79 
80 ! After this one iteration through this modified Newton-Raphson iterative
81 ! procedure (McDougall and Wotherspoon, 2013), the remaining error in p is
82 ! at computer machine precision, being no more than 1.6e-10 dbar.
83 
84 gsw_p_from_z = p
85 
86 return
87 end function
88 
89 !--------------------------------------------------------------------------
elemental real(r8) function gsw_p_from_z(z, lat, geo_strf_dyn_height, sea_surface_geopotental)
Definition: gsw_p_from_z.f90:4