Allocate the kv / kt / ks diffusivity fields at layer
interfaces. Default values: kv = kv_bg (= pp81_nu_bg),
kt = ks = kt_bg (= pp81_kappa_bg) at interior interfaces;
boundary interfaces k=1 and k=nz+1 are zeroed (closed BC).
BL fields (bl_depth, gamma_*) seed at zero. ks is
allocated so the assembly stage (vmix_assemble) can
floor/clip it; vmix_split_kd_heat_salt derives its live
value from kt every stage, and vdiff_apply_tracers
consumes it for salinity + every passive tracer.
smooth_scratch is NOT allocated here — it is allocated lazily
in configure_ocean_vmix only when kd_smooth_iterations > 0
(before ocean_state_enter_data). The enter_data path
already guards on allocated(smooth_scratch).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(ocean_vmix_t), | intent(inout) | :: | this | |||
| type(hgrid_t), | intent(in) | :: | grid | |||
| integer, | intent(in), | optional | :: | nz_ml |
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer, | private | :: | nx | ||||
| integer, | private | :: | ny | ||||
| integer, | private | :: | nz |
subroutine ocean_vmix_init(this, grid, nz_ml) !! Allocate the kv / kt / ks diffusivity fields at layer !! interfaces. Default values: kv = kv_bg (= pp81_nu_bg), !! kt = ks = kt_bg (= pp81_kappa_bg) at interior interfaces; !! boundary interfaces k=1 and k=nz+1 are zeroed (closed BC). !! BL fields (`bl_depth`, `gamma_*`) seed at zero. `ks` is !! allocated so the assembly stage (`vmix_assemble`) can !! floor/clip it; `vmix_split_kd_heat_salt` derives its live !! value from `kt` every stage, and `vdiff_apply_tracers` !! consumes it for salinity + every passive tracer. !! !! `smooth_scratch` is NOT allocated here — it is allocated lazily !! in `configure_ocean_vmix` only when `kd_smooth_iterations > 0` !! (before `ocean_state_enter_data`). The `enter_data` path !! already guards on `allocated(smooth_scratch)`. class(ocean_vmix_t), intent(inout) :: this type(hgrid_t), intent(in) :: grid integer, intent(in), optional :: nz_ml integer :: nx, ny, nz nx = grid%nx_total ny = grid%ny_total nz = 1 if (present(nz_ml)) nz = nz_ml allocate (this%kv(nx, ny, nz + 1)) allocate (this%kt(nx, ny, nz + 1)) allocate (this%ks(nx, ny, nz + 1)) allocate (this%kd_bg(nx, ny, nz + 1)) ! kv_bg/kt_bg/ks_bg + kv/kt/ks/kd_bg all seed from pp81_* here ! (structural invariant, see `vmix_seed_backgrounds`). The SAME ! call re-derives them after `&ocean_vmix_nml pp81_*` reaches the ! slot at configure — see `rdb_ocean_setup.F90:configure_ocean_lateral`. call this%seed_backgrounds() allocate (this%bl_depth(nx, ny), source=0.0_wp) allocate (this%b0(nx, ny), source=0.0_wp) allocate (this%gamma_t(nx, ny, nz + 1), source=0.0_wp) allocate (this%gamma_s(nx, ny, nz + 1), source=0.0_wp) this%is_init = .true. end subroutine ocean_vmix_init