subroutine register_ocean_grid(cfg, schema)
!! `&ocean_grid_nml`: horizontal-grid generator + geometry
!! (curvilinear-grid stream). `grid_config` / `coriolis_scheme`
!! enums mirror `parse_grid_config` / `parse_coriolis_scheme` in
!! `rdb_ocean_metrics`.
type(config_t), target, intent(in) :: cfg
type(nml_schema_t), intent(inout) :: schema
type(nml_group_t) :: g
character(len=:), pointer :: ps
real(wp), pointer :: pr
g%name = "ocean_grid"
g%doc = "Horizontal-grid generator + geometry (ocean curvilinear stream)."
ps => cfg%ocean%grid%grid_config
call g%add(nml_enum("grid_config", ps, &
"Horizontal grid generator", &
allowed=[character(len=12) :: "cartesian", "spherical", &
"supergrid", "tripolar"]))
pr => cfg%ocean%grid%lon_west
call g%add(nml_real("lon_west", pr, &
"West edge of the domain (spherical)", units="degrees_east"))
pr => cfg%ocean%grid%lat_south
call g%add(nml_real("lat_south", pr, &
"South edge of the domain (spherical)", units="degrees_north", &
min=-90.0_wp, max=90.0_wp))
pr => cfg%ocean%grid%rad_earth
call g%add(nml_real("rad_earth", pr, "Earth radius for the spherical metric", &
units="m", min=0.0_wp))
ps => cfg%ocean%grid%supergrid_file
call g%add(nml_string("supergrid_file", ps, &
"Path to the MOM6 supergrid NetCDF (supergrid grid_config)"))
ps => cfg%ocean%grid%coriolis_scheme
call g%add(nml_enum("coriolis_scheme", ps, &
"Coriolis source for the metrics f-fill", &
allowed=[character(len=10) :: "beta_plane", "planetary"]))
pr => cfg%ocean%grid%omega
call g%add(nml_real("omega", pr, "Planetary rotation rate (planetary scheme)", &
units="rad/s"))
pr => cfg%ocean%grid%phi_join
call g%add(nml_real("phi_join", pr, &
"Join latitude for the tripolar bipolar cap", &
units="degrees_north", min=-90.0_wp, max=90.0_wp))
pr => cfg%ocean%grid%lon_pole
call g%add(nml_real("lon_pole", pr, &
"Longitude of the first tripolar cap pole (partner +180)", &
units="degrees_east"))
ps => cfg%ocean%grid%axis_units
call g%add(nml_enum("axis_units", ps, &
"Units of the Cartesian domain extent (MOM6 AXIS_UNITS)", &
allowed=[character(len=8) :: "meters", "degrees", "km"]))
pr => cfg%ocean%grid%len_lon
call g%add(nml_real("len_lon", pr, &
"Total x-extent of the Cartesian domain in axis_units "// &
"(MOM6 LENLON; derives dx when > 0)"))
pr => cfg%ocean%grid%len_lat
call g%add(nml_real("len_lat", pr, &
"Total y-extent of the Cartesian domain in axis_units "// &
"(MOM6 LENLAT; derives dy when > 0)"))
call schema%add_group(g)
end subroutine register_ocean_grid