Skip to content

Commit b771b91

Browse files
Merge pull request #9 from gustavo-marques/merge_dev_gfdl_19may2021
Merge dev gfdl 19may2021
2 parents e406b72 + 87f011c commit b771b91

75 files changed

Lines changed: 10203 additions & 1827 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitlab-ci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ setup:
3838
- test -d MOM6-examples/src/LM3 || make -f MRS/Makefile.clone clone_gfdl -s
3939
- make -f MRS/Makefile.clone MOM6-examples/.datasets -s
4040
- env > gitlab_session.log
41+
# Show hashes for final setup
42+
- git show --oneline
43+
- git submodule status
44+
- (cd MOM6-examples && git submodule status --recursive src)
4145
# Cache everything under tests to unpack for each subsequent stage
4246
- cd ../ ; time tar zcf $CACHE_DIR/tests_$CI_PIPELINE_ID.tgz tests
4347

.testing/Makefile

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ FCFLAGS_COVERAGE ?=
8484
# - FMS cannot be built with the same aggressive initialization flags as MOM6,
8585
# so FCFLAGS_INIT is used to provide additional MOM6 configuration.
8686

87+
# User-defined LDFLAGS (applied to all builds and FMS)
88+
LDFLAGS_USER ?=
89+
8790
# Set to `true` to require identical results from DEBUG and REPRO builds
8891
# NOTE: Many compilers (Intel, GCC on ARM64) do not yet produce identical
8992
# results across DEBUG and REPRO builds (as defined below), so we disable on
@@ -190,7 +193,7 @@ endif
190193
# Rules
191194

192195
.PHONY: all build.regressions
193-
all: $(foreach b,$(BUILDS),build/$(b)/MOM6)
196+
all: $(foreach b,$(BUILDS),build/$(b)/MOM6) $(VENV_PATH)
194197
build.regressions: $(foreach b,symmetric target,build/$(b)/MOM6)
195198

196199
# Executable
@@ -217,8 +220,8 @@ REPRO_FCFLAGS := FCFLAGS="$(FCFLAGS_REPRO) $(FCFLAGS_FMS)"
217220
OPENMP_FCFLAGS := FCFLAGS="$(FCFLAGS_DEBUG) $(FCFLAGS_INIT) $(FCFLAGS_FMS)"
218221
TARGET_FCFLAGS := FCFLAGS="$(FCFLAGS_DEBUG) $(FCFLAGS_INIT) $(FCFLAGS_FMS)"
219222

220-
MOM_LDFLAGS := LDFLAGS="$(LDFLAGS_FMS)"
221-
SYMMETRIC_LDFLAGS := LDFLAGS="$(COVERAGE) $(LDFLAGS_FMS)"
223+
MOM_LDFLAGS := LDFLAGS="$(LDFLAGS_FMS) $(LDFLAGS_USER)"
224+
SYMMETRIC_LDFLAGS := LDFLAGS="$(COVERAGE) $(LDFLAGS_FMS) $(LDFLAGS_USER)"
222225

223226

224227
# Environment variable configuration
@@ -286,7 +289,7 @@ $(TARGET_CODEBASE)/ac/configure: $(TARGET_CODEBASE)
286289

287290
$(TARGET_CODEBASE):
288291
git clone --recursive $(MOM_TARGET_URL) $@
289-
cd $@ && git checkout $(MOM_TARGET_BRANCH)
292+
cd $@ && git checkout --recurse-submodules $(MOM_TARGET_BRANCH)
290293

291294

292295
#---
@@ -358,6 +361,7 @@ check_mom6_api_mct: build/mct/mom_ocean_model_mct.o
358361
work/local-env:
359362
python3 -m venv $@
360363
. $@/bin/activate \
364+
&& python3 -m pip install --upgrade pip \
361365
&& pip3 install wheel \
362366
&& pip3 install cython \
363367
&& pip3 install numpy \

config_src/drivers/FMS_cap/MOM_surface_forcing_gfdl.F90

Lines changed: 36 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ module MOM_surface_forcing_gfdl
2727
use MOM_grid, only : ocean_grid_type
2828
use MOM_interpolate, only : init_external_field, time_interp_external
2929
use MOM_interpolate, only : time_interp_external_init
30-
use MOM_io, only : slasher, write_version_number, MOM_read_data, stdout
30+
use MOM_io, only : slasher, write_version_number, MOM_read_data
31+
use MOM_io, only : stdout_if_root
3132
use MOM_restart, only : register_restart_field, restart_init, MOM_restart_CS
3233
use MOM_restart, only : restart_init_end, save_restart, restore_state
3334
use MOM_string_functions, only : uppercase
@@ -36,6 +37,7 @@ module MOM_surface_forcing_gfdl
3637
use MOM_variables, only : surface
3738
use user_revise_forcing, only : user_alter_forcing, user_revise_forcing_init
3839
use user_revise_forcing, only : user_revise_forcing_CS
40+
use iso_fortran_env, only : int64
3941

4042
implicit none ; private
4143

@@ -1622,32 +1624,39 @@ subroutine ice_ocn_bnd_type_chksum(id, timestep, iobt)
16221624
type(ice_ocean_boundary_type), &
16231625
intent(in) :: iobt !< An ice-ocean boundary type with fluxes to drive the
16241626
!! ocean in a coupled model whose checksums are reported
1625-
integer :: n,m, outunit
1626-
1627-
outunit = stdout
1628-
1629-
write(outunit,*) "BEGIN CHECKSUM(ice_ocean_boundary_type):: ", id, timestep
1630-
write(outunit,100) 'iobt%u_flux ', field_chksum( iobt%u_flux )
1631-
write(outunit,100) 'iobt%v_flux ', field_chksum( iobt%v_flux )
1632-
write(outunit,100) 'iobt%t_flux ', field_chksum( iobt%t_flux )
1633-
write(outunit,100) 'iobt%q_flux ', field_chksum( iobt%q_flux )
1634-
write(outunit,100) 'iobt%salt_flux ', field_chksum( iobt%salt_flux )
1635-
write(outunit,100) 'iobt%lw_flux ', field_chksum( iobt%lw_flux )
1636-
write(outunit,100) 'iobt%sw_flux_vis_dir', field_chksum( iobt%sw_flux_vis_dir)
1637-
write(outunit,100) 'iobt%sw_flux_vis_dif', field_chksum( iobt%sw_flux_vis_dif)
1638-
write(outunit,100) 'iobt%sw_flux_nir_dir', field_chksum( iobt%sw_flux_nir_dir)
1639-
write(outunit,100) 'iobt%sw_flux_nir_dif', field_chksum( iobt%sw_flux_nir_dif)
1640-
write(outunit,100) 'iobt%lprec ', field_chksum( iobt%lprec )
1641-
write(outunit,100) 'iobt%fprec ', field_chksum( iobt%fprec )
1642-
write(outunit,100) 'iobt%runoff ', field_chksum( iobt%runoff )
1643-
write(outunit,100) 'iobt%calving ', field_chksum( iobt%calving )
1644-
write(outunit,100) 'iobt%p ', field_chksum( iobt%p )
1645-
if (associated(iobt%ustar_berg)) &
1646-
write(outunit,100) 'iobt%ustar_berg ', field_chksum( iobt%ustar_berg )
1647-
if (associated(iobt%area_berg)) &
1648-
write(outunit,100) 'iobt%area_berg ', field_chksum( iobt%area_berg )
1649-
if (associated(iobt%mass_berg)) &
1650-
write(outunit,100) 'iobt%mass_berg ', field_chksum( iobt%mass_berg )
1627+
! Local variables
1628+
integer(kind=int64) :: chks ! A checksum for the field
1629+
logical :: root ! True only on the root PE
1630+
integer :: outunit ! The output unit to write to
1631+
1632+
root = is_root_pe()
1633+
outunit = stdout_if_root()
1634+
1635+
if (root) write(outunit,*) "BEGIN CHECKSUM(ice_ocean_boundary_type):: ", id, timestep
1636+
chks = field_chksum( iobt%u_flux ) ; if (root) write(outunit,100) 'iobt%u_flux ', chks
1637+
chks = field_chksum( iobt%v_flux ) ; if (root) write(outunit,100) 'iobt%v_flux ', chks
1638+
chks = field_chksum( iobt%t_flux ) ; if (root) write(outunit,100) 'iobt%t_flux ', chks
1639+
chks = field_chksum( iobt%q_flux ) ; if (root) write(outunit,100) 'iobt%q_flux ', chks
1640+
chks = field_chksum( iobt%salt_flux ) ; if (root) write(outunit,100) 'iobt%salt_flux ', chks
1641+
chks = field_chksum( iobt%lw_flux ) ; if (root) write(outunit,100) 'iobt%lw_flux ', chks
1642+
chks = field_chksum( iobt%sw_flux_vis_dir) ; if (root) write(outunit,100) 'iobt%sw_flux_vis_dir', chks
1643+
chks = field_chksum( iobt%sw_flux_vis_dif) ; if (root) write(outunit,100) 'iobt%sw_flux_vis_dif', chks
1644+
chks = field_chksum( iobt%sw_flux_nir_dir) ; if (root) write(outunit,100) 'iobt%sw_flux_nir_dir', chks
1645+
chks = field_chksum( iobt%sw_flux_nir_dif) ; if (root) write(outunit,100) 'iobt%sw_flux_nir_dif', chks
1646+
chks = field_chksum( iobt%lprec ) ; if (root) write(outunit,100) 'iobt%lprec ', chks
1647+
chks = field_chksum( iobt%fprec ) ; if (root) write(outunit,100) 'iobt%fprec ', chks
1648+
chks = field_chksum( iobt%runoff ) ; if (root) write(outunit,100) 'iobt%runoff ', chks
1649+
chks = field_chksum( iobt%calving ) ; if (root) write(outunit,100) 'iobt%calving ', chks
1650+
chks = field_chksum( iobt%p ) ; if (root) write(outunit,100) 'iobt%p ', chks
1651+
if (associated(iobt%ustar_berg)) then
1652+
chks = field_chksum( iobt%ustar_berg ) ; if (root) write(outunit,100) 'iobt%ustar_berg ', chks
1653+
endif
1654+
if (associated(iobt%area_berg)) then
1655+
chks = field_chksum( iobt%area_berg ) ; if (root) write(outunit,100) 'iobt%area_berg ', chks
1656+
endif
1657+
if (associated(iobt%mass_berg)) then
1658+
chks = field_chksum( iobt%mass_berg ) ; if (root) write(outunit,100) 'iobt%mass_berg ', chks
1659+
endif
16511660
100 FORMAT(" CHECKSUM::",A20," = ",Z20)
16521661

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

config_src/drivers/FMS_cap/ocean_model_MOM.F90

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ module ocean_model_mod
3535
use MOM_forcing_type, only : forcing_diagnostics, mech_forcing_diags
3636
use MOM_get_input, only : Get_MOM_Input, directories
3737
use MOM_grid, only : ocean_grid_type
38-
use MOM_io, only : write_version_number, stdout
38+
use MOM_io, only : write_version_number, stdout_if_root
3939
use MOM_marine_ice, only : iceberg_forces, iceberg_fluxes, marine_ice_init, marine_ice_CS
4040
use MOM_restart, only : MOM_restart_CS, save_restart
4141
use MOM_string_functions, only : uppercase
@@ -56,6 +56,7 @@ module ocean_model_mod
5656
use MOM_ice_shelf, only : add_shelf_forces, ice_shelf_end, ice_shelf_save_restart
5757
use MOM_wave_interface, only: wave_parameters_CS, MOM_wave_interface_init
5858
use MOM_wave_interface, only: MOM_wave_interface_init_lite, Update_Surface_Waves
59+
use iso_fortran_env, only : int64
5960

6061
#include <MOM_memory.h>
6162

@@ -1094,25 +1095,29 @@ subroutine ocean_model_data1D_get(OS, Ocean, name, value)
10941095

10951096
end subroutine ocean_model_data1D_get
10961097

1097-
!> Write out FMS-format checsums on fields from the ocean surface state
1098+
!> Write out checksums for fields from the ocean surface state
10981099
subroutine ocean_public_type_chksum(id, timestep, ocn)
10991100

11001101
character(len=*), intent(in) :: id !< An identifying string for this call
11011102
integer, intent(in) :: timestep !< The number of elapsed timesteps
11021103
type(ocean_public_type), intent(in) :: ocn !< A structure containing various publicly
11031104
!! visible ocean surface fields.
1104-
integer :: n, m, outunit
1105-
1106-
outunit = stdout
1107-
1108-
write(outunit,*) "BEGIN CHECKSUM(ocean_type):: ", id, timestep
1109-
write(outunit,100) 'ocean%t_surf ', field_chksum(ocn%t_surf )
1110-
write(outunit,100) 'ocean%s_surf ', field_chksum(ocn%s_surf )
1111-
write(outunit,100) 'ocean%u_surf ', field_chksum(ocn%u_surf )
1112-
write(outunit,100) 'ocean%v_surf ', field_chksum(ocn%v_surf )
1113-
write(outunit,100) 'ocean%sea_lev ', field_chksum(ocn%sea_lev)
1114-
write(outunit,100) 'ocean%frazil ', field_chksum(ocn%frazil )
1115-
write(outunit,100) 'ocean%melt_potential ', field_chksum(ocn%melt_potential)
1105+
! Local variables
1106+
integer(kind=int64) :: chks ! A checksum for the field
1107+
logical :: root ! True only on the root PE
1108+
integer :: outunit ! The output unit to write to
1109+
1110+
root = is_root_pe()
1111+
outunit = stdout_if_root()
1112+
1113+
if (root) write(outunit,*) "BEGIN CHECKSUM(ocean_type):: ", id, timestep
1114+
chks = field_chksum(ocn%t_surf ) ; if (root) write(outunit,100) 'ocean%t_surf ', chks
1115+
chks = field_chksum(ocn%s_surf ) ; if (root) write(outunit,100) 'ocean%s_surf ', chks
1116+
chks = field_chksum(ocn%u_surf ) ; if (root) write(outunit,100) 'ocean%u_surf ', chks
1117+
chks = field_chksum(ocn%v_surf ) ; if (root) write(outunit,100) 'ocean%v_surf ', chks
1118+
chks = field_chksum(ocn%sea_lev) ; if (root) write(outunit,100) 'ocean%sea_lev ', chks
1119+
chks = field_chksum(ocn%frazil ) ; if (root) write(outunit,100) 'ocean%frazil ', chks
1120+
chks = field_chksum(ocn%melt_potential) ; if (root) write(outunit,100) 'ocean%melt_potential ', chks
11161121
call coupler_type_write_chksums(ocn%fields, outunit, 'ocean%')
11171122
100 FORMAT(" CHECKSUM::",A20," = ",Z20)
11181123

@@ -1162,6 +1167,8 @@ subroutine ocean_model_get_UV_surf(OS, Ocean, name, array2D, isc, jsc)
11621167

11631168
sfc_state => OS%sfc_state
11641169

1170+
call pass_vector(sfc_state%u, sfc_state%v, G%Domain)
1171+
11651172
select case(name)
11661173
case('ua')
11671174
do j=jsc_bnd,jec_bnd ; do i=isc_bnd,iec_bnd

config_src/drivers/ice_solo_driver/ice_shelf_driver.F90

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,8 @@ program Shelf_main
185185
endif
186186
endif
187187

188+
call Get_MOM_Input(param_file, dirs)
189+
188190
! Read ocean_solo restart, which can override settings from the namelist.
189191
if (file_exists(trim(dirs%restart_input_dir)//'ice_solo.res')) then
190192
call open_ASCII_file(unit, trim(dirs%restart_input_dir)//'ice_solo.res', action=READONLY_FILE)
@@ -215,7 +217,6 @@ program Shelf_main
215217
Start_time = real_to_time(0.0)
216218
endif
217219

218-
call Get_MOM_Input(param_file, dirs)
219220
! Determining the internal unit scaling factors for this run.
220221
call unit_scaling_init(param_file, US)
221222

config_src/drivers/mct_cap/mom_ocean_model_mct.F90

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ module MOM_ocean_model_mct
1515
use MOM, only : extract_surface_state, allocate_surface_state, finish_MOM_initialization
1616
use MOM, only : get_MOM_state_elements, MOM_state_is_synchronized
1717
use MOM, only : get_ocean_stocks, step_offline
18+
use MOM_coms, only : field_chksum
1819
use MOM_constants, only : CELSIUS_KELVIN_OFFSET, hlf
1920
use MOM_diag_mediator, only : diag_ctrl, enable_averaging, disable_averaging
2021
use MOM_diag_mediator, only : diag_mediator_close_registration, diag_mediator_end
@@ -65,6 +66,7 @@ module MOM_ocean_model_mct
6566

6667
! MCT specfic routines
6768
use MOM_domains, only : MOM_infra_end
69+
use iso_fortran_env, only : int64
6870

6971
#include <MOM_memory.h>
7072

@@ -1042,24 +1044,26 @@ subroutine Ocean_stock_pe(OS, index, value, time_index)
10421044

10431045
end subroutine Ocean_stock_pe
10441046

1045-
!> Write out FMS-format checsums on fields from the ocean surface state
1047+
!> Write out checksums for fields from the ocean surface state
10461048
subroutine ocean_public_type_chksum(id, timestep, ocn)
10471049

10481050
character(len=*), intent(in) :: id !< An identifying string for this call
10491051
integer, intent(in) :: timestep !< The number of elapsed timesteps
10501052
type(ocean_public_type), intent(in) :: ocn !< A structure containing various publicly
10511053
!! visible ocean surface fields.
1052-
integer :: n, m
1053-
1054-
write(stdout,*) "BEGIN CHECKSUM(ocean_type):: ", id, timestep
1055-
write(stdout,100) 'ocean%t_surf ',mpp_chksum(ocn%t_surf )
1056-
write(stdout,100) 'ocean%s_surf ',mpp_chksum(ocn%s_surf )
1057-
write(stdout,100) 'ocean%u_surf ',mpp_chksum(ocn%u_surf )
1058-
write(stdout,100) 'ocean%v_surf ',mpp_chksum(ocn%v_surf )
1059-
write(stdout,100) 'ocean%sea_lev ',mpp_chksum(ocn%sea_lev)
1060-
write(stdout,100) 'ocean%frazil ',mpp_chksum(ocn%frazil )
1061-
write(stdout,100) 'ocean%melt_potential ',mpp_chksum(ocn%melt_potential)
1062-
1054+
! Local variables
1055+
integer(kind=int64) :: chks ! A checksum for the field
1056+
logical :: root ! True only on the root PE
1057+
integer :: outunit ! The output unit to write to
1058+
1059+
if (root) write(outunit,*) "BEGIN CHECKSUM(ocean_type):: ", id, timestep
1060+
chks = field_chksum(ocn%t_surf ) ; if (root) write(outunit,100) 'ocean%t_surf ', chks
1061+
chks = field_chksum(ocn%s_surf ) ; if (root) write(outunit,100) 'ocean%s_surf ', chks
1062+
chks = field_chksum(ocn%u_surf ) ; if (root) write(outunit,100) 'ocean%u_surf ', chks
1063+
chks = field_chksum(ocn%v_surf ) ; if (root) write(outunit,100) 'ocean%v_surf ', chks
1064+
chks = field_chksum(ocn%sea_lev) ; if (root) write(outunit,100) 'ocean%sea_lev ', chks
1065+
chks = field_chksum(ocn%frazil ) ; if (root) write(outunit,100) 'ocean%frazil ', chks
1066+
chks = field_chksum(ocn%melt_potential) ; if (root) write(outunit,100) 'ocean%melt_potential ', chks
10631067
call coupler_type_write_chksums(ocn%fields, stdout, 'ocean%')
10641068
100 FORMAT(" CHECKSUM::",A20," = ",Z20)
10651069

0 commit comments

Comments
 (0)