Skip to content

Commit

Permalink
Bug fix: Uninitialized data in Kd_ePBL
Browse files Browse the repository at this point in the history
- Kd_ePBL has intent(out) from the PBL routine but was being
  initialized by the calling routine and conditionally on whether
  a diagnostic is active:
  - Kd_ePBL is a mandatory output, no-longer conditional on the
    diagnostic;
  - initializing values by the caller is not guaranteed to work when the
    callee has intent(out);
  - ePBL was only setting values for non-land points.
- The conditional initialization has been removed entirely.
- ePBL now sets values on all computational points.
- Addresses issue discussed in #257 where DEBUG=True was detecting
  NaN's in Kd_ePBL.
  • Loading branch information
adcroft committed Mar 17, 2016
1 parent 8f54ce6 commit b4f8cdb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 0 additions & 2 deletions src/parameterizations/vertical/MOM_diabatic_driver.F90
Original file line number Diff line number Diff line change
Expand Up @@ -709,8 +709,6 @@ subroutine diabatic(u, v, h, tv, fluxes, visc, ADp, CDp, dt, G, CS)
call hchksum(G%GV%H_to_m*eb, "after calc_entrain eb",G,haloshift=0)
endif

if (CS%id_Kd_ePBL > -1) Kd_ePBL(:,:,:) = 0.0

! Apply forcing when using the ALE algorithm
if (CS%useALEalgorithm) then
call cpu_clock_begin(id_clock_remap)
Expand Down
5 changes: 5 additions & 0 deletions src/parameterizations/vertical/MOM_energetic_PBL.F90
Original file line number Diff line number Diff line change
Expand Up @@ -889,6 +889,11 @@ subroutine energetic_PBL(h_3d, u_3d, v_3d, tv, fluxes, dt, Kd_int, G, CS, &
enddo
endif
k = nz ! This is here to allow a breakpoint to be set.
else
! For masked points, Kd_int must still be set (to 0) because it has intent(out).
do K=1,nz+1
Kd(i,K) = 0.
enddo
endif ; enddo ; ! Close of i-loop - Note unusual loop order!

if (CS%id_Hsfc_used > 0) then
Expand Down

0 comments on commit b4f8cdb

Please sign in to comment.