read_config_impl Subroutine

private subroutine read_config_impl(filename, cfg, sch, ierr)

Body of read_config: build the strict schema (capturing defaults from the pristine cfg field initialisers), parse the file (validate + apply straight into cfg), run the post-parse time-unit cascade.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: filename

Path to the namelist input file

type(config_t), intent(out), target :: cfg

Populated configuration

type(nml_schema_t), intent(out) :: sch

Built + parsed schema (aliases into cfg)

integer, intent(out), optional :: ierr

Non-zero on a strict-parse failure when present; absent behaves as today (error stop).


Calls

proc~~read_config_impl~~CallsGraph proc~read_config_impl read_config_impl debug debug proc~read_config_impl->debug error error proc~read_config_impl->error parse_errors parse_errors proc~read_config_impl->parse_errors proc~apply_cartesian_degrees apply_cartesian_degrees proc~read_config_impl->proc~apply_cartesian_degrees proc~apply_time_unit_cascade apply_time_unit_cascade proc~read_config_impl->proc~apply_time_unit_cascade proc~build_rdb_schema build_rdb_schema proc~read_config_impl->proc~build_rdb_schema proc~error_ring_push error_ring_push proc~read_config_impl->proc~error_ring_push proc~schema_parse nml_schema_t%schema_parse proc~read_config_impl->proc~schema_parse proc~apply_cartesian_degrees->error info info proc~apply_cartesian_degrees->info to_string to_string proc~apply_cartesian_degrees->to_string proc~apply_time_unit_cascade->error proc~register_boundary register_boundary proc~build_rdb_schema->proc~register_boundary proc~register_conv register_conv proc~build_rdb_schema->proc~register_conv proc~register_ddiff register_ddiff proc~build_rdb_schema->proc~register_ddiff proc~register_epbl register_epbl proc~build_rdb_schema->proc~register_epbl proc~register_foxkemper register_foxkemper proc~build_rdb_schema->proc~register_foxkemper proc~register_gm register_gm proc~build_rdb_schema->proc~register_gm proc~register_grid register_grid proc~build_rdb_schema->proc~register_grid proc~register_initial_condition register_initial_condition proc~build_rdb_schema->proc~register_initial_condition proc~register_kappa_shear register_kappa_shear proc~build_rdb_schema->proc~register_kappa_shear proc~register_logging register_logging proc~build_rdb_schema->proc~register_logging proc~register_meke register_meke proc~build_rdb_schema->proc~register_meke proc~register_mpi register_mpi proc~build_rdb_schema->proc~register_mpi proc~register_nonhydrostatic register_nonhydrostatic proc~build_rdb_schema->proc~register_nonhydrostatic proc~register_ocean_bc register_ocean_bc proc~build_rdb_schema->proc~register_ocean_bc proc~register_ocean_bdrag register_ocean_bdrag proc~build_rdb_schema->proc~register_ocean_bdrag proc~register_ocean_bt register_ocean_bt proc~build_rdb_schema->proc~register_ocean_bt proc~register_ocean_cavity_dyn register_ocean_cavity_dyn proc~build_rdb_schema->proc~register_ocean_cavity_dyn proc~register_ocean_cavity_melt register_ocean_cavity_melt proc~build_rdb_schema->proc~register_ocean_cavity_melt proc~register_ocean_continuity register_ocean_continuity proc~build_rdb_schema->proc~register_ocean_continuity proc~register_ocean_coriolis register_ocean_coriolis proc~build_rdb_schema->proc~register_ocean_coriolis proc~register_ocean_data register_ocean_data proc~build_rdb_schema->proc~register_ocean_data proc~register_ocean_dataovr register_ocean_dataovr proc~build_rdb_schema->proc~register_ocean_dataovr proc~register_ocean_debug register_ocean_debug proc~build_rdb_schema->proc~register_ocean_debug proc~register_ocean_diag register_ocean_diag proc~build_rdb_schema->proc~register_ocean_diag proc~register_ocean_eos register_ocean_eos proc~build_rdb_schema->proc~register_ocean_eos proc~register_ocean_forcing register_ocean_forcing proc~build_rdb_schema->proc~register_ocean_forcing proc~register_ocean_geothermal register_ocean_geothermal proc~build_rdb_schema->proc~register_ocean_geothermal proc~register_ocean_grid register_ocean_grid proc~build_rdb_schema->proc~register_ocean_grid proc~register_ocean_hdiff register_ocean_hdiff proc~build_rdb_schema->proc~register_ocean_hdiff proc~register_ocean_hvisc register_ocean_hvisc proc~build_rdb_schema->proc~register_ocean_hvisc proc~register_ocean_ic register_ocean_ic proc~build_rdb_schema->proc~register_ocean_ic proc~register_ocean_ice register_ocean_ice proc~build_rdb_schema->proc~register_ocean_ice proc~register_ocean_ice_ic register_ocean_ice_ic proc~build_rdb_schema->proc~register_ocean_ice_ic proc~register_ocean_isopycnal register_ocean_isopycnal proc~build_rdb_schema->proc~register_ocean_isopycnal proc~register_ocean_mpi register_ocean_mpi proc~build_rdb_schema->proc~register_ocean_mpi proc~register_ocean_pgf register_ocean_pgf proc~build_rdb_schema->proc~register_ocean_pgf proc~register_ocean_psurf register_ocean_psurf proc~build_rdb_schema->proc~register_ocean_psurf proc~register_ocean_restore register_ocean_restore proc~build_rdb_schema->proc~register_ocean_restore proc~register_ocean_sponge register_ocean_sponge proc~build_rdb_schema->proc~register_ocean_sponge proc~register_ocean_tdrag register_ocean_tdrag proc~build_rdb_schema->proc~register_ocean_tdrag proc~register_ocean_thermo register_ocean_thermo proc~build_rdb_schema->proc~register_ocean_thermo proc~register_ocean_tides register_ocean_tides proc~build_rdb_schema->proc~register_ocean_tides proc~register_ocean_topo register_ocean_topo proc~build_rdb_schema->proc~register_ocean_topo proc~register_ocean_tracers register_ocean_tracers proc~build_rdb_schema->proc~register_ocean_tracers proc~register_ocean_vdiff register_ocean_vdiff proc~build_rdb_schema->proc~register_ocean_vdiff proc~register_ocean_vmix register_ocean_vmix proc~build_rdb_schema->proc~register_ocean_vmix proc~register_ocean_wetdry register_ocean_wetdry proc~build_rdb_schema->proc~register_ocean_wetdry proc~register_ocean_zinit register_ocean_zinit proc~build_rdb_schema->proc~register_ocean_zinit proc~register_output register_output proc~build_rdb_schema->proc~register_output proc~register_physics register_physics proc~build_rdb_schema->proc~register_physics proc~register_porous register_porous proc~build_rdb_schema->proc~register_porous proc~register_redi register_redi proc~build_rdb_schema->proc~register_redi proc~register_sim register_sim proc~build_rdb_schema->proc~register_sim proc~register_slopes register_slopes proc~build_rdb_schema->proc~register_slopes proc~register_tidal_mixing register_tidal_mixing proc~build_rdb_schema->proc~register_tidal_mixing proc~register_time register_time proc~build_rdb_schema->proc~register_time proc~register_tracer register_tracer proc~build_rdb_schema->proc~register_tracer proc~register_varmix register_varmix proc~build_rdb_schema->proc~register_varmix proc~register_vcoord register_vcoord proc~build_rdb_schema->proc~register_vcoord proc~register_wavespeed register_wavespeed proc~build_rdb_schema->proc~register_wavespeed proc~parse_file parse_file proc~schema_parse->proc~parse_file proc~post_parse_validate post_parse_validate proc~schema_parse->proc~post_parse_validate proc~reset_state reset_state proc~schema_parse->proc~reset_state proc~add_err add_err proc~parse_file->proc~add_err proc~parse_from_lines parse_from_lines proc~parse_file->proc~parse_from_lines proc~read_lines read_lines proc~parse_file->proc~read_lines proc~post_parse_validate->error proc~post_parse_validate->proc~error_ring_push proc~post_parse_validate->proc~add_err proc~group_add nml_group_t%group_add proc~register_boundary->proc~group_add proc~nml_enum nml_enum proc~register_boundary->proc~nml_enum proc~nml_int nml_int proc~register_boundary->proc~nml_int proc~nml_real nml_real proc~register_boundary->proc~nml_real proc~nml_real_array nml_real_array proc~register_boundary->proc~nml_real_array proc~schema_add_group nml_schema_t%schema_add_group proc~register_boundary->proc~schema_add_group proc~register_conv->proc~group_add proc~nml_logical nml_logical proc~register_conv->proc~nml_logical proc~register_conv->proc~nml_real proc~register_conv->proc~schema_add_group proc~register_ddiff->proc~group_add proc~register_ddiff->proc~nml_logical proc~register_ddiff->proc~nml_real proc~register_ddiff->proc~schema_add_group proc~register_epbl->proc~group_add proc~register_epbl->proc~nml_enum proc~register_epbl->proc~nml_int proc~register_epbl->proc~nml_logical proc~register_epbl->proc~nml_real proc~register_epbl->proc~schema_add_group proc~register_foxkemper->proc~group_add proc~register_foxkemper->proc~nml_logical proc~register_foxkemper->proc~nml_real proc~register_foxkemper->proc~schema_add_group proc~register_gm->proc~group_add proc~register_gm->proc~nml_logical proc~register_gm->proc~nml_real proc~register_gm->proc~schema_add_group proc~register_grid->proc~group_add proc~register_grid->proc~nml_int proc~register_grid->proc~nml_real proc~register_grid->proc~schema_add_group proc~register_initial_condition->proc~group_add proc~register_initial_condition->proc~nml_real proc~register_initial_condition->proc~schema_add_group proc~register_kappa_shear->proc~group_add proc~register_kappa_shear->proc~nml_int proc~register_kappa_shear->proc~nml_logical proc~register_kappa_shear->proc~nml_real proc~register_kappa_shear->proc~schema_add_group proc~register_logging->proc~group_add proc~register_logging->proc~nml_enum proc~register_logging->proc~nml_real proc~register_logging->proc~schema_add_group proc~register_meke->proc~group_add proc~register_meke->proc~nml_logical proc~register_meke->proc~nml_real proc~register_meke->proc~schema_add_group proc~register_mpi->proc~group_add proc~register_mpi->proc~nml_int proc~register_mpi->proc~schema_add_group proc~register_nonhydrostatic->proc~group_add proc~register_nonhydrostatic->proc~nml_int proc~register_nonhydrostatic->proc~nml_logical proc~register_nonhydrostatic->proc~nml_real proc~register_nonhydrostatic->proc~schema_add_group proc~register_ocean_bc->proc~group_add proc~register_ocean_bc->proc~nml_enum proc~register_ocean_bc->proc~nml_int proc~register_ocean_bc->proc~nml_logical proc~register_ocean_bc->proc~nml_real proc~register_ocean_bc->proc~nml_real_array proc~register_ocean_bc->proc~schema_add_group proc~register_ocean_bdrag->proc~group_add proc~register_ocean_bdrag->proc~nml_enum proc~register_ocean_bdrag->proc~nml_logical proc~register_ocean_bdrag->proc~nml_real proc~register_ocean_bdrag->proc~schema_add_group proc~register_ocean_bt->proc~group_add proc~register_ocean_bt->proc~nml_enum proc~register_ocean_bt->proc~nml_int proc~register_ocean_bt->proc~nml_logical proc~register_ocean_bt->proc~nml_real proc~nml_string nml_string proc~register_ocean_bt->proc~nml_string proc~register_ocean_bt->proc~schema_add_group proc~register_ocean_cavity_dyn->proc~group_add proc~register_ocean_cavity_dyn->proc~nml_enum proc~register_ocean_cavity_dyn->proc~nml_logical proc~register_ocean_cavity_dyn->proc~nml_real proc~register_ocean_cavity_dyn->proc~nml_string proc~register_ocean_cavity_dyn->proc~schema_add_group proc~register_ocean_cavity_melt->proc~group_add proc~register_ocean_cavity_melt->proc~nml_enum proc~register_ocean_cavity_melt->proc~nml_logical proc~register_ocean_cavity_melt->proc~nml_real proc~register_ocean_cavity_melt->proc~schema_add_group proc~register_ocean_continuity->proc~group_add proc~register_ocean_continuity->proc~nml_logical proc~register_ocean_continuity->proc~nml_real proc~register_ocean_continuity->proc~schema_add_group proc~register_ocean_coriolis->proc~group_add proc~register_ocean_coriolis->proc~nml_enum proc~register_ocean_coriolis->proc~nml_logical proc~register_ocean_coriolis->proc~schema_add_group proc~register_ocean_data->proc~group_add proc~register_ocean_data->proc~nml_int proc~register_ocean_data->proc~nml_logical proc~register_ocean_data->proc~schema_add_group proc~add_dataovr_entry add_dataovr_entry proc~register_ocean_dataovr->proc~add_dataovr_entry proc~register_ocean_dataovr->proc~group_add proc~register_ocean_dataovr->proc~nml_enum proc~register_ocean_dataovr->proc~nml_logical proc~register_ocean_dataovr->proc~nml_real proc~register_ocean_dataovr->proc~schema_add_group proc~register_ocean_debug->proc~group_add proc~register_ocean_debug->proc~nml_int proc~register_ocean_debug->proc~nml_logical proc~register_ocean_debug->proc~schema_add_group proc~register_ocean_diag->proc~group_add proc~register_ocean_diag->proc~nml_enum proc~register_ocean_diag->proc~nml_int proc~register_ocean_diag->proc~nml_logical proc~register_ocean_diag->proc~nml_real proc~register_ocean_diag->proc~nml_real_array proc~register_ocean_diag->proc~nml_string proc~register_ocean_diag->proc~schema_add_group proc~register_ocean_eos->proc~group_add proc~register_ocean_eos->proc~nml_enum proc~register_ocean_eos->proc~nml_real proc~register_ocean_eos->proc~schema_add_group proc~register_ocean_forcing->proc~group_add proc~register_ocean_forcing->proc~nml_logical proc~register_ocean_forcing->proc~schema_add_group proc~register_ocean_geothermal->proc~group_add proc~register_ocean_geothermal->proc~nml_logical proc~register_ocean_geothermal->proc~nml_real proc~register_ocean_geothermal->proc~schema_add_group proc~register_ocean_grid->proc~group_add proc~register_ocean_grid->proc~nml_enum proc~register_ocean_grid->proc~nml_real proc~register_ocean_grid->proc~nml_string proc~register_ocean_grid->proc~schema_add_group proc~register_ocean_hdiff->proc~group_add proc~register_ocean_hdiff->proc~nml_real proc~register_ocean_hdiff->proc~schema_add_group proc~register_ocean_hvisc->proc~group_add proc~register_ocean_hvisc->proc~nml_enum proc~register_ocean_hvisc->proc~nml_int proc~register_ocean_hvisc->proc~nml_logical proc~register_ocean_hvisc->proc~nml_real proc~register_ocean_hvisc->proc~nml_real_array proc~register_ocean_hvisc->proc~schema_add_group proc~register_ocean_ic->proc~group_add proc~register_ocean_ic->proc~nml_enum proc~register_ocean_ic->proc~nml_int proc~register_ocean_ic->proc~nml_real proc~register_ocean_ic->proc~nml_real_array proc~register_ocean_ic->proc~schema_add_group proc~register_ocean_ice->proc~group_add proc~register_ocean_ice->proc~nml_int proc~register_ocean_ice->proc~nml_logical proc~register_ocean_ice->proc~nml_real proc~register_ocean_ice->proc~nml_real_array proc~register_ocean_ice->proc~schema_add_group proc~register_ocean_ice_ic->proc~group_add proc~register_ocean_ice_ic->proc~nml_enum proc~register_ocean_ice_ic->proc~nml_real proc~register_ocean_ice_ic->proc~schema_add_group proc~register_ocean_isopycnal->proc~group_add proc~register_ocean_isopycnal->proc~nml_logical proc~register_ocean_isopycnal->proc~nml_real proc~register_ocean_isopycnal->proc~schema_add_group proc~register_ocean_mpi->proc~group_add proc~register_ocean_mpi->proc~nml_logical proc~register_ocean_mpi->proc~schema_add_group proc~register_ocean_pgf->proc~group_add proc~register_ocean_pgf->proc~nml_enum proc~register_ocean_pgf->proc~nml_int proc~register_ocean_pgf->proc~nml_logical proc~register_ocean_pgf->proc~nml_real proc~register_ocean_pgf->proc~schema_add_group proc~register_ocean_psurf->proc~group_add proc~register_ocean_psurf->proc~nml_logical proc~register_ocean_psurf->proc~nml_real proc~register_ocean_psurf->proc~schema_add_group proc~register_ocean_restore->proc~group_add proc~register_ocean_restore->proc~nml_logical proc~register_ocean_restore->proc~nml_real proc~register_ocean_restore->proc~schema_add_group proc~register_ocean_sponge->proc~group_add proc~register_ocean_sponge->proc~nml_enum proc~register_ocean_sponge->proc~nml_int proc~register_ocean_sponge->proc~nml_logical proc~register_ocean_sponge->proc~nml_real proc~register_ocean_sponge->proc~schema_add_group proc~register_ocean_tdrag->proc~group_add proc~register_ocean_tdrag->proc~nml_enum proc~register_ocean_tdrag->proc~nml_logical proc~register_ocean_tdrag->proc~nml_real proc~register_ocean_tdrag->proc~schema_add_group proc~register_ocean_thermo->proc~group_add proc~register_ocean_thermo->proc~nml_enum proc~register_ocean_thermo->proc~nml_logical proc~register_ocean_thermo->proc~nml_real proc~register_ocean_thermo->proc~schema_add_group proc~register_ocean_tides->proc~group_add proc~register_ocean_tides->proc~nml_logical proc~register_ocean_tides->proc~nml_real proc~register_ocean_tides->proc~nml_string proc~register_ocean_tides->proc~schema_add_group proc~register_ocean_topo->proc~group_add proc~register_ocean_topo->proc~nml_enum proc~register_ocean_topo->proc~nml_real proc~register_ocean_topo->proc~schema_add_group proc~register_ocean_tracers->proc~group_add proc~register_ocean_tracers->proc~nml_logical proc~register_ocean_tracers->proc~nml_real proc~register_ocean_tracers->proc~schema_add_group proc~register_ocean_vdiff->proc~group_add proc~register_ocean_vdiff->proc~nml_logical proc~register_ocean_vdiff->proc~nml_real proc~register_ocean_vdiff->proc~schema_add_group proc~register_ocean_vmix->proc~group_add proc~register_ocean_vmix->proc~nml_enum proc~register_ocean_vmix->proc~nml_int proc~register_ocean_vmix->proc~nml_logical proc~register_ocean_vmix->proc~nml_real proc~register_ocean_vmix->proc~schema_add_group proc~register_ocean_wetdry->proc~group_add proc~register_ocean_wetdry->proc~nml_logical proc~register_ocean_wetdry->proc~nml_real proc~register_ocean_wetdry->proc~schema_add_group proc~register_ocean_zinit->proc~group_add proc~register_ocean_zinit->proc~nml_enum proc~register_ocean_zinit->proc~nml_logical proc~register_ocean_zinit->proc~nml_real proc~register_ocean_zinit->proc~nml_string proc~register_ocean_zinit->proc~schema_add_group proc~register_output->proc~group_add proc~register_output->proc~nml_int proc~register_output->proc~nml_logical proc~register_output->proc~nml_real proc~register_output->proc~nml_string proc~register_output->proc~schema_add_group proc~register_physics->proc~group_add proc~register_physics->proc~nml_real proc~register_physics->proc~schema_add_group proc~register_porous->proc~group_add proc~register_porous->proc~nml_enum proc~register_porous->proc~nml_logical proc~register_porous->proc~nml_real proc~register_porous->proc~schema_add_group proc~register_redi->proc~group_add proc~register_redi->proc~nml_logical proc~register_redi->proc~nml_real proc~register_redi->proc~schema_add_group proc~register_sim->proc~group_add proc~register_sim->proc~nml_enum proc~register_sim->proc~schema_add_group proc~register_slopes->proc~group_add proc~register_slopes->proc~nml_logical proc~register_slopes->proc~nml_real proc~register_slopes->proc~schema_add_group proc~register_tidal_mixing->proc~group_add proc~register_tidal_mixing->proc~nml_logical proc~register_tidal_mixing->proc~nml_real proc~register_tidal_mixing->proc~schema_add_group proc~register_time->proc~group_add proc~register_time->proc~nml_int proc~register_time->proc~nml_real proc~register_time->proc~nml_string proc~register_time->proc~schema_add_group proc~register_tracer->proc~group_add proc~register_tracer->proc~nml_real proc~register_tracer->proc~schema_add_group proc~register_varmix->proc~group_add proc~register_varmix->proc~nml_int proc~register_varmix->proc~nml_logical proc~register_varmix->proc~nml_real proc~register_varmix->proc~schema_add_group proc~register_vcoord->proc~group_add proc~register_vcoord->proc~nml_enum proc~register_vcoord->proc~nml_int proc~register_vcoord->proc~nml_logical proc~register_vcoord->proc~nml_real proc~register_vcoord->proc~nml_real_array proc~register_vcoord->proc~schema_add_group proc~register_wavespeed->proc~group_add proc~register_wavespeed->proc~nml_int proc~register_wavespeed->proc~nml_logical proc~register_wavespeed->proc~nml_real proc~register_wavespeed->proc~schema_add_group proc~add_dataovr_entry->proc~group_add proc~add_dataovr_entry->proc~nml_real proc~add_dataovr_entry->proc~nml_string proc~group_add->error proc~lower lower proc~group_add->proc~lower proc~parse_from_lines->proc~add_err proc~dispatch_group dispatch_group proc~parse_from_lines->proc~dispatch_group proc~make_prefix make_prefix proc~parse_from_lines->proc~make_prefix proc~next_amp next_amp proc~parse_from_lines->proc~next_amp proc~read_group_name read_group_name proc~parse_from_lines->proc~read_group_name proc~skip_to_slash skip_to_slash proc~parse_from_lines->proc~skip_to_slash proc~schema_add_group->error proc~schema_add_group->proc~lower proc~move_group move_group proc~schema_add_group->proc~move_group proc~dispatch_group->proc~add_err proc~dispatch_group->proc~skip_to_slash names names proc~dispatch_group->names proc~group_name_list group_name_list proc~dispatch_group->proc~group_name_list proc~parse_group_body parse_group_body proc~dispatch_group->proc~parse_group_body proc~schema_find_group nml_schema_t%schema_find_group proc~dispatch_group->proc~schema_find_group proc~schema_is_external nml_schema_t%schema_is_external proc~dispatch_group->proc~schema_is_external proc~strip_nml strip_nml proc~dispatch_group->proc~strip_nml proc~suggest suggest proc~dispatch_group->proc~suggest proc~fmt_int fmt_int proc~make_prefix->proc~fmt_int proc~strip_comment strip_comment proc~next_amp->proc~strip_comment proc~is_ident_char is_ident_char proc~read_group_name->proc~is_ident_char proc~read_group_name->proc~strip_comment proc~skip_to_slash->proc~strip_comment

Called by

proc~~read_config_impl~~CalledByGraph proc~read_config_impl read_config_impl proc~read_config read_config proc~read_config->proc~read_config_impl

Source Code

   subroutine read_config_impl(filename, cfg, sch, ierr)
      !! Body of [[read_config]]: build the strict schema (capturing
      !! defaults from the pristine `cfg` field initialisers), parse the
      !! file (validate + apply straight into `cfg`), run the post-parse
      !! time-unit cascade.
      character(len=*), intent(in) :: filename
         !! Path to the namelist input file
      type(config_t), target, intent(out) :: cfg
         !! Populated configuration
      type(nml_schema_t), intent(out) :: sch
         !! Built + parsed schema (aliases into `cfg`)
      integer, intent(out), optional :: ierr
         !! Non-zero on a strict-parse failure when present; absent
         !! behaves as today (`error stop`).

      ! `cfg` arrives at its pristine field-initialiser defaults.  Every
      ! namelist group is now on the strict schema: build it (capturing
      ! those defaults), then parse — which validates AND applies every
      ! override straight into `cfg` via the schema's key pointers.  No
      ! native readers, no flat shadow locals, no copy-back remain.

      ! Build the strict schema so its key constructors capture defaults
      ! from the pristine `cfg` field initialisers.
      call build_rdb_schema(cfg, sch)

      ! A missing namelist file is not an error — the pristine `cfg`
      ! defaults stand (production main.F90 fails loudly on a missing
      ! file earlier; tests + the FFI rely on this defaults-on-absent
      ! behaviour).  Guard the strict parse so it never error-stops on
      ! "cannot open file".
      block
         logical :: file_exists
         inquire (file=trim(filename), exist=file_exists)
         if (.not. file_exists) then
            call logger%debug("Namelist file not found, keeping defaults: "//trim(filename))
            if (present(ierr)) ierr = OCEAN_STATUS_OK
            return
         end if
      end block

      ! Strict schema parse: validate + APPLY every group straight into
      ! `cfg`.  When `ierr` is present, route through the schema's own
      ! non-aborting `status`/`errors` pair (already implemented in
      ! `rdb_nml_schema`) instead of the bare (strict, error-stopping)
      ! form — every collected message is still logged, just without the
      ! `error stop`.  Absent `ierr` ⇒ unchanged bare call, for EVERY
      ! existing caller (driver, benchmarks, unit tests).
      if (present(ierr)) then
         block
            integer :: parse_status, e
            character(len=:), allocatable :: parse_errors(:)
            call sch%parse(trim(filename), status=parse_status, errors=parse_errors)
            if (parse_status /= 0) then
               if (allocated(parse_errors)) then
                  do e = 1, size(parse_errors)
                     call error_ring_push(trim(parse_errors(e)))
                     call logger%error(trim(parse_errors(e)))
                  end do
               end if
               ierr = OCEAN_STATUS_ERR_CONFIG_PARSE
               return
            end if
         end block
      else
         call sch%parse(trim(filename))
      end if

      call apply_time_unit_cascade(cfg)
      call apply_cartesian_degrees(cfg)
      if (present(ierr)) ierr = OCEAN_STATUS_OK

   end subroutine read_config_impl