subroutine register_boundary(cfg, schema)
!! `&boundary_nml`: per-side BC types, tidal forcing, inflow/
!! discharge/clamped/sponge/nesting parameters. The four `bc_*`
!! keys are enums over the bc_type_from_string accepted set.
type(config_t), target, intent(in) :: cfg
type(nml_schema_t), intent(inout) :: schema
type(nml_group_t) :: g
real(wp), pointer :: pr
real(wp), pointer :: pa(:)
integer, pointer :: pi
character(len=:), pointer :: ps
character(len=9), parameter :: bc_allowed(*) = &
[character(len=9) :: "wall", "open", "tidal", "nested", "inflow", &
"discharge", "clamped", "sponge", "chapman"]
g%name = "boundary"
g%doc = "Boundary conditions, tidal forcing, inflow/discharge/sponge/nesting."
ps => cfg%bc_west
call g%add(nml_enum("bc_west", ps, "West boundary type", allowed=bc_allowed, &
dead_on_ocean_path="coastal-legacy: reaches only warn_unknown_bc "// &
"and nothing else. The ocean path's edge selector is &ocean_bc_nml "// &
"west/east/south/north."))
ps => cfg%bc_east
call g%add(nml_enum("bc_east", ps, "East boundary type", allowed=bc_allowed, &
dead_on_ocean_path="coastal-legacy: reaches only warn_unknown_bc "// &
"and nothing else. The ocean path's edge selector is &ocean_bc_nml "// &
"west/east/south/north."))
ps => cfg%bc_south
call g%add(nml_enum("bc_south", ps, "South boundary type", allowed=bc_allowed, &
dead_on_ocean_path="coastal-legacy: reaches only warn_unknown_bc "// &
"and nothing else. The ocean path's edge selector is &ocean_bc_nml "// &
"west/east/south/north."))
ps => cfg%bc_north
call g%add(nml_enum("bc_north", ps, "North boundary type", allowed=bc_allowed, &
dead_on_ocean_path="coastal-legacy: reaches only warn_unknown_bc "// &
"and nothing else. The ocean path's edge selector is &ocean_bc_nml "// &
"west/east/south/north."))
pi => cfg%n_tidal_constituents
call g%add(nml_int("n_tidal_constituents", pi, &
"Active tidal constituents (0 = legacy single)", min=0))
pa => cfg%tidal_amp
call g%add(nml_real_array("tidal_amp", pa, "Constituent amplitudes", units="m"))
pa => cfg%tidal_phase
call g%add(nml_real_array("tidal_phase", pa, "Constituent phases", units="rad"))
pa => cfg%tidal_omega
call g%add(nml_real_array("tidal_omega", pa, "Constituent angular frequencies", units="rad/s"))
pr => cfg%inflow_salinity
call g%add(nml_real("inflow_salinity", pr, "Inflow salinity (<0 = zero-gradient)", units="PSU", &
dead_on_ocean_path="stored onto tracer_t%tr_inflow via "// &
"register_default_tracers but tr_inflow is read nowhere on the "// &
"ocean path (found by the P4 dead-knob sweep, 2026-09-10)."))
pr => cfg%inflow_temperature
call g%add(nml_real("inflow_temperature", pr, "Inflow temperature (<0 = zero-gradient)", units="degC", &
dead_on_ocean_path="stored onto tracer_t%tr_inflow via "// &
"register_default_tracers but tr_inflow is read nowhere on the "// &
"ocean path (found by the P4 dead-knob sweep, 2026-09-10)."))
pi => cfg%sponge_width
call g%add(nml_int("sponge_width", pi, "Sponge layer width in cells", min=0))
pr => cfg%sponge_strength
call g%add(nml_real("sponge_strength", pr, "Sponge relaxation rate", units="1/s"))
call schema%add_group(g)
end subroutine register_boundary