Skip to content

Commit

Permalink
Merge branch 'dev/gfdl' into IS_BC_edits
Browse files Browse the repository at this point in the history
  • Loading branch information
marshallward authored Sep 11, 2023
2 parents c52f35a + 1d35fa1 commit 26c3628
Show file tree
Hide file tree
Showing 49 changed files with 1,457 additions and 1,154 deletions.
45 changes: 45 additions & 0 deletions ac/deps/m4/ax_fc_check_c_lib.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
dnl AX_FC_CHECK_C_LIB(LIBRARY, FUNCTION,
dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND],
dnl [OTHER-LDFLAGS], [OTHER-LIBS])
dnl
dnl This macro checks if a C library can be referenced by a Fortran compiler.
dnl
dnl Results are cached in `ax_fc_cv_c_lib_LIBRARY_FUNCTION`.
dnl
dnl NOTE: Might be possible to rewrite this to use `AX_FC_CHECK_BIND_C`.
dnl
AC_DEFUN([AX_FC_CHECK_C_LIB], [
AS_VAR_PUSHDEF([ax_fc_C_Lib], [ax_fc_cv_c_lib_$1_$2])
m4_ifval([$5],
[ax_fc_c_lib_msg_LDFLAGS=" with $5"],
[ax_fc_c_lib_msg_LDFLAGS=""]
)
AC_CACHE_CHECK(
[for $2 in -l$1$ax_fc_c_lib_msg_LDFLAGS], [ax_fc_cv_c_lib_$1_$2], [
ax_fc_check_c_lib_save_LDFLAGS=$LDFLAGS
LDFLAGS="$6 $LDFLAGS"
ax_fc_check_c_lib_save_LIBS=$LIBS
LIBS="-l$1 $7 $LIBS"
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([],[dnl
dnl begin code block
interface
subroutine test() bind(c, name="$2")
end subroutine test
end interface
call test])
dnl end code block
],
[AS_VAR_SET([ax_fc_C_Lib], [yes])],
[AS_VAR_SET([ax_fc_C_Lib], [no])]
)
LDFLAGS=$ax_fc_check_c_lib_save_LDFLAGS
LIBS=$ax_fc_check_c_lib_save_LIBS
]
)
AS_VAR_IF([ax_fc_C_Lib], [yes],
[m4_default([$3], [LIBS="-l$1 $LIBS"])],
[$4]
)
AS_VAR_POPDEF([ax_fc_C_Lib])
])
13 changes: 7 additions & 6 deletions ac/deps/m4/ax_fc_check_lib.m4
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ dnl library with different -L flags, or perhaps other ld configurations.
dnl
dnl Results are cached in the ax_fc_cv_lib_LIBRARY_FUNCTION variable.
dnl
AC_DEFUN([AX_FC_CHECK_LIB],[dnl
AC_DEFUN([AX_FC_CHECK_LIB],[
AS_VAR_PUSHDEF([ax_fc_Lib], [ax_fc_cv_lib_$1_$2])
m4_ifval([$6],
[ax_fc_lib_msg_LDFLAGS=" with $6"],
Expand All @@ -29,14 +29,15 @@ AC_DEFUN([AX_FC_CHECK_LIB],[dnl
LDFLAGS="$6 $LDFLAGS"
ax_fc_check_lib_save_LIBS=$LIBS
LIBS="-l$1 $7 $LIBS"
AS_IF([test -n $3],
AS_IF([test -n "$3"],
[ax_fc_use_mod="use $3"],
[ax_fc_use_mod=""])
AC_LINK_IFELSE([
AC_LANG_PROGRAM([], [dnl
AC_LINK_IFELSE([dnl
dnl Begin 7-column code block
AC_LANG_PROGRAM([], [dnl
$ax_fc_use_mod
call $2]dnl
)
call $2])dnl
dnl End code block
],
[AS_VAR_SET([ax_fc_Lib], [yes])],
[AS_VAR_SET([ax_fc_Lib], [no])]
Expand Down
19 changes: 2 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 @@ -1284,10 +1284,6 @@ subroutine surface_forcing_init(Time, G, US, param_file, diag, CS, wind_stagger)
! or other equivalent files.
logical :: iceberg_flux_diags ! If true, diagnostics of fluxes from icebergs are available.
integer :: default_answer_date ! The default setting for the various ANSWER_DATE flags.
logical :: default_2018_answers ! The default setting for the various 2018_ANSWERS flags.
logical :: answers_2018 ! If true, use the order of arithmetic and expressions that recover
! the answers from the end of 2018. Otherwise, use a simpler
! expression to calculate gustiness.
type(time_type) :: Time_frc
type(directories) :: dirs ! A structure containing relevant directory paths and input filenames.
character(len=200) :: TideAmp_file, gust_file, salt_file, temp_file ! Input file names.
Expand Down Expand Up @@ -1586,22 +1582,11 @@ subroutine surface_forcing_init(Time, G, US, param_file, diag, CS, wind_stagger)
call get_param(param_file, mdl, "DEFAULT_ANSWER_DATE", default_answer_date, &
"This sets the default value for the various _ANSWER_DATE parameters.", &
default=99991231)
call get_param(param_file, mdl, "DEFAULT_2018_ANSWERS", default_2018_answers, &
"This sets the default value for the various _2018_ANSWERS parameters.", &
default=(default_answer_date<20190101))
call get_param(param_file, mdl, "SURFACE_FORCING_2018_ANSWERS", answers_2018, &
"If true, use the order of arithmetic and expressions that recover the answers "//&
"from the end of 2018. Otherwise, use a simpler expression to calculate gustiness.", &
default=default_2018_answers)
! Revise inconsistent default answer dates.
if (answers_2018 .and. (default_answer_date >= 20190101)) default_answer_date = 20181231
if (.not.answers_2018 .and. (default_answer_date < 20190101)) default_answer_date = 20190101
call get_param(param_file, mdl, "SURFACE_FORCING_ANSWER_DATE", CS%answer_date, &
"The vintage of the order of arithmetic and expressions in the gustiness "//&
"calculations. Values below 20190101 recover the answers from the end "//&
"of 2018, while higher values use a simpler expression to calculate gustiness. "//&
"If both SURFACE_FORCING_2018_ANSWERS and SURFACE_FORCING_ANSWER_DATE are "//&
"specified, the latter takes precedence.", default=default_answer_date)
"of 2018, while higher values use a simpler expression to calculate gustiness.", &
default=default_answer_date)

call get_param(param_file, mdl, "FIX_USTAR_GUSTLESS_BUG", CS%fix_ustar_gustless_bug, &
"If true correct a bug in the time-averaging of the gustless wind friction velocity", &
Expand Down
21 changes: 2 additions & 19 deletions config_src/drivers/solo_driver/MOM_surface_forcing.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1529,11 +1529,6 @@ subroutine surface_forcing_init(Time, G, US, param_file, diag, CS, tracer_flow_C
# include "version_variable.h"
real :: flux_const_default ! The unscaled value of FLUXCONST [m day-1]
integer :: default_answer_date ! The default setting for the various ANSWER_DATE flags.
logical :: default_2018_answers ! The default setting for the various 2018_ANSWERS flags.
logical :: answers_2018 ! If true, use the order of arithmetic and expressions that recover
! the answers from the end of 2018. Otherwise, use a form of the gyre
! wind stresses that are rotationally invariant and more likely to be
! the same between compilers.
character(len=40) :: mdl = "MOM_surface_forcing" ! This module's name.
character(len=200) :: filename, gust_file ! The name of the gustiness input file.

Expand Down Expand Up @@ -1769,24 +1764,12 @@ subroutine surface_forcing_init(Time, G, US, param_file, diag, CS, tracer_flow_C
call get_param(param_file, mdl, "DEFAULT_ANSWER_DATE", default_answer_date, &
"This sets the default value for the various _ANSWER_DATE parameters.", &
default=99991231)
call get_param(param_file, mdl, "DEFAULT_2018_ANSWERS", default_2018_answers, &
"This sets the default value for the various _2018_ANSWERS parameters.", &
default=(default_answer_date<20190101))
call get_param(param_file, mdl, "WIND_GYRES_2018_ANSWERS", answers_2018, &
"If true, use the order of arithmetic and expressions that recover the answers "//&
"from the end of 2018. Otherwise, use expressions for the gyre friction velocities "//&
"that are rotationally invariant and more likely to be the same between compilers.", &
default=default_2018_answers)
! Revise inconsistent default answer dates.
if (answers_2018 .and. (default_answer_date >= 20190101)) default_answer_date = 20181231
if (.not.answers_2018 .and. (default_answer_date < 20190101)) default_answer_date = 20190101
call get_param(param_file, mdl, "WIND_GYRES_ANSWER_DATE", CS%answer_date, &
"The vintage of the expressions used to set gyre wind stresses. "//&
"Values below 20190101 recover the answers from the end of 2018, "//&
"while higher values use a form of the gyre wind stresses that are "//&
"rotationally invariant and more likely to be the same between compilers. "//&
"If both WIND_GYRES_2018_ANSWERS and WIND_GYRES_ANSWER_DATE are specified, "//&
"the latter takes precedence.", default=default_answer_date)
"rotationally invariant and more likely to be the same between compilers.", &
default=default_answer_date)
else
CS%answer_date = 20190101
endif
Expand Down
26 changes: 5 additions & 21 deletions src/ALE/MOM_ALE.F90
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,6 @@ subroutine ALE_init( param_file, GV, US, max_depth, CS)
character(len=80) :: string, vel_string ! Temporary strings
real :: filter_shallow_depth, filter_deep_depth ! Depth ranges of filtering [H ~> m or kg m-2]
integer :: default_answer_date ! The default setting for the various ANSWER_DATE flags.
logical :: default_2018_answers ! The default setting for the various 2018_ANSWERS flags.
logical :: answers_2018 ! If true, use the order of arithmetic and expressions for remapping
! that recover the answers from the end of 2018. Otherwise, use more
! robust and accurate forms of mathematically equivalent expressions.
logical :: check_reconstruction
logical :: check_remapping
logical :: force_bounds_in_subcell
Expand Down Expand Up @@ -231,25 +227,12 @@ subroutine ALE_init( param_file, GV, US, max_depth, CS)
call get_param(param_file, mdl, "DEFAULT_ANSWER_DATE", default_answer_date, &
"This sets the default value for the various _ANSWER_DATE parameters.", &
default=99991231)
call get_param(param_file, mdl, "DEFAULT_2018_ANSWERS", default_2018_answers, &
"This sets the default value for the various _2018_ANSWERS parameters.", &
default=(default_answer_date<20190101), do_not_log=.not.GV%Boussinesq)
call get_param(param_file, mdl, "REMAPPING_2018_ANSWERS", answers_2018, &
"If true, use the order of arithmetic and expressions that recover the "//&
"answers from the end of 2018. Otherwise, use updated and more robust "//&
"forms of the same expressions.", default=default_2018_answers, do_not_log=.not.GV%Boussinesq)
! Revise inconsistent default answer dates for remapping.
if (GV%Boussinesq) then
if (answers_2018 .and. (default_answer_date >= 20190101)) default_answer_date = 20181231
if (.not.answers_2018 .and. (default_answer_date < 20190101)) default_answer_date = 20190101
endif
call get_param(param_file, mdl, "REMAPPING_ANSWER_DATE", CS%answer_date, &
"The vintage of the expressions and order of arithmetic to use for remapping. "//&
"Values below 20190101 result in the use of older, less accurate expressions "//&
"that were in use at the end of 2018. Higher values result in the use of more "//&
"robust and accurate forms of mathematically equivalent expressions. "//&
"If both REMAPPING_2018_ANSWERS and REMAPPING_ANSWER_DATE are specified, the "//&
"latter takes precedence.", default=default_answer_date, do_not_log=.not.GV%Boussinesq)
"robust and accurate forms of mathematically equivalent expressions.", &
default=default_answer_date, do_not_log=.not.GV%Boussinesq)
if (.not.GV%Boussinesq) CS%answer_date = max(CS%answer_date, 20230701)

call initialize_remapping( CS%remapCS, string, &
Expand Down Expand Up @@ -504,13 +487,14 @@ subroutine ALE_offline_inputs(CS, G, GV, US, h, tv, Reg, uhtr, vhtr, Kd, debug,
type(ALE_CS), pointer :: CS !< Regridding parameters and options
type(ocean_grid_type), intent(in ) :: G !< Ocean grid informations
type(verticalGrid_type), intent(in ) :: GV !< Ocean vertical grid structure
type(unit_scale_type), intent(in ) :: US !< A dimensional unit scaling type
type(unit_scale_type), intent(in ) :: US !< A dimensional unit scaling type
real, dimension(SZI_(G),SZJ_(G),SZK_(GV)), intent(inout) :: h !< Layer thicknesses [H ~> m or kg m-2]
type(thermo_var_ptrs), intent(inout) :: tv !< Thermodynamic variable structure
type(tracer_registry_type), pointer :: Reg !< Tracer registry structure
real, dimension(SZIB_(G),SZJ_(G),SZK_(GV)), intent(inout) :: uhtr !< Zonal mass fluxes [H L2 ~> m3 or kg]
real, dimension(SZI_(G),SZJB_(G),SZK_(GV)), intent(inout) :: vhtr !< Meridional mass fluxes [H L2 ~> m3 or kg]
real, dimension(SZI_(G),SZJ_(G),SZK_(GV)+1), intent(inout) :: Kd !< Input diffusivities [Z2 T-1 ~> m2 s-1]
real, dimension(SZI_(G),SZJ_(G),SZK_(GV)+1), intent(inout) :: Kd !< Input diffusivities
!! [H Z T-1 ~> m2 s-1 or kg m-1 s-1]
logical, intent(in ) :: debug !< If true, then turn checksums
type(ocean_OBC_type), pointer :: OBC !< Open boundary structure
! Local variables
Expand Down
19 changes: 2 additions & 17 deletions src/ALE/MOM_regridding.F90
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,6 @@ subroutine initialize_regridding(CS, GV, US, max_depth, param_file, mdl, coord_m
logical :: tmpLogical, do_sum, main_parameters
logical :: coord_is_state_dependent, ierr
integer :: default_answer_date ! The default setting for the various ANSWER_DATE flags.
logical :: default_2018_answers ! The default setting for the various 2018_ANSWERS flags.
logical :: remap_answers_2018
integer :: remap_answer_date ! The vintage of the remapping expressions to use.
integer :: regrid_answer_date ! The vintage of the regridding expressions to use.
real :: tmpReal ! A temporary variable used in setting other variables [various]
Expand Down Expand Up @@ -275,25 +273,12 @@ subroutine initialize_regridding(CS, GV, US, max_depth, param_file, mdl, coord_m
call get_param(param_file, mdl, "DEFAULT_ANSWER_DATE", default_answer_date, &
"This sets the default value for the various _ANSWER_DATE parameters.", &
default=99991231)
call get_param(param_file, mdl, "DEFAULT_2018_ANSWERS", default_2018_answers, &
"This sets the default value for the various _2018_ANSWERS parameters.", &
default=(default_answer_date<20190101), do_not_log=.not.GV%Boussinesq)
call get_param(param_file, mdl, "REMAPPING_2018_ANSWERS", remap_answers_2018, &
"If true, use the order of arithmetic and expressions that recover the "//&
"answers from the end of 2018. Otherwise, use updated and more robust "//&
"forms of the same expressions.", default=default_2018_answers, do_not_log=.not.GV%Boussinesq)
! Revise inconsistent default answer dates for remapping.
if (GV%Boussinesq) then
if (remap_answers_2018 .and. (default_answer_date >= 20190101)) default_answer_date = 20181231
if (.not.remap_answers_2018 .and. (default_answer_date < 20190101)) default_answer_date = 20190101
endif
call get_param(param_file, mdl, "REMAPPING_ANSWER_DATE", remap_answer_date, &
"The vintage of the expressions and order of arithmetic to use for remapping. "//&
"Values below 20190101 result in the use of older, less accurate expressions "//&
"that were in use at the end of 2018. Higher values result in the use of more "//&
"robust and accurate forms of mathematically equivalent expressions. "//&
"If both REMAPPING_2018_ANSWERS and REMAPPING_ANSWER_DATE are specified, the "//&
"latter takes precedence.", default=default_answer_date, do_not_log=.not.GV%Boussinesq)
"robust and accurate forms of mathematically equivalent expressions.", &
default=default_answer_date, do_not_log=.not.GV%Boussinesq)
if (.not.GV%Boussinesq) remap_answer_date = max(remap_answer_date, 20230701)
call set_regrid_params(CS, remap_answer_date=remap_answer_date)
call get_param(param_file, mdl, "REGRIDDING_ANSWER_DATE", regrid_answer_date, &
Expand Down
Loading

0 comments on commit 26c3628

Please sign in to comment.