diff --git a/config_src/drivers/FMS_cap/MOM_surface_forcing_gfdl.F90 b/config_src/drivers/FMS_cap/MOM_surface_forcing_gfdl.F90 index 8e04c5f116..07bff26395 100644 --- a/config_src/drivers/FMS_cap/MOM_surface_forcing_gfdl.F90 +++ b/config_src/drivers/FMS_cap/MOM_surface_forcing_gfdl.F90 @@ -17,6 +17,7 @@ module MOM_surface_forcing_gfdl use MOM_domains, only : pass_vector, pass_var, fill_symmetric_edges use MOM_domains, only : AGRID, BGRID_NE, CGRID_NE, To_All use MOM_domains, only : To_North, To_East, Omit_Corners +use MOM_EOS, only : gsw_sr_from_sp use MOM_error_handler, only : MOM_error, WARNING, FATAL, is_root_pe, MOM_mesg use MOM_file_parser, only : get_param, log_param, log_version, param_file_type use MOM_forcing_type, only : forcing, mech_forcing @@ -145,6 +146,7 @@ module MOM_surface_forcing_gfdl character(len=200) :: inputdir !< Directory where NetCDF input files are character(len=200) :: salt_restore_file !< Filename for salt restoring data character(len=30) :: salt_restore_var_name !< Name of surface salinity in salt_restore_file + logical :: salt_restore_is_practical !< Specifies that the target salinity is practical and not absolute. logical :: mask_srestore !< If true, apply a 2-dimensional mask to the surface !! salinity restoring fluxes. The masking file should be !! in inputdir/salt_restore_mask.nc and the field should @@ -356,6 +358,14 @@ subroutine convert_IOB_to_fluxes(IOB, fluxes, index_bounds, Time, valid_time, G, ! Salinity restoring logic if (CS%restore_salt) then call time_interp_external(CS%srestore_handle, Time, data_restore, scale=US%ppt_to_S) + if (sfc_state%S_is_absS .and. CS%salt_restore_is_practical) then + !Adjust the salt restoring data to absolute + do j=js,je + do i=is,ie + data_restore(i,j) = gsw_sr_from_sp(data_restore(i,j)) + enddo + enddo + endif ! open_ocn_mask indicates where to restore salinity (1 means restore, 0 does not) open_ocn_mask(:,:) = 1.0 if (CS%mask_srestore_under_ice) then ! Do not restore under sea-ice @@ -1484,7 +1494,9 @@ subroutine surface_forcing_init(Time, G, US, param_file, diag, CS, wind_stagger) "The name of the surface salinity variable to read from "//& "SALT_RESTORE_FILE for restoring salinity.", & default="salt") - + call get_param(param_file, mdl, "SALT_RESTORE_PRACTICAL_SALINITY", CS%salt_restore_is_practical, & + "Specifies if the restoring surface salinity variable is practical salinity. If this "//& + "flag is set to false it is assumed that the salinity is absolute salinity.", default=.false.) call get_param(param_file, mdl, "SRESTORE_AS_SFLUX", CS%salt_restore_as_sflux, & "If true, the restoring of salinity is applied as a salt "//& "flux instead of as a freshwater flux.", default=.false.) diff --git a/src/equation_of_state/MOM_EOS.F90 b/src/equation_of_state/MOM_EOS.F90 index 267a5f3095..4c7f86668c 100644 --- a/src/equation_of_state/MOM_EOS.F90 +++ b/src/equation_of_state/MOM_EOS.F90 @@ -17,7 +17,7 @@ module MOM_EOS use MOM_EOS_Roquet_rho, only : Roquet_rho_EOS use MOM_EOS_Roquet_SpV, only : Roquet_SpV_EOS use MOM_EOS_TEOS10, only : TEOS10_EOS -use MOM_EOS_TEOS10, only : gsw_sp_from_sr, gsw_pt_from_ct +use MOM_EOS_TEOS10, only : gsw_sp_from_sr, gsw_pt_from_ct, gsw_sr_from_sp use MOM_temperature_convert, only : poTemp_to_consTemp, consTemp_to_poTemp use MOM_TFreeze, only : calculate_TFreeze_linear, calculate_TFreeze_Millero use MOM_TFreeze, only : calculate_TFreeze_teos10, calculate_TFreeze_TEOS_poly @@ -52,6 +52,7 @@ module MOM_EOS public cons_temp_to_pot_temp public abs_saln_to_prac_saln public gsw_sp_from_sr +public gsw_sr_from_sp public gsw_pt_from_ct public query_compressible public get_EOS_name diff --git a/src/equation_of_state/MOM_EOS_TEOS10.F90 b/src/equation_of_state/MOM_EOS_TEOS10.F90 index 6e4aaa762f..17f2f5156f 100644 --- a/src/equation_of_state/MOM_EOS_TEOS10.F90 +++ b/src/equation_of_state/MOM_EOS_TEOS10.F90 @@ -3,7 +3,7 @@ module MOM_EOS_TEOS10 ! This file is part of MOM6. See LICENSE.md for the license. -use gsw_mod_toolbox, only : gsw_sp_from_sr, gsw_pt_from_ct +use gsw_mod_toolbox, only : gsw_sp_from_sr, gsw_pt_from_ct, gsw_sr_from_sp use gsw_mod_toolbox, only : gsw_rho, gsw_specvol use gsw_mod_toolbox, only : gsw_rho_first_derivatives, gsw_specvol_first_derivatives use gsw_mod_toolbox, only : gsw_rho_second_derivatives @@ -11,7 +11,7 @@ module MOM_EOS_TEOS10 implicit none ; private -public gsw_sp_from_sr, gsw_pt_from_ct +public gsw_sp_from_sr, gsw_pt_from_ct, gsw_sr_from_sp public TEOS10_EOS real, parameter :: Pa2db = 1.e-4 !< The conversion factor from Pa to dbar [dbar Pa-1]