Skip to content

Commit

Permalink
Merge pull request NOAA-EMC#57 from NOAA-GFDL/dev/gfdl
Browse files Browse the repository at this point in the history
merge in dev/gfdl updates
  • Loading branch information
wrongkindofdoctor authored May 7, 2020
2 parents 496617c + 2b6d7c6 commit ff1a27f
Show file tree
Hide file tree
Showing 49 changed files with 658 additions and 555 deletions.
14 changes: 9 additions & 5 deletions .testing/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
SHELL = bash
.SUFFIXES:

# User-defined configuration
-include config.mk
Expand Down Expand Up @@ -30,9 +31,9 @@ MKMF_CPP = "-Duse_libMPI -Duse_netCDF -DSPMD"

# Environment
# TODO: This info ought to be determined by CMake, automake, etc.
#MKMF_TEMPLATE ?= .testing/linux-ubuntu-xenial-gnu.mk
MKMF_TEMPLATE ?= build/mkmf/templates/ncrc-gnu.mk
#MKMF_TEMPLATE ?= build/mkmf/templates/ncrc-intel.mk
#MKMF_TEMPLATE ?= linux-ubuntu-xenial-gnu.mk
MKMF_TEMPLATE ?= deps/mkmf/templates/ncrc-gnu.mk
#MKMF_TEMPLATE ?= deps/mkmf/templates/ncrc-intel.mk

#---
# Test configuration
Expand All @@ -41,6 +42,7 @@ MKMF_TEMPLATE ?= build/mkmf/templates/ncrc-gnu.mk
BUILDS = symmetric asymmetric repro openmp
CONFIGS := $(wildcard tc*)
TESTS = grids layouts restarts nans dims openmps rotations
DIMS = t l h z q r

# REPRO tests enable reproducibility with optimization, and often do not match
# the DEBUG results in older GCCs and vendor compilers, so we can optionally
Expand Down Expand Up @@ -199,7 +201,7 @@ test.restarts: $(foreach c,$(CONFIGS),$(c).restart)
test.repros: $(foreach c,$(CONFIGS),$(c).repro $(c).repro.diag)
test.openmps: $(foreach c,$(CONFIGS),$(c).openmp $(c).openmp.diag)
test.nans: $(foreach c,$(CONFIGS),$(c).nan $(c).nan.diag)
test.dims: $(foreach c,$(CONFIGS),$(foreach d,t l h z,$(c).dim.$(d) $(c).dim.$(d).diag))
test.dims: $(foreach c,$(CONFIGS),$(foreach d,$(DIMS),$(c).dim.$(d) $(c).dim.$(d).diag))

test.regressions: $(foreach c,$(CONFIGS),$(c).regression $(c).regression.diag)
! ls -1 results/*/*.reg
Expand All @@ -220,7 +222,7 @@ $(eval $(call CMP_RULE,rotate,symmetric rotate))
$(eval $(call CMP_RULE,repro,symmetric repro))
$(eval $(call CMP_RULE,openmp,symmetric openmp))
$(eval $(call CMP_RULE,nan,symmetric nan))
$(foreach d,t l h z,$(eval $(call CMP_RULE,dim.$(d),symmetric dim.$(d))))
$(foreach d,$(DIMS),$(eval $(call CMP_RULE,dim.$(d),symmetric dim.$(d))))

# Custom comparison rules

Expand Down Expand Up @@ -295,6 +297,8 @@ $(eval $(call STAT_RULE,dim.t,symmetric,,T_RESCALE_POWER=11,,1))
$(eval $(call STAT_RULE,dim.l,symmetric,,L_RESCALE_POWER=11,,1))
$(eval $(call STAT_RULE,dim.h,symmetric,,H_RESCALE_POWER=11,,1))
$(eval $(call STAT_RULE,dim.z,symmetric,,Z_RESCALE_POWER=11,,1))
$(eval $(call STAT_RULE,dim.q,symmetric,,Q_RESCALE_POWER=11,,1))
$(eval $(call STAT_RULE,dim.r,symmetric,,R_RESCALE_POWER=11,,1))

# Restart tests require significant preprocessing, and are handled separately.
results/%/ocean.stats.restart: build/symmetric/MOM6
Expand Down
22 changes: 11 additions & 11 deletions config_src/coupled_driver/ocean_model_MOM.F90
Original file line number Diff line number Diff line change
Expand Up @@ -862,40 +862,40 @@ subroutine convert_state_to_ocean_type(sfc_state, Ocean_sfc, G, US, patm, press_

if (present(patm)) then
do j=jsc_bnd,jec_bnd ; do i=isc_bnd,iec_bnd
Ocean_sfc%sea_lev(i,j) = sfc_state%sea_lev(i+i0,j+j0) + patm(i,j) * press_to_z
Ocean_sfc%area(i,j) = US%L_to_m**2*G%areaT(i+i0,j+j0)
Ocean_sfc%sea_lev(i,j) = US%Z_to_m * sfc_state%sea_lev(i+i0,j+j0) + patm(i,j) * press_to_z
Ocean_sfc%area(i,j) = US%L_to_m**2 * G%areaT(i+i0,j+j0)
enddo ; enddo
else
do j=jsc_bnd,jec_bnd ; do i=isc_bnd,iec_bnd
Ocean_sfc%sea_lev(i,j) = sfc_state%sea_lev(i+i0,j+j0)
Ocean_sfc%area(i,j) = US%L_to_m**2*G%areaT(i+i0,j+j0)
Ocean_sfc%sea_lev(i,j) = US%Z_to_m * sfc_state%sea_lev(i+i0,j+j0)
Ocean_sfc%area(i,j) = US%L_to_m**2 * G%areaT(i+i0,j+j0)
enddo ; enddo
endif

if (allocated(sfc_state%frazil)) then
do j=jsc_bnd,jec_bnd ; do i=isc_bnd,iec_bnd
Ocean_sfc%frazil(i,j) = sfc_state%frazil(i+i0,j+j0)
Ocean_sfc%frazil(i,j) = US%Q_to_J_kg*US%RZ_to_kg_m2 * sfc_state%frazil(i+i0,j+j0)
enddo ; enddo
endif

if (Ocean_sfc%stagger == AGRID) then
do j=jsc_bnd,jec_bnd ; do i=isc_bnd,iec_bnd
Ocean_sfc%u_surf(i,j) = G%mask2dT(i+i0,j+j0) * &
Ocean_sfc%u_surf(i,j) = G%mask2dT(i+i0,j+j0) * US%L_T_to_m_s * &
0.5*(sfc_state%u(I+i0,j+j0)+sfc_state%u(I-1+i0,j+j0))
Ocean_sfc%v_surf(i,j) = G%mask2dT(i+i0,j+j0) * &
Ocean_sfc%v_surf(i,j) = G%mask2dT(i+i0,j+j0) * US%L_T_to_m_s * &
0.5*(sfc_state%v(i+i0,J+j0)+sfc_state%v(i+i0,J-1+j0))
enddo ; enddo
elseif (Ocean_sfc%stagger == BGRID_NE) then
do j=jsc_bnd,jec_bnd ; do i=isc_bnd,iec_bnd
Ocean_sfc%u_surf(i,j) = G%mask2dBu(I+i0,J+j0) * &
Ocean_sfc%u_surf(i,j) = G%mask2dBu(I+i0,J+j0) * US%L_T_to_m_s * &
0.5*(sfc_state%u(I+i0,j+j0)+sfc_state%u(I+i0,j+j0+1))
Ocean_sfc%v_surf(i,j) = G%mask2dBu(I+i0,J+j0) * &
Ocean_sfc%v_surf(i,j) = G%mask2dBu(I+i0,J+j0) * US%L_T_to_m_s * &
0.5*(sfc_state%v(i+i0,J+j0)+sfc_state%v(i+i0+1,J+j0))
enddo ; enddo
elseif (Ocean_sfc%stagger == CGRID_NE) then
do j=jsc_bnd,jec_bnd ; do i=isc_bnd,iec_bnd
Ocean_sfc%u_surf(i,j) = G%mask2dCu(I+i0,j+j0)*sfc_state%u(I+i0,j+j0)
Ocean_sfc%v_surf(i,j) = G%mask2dCv(i+i0,J+j0)*sfc_state%v(i+i0,J+j0)
Ocean_sfc%u_surf(i,j) = G%mask2dCu(I+i0,j+j0)*US%L_T_to_m_s * sfc_state%u(I+i0,j+j0)
Ocean_sfc%v_surf(i,j) = G%mask2dCv(i+i0,J+j0)*US%L_T_to_m_s * sfc_state%v(i+i0,J+j0)
enddo ; enddo
else
write(val_str, '(I8)') Ocean_sfc%stagger
Expand Down
8 changes: 4 additions & 4 deletions config_src/ice_solo_driver/MOM_surface_forcing.F90
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ module MOM_surface_forcing

real, pointer :: T_Restore(:,:) => NULL() !< temperature to damp (restore) the SST to [degC]
real, pointer :: S_Restore(:,:) => NULL() !< salinity to damp (restore) the SSS [ppt]
real, pointer :: Dens_Restore(:,:) => NULL() !< density to damp (restore) surface density [kg m-3]
real, pointer :: Dens_Restore(:,:) => NULL() !< density to damp (restore) surface density [R ~> kg m-3]

integer :: wind_last_lev_read = -1 !< The last time level read from the wind input files
integer :: buoy_last_lev_read = -1 !< The last time level read from buoyancy input files
Expand Down Expand Up @@ -774,7 +774,7 @@ subroutine buoyancy_forcing_from_files(sfc_state, fluxes, day, dt, G, US, CS)
do j=js,je ; do i=is,ie
if (G%mask2dT(i,j) > 0) then
fluxes%buoy(i,j) = (CS%Dens_Restore(i,j) - sfc_state%sfc_density(i,j)) * &
(CS%G_Earth * CS%Flux_const/(US%R_to_kg_m3*CS%Rho0))
(CS%G_Earth * CS%Flux_const / CS%Rho0)
else
fluxes%buoy(i,j) = 0.0
endif
Expand Down Expand Up @@ -909,8 +909,8 @@ subroutine buoyancy_forcing_linear(sfc_state, fluxes, day, dt, G, US, CS)
"RESTOREBUOY to linear not written yet.")
!do j=js,je ; do i=is,ie
! if (G%mask2dT(i,j) > 0) then
! fluxes%buoy(i,j) = US%kg_m3_to_R*(CS%Dens_Restore(i,j) - sfc_state%sfc_density(i,j)) * &
! (CS%G_Earth * CS%Flux_const / CS%Rho0)
! fluxes%buoy(i,j) = (CS%Dens_Restore(i,j) - sfc_state%sfc_density(i,j)) * &
! (CS%G_Earth * CS%Flux_const / CS%Rho0)
! else
! fluxes%buoy(i,j) = 0.0
! endif
Expand Down
9 changes: 4 additions & 5 deletions config_src/ice_solo_driver/user_surface_forcing.F90
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,7 @@ subroutine USER_buoyancy_forcing(sfc_state, fluxes, day, dt, G, US, CS)

real :: Temp_restore ! The temperature that is being restored toward [C].
real :: Salin_restore ! The salinity that is being restored toward [ppt]
real :: density_restore ! The potential density that is being restored
! toward [kg m-3].
real :: density_restore ! The potential density that is being restored toward [R ~> kg m-3].
real :: rhoXcp ! The mean density times the heat capacity [Q R degC-1 ~> J m-3 degC-1].
real :: buoy_rest_const ! A constant relating density anomalies to the
! restoring buoyancy flux [L2 T-3 R-1 ~> m5 s-3 kg-1].
Expand Down Expand Up @@ -271,11 +270,11 @@ subroutine USER_buoyancy_forcing(sfc_state, fluxes, day, dt, G, US, CS)
buoy_rest_const = -1.0 * (CS%G_Earth * CS%Flux_const) / CS%Rho0
do j=js,je ; do i=is,ie
! Set density_restore to an expression for the surface potential
! density [kg m-3] that is being restored toward.
density_restore = 1030.0
! density [R ~> kg m-3] that is being restored toward.
density_restore = 1030.0*US%kg_m3_to_R

fluxes%buoy(i,j) = G%mask2dT(i,j) * buoy_rest_const * &
US%kg_m3_to_R*(density_restore - sfc_state%sfc_density(i,j))
(density_restore - sfc_state%sfc_density(i,j))
enddo ; enddo
endif
endif ! end RESTOREBUOY
Expand Down
26 changes: 13 additions & 13 deletions config_src/mct_driver/mom_ocean_model_mct.F90
Original file line number Diff line number Diff line change
Expand Up @@ -894,52 +894,52 @@ subroutine convert_state_to_ocean_type(sfc_state, Ocean_sfc, G, US, patm, press_

if (present(patm)) then
do j=jsc_bnd,jec_bnd ; do i=isc_bnd,iec_bnd
Ocean_sfc%sea_lev(i,j) = sfc_state%sea_lev(i+i0,j+j0) + patm(i,j) * press_to_z
Ocean_sfc%area(i,j) = US%L_to_m**2*G%areaT(i+i0,j+j0)
Ocean_sfc%sea_lev(i,j) = US%Z_to_m * sfc_state%sea_lev(i+i0,j+j0) + patm(i,j) * press_to_z
Ocean_sfc%area(i,j) = US%L_to_m**2 * G%areaT(i+i0,j+j0)
enddo ; enddo
else
do j=jsc_bnd,jec_bnd ; do i=isc_bnd,iec_bnd
Ocean_sfc%sea_lev(i,j) = sfc_state%sea_lev(i+i0,j+j0)
Ocean_sfc%area(i,j) = US%L_to_m**2*G%areaT(i+i0,j+j0)
Ocean_sfc%sea_lev(i,j) = US%Z_to_m * sfc_state%sea_lev(i+i0,j+j0)
Ocean_sfc%area(i,j) = US%L_to_m**2 * G%areaT(i+i0,j+j0)
enddo ; enddo
endif

if (allocated(sfc_state%frazil)) then
do j=jsc_bnd,jec_bnd ; do i=isc_bnd,iec_bnd
Ocean_sfc%frazil(i,j) = sfc_state%frazil(i+i0,j+j0)
Ocean_sfc%frazil(i,j) = US%Q_to_J_kg*US%RZ_to_kg_m2 * sfc_state%frazil(i+i0,j+j0)
enddo ; enddo
endif

if (allocated(sfc_state%melt_potential)) then
do j=jsc_bnd,jec_bnd ; do i=isc_bnd,iec_bnd
Ocean_sfc%melt_potential(i,j) = sfc_state%melt_potential(i+i0,j+j0)
Ocean_sfc%melt_potential(i,j) = US%Q_to_J_kg*US%RZ_to_kg_m2 * sfc_state%melt_potential(i+i0,j+j0)
enddo ; enddo
endif

if (allocated(sfc_state%Hml)) then
do j=jsc_bnd,jec_bnd ; do i=isc_bnd,iec_bnd
Ocean_sfc%OBLD(i,j) = sfc_state%Hml(i+i0,j+j0)
Ocean_sfc%OBLD(i,j) = US%Z_to_m * sfc_state%Hml(i+i0,j+j0)
enddo ; enddo
endif

if (Ocean_sfc%stagger == AGRID) then
do j=jsc_bnd,jec_bnd ; do i=isc_bnd,iec_bnd
Ocean_sfc%u_surf(i,j) = G%mask2dT(i+i0,j+j0) * &
Ocean_sfc%u_surf(i,j) = G%mask2dT(i+i0,j+j0) * US%L_T_to_m_s * &
0.5*(sfc_state%u(I+i0,j+j0)+sfc_state%u(I-1+i0,j+j0))
Ocean_sfc%v_surf(i,j) = G%mask2dT(i+i0,j+j0) * &
Ocean_sfc%v_surf(i,j) = G%mask2dT(i+i0,j+j0) * US%L_T_to_m_s * &
0.5*(sfc_state%v(i+i0,J+j0)+sfc_state%v(i+i0,J-1+j0))
enddo ; enddo
elseif (Ocean_sfc%stagger == BGRID_NE) then
do j=jsc_bnd,jec_bnd ; do i=isc_bnd,iec_bnd
Ocean_sfc%u_surf(i,j) = G%mask2dBu(I+i0,J+j0) * &
Ocean_sfc%u_surf(i,j) = G%mask2dBu(I+i0,J+j0) * US%L_T_to_m_s * &
0.5*(sfc_state%u(I+i0,j+j0)+sfc_state%u(I+i0,j+j0+1))
Ocean_sfc%v_surf(i,j) = G%mask2dBu(I+i0,J+j0) * &
Ocean_sfc%v_surf(i,j) = G%mask2dBu(I+i0,J+j0) * US%L_T_to_m_s * &
0.5*(sfc_state%v(i+i0,J+j0)+sfc_state%v(i+i0+1,J+j0))
enddo ; enddo
elseif (Ocean_sfc%stagger == CGRID_NE) then
do j=jsc_bnd,jec_bnd ; do i=isc_bnd,iec_bnd
Ocean_sfc%u_surf(i,j) = G%mask2dCu(I+i0,j+j0)*sfc_state%u(I+i0,j+j0)
Ocean_sfc%v_surf(i,j) = G%mask2dCv(i+i0,J+j0)*sfc_state%v(i+i0,J+j0)
Ocean_sfc%u_surf(i,j) = G%mask2dCu(I+i0,j+j0) * US%L_T_to_m_s * sfc_state%u(I+i0,j+j0)
Ocean_sfc%v_surf(i,j) = G%mask2dCv(i+i0,J+j0) * US%L_T_to_m_s * sfc_state%v(i+i0,J+j0)
enddo ; enddo
else
write(val_str, '(I8)') Ocean_sfc%stagger
Expand Down
26 changes: 13 additions & 13 deletions config_src/nuopc_driver/mom_ocean_model_nuopc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -889,52 +889,52 @@ subroutine convert_state_to_ocean_type(sfc_state, Ocean_sfc, G, US, patm, press_

if (present(patm)) then
do j=jsc_bnd,jec_bnd ; do i=isc_bnd,iec_bnd
Ocean_sfc%sea_lev(i,j) = sfc_state%sea_lev(i+i0,j+j0) + patm(i,j) * press_to_z
Ocean_sfc%area(i,j) = US%L_to_m**2*G%areaT(i+i0,j+j0)
Ocean_sfc%sea_lev(i,j) = US%Z_to_m * sfc_state%sea_lev(i+i0,j+j0) + patm(i,j) * press_to_z
Ocean_sfc%area(i,j) = US%L_to_m**2 * G%areaT(i+i0,j+j0)
enddo ; enddo
else
do j=jsc_bnd,jec_bnd ; do i=isc_bnd,iec_bnd
Ocean_sfc%sea_lev(i,j) = sfc_state%sea_lev(i+i0,j+j0)
Ocean_sfc%area(i,j) = US%L_to_m**2*G%areaT(i+i0,j+j0)
Ocean_sfc%sea_lev(i,j) = US%Z_to_m * sfc_state%sea_lev(i+i0,j+j0)
Ocean_sfc%area(i,j) = US%L_to_m**2 * G%areaT(i+i0,j+j0)
enddo ; enddo
endif

if (allocated(sfc_state%frazil)) then
do j=jsc_bnd,jec_bnd ; do i=isc_bnd,iec_bnd
Ocean_sfc%frazil(i,j) = sfc_state%frazil(i+i0,j+j0)
Ocean_sfc%frazil(i,j) = US%Q_to_J_kg*US%RZ_to_kg_m2 * sfc_state%frazil(i+i0,j+j0)
enddo ; enddo
endif

if (allocated(sfc_state%melt_potential)) then
do j=jsc_bnd,jec_bnd ; do i=isc_bnd,iec_bnd
Ocean_sfc%melt_potential(i,j) = sfc_state%melt_potential(i+i0,j+j0)
Ocean_sfc%melt_potential(i,j) = US%Q_to_J_kg*US%RZ_to_kg_m2 * sfc_state%melt_potential(i+i0,j+j0)
enddo ; enddo
endif

if (allocated(sfc_state%Hml)) then
do j=jsc_bnd,jec_bnd ; do i=isc_bnd,iec_bnd
Ocean_sfc%OBLD(i,j) = sfc_state%Hml(i+i0,j+j0)
Ocean_sfc%OBLD(i,j) = US%Z_to_m * sfc_state%Hml(i+i0,j+j0)
enddo ; enddo
endif

if (Ocean_sfc%stagger == AGRID) then
do j=jsc_bnd,jec_bnd ; do i=isc_bnd,iec_bnd
Ocean_sfc%u_surf(i,j) = G%mask2dT(i+i0,j+j0) * &
Ocean_sfc%u_surf(i,j) = G%mask2dT(i+i0,j+j0) * US%L_T_to_m_s * &
0.5*(sfc_state%u(I+i0,j+j0)+sfc_state%u(I-1+i0,j+j0))
Ocean_sfc%v_surf(i,j) = G%mask2dT(i+i0,j+j0) * &
Ocean_sfc%v_surf(i,j) = G%mask2dT(i+i0,j+j0) * US%L_T_to_m_s * &
0.5*(sfc_state%v(i+i0,J+j0)+sfc_state%v(i+i0,J-1+j0))
enddo ; enddo
elseif (Ocean_sfc%stagger == BGRID_NE) then
do j=jsc_bnd,jec_bnd ; do i=isc_bnd,iec_bnd
Ocean_sfc%u_surf(i,j) = G%mask2dBu(I+i0,J+j0) * &
Ocean_sfc%u_surf(i,j) = G%mask2dBu(I+i0,J+j0) * US%L_T_to_m_s * &
0.5*(sfc_state%u(I+i0,j+j0)+sfc_state%u(I+i0,j+j0+1))
Ocean_sfc%v_surf(i,j) = G%mask2dBu(I+i0,J+j0) * &
Ocean_sfc%v_surf(i,j) = G%mask2dBu(I+i0,J+j0) * US%L_T_to_m_s * &
0.5*(sfc_state%v(i+i0,J+j0)+sfc_state%v(i+i0+1,J+j0))
enddo ; enddo
elseif (Ocean_sfc%stagger == CGRID_NE) then
do j=jsc_bnd,jec_bnd ; do i=isc_bnd,iec_bnd
Ocean_sfc%u_surf(i,j) = G%mask2dCu(I+i0,j+j0)*sfc_state%u(I+i0,j+j0)
Ocean_sfc%v_surf(i,j) = G%mask2dCv(i+i0,J+j0)*sfc_state%v(i+i0,J+j0)
Ocean_sfc%u_surf(i,j) = G%mask2dCu(I+i0,j+j0) * US%L_T_to_m_s * sfc_state%u(I+i0,j+j0)
Ocean_sfc%v_surf(i,j) = G%mask2dCv(i+i0,J+j0) * US%L_T_to_m_s * sfc_state%v(i+i0,J+j0)
enddo ; enddo
else
write(val_str, '(I8)') Ocean_sfc%stagger
Expand Down
9 changes: 4 additions & 5 deletions config_src/solo_driver/MESO_surface_forcing.F90
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,7 @@ subroutine MESO_buoyancy_forcing(sfc_state, fluxes, day, dt, G, US, CS)

real :: Temp_restore ! The temperature that is being restored toward [degC].
real :: Salin_restore ! The salinity that is being restored toward [ppt]
real :: density_restore ! The potential density that is being restored
! toward [kg m-3].
real :: density_restore ! The potential density that is being restored toward [R ~> kg m-3].
real :: rhoXcp ! The mean density times the heat capacity [Q R degC-1 ~> J m-3 degC-1].
real :: buoy_rest_const ! A constant relating density anomalies to the
! restoring buoyancy flux [L2 T-3 R-1 ~> m5 s-3 kg-1].
Expand Down Expand Up @@ -194,11 +193,11 @@ subroutine MESO_buoyancy_forcing(sfc_state, fluxes, day, dt, G, US, CS)
buoy_rest_const = -1.0 * (CS%G_Earth * CS%Flux_const) / CS%Rho0
do j=js,je ; do i=is,ie
! Set density_restore to an expression for the surface potential
! density [kg m-3] that is being restored toward.
density_restore = 1030.0
! density [R ~> kg m-3] that is being restored toward.
density_restore = 1030.0 * US%kg_m3_to_R

fluxes%buoy(i,j) = G%mask2dT(i,j) * buoy_rest_const * &
US%kg_m3_to_R * (density_restore - sfc_state%sfc_density(i,j))
(density_restore - sfc_state%sfc_density(i,j))
enddo ; enddo
endif
endif ! end RESTOREBUOY
Expand Down
8 changes: 4 additions & 4 deletions config_src/solo_driver/MOM_surface_forcing.F90
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ module MOM_surface_forcing

real, pointer :: T_Restore(:,:) => NULL() !< temperature to damp (restore) the SST to [degC]
real, pointer :: S_Restore(:,:) => NULL() !< salinity to damp (restore) the SSS [ppt]
real, pointer :: Dens_Restore(:,:) => NULL() !< density to damp (restore) surface density [kg m-3]
real, pointer :: Dens_Restore(:,:) => NULL() !< density to damp (restore) surface density [R ~> kg m-3]

integer :: buoy_last_lev_read = -1 !< The last time level read from buoyancy input files

Expand Down Expand Up @@ -1000,7 +1000,7 @@ subroutine buoyancy_forcing_from_files(sfc_state, fluxes, day, dt, G, US, CS)
else
do j=js,je ; do i=is,ie
if (G%mask2dT(i,j) > 0) then
fluxes%buoy(i,j) = US%kg_m3_to_R * (CS%Dens_Restore(i,j) - sfc_state%sfc_density(i,j)) * &
fluxes%buoy(i,j) = (CS%Dens_Restore(i,j) - sfc_state%sfc_density(i,j)) * &
(CS%G_Earth * CS%Flux_const / CS%Rho0)
else
fluxes%buoy(i,j) = 0.0
Expand Down Expand Up @@ -1161,7 +1161,7 @@ subroutine buoyancy_forcing_from_data_override(sfc_state, fluxes, day, dt, G, US
else
do j=js,je ; do i=is,ie
if (G%mask2dT(i,j) > 0) then
fluxes%buoy(i,j) = US%kg_m3_to_R * (CS%Dens_Restore(i,j) - sfc_state%sfc_density(i,j)) * &
fluxes%buoy(i,j) = (CS%Dens_Restore(i,j) - sfc_state%sfc_density(i,j)) * &
(CS%G_Earth * CS%Flux_const / CS%Rho0)
else
fluxes%buoy(i,j) = 0.0
Expand Down Expand Up @@ -1362,7 +1362,7 @@ subroutine buoyancy_forcing_linear(sfc_state, fluxes, day, dt, G, US, CS)
"RESTOREBUOY to linear not written yet.")
!do j=js,je ; do i=is,ie
! if (G%mask2dT(i,j) > 0) then
! fluxes%buoy(i,j) = US%kg_m3_to_R * (CS%Dens_Restore(i,j) - sfc_state%sfc_density(i,j)) * &
! fluxes%buoy(i,j) = (CS%Dens_Restore(i,j) - sfc_state%sfc_density(i,j)) * &
! (CS%G_Earth * CS%Flux_const / CS%Rho0)
! else
! fluxes%buoy(i,j) = 0.0
Expand Down
8 changes: 4 additions & 4 deletions config_src/solo_driver/Neverland_surface_forcing.F90
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ subroutine Neverland_buoyancy_forcing(sfc_state, fluxes, day, dt, G, US, CS)
! Local variables
real :: buoy_rest_const ! A constant relating density anomalies to the
! restoring buoyancy flux [L2 T-3 R-1 ~> m5 s-3 kg-1].
real :: density_restore ! De
real :: density_restore ! Density being restored toward [R ~> kg m-3]
integer :: i, j, is, ie, js, je
integer :: isd, ied, jsd, jed

Expand Down Expand Up @@ -199,11 +199,11 @@ subroutine Neverland_buoyancy_forcing(sfc_state, fluxes, day, dt, G, US, CS)
buoy_rest_const = -1.0 * (CS%G_Earth * CS%Flux_const) / CS%Rho0
do j=js,je ; do i=is,ie
! Set density_restore to an expression for the surface potential
! density [kg m-3] that is being restored toward.
density_restore = 1030.0
! density [R ~> kg m-3] that is being restored toward.
density_restore = 1030.0*US%kg_m3_to_R

fluxes%buoy(i,j) = G%mask2dT(i,j) * buoy_rest_const * &
US%kg_m3_to_R*(density_restore - sfc_state%sfc_density(i,j))
(density_restore - sfc_state%sfc_density(i,j))
enddo ; enddo
endif
endif ! end RESTOREBUOY
Expand Down
2 changes: 1 addition & 1 deletion config_src/solo_driver/user_surface_forcing.F90
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ subroutine USER_buoyancy_forcing(sfc_state, fluxes, day, dt, G, US, CS)
density_restore = 1030.0*US%kg_m3_to_R

fluxes%buoy(i,j) = G%mask2dT(i,j) * buoy_rest_const * &
(density_restore - US%kg_m3_to_R*sfc_state%sfc_density(i,j))
(density_restore - sfc_state%sfc_density(i,j))
enddo ; enddo
endif
endif ! end RESTOREBUOY
Expand Down
Loading

0 comments on commit ff1a27f

Please sign in to comment.