Convert a config-namelist edge string → integer OBC tag.
Case-INSENSITIVE (to_lower), so “OPEN”/”Open”/”open” all parse
to OBC_OPEN. An unrecognised name returns OBC_INVALID
(PR-6 fail-loud): a typo must NOT silently close the boundary to
a wall. validate_config rejects OBC_INVALID (naming the
edge) before configure_ocean_bc consumes any parse result, so
no production caller ever sees the sentinel at a live edge.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | name |
pure function ocean_bc_type_from_string(name) result(bc_type) !! Convert a config-namelist edge string → integer OBC tag. !! Case-INSENSITIVE (`to_lower`), so "OPEN"/"Open"/"open" all parse !! to `OBC_OPEN`. An unrecognised name returns `OBC_INVALID` !! (PR-6 fail-loud): a typo must NOT silently close the boundary to !! a wall. `validate_config` rejects `OBC_INVALID` (naming the !! edge) before `configure_ocean_bc` consumes any parse result, so !! no production caller ever sees the sentinel at a live edge. character(len=*), intent(in) :: name integer :: bc_type select case (to_lower(trim(name))) case ("wall") bc_type = OBC_WALL case ("open") bc_type = OBC_OPEN case ("tidal") bc_type = OBC_TIDAL case ("nested") bc_type = OBC_NESTED case ("inflow") bc_type = OBC_INFLOW case ("discharge") bc_type = OBC_DISCHARGE case ("clamped") bc_type = OBC_CLAMPED case ("sponge") bc_type = OBC_SPONGE case ("chapman") bc_type = OBC_CHAPMAN case ("periodic") bc_type = OBC_PERIODIC case ("tripolar_fold") bc_type = OBC_TRIPOLAR_FOLD case default bc_type = OBC_INVALID end select end function ocean_bc_type_from_string