57 implicit none ;
private 59 #include <MOM_memory.h> 69 subroutine find_eta_3d(h, tv, G_Earth, G, GV, eta, eta_bt, halo_size)
74 real,
dimension(SZI_(G),SZJ_(G),SZK_(G)),
intent(in) :: h
79 real,
intent(in) :: G_Earth
81 real,
dimension(SZI_(G),SZJ_(G),SZK_(G)+1),
intent(out) :: eta
83 real,
dimension(SZI_(G),SZJ_(G)),
optional,
intent(in) :: eta_bt
87 integer,
optional,
intent(in) :: halo_size
110 real :: p(szi_(g),szj_(g),szk_(g)+1)
111 real :: dz_geo(szi_(g),szj_(g),szk_(g))
113 real :: dilate(szi_(g))
114 real :: htot(szi_(g))
116 integer i, j, k, isv, iev, jsv, jev, nz, halo
118 halo = 0 ;
if (
present(halo_size)) halo = max(0,halo_size)
120 isv = g%isc-halo ; iev = g%iec+halo ; jsv = g%jsc-halo ; jev = g%jec+halo
123 if ((isv<g%isd) .or. (iev>g%ied) .or. (jsv<g%jsd) .or. (jev>g%jed)) &
124 call mom_error(fatal,
"find_eta called with an overly large halo_size.")
126 i_gearth = 1.0 / g_earth
132 do j=jsv,jev ;
do i=isv,iev ; eta(i,j,nz+1) = -g%bathyT(i,j) ;
enddo ;
enddo 134 if (gv%Boussinesq)
then 136 do j=jsv,jev ;
do k=nz,1,-1;
do i=isv,iev
137 eta(i,j,k) = eta(i,j,k+1) + h(i,j,k)*gv%H_to_m
138 enddo ;
enddo ;
enddo 139 if (
present(eta_bt))
then 145 dilate(i) = (eta_bt(i,j)*gv%H_to_m + g%bathyT(i,j)) / &
146 (eta(i,j,1) + g%bathyT(i,j))
148 do k=1,nz ;
do i=isv,iev
149 eta(i,j,k) = dilate(i) * (eta(i,j,k) + g%bathyT(i,j)) - g%bathyT(i,j)
154 if (
associated(tv%eqn_of_state))
then 158 do i=isv,iev ; p(i,j,1) = 0.0 ;
enddo 159 do k=1,nz ;
do i=isv,iev
160 p(i,j,k+1) = p(i,j,k) + g_earth*gv%H_to_kg_m2*h(i,j,k)
165 call int_specific_vol_dp(tv%T(:,:,k), tv%S(:,:,k), p(:,:,k), p(:,:,k+1), &
166 0.0, g%HI, tv%eqn_of_state, dz_geo(:,:,k), halo_size=halo)
170 do k=nz,1,-1 ;
do i=isv,iev
171 eta(i,j,k) = eta(i,j,k+1) + i_gearth * dz_geo(i,j,k)
176 do j=jsv,jev ;
do k=nz,1,-1;
do i=isv,iev
177 eta(i,j,k) = eta(i,j,k+1) + gv%H_to_kg_m2*h(i,j,k)/gv%Rlay(k)
178 enddo ;
enddo ;
enddo 180 if (
present(eta_bt))
then 185 do i=isv,iev ; htot(i) = gv%H_subroundoff ;
enddo 186 do k=1,nz ;
do i=isv,iev ; htot(i) = htot(i) + h(i,j,k) ;
enddo ;
enddo 187 do i=isv,iev ; dilate(i) = eta_bt(i,j) / htot(i) ;
enddo 188 do k=1,nz ;
do i=isv,iev
189 eta(i,j,k) = dilate(i) * (eta(i,j,k) + g%bathyT(i,j)) - g%bathyT(i,j)
199 subroutine find_eta_2d(h, tv, G_Earth, G, GV, eta, eta_bt, halo_size)
203 real,
dimension(SZI_(G),SZJ_(G),SZK_(G)),
intent(in) :: h
208 real,
intent(in) :: G_Earth
210 real,
dimension(SZI_(G),SZJ_(G)),
intent(out) :: eta
213 real,
dimension(SZI_(G),SZJ_(G)),
optional,
intent(in) :: eta_bt
216 integer,
optional,
intent(in) :: halo_size
236 real,
dimension(SZI_(G),SZJ_(G),SZK_(G)+1) :: &
238 real,
dimension(SZI_(G),SZJ_(G),SZK_(G)) :: &
240 real :: htot(szi_(g))
242 integer i, j, k, is, ie, js, je, nz, halo
244 halo = 0 ;
if (
present(halo_size)) halo = max(0,halo_size)
245 is = g%isc-halo ; ie = g%iec+halo ; js = g%jsc-halo ; je = g%jec+halo
248 i_gearth = 1.0 / g_earth
254 do j=js,je ;
do i=is,ie ; eta(i,j) = -g%bathyT(i,j) ;
enddo ;
enddo 256 if (gv%Boussinesq)
then 257 if (
present(eta_bt))
then 259 do j=js,je ;
do i=is,ie
260 eta(i,j) = eta_bt(i,j)
264 do j=js,je ;
do k=1,nz ;
do i=is,ie
265 eta(i,j) = eta(i,j) + h(i,j,k)*gv%H_to_m
266 enddo ;
enddo ;
enddo 269 if (
associated(tv%eqn_of_state))
then 272 do i=is,ie ; p(i,j,1) = 0.0 ;
enddo 274 do k=1,nz ;
do i=is,ie
275 p(i,j,k+1) = p(i,j,k) + g_earth*gv%H_to_kg_m2*h(i,j,k)
280 call int_specific_vol_dp(tv%T(:,:,k), tv%S(:,:,k), p(:,:,k), p(:,:,k+1), 0.0, &
281 g%HI, tv%eqn_of_state, dz_geo(:,:,k), halo_size=halo)
284 do j=js,je ;
do k=1,nz ;
do i=is,ie
285 eta(i,j) = eta(i,j) + i_gearth * dz_geo(i,j,k)
286 enddo ;
enddo ;
enddo 289 do j=js,je ;
do k=1,nz ;
do i=is,ie
290 eta(i,j) = eta(i,j) + gv%H_to_kg_m2*h(i,j,k)/gv%Rlay(k)
291 enddo ;
enddo ;
enddo 293 if (
present(eta_bt))
then 298 do i=is,ie ; htot(i) = gv%H_subroundoff ;
enddo 299 do k=1,nz ;
do i=is,ie ; htot(i) = htot(i) + h(i,j,k) ;
enddo ;
enddo 301 eta(i,j) = (eta_bt(i,j) / htot(i)) * (eta(i,j) + g%bathyT(i,j)) - &
subroutine, public int_specific_vol_dp(T, S, p_t, p_b, alpha_ref, HI, EOS, dza, intp_dza, intx_dza, inty_dza, halo_size)
Calls the appropriate subroutine to alculate analytical and nearly-analytical integrals in pressure a...
The module calculates interface heights, including free surface height.
Ocean grid type. See mom_grid for details.
Provides the ocean grid type.
subroutine find_eta_3d(h, tv, G_Earth, G, GV, eta, eta_bt, halo_size)
subroutine find_eta_2d(h, tv, G_Earth, G, GV, eta, eta_bt, halo_size)
Provides subroutines for quantities specific to the equation of state.
The thermo_var_ptrs structure contains pointers to an assortment of thermodynamic fields that may be ...
subroutine, public mom_error(level, message, all_print)