Copy the &ocean_wavespeed_nml knobs onto the wave-speed slot
(B1). Diagnostic, no mutual exclusion: cg1/Rd read rho_layer
directly. Fills f_centre + the static beta_centre = |grad
f| field via fill_coriolis_centre + build_static — the
SAME metrics_fill_coriolis path VarMix/MEKE use (planetary on
spherical/tripolar, beta-plane bit-identical elsewhere) —
rather than the legacy hard-coded beta-plane set_f_centre.
Copies rho0 from the EOS slot for the Boussinesq gprime. Must
run AFTER configure_ocean_metrics (metrics filled + finalized).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(config_t), | intent(in) | :: | cfg | |||
| type(ocean_state_t), | intent(inout) | :: | ocean_state | |||
| type(hgrid_t), | intent(in) | :: | grid | |||
| integer, | intent(out), | optional | :: | ierr |
Non-zero on a wave-speed configuration conflict when present;
absent behaves as today ( |
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| real(kind=wp), | private, | allocatable | :: | f_centre(:,:) |
subroutine configure_ocean_wavespeed(cfg, ocean_state, grid, ierr) !! Copy the `&ocean_wavespeed_nml` knobs onto the wave-speed slot !! (B1). Diagnostic, no mutual exclusion: cg1/Rd read `rho_layer` !! directly. Fills `f_centre` + the static `beta_centre = |grad !! f|` field via `fill_coriolis_centre` + `build_static` — the !! SAME `metrics_fill_coriolis` path VarMix/MEKE use (planetary on !! spherical/tripolar, beta-plane bit-identical elsewhere) — !! rather than the legacy hard-coded beta-plane `set_f_centre`. !! Copies rho0 from the EOS slot for the Boussinesq `gprime`. Must !! run AFTER `configure_ocean_metrics` (metrics filled + finalized). type(config_t), intent(in) :: cfg type(ocean_state_t), intent(inout) :: ocean_state type(hgrid_t), intent(in) :: grid integer, intent(out), optional :: ierr !! Non-zero on a wave-speed configuration conflict when present; !! absent behaves as today (`error stop`). real(wp), allocatable :: f_centre(:, :) associate (ws => ocean_state%wavespeed, wcfg => cfg%ocean%wavespeed) ws%enable = wcfg%enable if (.not. wcfg%enable) then if (present(ierr)) ierr = OCEAN_STATUS_OK return end if ! Fail loud at configure: the column kernel indexes fixed-size ! NZ_STACK_MAX column arrays; wavespeed_compute never ran before ! this PR so nz > NZ_STACK_MAX never overran it. It can now. if (cfg%nz_layers > NZ_STACK_MAX) then call fail("ocean_wavespeed_nml: nz_layers exceeds "// & "NZ_STACK_MAX (raise NZ_STACK_MAX in rdb_constants)", ierr, OCEAN_STATUS_ERR_SETUP) return end if ws%mono_n2_depth = wcfg%mono_n2 ws%use_ebt = wcfg%use_ebt ws%n_wavespeed = wcfg%n_wavespeed ws%rho0 = ocean_state%eos%rho0 ! |f| at centres + the static |grad f| field for Rd. allocate (f_centre(grid%nx_total, grid%ny_total)) call fill_coriolis_centre(cfg, ocean_state%metrics, grid, f_centre) call ws%build_static(grid, ocean_state%metrics, f_centre) deallocate (f_centre) if (wcfg%n_wavespeed < 1) then call fail("ocean_wavespeed_nml: n_wavespeed must be >= 1", ierr, OCEAN_STATUS_ERR_SETUP) return end if end associate if (present(ierr)) ierr = OCEAN_STATUS_OK end subroutine configure_ocean_wavespeed