Skip to content

Commit 119ac80

Browse files
committed
Check for association of all fw fluxes in bulk forcing
1 parent 20983da commit 119ac80

File tree

1 file changed

+28
-7
lines changed

1 file changed

+28
-7
lines changed

components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F

+28-7
Original file line numberDiff line numberDiff line change
@@ -967,36 +967,57 @@ subroutine ocn_surface_bulk_forcing_freshwater_tracers(meshPool, forcingPool, tr
967967
call mpas_pool_get_array(forcingPool, 'landIceFreshwaterFlux', landIceFreshwaterFlux)
968968

969969
nCells = nCellsArray( 3 )
970-
do iCell=1,nCells
970+
if (associated(indexRain) .and. associated(rainFlux)) then
971+
do iCell=1,nCells
971972
freshwaterSurfaceFlux(indexRain, iCell) = rainFlux(iCell) / rho_sw
973+
enddo ! iCell
974+
else
975+
call mpas_log_write('indexRain is not associated')
976+
endif
977+
if (associated(indexSnow) .and. associated(snowFlux)) then
978+
do iCell=1,nCells
972979
freshwaterSurfaceFlux(indexSnow, iCell) = snowFlux(iCell) / rho_sw
980+
enddo ! iCell
981+
else
982+
call mpas_log_write('indexSnow is not associated')
983+
endif
984+
if (associated(indexIceRunoff) .and. associated(iceRunoffFlux)) then
985+
do iCell=1,nCells
973986
freshwaterSurfaceFluxRunoff(indexIceRunoff, iCell) = iceRunoffFlux(iCell) / rho_sw
987+
enddo ! iCell
988+
else
989+
call mpas_log_write('indexIceRunoff is not associated')
990+
endif
991+
if (associated(indexRiverRunoff) .and. associated(riverRunoffFlux)) then
992+
do iCell=1,nCells
974993
freshwaterSurfaceFluxRunoff(indexRiverRunoff, iCell) = riverRunoffFlux(iCell) / rho_sw
975-
enddo ! iCell
976-
if (associated(indexSeaIceFreshWater)) then
994+
enddo ! iCell
995+
else
996+
if (.not. associated(indexRiverRunoff)) call mpas_log_write('indexRiverRunoff is not associated')
997+
if (.not. associated(riverRunoffFlux)) call mpas_log_write('riverRunoffFlux is not associated')
998+
endif
999+
if (associated(indexSeaIceFreshWater) .and. associated(seaIceFreshWaterFlux)) then
9771000
do iCell=1,nCells
9781001
freshwaterSurfaceFlux(indexSeaIceFreshWater, iCell) = seaIceFreshWaterFlux(iCell) / rho_sw
9791002
enddo ! iCell
9801003
else
9811004
call mpas_log_write('indexSeaIceFreshWater is not associated')
982-
freshwaterSurfaceFlux(indexSeaIceFreshWater, :) = 0.0_RKIND
9831005
endif
984-
if (associated(indexIcebergFreshWater)) then
1006+
if (associated(indexIcebergFreshWater) .and. associated(icebergFreshWaterFlux)) then
9851007
do iCell=1,nCells
9861008
freshwaterSurfaceFlux(indexIcebergFreshWater, iCell) = icebergFreshWaterFlux(iCell) / rho_sw
9871009
enddo ! iCell
9881010
else
9891011
call mpas_log_write('indexIcebergFreshWater is not associated')
990-
freshwaterSurfaceFlux(indexIcebergFreshWater, :) = 0.0_RKIND
9911012
endif
9921013
if (associated(indexLandIceFreshwater) .and. associated(landIceFreshwaterFlux)) then
9931014
do iCell=1,nCells
9941015
freshwaterSurfaceFlux(indexLandIceFreshwater, iCell) = landIceFreshwaterFlux(iCell) / rho_sw
9951016
enddo ! iCell
9961017
else
9971018
call mpas_log_write('indexLandIceFreshwater or landIceFreshwaterFlux is not associated')
998-
freshwaterSurfaceFlux(indexLandIceFreshwater, :) = 0.0_RKIND
9991019
endif
1020+
call mpas_log_write('end fw assign sflux')
10001021

10011022
end subroutine ocn_surface_bulk_forcing_freshwater_tracers!}}}
10021023

0 commit comments

Comments
 (0)