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.| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | d | |||
| integer, | intent(in) | :: | band | |||
| integer, | intent(in) | :: | ramp |
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| real(kind=wp), | private, | parameter | :: | PI_LOCAL | = | acos(-1.0_wp) |
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