ocean_budgets_evaluate Subroutine

private subroutine ocean_budgets_evaluate(this, ms)

Recompute this%values(:) from the current multilayer state. Honours this%mask — sums are weighted by mask%weight · areaT.

Type Bound

ocean_budgets_t

Arguments

Type IntentOptional Attributes Name
class(ocean_budgets_t), intent(inout) :: this
type(multilayer_state_t), intent(in) :: ms

Calls

proc~~ocean_budgets_evaluate~~CallsGraph proc~ocean_budgets_evaluate ocean_budgets_t%ocean_budgets_evaluate proc~budget_area_field budget_area_field proc~ocean_budgets_evaluate->proc~budget_area_field proc~budget_total_ke budget_total_ke proc~ocean_budgets_evaluate->proc~budget_total_ke proc~budget_total_mass budget_total_mass proc~ocean_budgets_evaluate->proc~budget_total_mass proc~budget_total_tracer budget_total_tracer proc~ocean_budgets_evaluate->proc~budget_total_tracer proc~diag_mask_global diag_mask_global proc~ocean_budgets_evaluate->proc~diag_mask_global proc~recompute_total_area recompute_total_area proc~diag_mask_global->proc~recompute_total_area

Called by

proc~~ocean_budgets_evaluate~~CalledByGraph proc~ocean_budgets_evaluate ocean_budgets_t%ocean_budgets_evaluate proc~ocean_budgets_init_snapshot ocean_budgets_t%ocean_budgets_init_snapshot proc~ocean_budgets_init_snapshot->proc~ocean_budgets_evaluate

Variables

Type Visibility Attributes Name Initial
real(kind=wp), private, allocatable :: areaT(:,:)
integer, private :: it_S
integer, private :: it_T
real(kind=wp), private :: total_KE
real(kind=wp), private :: total_S
real(kind=wp), private :: total_T
real(kind=wp), private :: total_mass

Source Code

   subroutine ocean_budgets_evaluate(this, ms)
      !! Recompute `this%values(:)` from the current multilayer state.
      !! Honours `this%mask` — sums are weighted by `mask%weight · areaT`.
      class(ocean_budgets_t), intent(inout) :: this
      type(multilayer_state_t), intent(in) :: ms
      real(wp) :: total_mass, total_KE, total_S, total_T
      real(wp), allocatable :: areaT(:, :)
      integer :: it_S, it_T

      if (.not. allocated(this%mask)) then
         allocate (this%mask, source=diag_mask_global(this%grid))
      end if

      call budget_area_field(this, areaT)

      total_mass = budget_total_mass(ms, this%mask, areaT)
      total_KE = budget_total_ke(ms, this%mask, areaT)

      it_S = ms%idx_salinity
      it_T = ms%idx_temperature
      total_S = 0.0_wp
      total_T = 0.0_wp
      if (it_S > 0) total_S = budget_total_tracer(ms, it_S, this%mask, areaT)
      if (it_T > 0) total_T = budget_total_tracer(ms, it_T, this%mask, areaT)

      this%values(BUDGET_MASS) = total_mass
      this%values(BUDGET_KE) = total_KE
      this%values(BUDGET_SALT_TOTAL) = total_S
      this%values(BUDGET_HEAT_TOTAL) = total_T
   end subroutine ocean_budgets_evaluate