sponge_band_alpha Function

public pure function sponge_band_alpha(d, band, ramp) result(alpha)

Shape factor of the damp_source="band" ramp at cell offset d (0 = hard against the sponge-tagged wall) for a band of band cells. The per-cell rate is sponge_strength * alpha.

  • SPONGE_RAMP_COSINE (default): 0.5*(1 + cos(pi*d/band)) — the legacy band kernel’s own ramp, reproduced bit-for-bit (including its acos(-1) spelling of pi) so ramp="cosine" stays byte-identical to every shipped namelist.
  • SPONGE_RAMP_LINEAR: (band - d - 0.5)/band. This is the CELL-CENTRE evaluation of ISOMIP+ Eq. (20), gamma(x) = gamma0*max(0, (x - x_r0)/(x_r1 - x_r0)) (Asay-Davis et al. 2016), when the band exactly spans [x_r0, x_r1]: the centre of cell d sits at x = x_r1 - (d + 0.5)*dx, so (x - x_r0)/(x_r1 - x_r0) = (band - d - 0.5)/band. It reaches neither 0 nor 1 exactly — it is a cell average of a ramp that does, which is the right discretisation of a continuous gamma(x) and is why the +0.5 is not a fudge.

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: d
integer, intent(in) :: band
integer, intent(in) :: ramp

Return Value real(kind=wp)


Called by

proc~~sponge_band_alpha~~CalledByGraph proc~sponge_band_alpha sponge_band_alpha proc~sponge_add_band_x sponge_add_band_x proc~sponge_add_band_x->proc~sponge_band_alpha proc~sponge_add_band_y sponge_add_band_y proc~sponge_add_band_y->proc~sponge_band_alpha proc~configure_ocean_sponge configure_ocean_sponge proc~configure_ocean_sponge->proc~sponge_add_band_x proc~configure_ocean_sponge->proc~sponge_add_band_y proc~engine_setup engine_setup proc~engine_setup->proc~configure_ocean_sponge 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, parameter :: PI_LOCAL = acos(-1.0_wp)

Source Code

   pure function sponge_band_alpha(d, band, ramp) result(alpha)
      !! Shape factor of the `damp_source="band"` ramp at cell offset `d`
      !! (0 = hard against the sponge-tagged wall) for a band of `band`
      !! cells.  The per-cell rate is `sponge_strength * alpha`.
      !!
      !!   * `SPONGE_RAMP_COSINE` (default): `0.5*(1 + cos(pi*d/band))` —
      !!     the legacy band kernel's own ramp, reproduced bit-for-bit
      !!     (including its `acos(-1)` spelling of pi) so `ramp="cosine"`
      !!     stays byte-identical to every shipped namelist.
      !!   * `SPONGE_RAMP_LINEAR`: `(band - d - 0.5)/band`.  This is the
      !!     CELL-CENTRE evaluation of ISOMIP+ Eq. (20),
      !!     `gamma(x) = gamma0*max(0, (x - x_r0)/(x_r1 - x_r0))`
      !!     (Asay-Davis et al. 2016), when the band exactly spans
      !!     `[x_r0, x_r1]`: the centre of cell `d` sits at
      !!     `x = x_r1 - (d + 0.5)*dx`, so
      !!     `(x - x_r0)/(x_r1 - x_r0) = (band - d - 0.5)/band`.
      !!     It reaches neither 0 nor 1 exactly — it is a cell average of
      !!     a ramp that does, which is the right discretisation of a
      !!     continuous `gamma(x)` and is why the `+0.5` is not a fudge.
      integer, intent(in) :: d, band, ramp
      real(wp) :: alpha
      real(wp), parameter :: PI_LOCAL = acos(-1.0_wp)
      select case (ramp)
      case (SPONGE_RAMP_LINEAR)
         alpha = (real(band - d, wp) - 0.5_wp)/real(band, wp)
      case default   ! SPONGE_RAMP_COSINE
         alpha = 0.5_wp*(1.0_wp + cos(PI_LOCAL*real(d, wp)/real(band, wp)))
      end select
   end function sponge_band_alpha