Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 25 additions & 17 deletions config_src/drivers/FMS_cap/MOM_surface_forcing_gfdl.F90
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ module MOM_surface_forcing_gfdl
logical :: restore_temp !< If true, the coupled MOM driver adds a term to restore sea
!! surface temperature to a specified value.
real :: Flux_const !< Piston velocity for surface restoring [Z T-1 ~> m s-1]
real :: Flux_const_salt !< Piston velocity for surface salt restoring [Z T-1 ~> m s-1]
real :: Flux_const_temp !< Piston velocity for surface temp restoring [Z T-1 ~> m s-1]
logical :: salt_restore_as_sflux !< If true, SSS restore as salt flux instead of water flux
logical :: adjust_net_srestore_to_zero !< Adjust srestore to zero (for both salt_flux or vprec)
logical :: adjust_net_srestore_by_scaling !< Adjust srestore w/o moving zero contour
Expand Down Expand Up @@ -291,22 +293,18 @@ subroutine convert_IOB_to_fluxes(IOB, fluxes, index_bounds, Time, valid_time, G,

call safe_alloc_ptr(fluxes%salt_flux,isd,ied,jsd,jed)
call safe_alloc_ptr(fluxes%salt_flux_in,isd,ied,jsd,jed)
call safe_alloc_ptr(fluxes%salt_flux_added,isd,ied,jsd,jed)

call safe_alloc_ptr(fluxes%TKE_tidal,isd,ied,jsd,jed)
call safe_alloc_ptr(fluxes%ustar_tidal,isd,ied,jsd,jed)

if (CS%allow_flux_adjustments) then
call safe_alloc_ptr(fluxes%heat_added,isd,ied,jsd,jed)
call safe_alloc_ptr(fluxes%salt_flux_added,isd,ied,jsd,jed)
endif
call safe_alloc_ptr(fluxes%heat_added,isd,ied,jsd,jed)
call safe_alloc_ptr(fluxes%salt_flux_added,isd,ied,jsd,jed)

do j=js-2,je+2 ; do i=is-2,ie+2
fluxes%TKE_tidal(i,j) = CS%TKE_tidal(i,j)
fluxes%ustar_tidal(i,j) = CS%ustar_tidal(i,j)
enddo ; enddo

if (CS%restore_temp) call safe_alloc_ptr(fluxes%heat_added,isd,ied,jsd,jed)

endif ! endif for allocation and initialization

Expand Down Expand Up @@ -336,10 +334,8 @@ subroutine convert_IOB_to_fluxes(IOB, fluxes, index_bounds, Time, valid_time, G,
fluxes%fluxes_used = .false.
fluxes%dt_buoy_accum = US%s_to_T*valid_time

if (CS%allow_flux_adjustments) then
fluxes%heat_added(:,:) = 0.0
fluxes%salt_flux_added(:,:) = 0.0
endif
fluxes%heat_added(:,:) = 0.0
fluxes%salt_flux_added(:,:) = 0.0

do j=js,je ; do i=is,ie
fluxes%salt_flux(i,j) = 0.0
Expand All @@ -360,7 +356,7 @@ subroutine convert_IOB_to_fluxes(IOB, fluxes, index_bounds, Time, valid_time, G,
do j=js,je ; do i=is,ie
delta_sss = data_restore(i,j)- sfc_state%SSS(i,j)
delta_sss = sign(1.0,delta_sss)*min(abs(delta_sss),CS%max_delta_srestore)
fluxes%salt_flux(i,j) = 1.e-3*G%mask2dT(i,j) * (CS%Rho0*CS%Flux_const)* &
fluxes%salt_flux(i,j) = 1.e-3*G%mask2dT(i,j) * (CS%Rho0*CS%Flux_const_salt)* &
(CS%basin_mask(i,j)*open_ocn_mask(i,j)*CS%srestore_mask(i,j)) *delta_sss ! R Z T-1 ~> kg Salt m-2 s-1
enddo ; enddo
if (CS%adjust_net_srestore_to_zero) then
Expand All @@ -370,9 +366,10 @@ subroutine convert_IOB_to_fluxes(IOB, fluxes, index_bounds, Time, valid_time, G,
fluxes%saltFluxGlobalAdj = 0.
else
work_sum(is:ie,js:je) = US%L_to_m**2*US%RZ_T_to_kg_m2s * &
G%areaT(is:ie,js:je)*fluxes%salt_flux(is:ie,js:je)
G%areaT(is:ie,js:je)*fluxes%salt_flux(is:ie,js:je) * G%mask2dT(is:ie,js:je)
fluxes%saltFluxGlobalAdj = reproducing_sum(work_sum(:,:), isr,ier, jsr,jer)/CS%area_surf
fluxes%salt_flux(is:ie,js:je) = fluxes%salt_flux(is:ie,js:je) - kg_m2_s_conversion * fluxes%saltFluxGlobalAdj
fluxes%salt_flux(is:ie,js:je) = fluxes%salt_flux(is:ie,js:je) - &
kg_m2_s_conversion * fluxes%saltFluxGlobalAdj * G%mask2dT(is:ie,js:je)
endif
endif
fluxes%salt_flux_added(is:ie,js:je) = fluxes%salt_flux(is:ie,js:je) ! Diagnostic
Expand All @@ -382,7 +379,7 @@ subroutine convert_IOB_to_fluxes(IOB, fluxes, index_bounds, Time, valid_time, G,
delta_sss = sfc_state%SSS(i,j) - data_restore(i,j)
delta_sss = sign(1.0,delta_sss)*min(abs(delta_sss),CS%max_delta_srestore)
fluxes%vprec(i,j) = (CS%basin_mask(i,j)*open_ocn_mask(i,j)*CS%srestore_mask(i,j))* &
(CS%Rho0*CS%Flux_const) * &
(CS%Rho0*CS%Flux_const_salt) * &
delta_sss / (0.5*(sfc_state%SSS(i,j) + data_restore(i,j)))
endif
enddo ; enddo
Expand Down Expand Up @@ -410,7 +407,7 @@ subroutine convert_IOB_to_fluxes(IOB, fluxes, index_bounds, Time, valid_time, G,
delta_sst = data_restore(i,j)- sfc_state%SST(i,j)
delta_sst = sign(1.0,delta_sst)*min(abs(delta_sst),CS%max_delta_trestore)
fluxes%heat_added(i,j) = G%mask2dT(i,j) * CS%trestore_mask(i,j) * &
rhoXcp * delta_sst * CS%Flux_const ! W m-2
rhoXcp * delta_sst * CS%Flux_const_temp ! W m-2
enddo ; enddo
endif

Expand Down Expand Up @@ -1252,6 +1249,7 @@ subroutine surface_forcing_init(Time, G, US, param_file, diag, CS, wind_stagger)
character(len=48) :: flnam
character(len=240) :: basin_file
integer :: i, j, isd, ied, jsd, jed
real :: unscaled_fluxconst

isd = G%isd ; ied = G%ied ; jsd = G%jsd ; jed = G%jed

Expand Down Expand Up @@ -1375,9 +1373,14 @@ subroutine surface_forcing_init(Time, G, US, param_file, diag, CS, wind_stagger)
call get_param(param_file, mdl, "FLUXCONST", CS%Flux_const, &
"The constant that relates the restoring surface fluxes to the relative "//&
"surface anomalies (akin to a piston velocity). Note the non-MKS units.", &
default=0.0, units="m day-1", scale=US%m_to_Z*US%T_to_s)
default=0.0, units="m day-1", scale=US%m_to_Z*US%T_to_s,unscaled=unscaled_fluxconst)
call get_param(param_file, mdl, "FLUXCONST_SALT", CS%Flux_const_salt, &
"The constant that relates the restoring surface salt fluxes to the relative "//&
"surface anomalies (akin to a piston velocity). Note the non-MKS units.", &
fail_if_missing=.false.,default=unscaled_fluxconst, units="m day-1", scale=US%m_to_Z*US%T_to_s)
! Convert CS%Flux_const from m day-1 to m s-1.
CS%Flux_const = CS%Flux_const / 86400.0
CS%Flux_const_salt = CS%Flux_const_salt / 86400.0
call get_param(param_file, mdl, "SALT_RESTORE_FILE", CS%salt_restore_file, &
"A file in which to find the surface salinity to use for restoring.", &
default="salt_restore.nc")
Expand Down Expand Up @@ -1422,9 +1425,14 @@ subroutine surface_forcing_init(Time, G, US, param_file, diag, CS, wind_stagger)
call get_param(param_file, mdl, "FLUXCONST", CS%Flux_const, &
"The constant that relates the restoring surface fluxes to the relative "//&
"surface anomalies (akin to a piston velocity). Note the non-MKS units.", &
default=0.0, units="m day-1", scale=US%m_to_Z*US%T_to_s)
default=0.0, units="m day-1", scale=US%m_to_Z*US%T_to_s,unscaled=unscaled_fluxconst)
call get_param(param_file, mdl, "FLUXCONST_TEMP", CS%Flux_const_temp, &
"The constant that relates the restoring surface temperature fluxes to the relative "//&
"surface anomalies (akin to a piston velocity). Note the non-MKS units.", &
fail_if_missing=.false.,default=unscaled_fluxconst, units="m day-1", scale=US%m_to_Z*US%T_to_s)
! Convert CS%Flux_const from m day-1 to m s-1.
CS%Flux_const = CS%Flux_const / 86400.0
CS%Flux_const_temp = CS%Flux_const_temp / 86400.0
call get_param(param_file, mdl, "SST_RESTORE_FILE", CS%temp_restore_file, &
"A file in which to find the surface temperature to use for restoring.", &
default="temp_restore.nc")
Expand Down