From 8690ea848a57f7dd2a1e61436f2b6cfdc4e0774e Mon Sep 17 00:00:00 2001 From: Carolyn Begeman Date: Wed, 25 Sep 2024 12:04:28 -0500 Subject: [PATCH] Check for association of all fw fluxes in bulk forcing --- .../shared/mpas_ocn_surface_bulk_forcing.F | 30 +++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F b/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F index e21d94cb9ba9..e7b57d1eeaff 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F @@ -953,12 +953,38 @@ subroutine ocn_surface_bulk_forcing_freshwater_tracers(meshPool, forcingPool, tr call mpas_pool_get_array(forcingPool, 'landIceFreshwaterFlux', landIceFreshwaterFlux) nCells = nCellsArray( 3 ) - do iCell=1,nCells + if (associated(indexRain)) then + do iCell=1,nCells freshwaterSurfaceFlux(indexRain, iCell) = rainFlux(iCell) / rho_sw + enddo ! iCell + else + call mpas_log_write('indexRain is not associated') + freshwaterSurfaceFlux(indexRain, :) = 0.0_RKIND + endif + if (associated(indexSnow)) then + do iCell=1,nCells freshwaterSurfaceFlux(indexSnow, iCell) = snowFlux(iCell) / rho_sw + enddo ! iCell + else + call mpas_log_write('indexSnow is not associated') + freshwaterSurfaceFlux(indexSnow, :) = 0.0_RKIND + endif + if (associated(indexIceRunoff)) then + do iCell=1,nCells freshwaterSurfaceFluxRunoff(indexIceRunoff, iCell) = iceRunoffFlux(iCell) / rho_sw + enddo ! iCell + else + call mpas_log_write('indexIceRunoff is not associated') + freshwaterSurfaceFlux(indexIceRunoff, :) = 0.0_RKIND + endif + if (associated(indexRiverRunoff)) then + do iCell=1,nCells freshwaterSurfaceFluxRunoff(indexRiverRunoff, iCell) = riverRunoffFlux(iCell) / rho_sw - enddo ! iCell + enddo ! iCell + else + call mpas_log_write('indexRiverRunoff is not associated') + freshwaterSurfaceFlux(indexRiverRunoff, :) = 0.0_RKIND + endif if (associated(indexSeaIceFreshWater)) then do iCell=1,nCells freshwaterSurfaceFlux(indexSeaIceFreshWater, iCell) = seaIceFreshWaterFlux(iCell) / rho_sw