ocean_budget_src Function

public pure function ocean_budget_src(source_sum, stage_weight) result(src)

Console src term for a conserved tracer: the surface (+ any other source, e.g. geothermal) contribution to the outer-step budget.

src = +RK2_STAGE_WEIGHT · source_sum · RHO_WATER

source_sum is the already-area-weighted interior reduction of the per-cell source budget array(s) — i.e. compute_total_tracer output, PRE-weight and PRE-RHO_WATER. Positive = added to the ocean by the source. Sole home of the weight + ρ scaling on the source side; both the reporter and the unit test call this, so a mutation of either factor fails the test.

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: source_sum
real(kind=wp), intent(in), optional :: stage_weight

Per-outer-step weight that converts the accumulator’s raw sum into the state change it must match. Absent ⇒ RK2_STAGE_WEIGHT (0.5), the historical SSP-RK2 value — so every existing caller is bit-identical. Supply ocean_budget_stage_weight(is_pc) rather than a literal: that function is the sole home of the mapping.

Return Value real(kind=wp)


Called by

proc~~ocean_budget_src~~CalledByGraph proc~ocean_budget_src ocean_budget_src proc~ocean_console_stats_report ocean_console_stats_report proc~ocean_console_stats_report->proc~ocean_budget_src proc~driver_run_ocean driver_run_ocean proc~driver_run_ocean->proc~ocean_console_stats_report proc~driver_run driver_run proc~driver_run->proc~driver_run_ocean

Variables

Type Visibility Attributes Name Initial
real(kind=wp), private :: w

Source Code

   pure function ocean_budget_src(source_sum, stage_weight) result(src)
      !! Console `src` term for a conserved tracer: the surface (+ any other
      !! source, e.g. geothermal) contribution to the outer-step budget.
      !!
      !!   src = +RK2_STAGE_WEIGHT · source_sum · RHO_WATER
      !!
      !! `source_sum` is the already-area-weighted interior reduction of the
      !! per-cell source budget array(s) — i.e. `compute_total_tracer`
      !! output, PRE-weight and PRE-`RHO_WATER`.  Positive = added to the
      !! ocean by the source.  Sole home of the weight + ρ scaling on the
      !! source side; both the reporter and the unit test call this, so a
      !! mutation of either factor fails the test.
      real(wp), intent(in) :: source_sum
      real(wp), intent(in), optional :: stage_weight
         !! Per-outer-step weight that converts the accumulator's raw sum
         !! into the state change it must match.  Absent ⇒ `RK2_STAGE_WEIGHT`
         !! (0.5), the historical SSP-RK2 value — so every existing caller is
         !! bit-identical.  Supply `ocean_budget_stage_weight(is_pc)` rather
         !! than a literal: that function is the sole home of the mapping.
      real(wp) :: src
      real(wp) :: w
      w = RK2_STAGE_WEIGHT
      if (present(stage_weight)) w = stage_weight
      src = w*source_sum*RHO_WATER
   end function ocean_budget_src