Copy the &ocean_tidal_mixing_nml knobs onto the tidal-mixing
slot — every field, end to end (no dead-config gaps). Seeds the
prescribed bottom energy field e_in (v1 uniform path), copies
the shared EOS hookup for the N^2 buoyancy derivatives, and
validates. No mutual exclusion: tidal mixing is an interior
closure that coexists with KPP / EPBL / PP81 / kappa-shear.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(config_t), | intent(in) | :: | cfg | |||
| type(ocean_state_t), | intent(inout) | :: | ocean_state | |||
| integer, | intent(in) | :: | compute_rank | |||
| integer, | intent(out), | optional | :: | ierr |
Non-zero on a tidal-mixing configuration conflict when present;
absent behaves as today ( |
subroutine configure_ocean_tidal_mixing(cfg, ocean_state, compute_rank, ierr) !! Copy the `&ocean_tidal_mixing_nml` knobs onto the tidal-mixing !! slot — every field, end to end (no dead-config gaps). Seeds the !! prescribed bottom energy field `e_in` (v1 uniform path), copies !! the shared EOS hookup for the N^2 buoyancy derivatives, and !! validates. No mutual exclusion: tidal mixing is an interior !! closure that coexists with KPP / EPBL / PP81 / kappa-shear. type(config_t), intent(in) :: cfg type(ocean_state_t), intent(inout) :: ocean_state integer, intent(in) :: compute_rank integer, intent(out), optional :: ierr !! Non-zero on a tidal-mixing configuration conflict when present; !! absent behaves as today (`error stop`). associate (tm => ocean_state%vmix_tidal, tcfg => cfg%ocean%tidal_mixing) ! `enable` is flipped LAST, only once every validation below has ! passed (P0.1 review F9 — `configure_ocean_porous` is the ! pattern): setting it up front left a half-configured slot ! flagged enabled on any of this routine's failure returns. if (.not. tcfg%enable) then tm%enable = .false. if (present(ierr)) ierr = OCEAN_STATUS_OK return end if ! Every St-Laurent/Simmons knob (no dead-config gaps). tm%gamma = tcfg%gamma tm%mu = tcfg%mu tm%zeta = tcfg%zeta tm%kd_max = tcfg%kd_max tm%prandtl_tidal = tcfg%prandtl_tidal tm%min_zbot = tcfg%min_zbot tm%e_uniform = tcfg%e_uniform tm%e_compute = tcfg%e_compute tm%kappa_itides = tcfg%kappa_itides tm%kappa_h2 = tcfg%kappa_h2 tm%utide = tcfg%utide tm%h2_rough = tcfg%h2_rough tm%frac_rough = tcfg%frac_rough tm%e_max = tcfg%e_max ! EOS hookup: the buoyancy derivatives use the SAME EOS handle ! the dyn-core runs (shared flat-POD copy — one source of truth). tm%eos = ocean_state%eos tm%rho0 = ocean_state%eos%rho0 ! Seed the prescribed bottom energy field (v1 uniform path). call tm%set_e_uniform(tm%e_uniform) ! Validation. if (.not. cfg%ocean%vmix%use_closure) then call fail("ocean_tidal_mixing_nml: enable=.true. requires "// & "ocean_vmix_nml use_closure=.true. (tidal mixing "// & "folds into the interior closure's kv/kt)", ierr, OCEAN_STATUS_ERR_SETUP) return end if if (.not. cfg%ocean%thermo%enable_thermodynamics) then call fail("ocean_tidal_mixing_nml: enable=.true. requires "// & "active thermodynamics (tidal mixing reads T, S for N^2)", ierr, OCEAN_STATUS_ERR_SETUP) return end if if (tm%zeta <= 0.0_wp) then call fail("ocean_tidal_mixing_nml: zeta must be > 0", ierr, OCEAN_STATUS_ERR_SETUP) return end if if (tm%prandtl_tidal <= 0.0_wp) then call fail("ocean_tidal_mixing_nml: prandtl_tidal must be > 0", ierr, OCEAN_STATUS_ERR_SETUP) return end if if (compute_rank == 0) then call logger%info("Tidal mixing: interior closure enabled "// & "(zeta="//to_string(tcfg%zeta)//" m "// & "E="//to_string(tcfg%e_uniform)//" W/m^2)") end if tm%enable = .true. end associate if (present(ierr)) ierr = OCEAN_STATUS_OK end subroutine configure_ocean_tidal_mixing