Skip to content

Commit

Permalink
Merge pull request #22 from NOAA-GFDL/dev/gfdl
Browse files Browse the repository at this point in the history
Merge in latest MOM6 updates
  • Loading branch information
wrongkindofdoctor authored Jul 3, 2019
2 parents 911d0a2 + c34a767 commit b5e5c48
Show file tree
Hide file tree
Showing 6 changed files with 692 additions and 408 deletions.
50 changes: 39 additions & 11 deletions src/core/MOM_forcing_type.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2239,10 +2239,19 @@ subroutine forcing_diagnostics(fluxes, sfc_state, dt, G, diag, handles)
if (handles%id_net_massout > 0 .or. handles%id_total_net_massout > 0) then
do j=js,je ; do i=is,ie
res(i,j) = 0.0
if (fluxes%lprec(i,j) < 0.0) res(i,j) = res(i,j) + fluxes%lprec(i,j)
if (fluxes%vprec(i,j) < 0.0) res(i,j) = res(i,j) + fluxes%vprec(i,j)
if (fluxes%evap(i,j) < 0.0) res(i,j) = res(i,j) + fluxes%evap(i,j)
if (fluxes%seaice_melt(i,j) < 0.0) res(i,j) = res(i,j) + fluxes%seaice_melt(i,j)
if (associated(fluxes%lprec)) then
if (fluxes%lprec(i,j) < 0.0) res(i,j) = res(i,j) + fluxes%lprec(i,j)
endif
if (associated(fluxes%vprec)) then
if (fluxes%vprec(i,j) < 0.0) res(i,j) = res(i,j) + fluxes%vprec(i,j)
endif
if (associated(fluxes%evap)) then
if (fluxes%evap(i,j) < 0.0) res(i,j) = res(i,j) + fluxes%evap(i,j)
endif
if (associated(fluxes%seaice_melt)) then
if (fluxes%seaice_melt(i,j) < 0.0) &
res(i,j) = res(i,j) + fluxes%seaice_melt(i,j)
endif
enddo ; enddo
if (handles%id_net_massout > 0) call post_data(handles%id_net_massout, res, diag)
if (handles%id_total_net_massout > 0) then
Expand All @@ -2251,16 +2260,34 @@ subroutine forcing_diagnostics(fluxes, sfc_state, dt, G, diag, handles)
endif
endif

if (handles%id_massout_flux > 0) call post_data(handles%id_massout_flux,fluxes%netMassOut,diag)
if (handles%id_massout_flux > 0 .and. associated(fluxes%netMassOut)) &
call post_data(handles%id_massout_flux,fluxes%netMassOut,diag)

if (handles%id_net_massin > 0 .or. handles%id_total_net_massin > 0) then
do j=js,je ; do i=is,ie
res(i,j) = fluxes%fprec(i,j) + fluxes%lrunoff(i,j) + fluxes%frunoff(i,j)
if (fluxes%lprec(i,j) > 0.0) res(i,j) = res(i,j) + fluxes%lprec(i,j)
if (fluxes%vprec(i,j) > 0.0) res(i,j) = res(i,j) + fluxes%vprec(i,j)
res(i,j) = 0.0

if (associated(fluxes%fprec)) &
res(i,j) = res(i,j) + fluxes%fprec(i,j)
if (associated(fluxes%lrunoff)) &
res(i,j) = res(i,j) + fluxes%lrunoff(i,j)
if (associated(fluxes%frunoff)) &
res(i,j) = res(i,j) + fluxes%frunoff(i,j)

if (associated(fluxes%lprec)) then
if (fluxes%lprec(i,j) > 0.0) res(i,j) = res(i,j) + fluxes%lprec(i,j)
endif
if (associated(fluxes%vprec)) then
if (fluxes%vprec(i,j) > 0.0) res(i,j) = res(i,j) + fluxes%vprec(i,j)
endif
! fluxes%cond is not needed because it is derived from %evap > 0
if (fluxes%evap(i,j) > 0.0) res(i,j) = res(i,j) + fluxes%evap(i,j)
if (fluxes%seaice_melt(i,j) > 0.0) res(i,j) = res(i,j) + fluxes%seaice_melt(i,j)
if (associated(fluxes%evap)) then
if (fluxes%evap(i,j) > 0.0) res(i,j) = res(i,j) + fluxes%evap(i,j)
endif
if (associated(fluxes%seaice_melt)) then
if (fluxes%seaice_melt(i,j) > 0.0) &
res(i,j) = res(i,j) + fluxes%seaice_melt(i,j)
endif
enddo ; enddo
if (handles%id_net_massin > 0) call post_data(handles%id_net_massin, res, diag)
if (handles%id_total_net_massin > 0) then
Expand All @@ -2269,7 +2296,8 @@ subroutine forcing_diagnostics(fluxes, sfc_state, dt, G, diag, handles)
endif
endif

if (handles%id_massin_flux > 0) call post_data(handles%id_massin_flux,fluxes%netMassIn,diag)
if (handles%id_massin_flux > 0 .and. associated(fluxes%netMassIn)) &
call post_data(handles%id_massin_flux,fluxes%netMassIn,diag)

if ((handles%id_evap > 0) .and. associated(fluxes%evap)) &
call post_data(handles%id_evap, fluxes%evap, diag)
Expand Down
13 changes: 8 additions & 5 deletions src/diagnostics/MOM_diagnostics.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1439,7 +1439,7 @@ subroutine MOM_diagnostics_init(MIS, ADp, CDp, Time, G, GV, US, param_file, diag
# include "version_variable.h"
character(len=40) :: mdl = "MOM_diagnostics" ! This module's name.
character(len=48) :: thickness_units, flux_units
logical :: use_temperature
logical :: use_temperature, adiabatic
integer :: isd, ied, jsd, jed, IsdB, IedB, JsdB, JedB, nz, nkml, nkbl
integer :: is, ie, js, je, Isq, Ieq, Jsq, Jeq, i, j

Expand All @@ -1457,6 +1457,8 @@ subroutine MOM_diagnostics_init(MIS, ADp, CDp, Time, G, GV, US, param_file, diag

CS%diag => diag
use_temperature = associated(tv%T)
call get_param(param_file, mdl, "ADIABATIC", adiabatic, default=.false., &
do_not_log=.true.)

! Read all relevant parameters and write them to the model log.
call log_version(param_file, mdl, version)
Expand Down Expand Up @@ -1642,10 +1644,11 @@ subroutine MOM_diagnostics_init(MIS, ADp, CDp, Time, G, GV, US, param_file, diag
'Kinetic Energy Source from Horizontal Viscosity', 'm3 s-3')
if (CS%id_KE_horvisc>0) call safe_alloc_ptr(CS%KE_horvisc,isd,ied,jsd,jed,nz)

CS%id_KE_dia = register_diag_field('ocean_model', 'KE_dia', diag%axesTL, Time, &
'Kinetic Energy Source from Diapycnal Diffusion', 'm3 s-3')
if (CS%id_KE_dia>0) call safe_alloc_ptr(CS%KE_dia,isd,ied,jsd,jed,nz)

if (.not. adiabatic) then
CS%id_KE_dia = register_diag_field('ocean_model', 'KE_dia', diag%axesTL, Time, &
'Kinetic Energy Source from Diapycnal Diffusion', 'm3 s-3')
if (CS%id_KE_dia>0) call safe_alloc_ptr(CS%KE_dia,isd,ied,jsd,jed,nz)
endif

! gravity wave CFLs
CS%id_cg1 = register_diag_field('ocean_model', 'cg1', diag%axesT1, Time, &
Expand Down
Loading

0 comments on commit b5e5c48

Please sign in to comment.