diff --git a/src/core/MOM_forcing_type.F90 b/src/core/MOM_forcing_type.F90 index 0b8013b6a2..3b6b9df2d7 100644 --- a/src/core/MOM_forcing_type.F90 +++ b/src/core/MOM_forcing_type.F90 @@ -715,18 +715,19 @@ subroutine calculateBuoyancyFlux1d(G, fluxes, optics, h, Temp, Salt, tv, j, & dRhodT, dRhodS, start, npts, tv%eqn_of_state) ! Adjust netSalt to reflect dilution effect of FW flux - netSalt(:) = netSalt(:) - Salt(:,j,1) * netH * G%H_to_m + netSalt(G%isc:G%iec) = netSalt(G%isc:G%iec) - Salt(G%isc:G%iec,j,1) * netH(G%isc:G%iec) * G%H_to_m - ! Add in the SW heating for purposes of calculating the net - ! surface buoyancy flux affecting the top layer. + ! Add in the SW heating for purposes of calculating the net + ! surface buoyancy flux affecting the top layer. !netHeat(:) = netHeatMinusSW(:) + sum( penSWbnd(:,:), dim=1 ) - netHeat(:) = netHeatMinusSW(:) + netPen(:,1) + netHeat(G%isc:G%iec) = netHeatMinusSW(G%isc:G%iec) + netPen(G%isc:G%iec,1) ! Convert to a buoyancy flux, excluding penetrating SW heating - buoyancyFlux(:,1) = - GoRho * ( dRhodS(:) * netSalt(:) + dRhodT(:) * netHeat(:) ) ! m^2/s^3 + buoyancyFlux(G%isc:G%iec,1) = - GoRho * ( dRhodS(G%isc:G%iec) * netSalt(G%isc:G%iec) + & + dRhodT(G%isc:G%iec) * netHeat(G%isc:G%iec) ) ! m^2/s^3 ! We also have a penetrative buoyancy flux associated with penetrative SW do k=2, G%ke+1 - buoyancyFlux(:,k) = - GoRho * ( dRhodT(:) * netPen(:,k) ) ! m^2/s^3 + buoyancyFlux(G%isc:G%iec,k) = - GoRho * ( dRhodT(G%isc:G%iec) * netPen(G%isc:G%iec,k) ) ! m^2/s^3 enddo end subroutine calculateBuoyancyFlux1d diff --git a/src/parameterizations/vertical/MOM_set_diffusivity.F90 b/src/parameterizations/vertical/MOM_set_diffusivity.F90 index 7b9b0e0c7e..2069772d2f 100644 --- a/src/parameterizations/vertical/MOM_set_diffusivity.F90 +++ b/src/parameterizations/vertical/MOM_set_diffusivity.F90 @@ -1658,7 +1658,11 @@ subroutine add_LOTW_BBL_diffusivity(h, u, v, tv, fluxes, visc, j, N2_int, G, CS, ! Diffusivity using law of the wall, limited by rotation, at height z, in m2/s. ! This calculation is at the upper interface of the layer - Kd_wall = ( ( von_karm * ustar2 ) * ( z * D_minus_z ) )/( ustar_D + absf * ( z * D_minus_z ) ) + if ( ustar_D + absf * ( z * D_minus_z ) == 0.) then + Kd_wall = 0. + else + Kd_wall = ( ( von_karm * ustar2 ) * ( z * D_minus_z ) )/( ustar_D + absf * ( z * D_minus_z ) ) + endif ! TKE associated with Kd_wall, in m3 s-2. ! This calculation if for the volume spanning the interface.