FV3 Bundle
gsw_z_from_p.f90
Go to the documentation of this file.
1 !==========================================================================
2 elemental function gsw_z_from_p (p, lat, geo_strf_dyn_height, &
3  sea_surface_geopotental)
4 !==========================================================================
5 !
6 ! Calculates height from sea pressure using the computationally-efficient
7 ! 75-term expression for specific volume in terms of SA, CT and p
8 ! (Roquet et al., 2015). Dynamic height anomaly, geo_strf_dyn_height, if
9 ! provided, must be computed with its p_ref = 0 (the surface). Also if
10 ! provided, sea_surface_geopotental is the geopotential at zero sea
11 ! pressure. This function solves Eqn.(3.32.3) of IOC et al. (2010).
12 !
13 ! Note. Height z is NEGATIVE in the ocean. i.e. Depth is -z.
14 ! Depth is not used in the GSW computer software library.
15 !
16 ! p = sea pressure [ dbar ]
17 ! ( i.e. absolute pressure - 10.1325 dbar )
18 ! lat = latitude in decimal degrees north [ -90 ... +90 ]
19 !
20 ! OPTIONAL:
21 ! geo_strf_dyn_height = dynamic height anomaly [ m^2/s^2 ]
22 ! Note that the refernce pressure, p_ref, of geo_strf_dyn_height must be
23 ! zero (0) dbar.
24 ! sea_surface_geopotental = geopotential at zero sea pressure [ m^2/s^2 ]
25 !
26 ! z = height [ m ]
27 !
28 !==========================================================================
29 
31 
33 
34 use gsw_mod_kinds
35 
36 implicit none
37 
38 real (r8), intent(in) :: p, lat
39 real (r8), intent(in), optional :: geo_strf_dyn_height
40 real (r8), intent(in), optional :: sea_surface_geopotental
41 
42 real (r8) :: gsw_z_from_p
43 
44 real (r8) :: a, b, c, g, sin2, 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 gamma would be set to be zero here,
61  ! and the code below works perfectly well.
62 
63 sin2 = sin(lat*deg2rad)**2
64 b = 9.780327_r8*(1.0_r8 + (5.2792e-3_r8 + (2.32e-5_r8*sin2))*sin2)
65 a = -0.5_r8*g*b
66 c = gsw_enthalpy_sso_0(p) - (gsdh + ssg)
67 
68 gsw_z_from_p = -2.0_r8*c/(b + sqrt(b*b - 4.0_r8*a*c))
69 
70 return
71 end function
72 
73 !--------------------------------------------------------------------------
elemental real(r8) function gsw_z_from_p(p, lat, geo_strf_dyn_height, sea_surface_geopotental)
Definition: gsw_z_from_p.f90:4