Per-layer transport weights a(k) = mu(sigma_top) - mu(sigma_bot),
walking surface (k=nz) -> bed (k=1). sum_k a(k) = mu(0)-mu(-1) = 0
(closed cell => conservation). Layers below the ML base get
sigma <= -1 => mu=0 on both interfaces => a(k)=0 (ML-confinement).
h_vel is clamped to the column total inside the caller so the
sigma walk reaches exactly -1 over the actual depth (guards the
mld > column-depth case; mu(-1)=0 keeps sum a(k)=0 regardless).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(in) | :: | h_face(nz) | |||
| integer, | intent(in) | :: | nz | |||
| real(kind=wp), | intent(in) | :: | h_vel | |||
| real(kind=wp), | intent(out) | :: | a(nz) |
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| real(kind=wp), | private | :: | ih_tot | ||||
| integer, | private | :: | k | ||||
| real(kind=wp), | private | :: | mu_bot | ||||
| real(kind=wp), | private | :: | mu_top | ||||
| real(kind=wp), | private | :: | sigma_bot | ||||
| real(kind=wp), | private | :: | sigma_top |
pure subroutine mle_layer_weights(h_face, nz, h_vel, a) !$acc routine seq !! Per-layer transport weights a(k) = mu(sigma_top) - mu(sigma_bot), !! walking surface (k=nz) -> bed (k=1). `sum_k a(k) = mu(0)-mu(-1) = 0` !! (closed cell => conservation). Layers below the ML base get !! sigma <= -1 => mu=0 on both interfaces => a(k)=0 (ML-confinement). !! !! `h_vel` is clamped to the column total inside the caller so the !! sigma walk reaches exactly -1 over the actual depth (guards the !! mld > column-depth case; mu(-1)=0 keeps sum a(k)=0 regardless). integer, intent(in) :: nz real(wp), intent(in) :: h_face(nz) ! k=1 bed .. k=nz surface real(wp), intent(in) :: h_vel real(wp), intent(out) :: a(nz) ! k=1 bed .. k=nz surface integer :: k real(wp) :: ih_tot, sigma_top, sigma_bot, mu_top, mu_bot ih_tot = 1.0_wp/(h_vel + H_NEGLECT) sigma_top = 0.0_wp ! sigma=0 at surface (above k=nz) ! Walk surface -> bed. do k = nz, 1, -1 sigma_bot = sigma_top - h_face(k)*ih_tot ! more negative going down mu_top = mle_mu_shape(sigma_top) mu_bot = mle_mu_shape(sigma_bot) a(k) = mu_top - mu_bot sigma_top = sigma_bot end do end subroutine mle_layer_weights