Skip to content

Commit

Permalink
Replaced array syntax additions in MOM_ice_shelf
Browse files Browse the repository at this point in the history
  Replaced array syntax arithmetic with explicit loops in shelf_calc_flux, so
that uninitialized values in halo points could not trigger model failures.  All
answers are bitwise identical.
  • Loading branch information
Hallberg-NOAA committed May 11, 2020
1 parent 70cfd64 commit 6ca3184
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/ice_shelf/MOM_ice_shelf.F90
Original file line number Diff line number Diff line change
Expand Up @@ -607,15 +607,16 @@ subroutine shelf_calc_flux(sfc_state, fluxes, Time, time_step, CS, forces)
ISS%tflux_ocn(i,j) = 0.0
endif

! haline_driving(:,:) = sfc_state%sss(i,j) - Sbdry(i,j)
! haline_driving(i,j) = sfc_state%sss(i,j) - Sbdry(i,j)

enddo ! i-loop
enddo ! j-loop

! ISS%water_flux = net liquid water into the ocean [R Z T-1 ~> kg m-2 s-1]
fluxes%iceshelf_melt(:,:) = ISS%water_flux(:,:) * CS%flux_factor

do j=js,je ; do i=is,ie
! ISS%water_flux = net liquid water into the ocean [R Z T-1 ~> kg m-2 s-1]
fluxes%iceshelf_melt(i,j) = ISS%water_flux(i,j) * CS%flux_factor

if ((sfc_state%ocean_mass(i,j) > CS%col_mass_melt_threshold) .and. &
(ISS%area_shelf_h(i,j) > 0.0) .and. (CS%isthermo)) then

Expand Down Expand Up @@ -653,11 +654,10 @@ subroutine shelf_calc_flux(sfc_state, fluxes, Time, time_step, CS, forces)
ISS%water_flux(i,j) = 0.0
fluxes%iceshelf_melt(i,j) = 0.0
endif ! area_shelf_h
enddo ; enddo ! i- and j-loops

! mass flux [R Z L2 T-1 ~> kg s-1], part of ISOMIP diags.
mass_flux(:,:) = 0.0
mass_flux(:,:) = ISS%water_flux(:,:) * ISS%area_shelf_h(:,:)
! mass flux [R Z L2 T-1 ~> kg s-1], part of ISOMIP diags.
mass_flux(i,j) = ISS%water_flux(i,j) * ISS%area_shelf_h(i,j)
enddo ; enddo ! i- and j-loops

if (CS%active_shelf_dynamics .or. CS%override_shelf_movement) then
call cpu_clock_begin(id_clock_pass)
Expand Down Expand Up @@ -690,7 +690,7 @@ subroutine shelf_calc_flux(sfc_state, fluxes, Time, time_step, CS, forces)
! advect the ice shelf, and advance the front. Calving will be in here somewhere as well..
! when we decide on how to do it
call update_ice_shelf(CS%dCS, ISS, G, US, US%s_to_T*time_step, Time, &
sfc_state%ocean_mass(:,:), coupled_GL)
sfc_state%ocean_mass, coupled_GL)

endif

Expand Down Expand Up @@ -1735,7 +1735,9 @@ subroutine update_shelf_mass(G, US, CS, ISS, Time)

call time_interp_external(CS%id_read_mass, Time, ISS%mass_shelf)
! This should only be done if time_interp_external did an update.
ISS%mass_shelf(:,:) = US%kg_m3_to_R*US%m_to_Z * ISS%mass_shelf(:,:) ! Rescale after time_interp
do j=js,je ; do i=is,ie
ISS%mass_shelf(i,j) = US%kg_m3_to_R*US%m_to_Z * ISS%mass_shelf(i,j) ! Rescale after time_interp
enddo ; enddo

do j=js,je ; do i=is,ie
ISS%area_shelf_h(i,j) = 0.0
Expand Down

0 comments on commit 6ca3184

Please sign in to comment.