Smallest NZ_STACK_MAX that safely covers a run of nz layers.
nz + 1. Derived from a survey of every NZ_STACK_MAX-dimensioned
array in the tree; the binding consumers are the ones that index a
plainly-NZ_STACK_MAX-declared array to nz+1 rather than the
NZ_STACK_MAX+1 an interface array would use:
Interface-indexed column workspaces are the ones to watch: a
tridiagonal over layer INTERFACES runs to nz + 1, so a
plainly-NZ_STACK_MAX-declared scratch array must still admit
that extra slot. The remap kernel’s own z_old(0:NZ_STACK_MAX) /
q_L/q_R/q6 are sized on the same rule.
* rdb_ocean_diag_fills z_iface — needs n_bin + 2, which the
n_bin <= NZ_STACK_MAX - 1 output-level guard bounds by nz + 1.
NOT 2*nz + 2: the Redi neutral-surface locals that motivated the
256 bump are declared 2*NZ_STACK_MAX + 2 and so scale with the
constant — they need only NZ_STACK_MAX >= nz.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | nz |
pure function nz_stack_required(nz) result(req) !! Smallest `NZ_STACK_MAX` that safely covers a run of `nz` layers. !! !! `nz + 1`. Derived from a survey of every `NZ_STACK_MAX`-dimensioned !! array in the tree; the binding consumers are the ones that index a !! plainly-`NZ_STACK_MAX`-declared array to `nz+1` rather than the !! `NZ_STACK_MAX+1` an interface array would use: !! !! Interface-indexed column workspaces are the ones to watch: a !! tridiagonal over layer INTERFACES runs to `nz + 1`, so a !! plainly-`NZ_STACK_MAX`-declared scratch array must still admit !! that extra slot. The remap kernel's own `z_old(0:NZ_STACK_MAX)` / !! `q_L`/`q_R`/`q6` are sized on the same rule. !! * `rdb_ocean_diag_fills` `z_iface` — needs `n_bin + 2`, which the !! `n_bin <= NZ_STACK_MAX - 1` output-level guard bounds by `nz + 1`. !! !! NOT `2*nz + 2`: the Redi neutral-surface locals that motivated the !! 256 bump are declared `2*NZ_STACK_MAX + 2` and so scale with the !! constant — they need only `NZ_STACK_MAX >= nz`. integer, intent(in) :: nz integer :: req req = nz + 1 end function nz_stack_required