Per-cell advective CFL from the C-grid face-velocity pairs and metric
inverses: cfl = (|u_c|·idx + |v_c|·idy)·dt, with u_c/v_c the
face averages. !$acc routine seq so it inlines into the reduction
loops below — same module ⇒ NVHPC keeps it inlined (and it’s a
status-cadence cold path regardless). Sole home of the CFL formula,
shared by the gated + un-gated compute_max_cfl loops.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(in) | :: | u_l | |||
| real(kind=wp), | intent(in) | :: | u_r | |||
| real(kind=wp), | intent(in) | :: | v_l | |||
| real(kind=wp), | intent(in) | :: | v_r | |||
| real(kind=wp), | intent(in) | :: | idx | |||
| real(kind=wp), | intent(in) | :: | idy | |||
| real(kind=wp), | intent(in) | :: | dt |
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| real(kind=wp), | private | :: | uc | ||||
| real(kind=wp), | private | :: | vc |
pure function cfl_cell_value(u_l, u_r, v_l, v_r, idx, idy, dt) result(cfl) !! Per-cell advective CFL from the C-grid face-velocity pairs and metric !! inverses: `cfl = (|u_c|·idx + |v_c|·idy)·dt`, with `u_c`/`v_c` the !! face averages. `!$acc routine seq` so it inlines into the reduction !! loops below — same module ⇒ NVHPC keeps it inlined (and it's a !! status-cadence cold path regardless). Sole home of the CFL formula, !! shared by the gated + un-gated `compute_max_cfl` loops. !$acc routine seq real(wp), intent(in) :: u_l, u_r, v_l, v_r, idx, idy, dt real(wp) :: cfl, uc, vc uc = 0.5_wp*(u_l + u_r) vc = 0.5_wp*(v_l + v_r) cfl = (abs(uc)*idx + abs(vc)*idy)*dt end function cfl_cell_value