wave_drag_roughness_proxy Subroutine

public subroutine wave_drag_roughness_proxy(b, wet_T, nx, ny, nghost, kappa, n_bot, h2_max, r_h)

form="roughness_proxy" filler — a DOCUMENTED PLACEHOLDER for Jayne & St Laurent (2001)’s subgrid <h^2>, not a substitute for it (that needs PR-14’s file reader or PR-30’s field-valued roughness). Estimates the subgrid topographic-height variance from the RESOLVED 2-delta bathymetry increment: _proxy(i,j) = 1/4*[(b(i+1,j)-b(i-1,j))^2 + (b(i,j+1)-b(i,j-1))^2] then r_H = 1/2*kappa*min(<h^2>_proxy, h2_max)*N_bot. b is bottom elevation, positive UP (rdb_barotropic_state.F90) — differences are sign-independent. Zero on land (wet_T==0) and on the ghost ring (the 2-delta stencil is unavailable there; a formula-bathymetry path that leaves ghosts unfilled would otherwise manufacture a spurious cliff at the ghost seam — CLAUDE.md “Formula bathymetry setters must fill ghost rows”).

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: b(nx,ny)
real(kind=wp), intent(in) :: wet_T(nx,ny)
integer, intent(in) :: nx
integer, intent(in) :: ny
integer, intent(in) :: nghost
real(kind=wp), intent(in) :: kappa
real(kind=wp), intent(in) :: n_bot
real(kind=wp), intent(in) :: h2_max
real(kind=wp), intent(inout) :: r_h(nx,ny)

Called by

proc~~wave_drag_roughness_proxy~~CalledByGraph proc~wave_drag_roughness_proxy wave_drag_roughness_proxy proc~configure_ocean_wave_drag configure_ocean_wave_drag proc~configure_ocean_wave_drag->proc~wave_drag_roughness_proxy proc~engine_setup engine_setup proc~engine_setup->proc~configure_ocean_wave_drag proc~complete_ocean_create complete_ocean_create proc~complete_ocean_create->proc~engine_setup proc~driver_run_ocean driver_run_ocean proc~driver_run_ocean->proc~engine_setup proc~driver_validate driver_validate proc~driver_validate->proc~engine_setup proc~driver_run driver_run proc~driver_run->proc~driver_run_ocean proc~rdb_ocean_create_finalize rdb_ocean_create_finalize proc~rdb_ocean_create_finalize->proc~complete_ocean_create proc~rdb_ocean_create_from_string rdb_ocean_create_from_string proc~rdb_ocean_create_from_string->proc~complete_ocean_create

Variables

Type Visibility Attributes Name Initial
real(kind=wp), private :: h2
integer, private :: i
integer, private :: j

Source Code

   subroutine wave_drag_roughness_proxy(b, wet_T, nx, ny, nghost, kappa, n_bot, h2_max, r_h)
      !! `form="roughness_proxy"` filler — a DOCUMENTED PLACEHOLDER for
      !! Jayne & St Laurent (2001)'s subgrid `<h^2>`, not a substitute for
      !! it (that needs PR-14's file reader or PR-30's field-valued
      !! roughness). Estimates the subgrid topographic-height variance from
      !! the RESOLVED 2-delta bathymetry increment:
      !!     <h^2>_proxy(i,j) = 1/4*[(b(i+1,j)-b(i-1,j))^2 + (b(i,j+1)-b(i,j-1))^2]
      !! then `r_H = 1/2*kappa*min(<h^2>_proxy, h2_max)*N_bot`. `b` is
      !! bottom elevation, positive UP (`rdb_barotropic_state.F90`) —
      !! differences are sign-independent. Zero on land (`wet_T==0`) and on
      !! the ghost ring (the 2-delta stencil is unavailable there; a
      !! formula-bathymetry path that leaves ghosts unfilled would
      !! otherwise manufacture a spurious cliff at the ghost seam — CLAUDE.md
      !! "Formula bathymetry setters must fill ghost rows").
      integer, intent(in) :: nx, ny, nghost
      real(wp), intent(in) :: b(nx, ny), wet_T(nx, ny)
      real(wp), intent(in) :: kappa, n_bot, h2_max
      real(wp), intent(inout) :: r_h(nx, ny)
      integer :: i, j
      real(wp) :: h2

      r_h = 0.0_wp
      do j = nghost + 1, ny - nghost
         do i = nghost + 1, nx - nghost
            if (wet_T(i, j) <= 0.0_wp) cycle
            h2 = 0.25_wp*((b(i + 1, j) - b(i - 1, j))**2 + (b(i, j + 1) - b(i, j - 1))**2)
            r_h(i, j) = 0.5_wp*kappa*min(h2, h2_max)*n_bot
         end do
      end do
   end subroutine wave_drag_roughness_proxy