Skip to content

Commit

Permalink
Merge branch 'dev/gfdl' into fix_units_wavestr
Browse files Browse the repository at this point in the history
  • Loading branch information
adcroft authored Dec 19, 2020
2 parents 8426fe7 + f3483be commit 42758d1
Show file tree
Hide file tree
Showing 108 changed files with 5,806 additions and 2,795 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
10 changes: 5 additions & 5 deletions .github/workflows/documentation-and-style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ jobs:
continue-on-error: true

- name: Install packages used when generating documentation
run: >
sudo apt-get install
python3-sphinx python3-lxml perl
texlive-binaries texlive-base bibtool tex-common texlive-bibtex-extra
graphviz
run: |
sudo apt-get update
sudo apt-get install python3-sphinx python3-lxml perl
sudo apt-get install texlive-binaries texlive-base bibtool tex-common texlive-bibtex-extra
sudo apt-get install graphviz
- name: Build doxygen HTML
run: |
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
63 changes: 51 additions & 12 deletions ac/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -82,18 +82,57 @@ AX_FC_CHECK_MODULE([mpi],


# netCDF configuration
AC_PATH_PROG([NC_CONFIG], [nc-config])
AS_IF([test -n "$NC_CONFIG"],
[CPPFLAGS="$CPPFLAGS -I$($NC_CONFIG --includedir)"
FCFLAGS="$FCFLAGS -I$($NC_CONFIG --includedir)"
LDFLAGS="$LDFLAGS -L$($NC_CONFIG --libdir)"],
[AC_MSG_ERROR([Could not find nc-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
46 changes: 34 additions & 12 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 @@ -73,18 +74,39 @@ AC_DEFINE([use_libMPI])


# netCDF configuration
AC_PATH_PROG([NC_CONFIG], [nc-config])
AS_IF([test -n "$NC_CONFIG"],
[CPPFLAGS="$CPPFLAGS -I$($NC_CONFIG --includedir)"
FCFLAGS="$FCFLAGS -I$($NC_CONFIG --includedir)"
LDFLAGS="$LDFLAGS -L$($NC_CONFIG --libdir)"],
[AC_MSG_ERROR([Could not find nc-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
47 changes: 40 additions & 7 deletions config_src/coupled_driver/ocean_model_MOM.F90
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ module ocean_model_mod
use MOM_verticalGrid, only : verticalGrid_type
use MOM_ice_shelf, only : initialize_ice_shelf, shelf_calc_flux, ice_shelf_CS
use MOM_ice_shelf, only : add_shelf_forces, ice_shelf_end, ice_shelf_save_restart
use MOM_IS_diag_mediator, only : diag_IS_ctrl => diag_ctrl, diag_mediator_IS_end=>diag_mediator_end
use coupler_types_mod, only : coupler_1d_bc_type, coupler_2d_bc_type
use coupler_types_mod, only : coupler_type_spawn, coupler_type_write_chksums
use coupler_types_mod, only : coupler_type_initialized, coupler_type_copy_data
Expand Down Expand Up @@ -121,6 +122,8 @@ module ocean_model_mod
!! i.e. dzt(1) + eta_t + patm/rho0/grav [m]
frazil =>NULL(), & !< Accumulated heating [J m-2] from frazil
!! formation in the ocean.
melt_potential => NULL(), & !< Instantaneous heat used to melt sea ice [J m-2].
OBLD => NULL(), & !< Ocean boundary layer depth [m].
area => NULL() !< cell area of the ocean surface [m2].
type(coupler_2d_bc_type) :: fields !< A structure that may contain named
!! arrays of tracer-related surface fields.
Expand Down Expand Up @@ -179,13 +182,13 @@ module ocean_model_mod
!! processes before time stepping the dynamics.

type(directories) :: dirs !< A structure containing several relevant directory paths.
type(mech_forcing) :: forces !< A structure with the driving mechanical surface forces
type(forcing) :: fluxes !< A structure containing pointers to
!! the thermodynamic ocean forcing fields.
type(forcing) :: flux_tmp !< A secondary structure containing pointers to the
type(mech_forcing), pointer :: forces => NULL() !< A structure with the driving mechanical surface forces
type(forcing), pointer :: fluxes => NULL() !< A structure containing pointers to
!! the thermodynamic ocean forcing fields.
type(forcing), pointer :: flux_tmp => NULL() !< A secondary structure containing pointers to the
!! ocean forcing fields for when multiple coupled
!! timesteps are taken per thermodynamic step.
type(surface) :: sfc_state !< A structure containing pointers to
type(surface), pointer :: sfc_state => NULL() !< A structure containing pointers to
!! the ocean surface state fields.
type(ocean_grid_type), pointer :: &
grid => NULL() !< A pointer to a grid structure containing metrics
Expand Down Expand Up @@ -214,6 +217,9 @@ module ocean_model_mod
!! that will be used for MOM restart files.
type(diag_ctrl), pointer :: &
diag => NULL() !< A pointer to the diagnostic regulatory structure
type(diag_IS_ctrl), pointer :: &
diag_IS => NULL() !< A pointer to the diagnostic regulatory structure
!! for the ice shelf module.
end type ocean_state_type

contains
Expand Down Expand Up @@ -267,6 +273,10 @@ subroutine ocean_model_init(Ocean_sfc, OS, Time_init, Time_in, wind_stagger, gas
endif
allocate(OS)

allocate(OS%fluxes)
allocate(OS%forces)
allocate(OS%flux_tmp)

OS%is_ocean_pe = Ocean_sfc%is_ocean_pe
if (.not.OS%is_ocean_pe) return

Expand Down Expand Up @@ -355,6 +365,7 @@ subroutine ocean_model_init(Ocean_sfc, OS, Time_init, Time_in, wind_stagger, gas
use_melt_pot=.false.
endif

allocate(OS%sfc_state)
call allocate_surface_state(OS%sfc_state, OS%grid, use_temperature, do_integrals=.true., &
gas_fields_ocn=gas_fields_ocn, use_meltpot=use_melt_pot)

Expand All @@ -368,7 +379,7 @@ subroutine ocean_model_init(Ocean_sfc, OS, Time_init, Time_in, wind_stagger, gas

if (OS%use_ice_shelf) then
call initialize_ice_shelf(param_file, OS%grid, OS%Time, OS%ice_shelf_CSp, &
OS%diag, OS%forces, OS%fluxes)
OS%diag_IS, OS%forces, OS%fluxes)
endif
if (OS%icebergs_alter_ocean) then
call marine_ice_init(OS%Time, OS%grid, param_file, OS%diag, OS%marine_ice_CSp)
Expand Down Expand Up @@ -717,6 +728,8 @@ subroutine ocean_model_end(Ocean_sfc, Ocean_state, Time)

call ocean_model_save_restart(Ocean_state, Time)
call diag_mediator_end(Time, Ocean_state%diag)
if (Ocean_state%use_ice_shelf) &
call diag_mediator_IS_end(Time, Ocean_state%diag_IS)
call MOM_end(Ocean_state%MOM_CSp)
if (Ocean_state%use_ice_shelf) call ice_shelf_end(Ocean_state%Ice_shelf_CSp)
end subroutine ocean_model_end
Expand Down Expand Up @@ -794,6 +807,8 @@ subroutine initialize_ocean_public_type(input_domain, Ocean_sfc, diag, maskmap,
Ocean_sfc%v_surf (isc:iec,jsc:jec), &
Ocean_sfc%sea_lev(isc:iec,jsc:jec), &
Ocean_sfc%area (isc:iec,jsc:jec), &
Ocean_sfc%melt_potential(isc:iec,jsc:jec), &
Ocean_sfc%OBLD (isc:iec,jsc:jec), &
Ocean_sfc%frazil (isc:iec,jsc:jec))

Ocean_sfc%t_surf(:,:) = 0.0 ! time averaged sst (Kelvin) passed to atmosphere/ice model
Expand All @@ -802,6 +817,8 @@ subroutine initialize_ocean_public_type(input_domain, Ocean_sfc, diag, maskmap,
Ocean_sfc%v_surf(:,:) = 0.0 ! time averaged v-current (m/sec) passed to atmosphere/ice models
Ocean_sfc%sea_lev(:,:) = 0.0 ! time averaged thickness of top model grid cell (m) plus patm/rho0/grav
Ocean_sfc%frazil(:,:) = 0.0 ! time accumulated frazil (J/m^2) passed to ice model
Ocean_sfc%melt_potential(:,:) = 0.0 ! time accumulated melt potential (J/m^2) passed to ice model
Ocean_sfc%OBLD(:,:) = 0.0 ! ocean boundary layer depth (m)
Ocean_sfc%area(:,:) = 0.0
Ocean_sfc%axes = diag%axesT1%handles !diag axes to be used by coupler tracer flux diagnostics

Expand Down Expand Up @@ -887,6 +904,18 @@ subroutine convert_state_to_ocean_type(sfc_state, Ocean_sfc, G, US, patm, press_
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) = 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) = 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) * US%L_T_to_m_s * &
Expand Down Expand Up @@ -1064,6 +1093,10 @@ subroutine ocean_model_data2D_get(OS, Ocean, name, array2D, isc, jsc)
array2D(isc:,jsc:) = Ocean%sea_lev(isc:,jsc:)
case('frazil')
array2D(isc:,jsc:) = Ocean%frazil(isc:,jsc:)
case('melt_pot')
array2D(isc:,jsc:) = Ocean%melt_potential(isc:,jsc:)
case('obld')
array2D(isc:,jsc:) = Ocean%OBLD(isc:,jsc:)
case default
call MOM_error(FATAL,'get_ocean_grid_data2D: unknown argument name='//name)
end select
Expand Down Expand Up @@ -1109,7 +1142,7 @@ subroutine ocean_public_type_chksum(id, timestep, ocn)
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%')
100 FORMAT(" CHECKSUM::",A20," = ",Z20)

Expand Down
Loading

0 comments on commit 42758d1

Please sign in to comment.