Resolve the VCOORD_Z_FIXED nominal layering onto the vcoord slot —
and the VCOORD_ZSTAR one, which is the same nominal profile
(MOM6 z* dilates it per column; ocean_vcoord_zstar_target):
z_fixed_h_ref = &ocean_topo_nml max_depth (the uniform
max_depth/nz spacing — the default, byte-identical), or, under
&vcoord_nml z_fixed_profile = "list" | "tanh", the stretched
per-layer tables z_fixed_zi / z_fixed_dz built by
rdb_vcoord :: z_fixed_nominal_dz (z_fixed_h_ref then becomes
the profile’s total depth).
The same tables are the z NOMINAL FLOOR of VCOORD_HYCOM (MOM6
HYCOM1 floors its interfaces at the z coordinateResolution its
ALE_COORDINATE_CONFIG defines), so this also runs for hycom.
Idempotent (it rebuilds from cfg each call). Called twice: by
engine_setup BEFORE the IC seed — the cavity z_fixed seed lays
h_layer from the same target builder and must see the same
profile — and from configure_ocean_lateral, which has always
owned z_fixed_h_ref. Both precede ocean_state_enter_data, so
the copyin captures the tables. validate_config has already
refused a profile that does not build, or one on another family.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(config_t), | intent(in) | :: | cfg | |||
| type(ocean_state_t), | intent(inout) | :: | ocean_state | |||
| integer, | intent(in) | :: | compute_rank | |||
| logical, | intent(in) | :: | log_it |
Log the resolved profile (rank 0). |
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer, | private | :: | code | ||||
| real(kind=wp), | private, | allocatable | :: | dz(:) | |||
| integer, | private | :: | ierr | ||||
| integer, | private | :: | nz |
subroutine configure_ocean_z_fixed_profile(cfg, ocean_state, compute_rank, log_it) !! Resolve the `VCOORD_Z_FIXED` nominal layering onto the vcoord slot — !! and the `VCOORD_ZSTAR` one, which is the same nominal profile !! (MOM6 z* dilates it per column; `ocean_vcoord_zstar_target`): !! `z_fixed_h_ref = &ocean_topo_nml max_depth` (the uniform !! `max_depth/nz` spacing — the default, byte-identical), or, under !! `&vcoord_nml z_fixed_profile = "list" | "tanh"`, the stretched !! per-layer tables `z_fixed_zi` / `z_fixed_dz` built by !! `rdb_vcoord :: z_fixed_nominal_dz` (`z_fixed_h_ref` then becomes !! the profile's total depth). !! !! The same tables are the z* NOMINAL FLOOR of `VCOORD_HYCOM` (MOM6 !! HYCOM1 floors its interfaces at the z* `coordinateResolution` its !! ALE_COORDINATE_CONFIG defines), so this also runs for `hycom`. !! !! Idempotent (it rebuilds from `cfg` each call). Called twice: by !! `engine_setup` BEFORE the IC seed — the cavity `z_fixed` seed lays !! `h_layer` from the same target builder and must see the same !! profile — and from `configure_ocean_lateral`, which has always !! owned `z_fixed_h_ref`. Both precede `ocean_state_enter_data`, so !! the copyin captures the tables. `validate_config` has already !! refused a profile that does not build, or one on another family. type(config_t), intent(in) :: cfg type(ocean_state_t), intent(inout) :: ocean_state integer, intent(in) :: compute_rank logical, intent(in) :: log_it !! Log the resolved profile (rank 0). integer :: code, ierr, nz real(wp), allocatable :: dz(:) ocean_state%vcoord%z_fixed_h_ref = cfg%ocean%topo%max_depth ocean_state%vcoord%z_fixed_use_profile = .false. if (.not. ocean_state%vcoord%is_init) return ! Three readers of the z* nominal resolution: `z_fixed` (its levels), ! `zstar` (MOM6 z*, its levels) and `hycom` (its z* nominal floor, ! MOM6 HYCOM1 coordinateResolution). if (ocean_state%vcoord%coord_type /= VCOORD_Z_FIXED .and. & ocean_state%vcoord%coord_type /= VCOORD_ZSTAR .and. & ocean_state%vcoord%coord_type /= VCOORD_HYCOM) return code = parse_z_fixed_profile(cfg%z_fixed_profile) if (code == ZFIXED_PROFILE_UNIFORM .or. code == ZFIXED_PROFILE_INVALID) return nz = ocean_state%vcoord%nz_ml allocate (dz(nz)) call z_fixed_nominal_dz(code, nz, cfg%ocean%topo%max_depth, cfg%z_fixed_dz, & cfg%z_fixed_dz_top, cfg%z_fixed_tanh_center, & cfg%z_fixed_tanh_width, dz, ierr) if (ierr /= ZFIXED_DZ_OK) return call ocean_vcoord_set_z_fixed_profile(ocean_state%vcoord, dz) if (log_it .and. compute_rank == 0) then call logger%info(trim(cfg%vcoord_type)//" z* profile: "//trim(cfg%z_fixed_profile)// & " — nominal dz "//to_string(dz(1))//" m (surface) … "// & to_string(dz(nz))//" m (bed), total "// & to_string(ocean_state%vcoord%z_fixed_h_ref)//" m over "// & to_string(nz)//" layers") end if end subroutine configure_ocean_z_fixed_profile