Skip to content

Commit

Permalink
Merge branch 'dev/gfdl' into ke_from_GV
Browse files Browse the repository at this point in the history
  • Loading branch information
Hallberg-NOAA committed Dec 19, 2020
2 parents 6d59996 + f3483be commit 204622f
Show file tree
Hide file tree
Showing 83 changed files with 3,137 additions and 1,126 deletions.
1 change: 1 addition & 0 deletions .github/actions/testing-setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ runs:
shell: bash
run: |
echo "::group::Install linux packages"
sudo apt-get update
sudo apt-get install netcdf-bin libnetcdf-dev libnetcdff-dev mpich libmpich-dev
echo "::endgroup::"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/regression.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ jobs:
- name: Create validation data
run: make run.symmetric -k -s

- name: Regression test
- name: Regression test
run: make test.regressions DO_REGRESSION_TESTS=true -k -s
8 changes: 1 addition & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,7 @@
html


# Build output
*.o
*.mod
MOM6


# Autoconf
# Autoconf output
aclocal.m4
autom4te.cache/
config.log
Expand Down
5 changes: 3 additions & 2 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
version: 2

# Extra formats
formats:
- pdf
# PDF generation is failing for now; disabled on 2020-12-02
#formats:
# - pdf

# Build documentation
sphinx:
Expand Down
69 changes: 50 additions & 19 deletions ac/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -83,25 +83,56 @@ AX_FC_CHECK_MODULE([mpi],

# netCDF configuration

# NOTE: `nf-config --flibs` combines library paths (-L) and libraries (-l),
# even though these ought to be separated in the invocation of `ld`.
#
# We use `sed` to strip the -l and pass the -L to LDFLAGS, and rely on autoconf
# to configure the -l flags.
AC_PROG_SED

AC_PATH_PROG([NF_CONFIG], [nf-config])
AS_IF([test -n "$NF_CONFIG"],
[CPPFLAGS="$CPPFLAGS $($NF_CONFIG --fflags)"
FCFLAGS="$FCFLAGS $($NF_CONFIG --fflags)"
LDFLAGS="$LDFLAGS $($NF_CONFIG --flibs | $SED -e 's/-l[[^ ]]*//g')"],
[AC_MSG_ERROR([Could not find nf-config.])])

AX_FC_CHECK_MODULE([netcdf],
[], [AC_MSG_ERROR([Could not find netcdf module.])])
AX_FC_CHECK_LIB([netcdff], [nf_create], [netcdf],
[], [AC_MSG_ERROR([Could not link netcdff library.])]
)
# Search for the Fortran netCDF module, fallback to nf-config.
AX_FC_CHECK_MODULE([netcdf], [], [
AS_UNSET([ax_fc_cv_mod_netcdf])
AC_PATH_PROG([NF_CONFIG], [nf-config])
AS_IF([test -n "$NF_CONFIG"], [
AC_SUBST([FCFLAGS], ["$FCFLAGS -I$($NF_CONFIG --includedir)"])
], [AC_MSG_ERROR([Could not find nf-config.])]
)
AX_FC_CHECK_MODULE([netcdf], [], [
AC_MSG_ERROR([Could not find netcdf module.])
])
])

# FMS may invoke netCDF C calls, so we link to libnetcdf.
AC_LANG_PUSH([C])
AC_CHECK_LIB([netcdf], [nc_create], [], [
AS_UNSET([ac_cv_lib_netcdf_nc_create])
AC_PATH_PROG([NC_CONFIG], [nc-config])
AS_IF([test -n "$NC_CONFIG"], [
AC_SUBST([LDFLAGS],
["$LDFLAGS -L$($NC_CONFIG --libdir)"]
)
], [AC_MSG_ERROR([Could not find nc-config.])]
)
AC_CHECK_LIB([netcdf], [nc_create], [], [
AC_MSG_ERROR([Could not find libnetcdf.])
])
])
AC_LANG_POP([C])

# NOTE: We test for nf_create, rather than nf90_create, because AX_FC_CHECK_LIB
# is currently not yet able to properly probe inside modules.
# Testing of the nf90_* functions will require a macro update.
# NOTE: nf-config does not have a --libdir flag, so we use --prefix and assume
# that libraries are in the $prefix/lib directory.

# Link to Fortran netCDF library, netcdff
AX_FC_CHECK_LIB([netcdff], [nf_create], [], [], [
AS_UNSET([ax_fc_cv_lib_netcdff_nf_create])
AC_PATH_PROG([NF_CONFIG], [nf-config])
AS_IF([test -n "$NF_CONFIG"], [
AC_SUBST([LDFLAGS],
["$LDFLAGS -L$($NF_CONFIG --prefix)/lib"]
)
], [AC_MSG_ERROR([Could not find nf-config.])]
)
AX_FC_CHECK_LIB([netcdff], [nf_create], [], [], [
AC_MSG_ERROR([Could not find libnetcdff.])
])
])


# Force 8-byte reals
Expand Down
2 changes: 1 addition & 1 deletion ac/deps/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ MKMF_COMMIT ?= master

# FMS framework
FMS_URL ?= https://github.com/NOAA-GFDL/FMS.git
FMS_COMMIT ?= 2019.01.03
FMS_COMMIT ?= 2020.04


# List of source files to link this Makefile's dependencies to model Makefiles
Expand Down
52 changes: 33 additions & 19 deletions ac/deps/configure.fms.ac
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ AC_PROG_CC
AX_MPI
CC=$MPICC


# FMS configuration

# Linux and macOS have a gettid system call, but it is not implemented in older
Expand Down Expand Up @@ -74,25 +75,38 @@ AC_DEFINE([use_libMPI])

# netCDF configuration

# NOTE: `nf-config --flibs` combines library paths (-L) and libraries (-l),
# even though these ought to be separated in the invocation of `ld`.
#
# We use `sed` to strip the -l and pass the -L to LDFLAGS, and rely on autoconf
# to configure the -l flags.
AC_PROG_SED

AC_PATH_PROG([NF_CONFIG], [nf-config])
AS_IF([test -n "$NF_CONFIG"],
[CPPFLAGS="$CPPFLAGS $($NF_CONFIG --fflags)"
FCFLAGS="$FCFLAGS $($NF_CONFIG --fflags)"
LDFLAGS="$LDFLAGS $($NF_CONFIG --flibs | $SED -e 's/-l[[^ ]]*//g')"],
[AC_MSG_ERROR([Could not find nf-config.])])

AX_FC_CHECK_MODULE([netcdf],
[], [AC_MSG_ERROR([Could not find netcdf module.])])
AX_FC_CHECK_LIB([netcdff], [nf_create], [netcdf],
[], [AC_MSG_ERROR([Could not link netcdff library.])]
)
# Check for netcdf.h header function declarations.
# If unavailable, then try to invoke nc-create.
AC_LANG_PUSH([C])
AC_CHECK_HEADERS([netcdf.h], [], [
AS_UNSET([ac_cv_header_netcdf_h])
AC_PATH_PROG([NC_CONFIG], [nc-config])
AS_IF([test -n "$NC_CONFIG"], [
AC_SUBST([CPPFLAGS], ["$CPPFLAGS -I$($NC_CONFIG --includedir)"])
],
[AC_MSG_ERROR([Could not find nc-config.])]
)
AC_CHECK_HEADERS([netcdf.h], [], [
AC_MSG_ERROR([Could not find netcdf.h])
])
])
AC_LANG_POP([C])

# Search for the Fortran netCDF module, fallback to nf-config.
AX_FC_CHECK_MODULE([netcdf], [], [
AS_UNSET([ax_fc_cv_mod_netcdf])
AC_PATH_PROG([NF_CONFIG], [nf-config])
AS_IF([test -n "$NF_CONFIG"], [
AC_SUBST([FCFLAGS], ["$FCFLAGS -I$($NF_CONFIG --includedir)"])
],
[AC_MSG_ERROR([Could not find nf-config.])]
)
AX_FC_CHECK_MODULE([netcdf], [], [
AC_MSG_ERROR([Could not find netcdf module.])
])
])

# FMS requires this macro to signal netCDF support.
AC_DEFINE([use_netCDF])


Expand Down
13 changes: 7 additions & 6 deletions ac/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
3 changes: 2 additions & 1 deletion config_src/coupled_driver/MOM_surface_forcing_gfdl.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1664,7 +1664,8 @@ subroutine check_mask_val_consistency(val, mask, i, j, varname, G)

real, intent(in) :: val !< value of flux/variable passed by IOB
real, intent(in) :: mask !< value of ocean mask
integer, intent(in) :: i, j !< model grid cell indices
integer, intent(in) :: i !< model grid cell indices
integer, intent(in) :: j !< model grid cell indices
character(len=*), intent(in) :: varname !< variable name
type(ocean_grid_type), intent(in) :: G !< The ocean's grid structure
! Local variables
Expand Down
16 changes: 12 additions & 4 deletions config_src/external/GFDL_ocean_BGC/FMS_coupler_util.F90
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,31 @@ module FMS_coupler_util
subroutine extract_coupler_values(BC_struc, BC_index, BC_element, array_out, ilb, jlb, &
is, ie, js, je, conversion)
real, dimension(ilb:,jlb:),intent(out) :: array_out !< The array being filled with the input values
integer, intent(in) :: ilb, jlb !< Lower bounds
integer, intent(in) :: ilb !< Lower bounds
integer, intent(in) :: jlb !< Lower bounds
type(coupler_2d_bc_type), intent(in) :: BC_struc !< The type from which the data is being extracted
integer, intent(in) :: BC_index !< The boundary condition number being extracted
integer, intent(in) :: BC_element !< The element of the boundary condition being extracted
integer, optional, intent(in) :: is, ie, js, je !< The i- and j- limits of array_out to be filled
integer, optional, intent(in) :: is !< The i- limits of array_out to be filled
integer, optional, intent(in) :: ie !< The i- limits of array_out to be filled
integer, optional, intent(in) :: js !< The j- limits of array_out to be filled
integer, optional, intent(in) :: je !< The j- limits of array_out to be filled
real, optional, intent(in) :: conversion !< A number that every element is multiplied by
end subroutine extract_coupler_values

!> Set element and index of a boundary condition
subroutine set_coupler_values(array_in, BC_struc, BC_index, BC_element, ilb, jlb,&
is, ie, js, je, conversion)
real, dimension(ilb:,jlb:), intent(in) :: array_in !< The array containing the values to load into the BC
integer, intent(in) :: ilb, jlb !< Lower bounds
integer, intent(in) :: ilb !< Lower bounds
integer, intent(in) :: jlb !< Lower bounds
type(coupler_2d_bc_type), intent(inout) :: BC_struc !< The type into which the data is being loaded
integer, intent(in) :: BC_index !< The boundary condition number being set
integer, intent(in) :: BC_element !< The element of the boundary condition being set
integer, optional, intent(in) :: is, ie, js, je !< The i- and j- limits of array_out to be filled
integer, optional, intent(in) :: is !< The i- limits of array_out to be filled
integer, optional, intent(in) :: ie !< The i- limits of array_out to be filled
integer, optional, intent(in) :: js !< The j- limits of array_out to be filled
integer, optional, intent(in) :: je !< The j- limits of array_out to be filled
real, optional, intent(in) :: conversion !< A number that every element is multiplied by
end subroutine set_coupler_values

Expand Down
32 changes: 13 additions & 19 deletions config_src/mct_driver/mom_ocean_model_mct.F90
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ module MOM_ocean_model_mct
use coupler_types_mod, only : coupler_type_set_diags, coupler_type_send_data
use mpp_domains_mod, only : domain2d, mpp_get_layout, mpp_get_global_domain
use mpp_domains_mod, only : mpp_define_domains, mpp_get_compute_domain, mpp_get_data_domain
use fms_mod, only : stdout
use MOM_io, only : stdout
use mpp_mod, only : mpp_chksum
use MOM_EOS, only : gsw_sp_from_sr, gsw_pt_from_ct
use MOM_wave_interface, only : wave_parameters_CS, MOM_wave_interface_init
Expand Down Expand Up @@ -409,10 +409,6 @@ subroutine ocean_model_init(Ocean_sfc, OS, Time_init, Time_in, gas_fields_ocn, i

call close_param_file(param_file)
call diag_mediator_close_registration(OS%diag)

if (is_root_pe()) &
write(*,'(/12x,a/)') '======== COMPLETED MOM INITIALIZATION ========'

call callTree_leave("ocean_model_init(")
end subroutine ocean_model_init

Expand Down Expand Up @@ -1053,20 +1049,18 @@ subroutine ocean_public_type_chksum(id, timestep, ocn)
integer, intent(in) :: timestep !< The number of elapsed timesteps
type(ocean_public_type), intent(in) :: ocn !< A structure containing various publicly
!! visible ocean surface fields.
integer :: n, m, outunit

outunit = stdout()

write(outunit,*) "BEGIN CHECKSUM(ocean_type):: ", id, timestep
write(outunit,100) 'ocean%t_surf ',mpp_chksum(ocn%t_surf )
write(outunit,100) 'ocean%s_surf ',mpp_chksum(ocn%s_surf )
write(outunit,100) 'ocean%u_surf ',mpp_chksum(ocn%u_surf )
write(outunit,100) 'ocean%v_surf ',mpp_chksum(ocn%v_surf )
write(outunit,100) 'ocean%sea_lev ',mpp_chksum(ocn%sea_lev)
write(outunit,100) 'ocean%frazil ',mpp_chksum(ocn%frazil )
write(outunit,100) 'ocean%melt_potential ',mpp_chksum(ocn%melt_potential)

call coupler_type_write_chksums(ocn%fields, outunit, 'ocean%')
integer :: n, m

write(stdout,*) "BEGIN CHECKSUM(ocean_type):: ", id, timestep
write(stdout,100) 'ocean%t_surf ',mpp_chksum(ocn%t_surf )
write(stdout,100) 'ocean%s_surf ',mpp_chksum(ocn%s_surf )
write(stdout,100) 'ocean%u_surf ',mpp_chksum(ocn%u_surf )
write(stdout,100) 'ocean%v_surf ',mpp_chksum(ocn%v_surf )
write(stdout,100) 'ocean%sea_lev ',mpp_chksum(ocn%sea_lev)
write(stdout,100) 'ocean%frazil ',mpp_chksum(ocn%frazil )
write(stdout,100) 'ocean%melt_potential ',mpp_chksum(ocn%melt_potential)

call coupler_type_write_chksums(ocn%fields, stdout, 'ocean%')
100 FORMAT(" CHECKSUM::",A20," = ",Z20)

end subroutine ocean_public_type_chksum
Expand Down
52 changes: 25 additions & 27 deletions config_src/mct_driver/mom_surface_forcing_mct.F90
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ module MOM_surface_forcing_mct
use coupler_types_mod, only : coupler_type_initialized, coupler_type_spawn
use coupler_types_mod, only : coupler_type_copy_data
use data_override_mod, only : data_override_init, data_override
use fms_mod, only : stdout
use mpp_mod, only : mpp_chksum
use time_interp_external_mod, only : init_external_field, time_interp_external
use time_interp_external_mod, only : time_interp_external_init
use MOM_io, only: stdout

implicit none ; private

Expand Down Expand Up @@ -1361,37 +1361,35 @@ subroutine ice_ocn_bnd_type_chksum(id, timestep, iobt)
!! ocean in a coupled model whose checksums are reported

! local variables
integer :: n,m, outunit

outunit = stdout()

write(outunit,*) "BEGIN CHECKSUM(ice_ocean_boundary_type):: ", id, timestep
write(outunit,100) 'iobt%u_flux ' , mpp_chksum( iobt%u_flux )
write(outunit,100) 'iobt%v_flux ' , mpp_chksum( iobt%v_flux )
write(outunit,100) 'iobt%t_flux ' , mpp_chksum( iobt%t_flux )
write(outunit,100) 'iobt%q_flux ' , mpp_chksum( iobt%q_flux )
write(outunit,100) 'iobt%salt_flux ' , mpp_chksum( iobt%salt_flux )
write(outunit,100) 'iobt%seaice_melt_heat' , mpp_chksum( iobt%seaice_melt_heat)
write(outunit,100) 'iobt%seaice_melt ' , mpp_chksum( iobt%seaice_melt )
write(outunit,100) 'iobt%lw_flux ' , mpp_chksum( iobt%lw_flux )
write(outunit,100) 'iobt%sw_flux_vis_dir' , mpp_chksum( iobt%sw_flux_vis_dir)
write(outunit,100) 'iobt%sw_flux_vis_dif' , mpp_chksum( iobt%sw_flux_vis_dif)
write(outunit,100) 'iobt%sw_flux_nir_dir' , mpp_chksum( iobt%sw_flux_nir_dir)
write(outunit,100) 'iobt%sw_flux_nir_dif' , mpp_chksum( iobt%sw_flux_nir_dif)
write(outunit,100) 'iobt%lprec ' , mpp_chksum( iobt%lprec )
write(outunit,100) 'iobt%fprec ' , mpp_chksum( iobt%fprec )
write(outunit,100) 'iobt%runoff ' , mpp_chksum( iobt%runoff )
write(outunit,100) 'iobt%calving ' , mpp_chksum( iobt%calving )
write(outunit,100) 'iobt%p ' , mpp_chksum( iobt%p )
integer :: n,m

write(stdout,*) "BEGIN CHECKSUM(ice_ocean_boundary_type):: ", id, timestep
write(stdout,100) 'iobt%u_flux ' , mpp_chksum( iobt%u_flux )
write(stdout,100) 'iobt%v_flux ' , mpp_chksum( iobt%v_flux )
write(stdout,100) 'iobt%t_flux ' , mpp_chksum( iobt%t_flux )
write(stdout,100) 'iobt%q_flux ' , mpp_chksum( iobt%q_flux )
write(stdout,100) 'iobt%salt_flux ' , mpp_chksum( iobt%salt_flux )
write(stdout,100) 'iobt%seaice_melt_heat' , mpp_chksum( iobt%seaice_melt_heat)
write(stdout,100) 'iobt%seaice_melt ' , mpp_chksum( iobt%seaice_melt )
write(stdout,100) 'iobt%lw_flux ' , mpp_chksum( iobt%lw_flux )
write(stdout,100) 'iobt%sw_flux_vis_dir' , mpp_chksum( iobt%sw_flux_vis_dir)
write(stdout,100) 'iobt%sw_flux_vis_dif' , mpp_chksum( iobt%sw_flux_vis_dif)
write(stdout,100) 'iobt%sw_flux_nir_dir' , mpp_chksum( iobt%sw_flux_nir_dir)
write(stdout,100) 'iobt%sw_flux_nir_dif' , mpp_chksum( iobt%sw_flux_nir_dif)
write(stdout,100) 'iobt%lprec ' , mpp_chksum( iobt%lprec )
write(stdout,100) 'iobt%fprec ' , mpp_chksum( iobt%fprec )
write(stdout,100) 'iobt%runoff ' , mpp_chksum( iobt%runoff )
write(stdout,100) 'iobt%calving ' , mpp_chksum( iobt%calving )
write(stdout,100) 'iobt%p ' , mpp_chksum( iobt%p )
if (associated(iobt%ustar_berg)) &
write(outunit,100) 'iobt%ustar_berg ' , mpp_chksum( iobt%ustar_berg )
write(stdout,100) 'iobt%ustar_berg ' , mpp_chksum( iobt%ustar_berg )
if (associated(iobt%area_berg)) &
write(outunit,100) 'iobt%area_berg ' , mpp_chksum( iobt%area_berg )
write(stdout,100) 'iobt%area_berg ' , mpp_chksum( iobt%area_berg )
if (associated(iobt%mass_berg)) &
write(outunit,100) 'iobt%mass_berg ' , mpp_chksum( iobt%mass_berg )
write(stdout,100) 'iobt%mass_berg ' , mpp_chksum( iobt%mass_berg )
100 FORMAT(" CHECKSUM::",A20," = ",Z20)

call coupler_type_write_chksums(iobt%fluxes, outunit, 'iobt%')
call coupler_type_write_chksums(iobt%fluxes, stdout, 'iobt%')

end subroutine ice_ocn_bnd_type_chksum

Expand Down
Loading

0 comments on commit 204622f

Please sign in to comment.