Validate the tripolar north-fold tag. Call after all per-edge
tags are set and after ocean_bc_state_init. Refreshes
north_fold and stops with a diagnostic if any rule fails.
Rules (design Appendix A): (a) OBC_TRIPOLAR_FOLD is accepted ONLY on the NORTH edge — west/east/south carrying it is a config error. (b) the fold requires periodic west AND east (the fold reads already-cyclically-wrapped corner columns). (c) the fold requires nghost >= 3 (PPM + biharmonic stencil depth — same as periodic). The reverse rule (tripolar grid REQUIRES the fold tag) is checked at the configure-metrics site, which knows grid_config.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(ocean_bc_state_t), | intent(inout) | :: | this | |||
| integer, | intent(out), | optional | :: | ierr |
Non-zero on a tripolar-fold configuration violation when
present; absent behaves as today ( |
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| logical, | private | :: | n_fold |
subroutine ocean_bc_validate_fold(this, ierr) !! Validate the tripolar north-fold tag. Call after all per-edge !! tags are set and after `ocean_bc_state_init`. Refreshes !! `north_fold` and stops with a diagnostic if any rule fails. !! !! Rules (design Appendix A): !! (a) OBC_TRIPOLAR_FOLD is accepted ONLY on the NORTH edge — !! west/east/south carrying it is a config error. !! (b) the fold requires periodic west AND east (the fold reads !! already-cyclically-wrapped corner columns). !! (c) the fold requires nghost >= 3 (PPM + biharmonic stencil !! depth — same as periodic). !! The reverse rule (tripolar grid REQUIRES the fold tag) is !! checked at the configure-metrics site, which knows grid_config. type(ocean_bc_state_t), intent(inout) :: this integer, intent(out), optional :: ierr !! Non-zero on a tripolar-fold configuration violation when !! present; absent behaves as today (`error stop`). logical :: n_fold n_fold = (this%north%bc_type == OBC_TRIPOLAR_FOLD) ! Rule (a): only the north edge may carry the fold tag. if (this%west%bc_type == OBC_TRIPOLAR_FOLD .or. & this%east%bc_type == OBC_TRIPOLAR_FOLD .or. & this%south%bc_type == OBC_TRIPOLAR_FOLD) then call logger%error("ocean_bc_validate_fold: tripolar_fold is accepted "// & "only on the north edge") if (present(ierr)) then ierr = OCEAN_STATUS_ERR_SETUP return end if error stop "ocean_bc_validate_fold: tripolar_fold is accepted only on the north edge" end if if (n_fold) then ! Rule (b): periodic west+east mandatory. if (this%west%bc_type /= OBC_PERIODIC .or. & this%east%bc_type /= OBC_PERIODIC) then call logger%error("ocean_bc_validate_fold: north='tripolar_fold' "// & "requires periodic west+east edges") if (present(ierr)) then ierr = OCEAN_STATUS_ERR_SETUP return end if error stop "ocean_bc_validate_fold: north='tripolar_fold' requires periodic west+east edges" end if ! Rule (c): ghost width. if (this%nghost < 3) then call logger%error("ocean_bc_validate_fold: tripolar_fold requires "// & "nghost >= 3 (PPM + biharmonic stencil depth)") if (present(ierr)) then ierr = OCEAN_STATUS_ERR_SETUP return end if error stop "ocean_bc_validate_fold: tripolar_fold requires nghost >= 3 (PPM + biharmonic stencil depth)" end if end if ! Rank-local: only the rank that owns the physical north edge folds. this%north_fold = n_fold .and. this%has_north if (present(ierr)) ierr = OCEAN_STATUS_OK end subroutine ocean_bc_validate_fold