Recompute this%values(:) from the current multilayer state.
Honours this%mask — sums are weighted by mask%weight · areaT.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(ocean_budgets_t), | intent(inout) | :: | this | |||
| type(multilayer_state_t), | intent(in) | :: | ms |
| 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 |
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