Skip to content

Commit

Permalink
Separate out prognostic and data ismf accumulation
Browse files Browse the repository at this point in the history
  • Loading branch information
darincomeau committed Feb 5, 2024
1 parent 6cc7a1e commit 947d2fb
Showing 1 changed file with 25 additions and 16 deletions.
41 changes: 25 additions & 16 deletions components/mpas-ocean/src/shared/mpas_ocn_time_average_coupled.F
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ subroutine ocn_time_average_coupled_accumulate(statePool, forcingPool, timeLevel
avgLandIceBoundaryLayerTracers, avgLandIceTracerTransferVelocities
real (kind=RKIND), dimension(:), pointer :: effectiveDensityInLandIce, avgEffectiveDensityInLandIce, &
totalFreshWaterTemperatureFlux, avgTotalFreshWaterTemperatureFlux, &
landIceFreshwaterFlux, avgLandIceFreshwaterFlux, &
landIceFreshwaterFlux, dataLandIceFreshwaterFlux, avgLandIceFreshwaterFlux, &
removedRiverRunoffFlux, avgRemovedRiverRunoffFlux, &
removedIceRunoffFlux, avgRemovedIceRunoffFlux

Expand Down Expand Up @@ -347,24 +347,33 @@ subroutine ocn_time_average_coupled_accumulate(statePool, forcingPool, timeLevel
if(trim(config_land_ice_flux_mode) == 'standalone' .or. trim(config_land_ice_flux_mode) == 'data') then
call mpas_pool_get_array(forcingPool, 'avgLandIceFreshwaterFlux', avgLandIceFreshwaterFlux)

! load prognostic melt rates
if(trim(config_land_ice_flux_mode) == 'standalone') then
call mpas_pool_get_array(forcingPool, 'landIceFreshwaterFlux', landIceFreshwaterFlux)
endif

! load data melt rates if used
if(trim(config_land_ice_flux_mode) == 'data') then
! call mpas_pool_get_array(forcingPool, 'dataLandIceFreshwaterFlux', landIceFreshwaterFlux)
call mpas_pool_get_array(forcingPool, 'landIceFreshwaterFlux', landIceFreshwaterFlux)
endif

!$omp parallel
!$omp do schedule(runtime)
do iCell = 1, nCells
avgLandIceFreshwaterFlux(iCell) = ( avgLandIceFreshwaterFlux(iCell) * nAccumulatedCoupled &
+ landIceFreshwaterFlux(iCell) ) / ( nAccumulatedCoupled + 1)
end do
!$omp end do
!$omp end parallel
!$omp parallel
!$omp do schedule(runtime)
do iCell = 1, nCells
avgLandIceFreshwaterFlux(iCell) = ( avgLandIceFreshwaterFlux(iCell) * nAccumulatedCoupled &
+ landIceFreshwaterFlux(iCell) ) / ( nAccumulatedCoupled + 1)
end do
!$omp end do
!$omp end parallel
end if

! load data melt rates if used
if(trim(config_land_ice_flux_mode) == 'data') then
call mpas_pool_get_array(forcingPool, 'dataLandIceFreshwaterFlux', dataLandIceFreshwaterFlux)

!$omp parallel
!$omp do schedule(runtime)
do iCell = 1, nCells
avgLandIceFreshwaterFlux(iCell) = ( avgLandIceFreshwaterFlux(iCell) * nAccumulatedCoupled &
+ dataLandIceFreshwaterFlux(iCell) ) / ( nAccumulatedCoupled + 1)
end do
!$omp end do
!$omp end parallel
end if
end if

if (config_remove_AIS_coupler_runoff) then
Expand Down

0 comments on commit 947d2fb

Please sign in to comment.