nz_stack_required Function

public 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.

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: nz

Return Value integer


Called by

proc~~nz_stack_required~~CalledByGraph proc~nz_stack_required nz_stack_required proc~nz_stack_is_sufficient nz_stack_is_sufficient proc~nz_stack_is_sufficient->proc~nz_stack_required proc~validate_config validate_config proc~validate_config->proc~nz_stack_required proc~validate_config->proc~nz_stack_is_sufficient proc~vcoord_init vcoord_t%vcoord_init proc~vcoord_init->proc~nz_stack_required proc~vcoord_init->proc~nz_stack_is_sufficient proc~build_pending_handle build_pending_handle proc~build_pending_handle->proc~validate_config proc~ocean_redi_init ocean_redi_t%ocean_redi_init proc~ocean_redi_init->proc~nz_stack_is_sufficient proc~rdb_ocean_create_from_string rdb_ocean_create_from_string proc~rdb_ocean_create_from_string->proc~build_pending_handle proc~rdb_ocean_create_pending rdb_ocean_create_pending proc~rdb_ocean_create_pending->proc~build_pending_handle

Source Code

   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