resolve_flux_targets Subroutine

private subroutine resolve_flux_targets(cfg, sf, this, ierr)

Pick the heat/salt destination for this run and reject the freshwater tags when the component set they need is absent.

ocean_surface_flux_assemble rebuilds Q_heat/Q_salt from the components on every thermo step when use_components is on, so a file write straight into Q_heat would be overwritten before it was ever read. With components off there is no component to write, so Q_heat is both correct and the only option. evap/lprec exist only in the component set.

Arguments

Type IntentOptional Attributes Name
type(ocean_dataovr_config_t), intent(in) :: cfg
type(ocean_surface_flux_t), intent(in) :: sf
type(ocean_data_forcing_t), intent(inout) :: this
integer, intent(out), optional :: ierr

Calls

proc~~resolve_flux_targets~~CallsGraph proc~resolve_flux_targets resolve_flux_targets proc~fail fail proc~resolve_flux_targets->proc~fail error error proc~fail->error proc~error_ring_push error_ring_push proc~fail->proc~error_ring_push

Called by

proc~~resolve_flux_targets~~CalledByGraph proc~resolve_flux_targets resolve_flux_targets proc~ocean_data_forcing_configure ocean_data_forcing_configure proc~ocean_data_forcing_configure->proc~resolve_flux_targets proc~engine_setup engine_setup proc~engine_setup->proc~ocean_data_forcing_configure proc~complete_ocean_create complete_ocean_create proc~complete_ocean_create->proc~engine_setup proc~driver_run_ocean driver_run_ocean proc~driver_run_ocean->proc~engine_setup proc~driver_validate driver_validate proc~driver_validate->proc~engine_setup proc~driver_run driver_run proc~driver_run->proc~driver_run_ocean proc~rdb_ocean_create_finalize rdb_ocean_create_finalize proc~rdb_ocean_create_finalize->proc~complete_ocean_create proc~rdb_ocean_create_from_string rdb_ocean_create_from_string proc~rdb_ocean_create_from_string->proc~complete_ocean_create

Source Code

   subroutine resolve_flux_targets(cfg, sf, this, ierr)
      !! Pick the heat/salt destination for this run and reject the
      !! freshwater tags when the component set they need is absent.
      !!
      !! `ocean_surface_flux_assemble` rebuilds `Q_heat`/`Q_salt` from
      !! the components on every thermo step when `use_components` is
      !! on, so a file write straight into `Q_heat` would be overwritten
      !! before it was ever read.  With components off there is no
      !! component to write, so `Q_heat` is both correct and the only
      !! option.  `evap`/`lprec` exist only in the component set.
      type(ocean_dataovr_config_t), intent(in) :: cfg
      type(ocean_surface_flux_t), intent(in) :: sf
      type(ocean_data_forcing_t), intent(inout) :: this
      integer, intent(out), optional :: ierr

      if (present(ierr)) ierr = OCEAN_STATUS_OK
      this%heat_to_component = sf%use_components
      this%salt_to_component = sf%use_components

      if (sf%use_components) return

      if (len_trim(cfg%evap%file) > 0 .or. len_trim(cfg%lprec%file) > 0) then
         call fail("&ocean_dataovr_nml: evap/lprec file forcing needs the surface-flux "// &
                   "component set — set &ocean_forcing_nml enable_components = .true. "// &
                   "(there is no non-component freshwater slot to write into)", &
                   ierr, OCEAN_STATUS_ERR_SETUP)
      end if
   end subroutine resolve_flux_targets