Skip to content

Commit

Permalink
Merge branch 'dev/gfdl' into rescale_net_mass_src
Browse files Browse the repository at this point in the history
  • Loading branch information
Hallberg-NOAA committed Dec 8, 2021
2 parents fa5c2fe + c0be5d3 commit 19d7f94
Show file tree
Hide file tree
Showing 13 changed files with 527 additions and 845 deletions.
14 changes: 10 additions & 4 deletions .testing/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ endif
# These are set to true by our Travis configuration if testing a pull request
DO_REGRESSION_TESTS ?=
REPORT_COVERAGE ?=
CODECOV_UPLOADER_URL ?= https://uploader.codecov.io/latest/linux/codecov

ifeq ($(DO_REGRESSION_TESTS), true)
BUILDS += target
Expand All @@ -165,6 +166,7 @@ else
endif



# List of source files to link this Makefile's dependencies to model Makefiles
# Assumes a depth of two, and the following extensions: F90 inc c h
# (1): Root directory
Expand Down Expand Up @@ -542,6 +544,7 @@ $(foreach c,$(CONFIGS),$(eval $(call CONFIG_DIM_RULE,$(c))))
# $(4): MOM_override configuration
# $(5): Environment variables
# $(6): Number of MPI ranks

define STAT_RULE
work/%/$(1)/ocean.stats work/%/$(1)/chksum_diag: build/$(2)/MOM6 $(VENV_PATH)
@echo "Running test $$*.$(1)..."
Expand Down Expand Up @@ -570,10 +573,13 @@ work/%/$(1)/ocean.stats work/%/$(1)/chksum_diag: build/$(2)/MOM6 $(VENV_PATH)
@echo -e "$(DONE): $$*.$(1); no runtime errors."
if [ $(3) ]; then \
mkdir -p results/$$* ; \
cd build/symmetric \
&& bash <(curl -s https://codecov.io/bash) -Z -n $$@ \
> codecov.$$*.$(1).out \
2> codecov.$$*.$(1).err \
cd build/symmetric ; \
gcov *.gcda > gcov.$$*.$(1).out ; \
curl -s $(CODECOV_UPLOADER_URL) -o codecov ; \
chmod +x codecov ; \
./codecov -Z -f "*.gcov" -n $$@ \
> codecov.$$*.$(1).out \
2> codecov.$$*.$(1).err \
&& echo -e "${MAGENTA}Report uploaded to codecov.${RESET}"; \
fi
endef
Expand Down
35 changes: 24 additions & 11 deletions src/core/MOM.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1781,8 +1781,7 @@ subroutine initialize_MOM(Time, Time_init, param_file, dirs, CS, restart_CSp, &
logical :: debug_truncations ! If true, turn on diagnostics useful for debugging truncations.
integer :: first_direction ! An integer that indicates which direction is to be
! updated first in directionally split parts of the
! calculation. This can be altered during the course
! of the run via calls to set_first_direction.
! calculation.
integer :: nkml, nkbl, verbosity, write_geom
integer :: dynamics_stencil ! The computational stencil for the calculations
! in the dynamic core.
Expand Down Expand Up @@ -2055,7 +2054,6 @@ subroutine initialize_MOM(Time, Time_init, param_file, dirs, CS, restart_CSp, &
"direction updates occur first in directionally split parts of the calculation. "//&
"If this is true, FIRST_DIRECTION applies at the start of a new run or if "//&
"the next first direction can not be found in the restart file.", default=.false.)

call get_param(param_file, "MOM", "CHECK_BAD_SURFACE_VALS", CS%check_bad_sfc_vals, &
"If true, check the surface state for ridiculous values.", &
default=.false.)
Expand Down Expand Up @@ -2153,6 +2151,11 @@ subroutine initialize_MOM(Time, Time_init, param_file, dirs, CS, restart_CSp, &
if (num_PEs() /= 1) &
call MOM_error(FATAL, "Index rotation is only supported on one PE.")

! Alternate_first_direction is not permitted with index rotation.
! This feature can be added later in the future if needed.
if (CS%alternate_first_direction) &
call MOM_error(FATAL, "Alternating_first_direction is not compatible with index rotation.")

call get_param(param_file, "MOM", "INDEX_TURNS", turns, &
"Number of counterclockwise quarter-turn index rotations.", &
default=1, debuggingParam=.true.)
Expand Down Expand Up @@ -2180,7 +2183,6 @@ subroutine initialize_MOM(Time, Time_init, param_file, dirs, CS, restart_CSp, &
if (CS%rotate_index) then
allocate(CS%G)
call clone_MOM_domain(G_in%Domain, CS%G%Domain, turns=turns, domain_name="MOM_rot")
first_direction = modulo(first_direction + turns, 2)
else
CS%G => G_in
endif
Expand Down Expand Up @@ -2455,8 +2457,11 @@ subroutine initialize_MOM(Time, Time_init, param_file, dirs, CS, restart_CSp, &
endif

! Set a few remaining fields that are specific to the ocean grid type.
call set_first_direction(G, first_direction)
CS%first_dir_restart = real(G%first_direction)
if (CS%rotate_index) then
call set_first_direction(G, modulo(first_direction + turns, 2))
else
call set_first_direction(G, modulo(first_direction, 2))
endif
! Allocate the auxiliary non-symmetric domain for debugging or I/O purposes.
if (CS%debug .or. G%symmetric) then
call clone_MOM_domain(G%Domain, G%Domain_aux, symmetric=.false.)
Expand Down Expand Up @@ -2505,11 +2510,12 @@ subroutine initialize_MOM(Time, Time_init, param_file, dirs, CS, restart_CSp, &
CS%tv%S => CS%S
endif

! Reset the first direction if it was found in a restart file.
if (CS%first_dir_restart > -0.5) &
call set_first_direction(G, NINT(CS%first_dir_restart))
! Store the first direction for the next time a restart file is written.
CS%first_dir_restart = real(G%first_direction)
! Reset the first direction if it was found in a restart file
if (CS%first_dir_restart > -1.0) then
call set_first_direction(G, modulo(NINT(CS%first_dir_restart) + turns, 2))
else
CS%first_dir_restart = real(modulo(first_direction, 2))
endif

call rotate_initial_state(u_in, v_in, h_in, T_in, S_in, use_temperature, &
turns, CS%u, CS%v, CS%h, CS%T, CS%S)
Expand Down Expand Up @@ -2551,6 +2557,13 @@ subroutine initialize_MOM(Time, Time_init, param_file, dirs, CS, restart_CSp, &
param_file, dirs, restart_CSp, CS%ALE_CSp, CS%tracer_Reg, &
CS%sponge_CSp, CS%ALE_sponge_CSp, CS%oda_incupd_CSp, CS%OBC, Time_in)
endif

! Reset the first direction if it was found in a restart file.
if (CS%first_dir_restart > -1.0) then
call set_first_direction(G, NINT(CS%first_dir_restart))
else
CS%first_dir_restart = real(modulo(first_direction, 2))
endif
endif

if (use_ice_shelf .and. CS%debug) &
Expand Down
Loading

0 comments on commit 19d7f94

Please sign in to comment.