Skip to content

Commit

Permalink
Merge branch 'dev/gfdl' into nonBous_brine_plume
Browse files Browse the repository at this point in the history
  • Loading branch information
marshallward authored Nov 8, 2023
2 parents cc66481 + 715f53a commit 2d28042
Show file tree
Hide file tree
Showing 69 changed files with 4,269 additions and 2,510 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/coupled-api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,3 @@ jobs:
- name: Compile MOM6 for the NUOPC driver
shell: bash
run: make check_mom6_api_nuopc -j

- name: Compile MOM6 for the MCT driver
shell: bash
run: make check_mom6_api_mct -j
11 changes: 9 additions & 2 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Read the Docs configuration file for Sphinx projects
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

build:
os: ubuntu-22.04
tools:
python: "3.11"

# Extra formats
# PDF generation is failing for now; disabled on 2020-12-02
#formats:
Expand All @@ -10,7 +19,5 @@ sphinx:
configuration: docs/conf.py

python:
# make sure we're using Python 3
version: 3
install:
- requirements: docs/requirements.txt
59 changes: 22 additions & 37 deletions .testing/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ MAKEFLAGS += -R
-include config.mk

# Set the infra framework
FRAMEWORK ?= fms1
FRAMEWORK ?= fms2

# Set the MPI launcher here
# TODO: This needs more automated configuration
Expand Down Expand Up @@ -245,43 +245,33 @@ COV_LDFLAGS := LDFLAGS="$(LDFLAGS_COVERAGE) $(LDFLAGS_DEPS) $(LDFLAGS_USER)"


# Environment variable configuration
build/symmetric/Makefile: MOM_ENV=$(PATH_FMS) $(SYMMETRIC_FCFLAGS) $(MOM_LDFLAGS)
build/asymmetric/Makefile: MOM_ENV=$(PATH_FMS) $(ASYMMETRIC_FCFLAGS) $(MOM_LDFLAGS) \
MOM_ENV := $(PATH_FMS)
build/symmetric/Makefile: MOM_ENV += $(SYMMETRIC_FCFLAGS) $(MOM_LDFLAGS)
build/asymmetric/Makefile: MOM_ENV += $(ASYMMETRIC_FCFLAGS) $(MOM_LDFLAGS) \
MOM_MEMORY=../../../config_src/memory/dynamic_nonsymmetric/MOM_memory.h
build/repro/Makefile: MOM_ENV=$(PATH_FMS) $(REPRO_FCFLAGS) $(MOM_LDFLAGS)
build/openmp/Makefile: MOM_ENV=$(PATH_FMS) $(OPENMP_FCFLAGS) $(MOM_LDFLAGS)
build/target/Makefile: MOM_ENV=$(PATH_FMS) $(TARGET_FCFLAGS) $(MOM_LDFLAGS)
build/opt/Makefile: MOM_ENV=$(PATH_FMS) $(OPT_FCFLAGS) $(MOM_LDFLAGS)
build/opt_target/Makefile: MOM_ENV=$(PATH_FMS) $(OPT_FCFLAGS) $(MOM_LDFLAGS)
build/coupled/Makefile: MOM_ENV=$(PATH_FMS) $(SYMMETRIC_FCFLAGS) $(MOM_LDFLAGS)
build/nuopc/Makefile: MOM_ENV=$(PATH_FMS) $(SYMMETRIC_FCFLAGS) $(MOM_LDFLAGS)
build/mct/Makefile: MOM_ENV=$(PATH_FMS) $(SYMMETRIC_FCFLAGS) $(MOM_LDFLAGS)
build/cov/Makefile: MOM_ENV=$(PATH_FMS) $(COV_FCFLAGS) $(COV_LDFLAGS)
build/unit/Makefile: MOM_ENV=$(PATH_FMS) $(COV_FCFLAGS) $(COV_LDFLAGS)
build/repro/Makefile: MOM_ENV += $(REPRO_FCFLAGS) $(MOM_LDFLAGS)
build/openmp/Makefile: MOM_ENV += $(OPENMP_FCFLAGS) $(MOM_LDFLAGS)
build/target/Makefile: MOM_ENV += $(TARGET_FCFLAGS) $(MOM_LDFLAGS)
build/opt/Makefile: MOM_ENV += $(OPT_FCFLAGS) $(MOM_LDFLAGS)
build/opt_target/Makefile: MOM_ENV += $(OPT_FCFLAGS) $(MOM_LDFLAGS)
build/coupled/Makefile: MOM_ENV += $(SYMMETRIC_FCFLAGS) $(MOM_LDFLAGS)
build/nuopc/Makefile: MOM_ENV += $(SYMMETRIC_FCFLAGS) $(MOM_LDFLAGS)
build/cov/Makefile: MOM_ENV += $(COV_FCFLAGS) $(COV_LDFLAGS)
build/unit/Makefile: MOM_ENV += $(COV_FCFLAGS) $(COV_LDFLAGS)

# Configure script flags
build/symmetric/Makefile: MOM_ACFLAGS=
build/asymmetric/Makefile: MOM_ACFLAGS=
build/repro/Makefile: MOM_ACFLAGS=
build/openmp/Makefile: MOM_ACFLAGS=--enable-openmp
build/target/Makefile: MOM_ACFLAGS=
build/opt/Makefile: MOM_ACFLAGS=
build/opt_target/Makefile: MOM_ACFLAGS=
build/coupled/Makefile: MOM_ACFLAGS=--with-driver=FMS_cap
build/nuopc/Makefile: MOM_ACFLAGS=--with-driver=nuopc_cap
build/mct/Makefile: MOM_ACFLAGS=--with-driver=mct_cap
build/cov/Makefile: MOM_ACFLAGS=
build/unit/Makefile: MOM_ACFLAGS=--with-driver=unit_tests
MOM_ACFLAGS := --with-framework=$(FRAMEWORK)
build/openmp/Makefile: MOM_ACFLAGS += --enable-openmp
build/coupled/Makefile: MOM_ACFLAGS += --with-driver=FMS_cap
build/nuopc/Makefile: MOM_ACFLAGS += --with-driver=nuopc_cap
build/unit/Makefile: MOM_ACFLAGS += --with-driver=unit_tests

# Fetch regression target source code
build/target/Makefile: | $(TARGET_CODEBASE)
build/opt_target/Makefile: | $(TARGET_CODEBASE)


# Define source code dependencies
# NOTE: ./configure is too much, but Makefile is not enough!
# Ideally we only want to re-run both Makefile and mkmf, but the mkmf call
# is inside ./configure, so we must re-run ./configure as well.
build/target_codebase/configure: $(TARGET_SOURCE)


Expand All @@ -297,8 +287,8 @@ build/%/MOM6: build/%/Makefile $(MOM_SOURCE)
build/%/Makefile: ../ac/configure ../ac/Makefile.in deps/lib/libFMS.a
mkdir -p $(@D)
cd $(@D) \
&& $(MOM_ENV) ../../../ac/configure $(MOM_ACFLAGS) --with-framework=$(FRAMEWORK) \
|| (cat config.log && false)
&& $(MOM_ENV) ../../../ac/configure $(MOM_ACFLAGS) \
|| (cat config.log && false)


../ac/configure: ../ac/configure.ac ../ac/m4
Expand All @@ -310,8 +300,8 @@ build/target/Makefile build/opt_target/Makefile: \
$(TARGET_CODEBASE)/ac/configure deps/lib/libFMS.a
mkdir -p $(@D)
cd $(@D) \
&& $(MOM_ENV) ../../$(TARGET_CODEBASE)/ac/configure $(MOM_ACFLAGS) \
|| (cat config.log && false)
&& $(MOM_ENV) ../../$(TARGET_CODEBASE)/ac/configure $(MOM_ACFLAGS) \
|| (cat config.log && false)


$(TARGET_CODEBASE)/ac/configure: $(TARGET_CODEBASE)
Expand Down Expand Up @@ -370,11 +360,6 @@ build/coupled/ocean_model_MOM.o: build/coupled/Makefile
cd $(@D) && make $(@F)
check_mom6_api_coupled: build/coupled/ocean_model_MOM.o

# MCT driver
build/mct/mom_ocean_model_mct.o: build/mct/Makefile
cd $(@D) && make $(@F)
check_mom6_api_mct: build/mct/mom_ocean_model_mct.o


#---
# Testing
Expand Down
2 changes: 1 addition & 1 deletion ac/deps/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ MAKEFLAGS += -R

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


# List of source files to link this Makefile's dependencies to model Makefiles
Expand Down
2 changes: 1 addition & 1 deletion ac/deps/Makefile.fms.in
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ ARFLAGS = @ARFLAGS@
.PHONY: depend
depend: Makefile.dep
Makefile.dep:
$(PYTHON) $(MAKEDEP) -o Makefile.dep -e -x libFMS.a @srcdir@
$(PYTHON) $(MAKEDEP) -o Makefile.dep -e -x libFMS.a -s @srcdir@/test_fms @srcdir@
20 changes: 16 additions & 4 deletions ac/makedep
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ re_procedure = re.compile(
)


def create_deps(src_dirs, makefile, debug, exec_target, fc_rule,
def create_deps(src_dirs, skip_dirs, makefile, debug, exec_target, fc_rule,
link_externals, script_path):
"""Create "makefile" after scanning "src_dis"."""

# Scan everything Fortran related
all_files = find_files(src_dirs)
all_files = find_files(src_dirs, skip_dirs)

# Lists of things
# ... all F90 source
Expand Down Expand Up @@ -332,10 +332,15 @@ def object_file(src_file):
return os.path.splitext(os.path.basename(src_file))[0] + '.o'


def find_files(src_dirs):
def find_files(src_dirs, skip_dirs):
"""Return sorted list of all source files starting from each directory in
the list "src_dirs"."""

if skip_dirs is not None:
skip = [os.path.normpath(s) for s in skip_dirs]
else:
skip = []

# TODO: Make this a user-defined argument
extensions = ('.f90', '.f', '.c', '.inc', '.h', '.fh')

Expand All @@ -345,6 +350,8 @@ def find_files(src_dirs):
if not os.path.isdir(path):
raise ValueError("Directory '{}' was not found".format(path))
for p, d, f in os.walk(os.path.normpath(path), followlinks=True):
d[:] = [s for s in d if os.path.join(p, s) not in skip]

for file in f:
if any(file.lower().endswith(ext) for ext in extensions):
files.append(p+'/'+file)
Expand Down Expand Up @@ -392,8 +399,13 @@ parser.add_argument(
action='store_true',
help="Annotate the makefile with extra information."
)
parser.add_argument(
'-s', '--skip',
action='append',
help="Skip directory in source code search."
)
args = parser.parse_args()

# Do the thing
create_deps(args.path, args.makefile, args.debug, args.exec_target,
create_deps(args.path, args.skip, args.makefile, args.debug, args.exec_target,
args.fc_rule, args.link_externals, sys.argv[0])
8 changes: 8 additions & 0 deletions config_src/drivers/FMS_cap/ocean_model_MOM.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1197,6 +1197,14 @@ subroutine ocean_model_get_UV_surf(OS, Ocean, name, array2D, isc, jsc)
array2D(i,j) = G%mask2dBu(I+i0,J+j0) * &
0.5*(sfc_state%v(i+i0,J+j0)+sfc_state%v(i+i0+1,J+j0))
enddo ; enddo
case('uc')
do j=jsc_bnd,jec_bnd ; do i=isc_bnd,iec_bnd
array2D(i,j) = G%mask2dCu(I+i0,J+j0) * sfc_state%u(I+i0,j+j0)
enddo ; enddo
case('vc')
do j=jsc_bnd,jec_bnd ; do i=isc_bnd,iec_bnd
array2D(i,j) = G%mask2dCv(I+i0,J+j0) * sfc_state%v(i+i0,J+j0)
enddo ; enddo
case default
call MOM_error(FATAL,'ocean_model_get_UV_surf: unknown argument name='//name)
end select
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ subroutine ocean_model_init(Ocean_sfc, OS, Time_init, Time_in, gas_fields_ocn, i

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, Time_init, OS%dirs%output_directory, OS%forces, OS%fluxes)
endif

if (OS%icebergs_alter_ocean) then
Expand Down
File renamed without changes.
49 changes: 39 additions & 10 deletions config_src/drivers/ice_solo_driver/ice_shelf_driver.F90
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ program Shelf_main
use MOM_cpu_clock, only : cpu_clock_id, cpu_clock_begin, cpu_clock_end
use MOM_cpu_clock, only : CLOCK_COMPONENT
use MOM_debugging, only : MOM_debugging_init
use MOM_diag_mediator, only : diag_mediator_init, diag_mediator_infrastructure_init
use MOM_diag_mediator, only : diag_mediator_init, diag_mediator_infrastructure_init, set_axes_info
use MOM_diag_mediator, only : diag_mediator_end, diag_ctrl, diag_mediator_close_registration
use MOM_domains, only : MOM_infra_init, MOM_infra_end
use MOM_domains, only : MOM_domains_init, clone_MOM_domain, pass_var
Expand Down Expand Up @@ -54,6 +54,8 @@ program Shelf_main
use MOM_verticalGrid, only : verticalGrid_type, verticalGridInit, verticalGridEnd
use MOM_write_cputime, only : write_cputime, MOM_write_cputime_init
use MOM_write_cputime, only : write_cputime_start_clock, write_cputime_CS
use MOM_forcing_type, only : forcing
use MOM_ice_shelf_initialize, only : initialize_ice_SMB

use MOM_ice_shelf, only : initialize_ice_shelf, ice_shelf_end, ice_shelf_CS
use MOM_ice_shelf, only : ice_shelf_save_restart, solo_step_ice_shelf
Expand All @@ -75,7 +77,9 @@ program Shelf_main
! CPU time limit. nmax is determined by evaluating the CPU time used between successive calls to
! write_cputime. Initially it is set to be very large.
integer :: nmax=2000000000

! A structure containing pointers to the thermodynamic forcing fields
! at the ocean surface.
type(forcing) :: fluxes
! A structure containing several relevant directory paths.
type(directories) :: dirs

Expand Down Expand Up @@ -104,7 +108,7 @@ program Shelf_main
real :: time_step ! The time step [T ~> s]

! A pointer to a structure containing metrics and related information.
type(ocean_grid_type), pointer :: ocn_grid
type(ocean_grid_type), pointer :: ocn_grid => NULL()

type(dyn_horgrid_type), pointer :: dG => NULL() ! A dynamic version of the horizontal grid
type(hor_index_type), pointer :: HI => NULL() ! A hor_index_type for array extents
Expand All @@ -114,7 +118,7 @@ program Shelf_main
type(ocean_OBC_type), pointer :: OBC => NULL()

! A pointer to a structure containing dimensional unit scaling factors.
type(unit_scale_type), pointer :: US
type(unit_scale_type), pointer :: US => NULL()

type(diag_ctrl), pointer :: &
diag => NULL() ! A pointer to the diagnostic regulatory structure
Expand All @@ -138,8 +142,9 @@ program Shelf_main
integer :: yr, mon, day, hr, mins, sec ! Temp variables for writing the date.
type(param_file_type) :: param_file ! The structure indicating the file(s)
! containing all run-time parameters.
real :: smb !A constant surface mass balance that can be specified in the param_file
character(len=9) :: month
character(len=16) :: calendar = 'julian'
character(len=16) :: calendar = 'noleap'
integer :: calendar_type=-1

integer :: unit, io_status, ierr
Expand Down Expand Up @@ -184,6 +189,8 @@ program Shelf_main
endif
endif

! Get the names of the I/O directories and initialization file.
! Also calls the subroutine that opens run-time parameter files.
call Get_MOM_Input(param_file, dirs)

! Read ocean_solo restart, which can override settings from the namelist.
Expand Down Expand Up @@ -252,8 +259,11 @@ program Shelf_main
! Set up the ocean model domain and grid; the ice model grid is set in initialize_ice_shelf,
! but the grids have strong commonalities in this configuration, and the ocean grid is required
! to set up the diag mediator control structure.
call MOM_domains_init(ocn_grid%domain, param_file)
allocate(ocn_grid)
call MOM_domains_init(ocn_grid%domain, param_file) !, domain_name='MOM')
allocate(HI)
call hor_index_init(ocn_grid%Domain, HI, param_file)
allocate(dG)
call create_dyn_horgrid(dG, HI)
call clone_MOM_domain(ocn_grid%Domain, dG%Domain)

Expand All @@ -266,11 +276,17 @@ program Shelf_main
! Initialize the diag mediator. The ocean's vertical grid is not really used here, but at
! present the interface to diag_mediator_init assumes the presence of ocean-specific information.
call verticalGridInit(param_file, GV, US)
allocate(diag)
call diag_mediator_init(ocn_grid, GV, US, GV%ke, param_file, diag, doc_file_dir=dirs%output_directory)

call callTree_waypoint("returned from diag_mediator_init()")

call initialize_ice_shelf(param_file, ocn_grid, Time, ice_shelf_CSp, diag)
call set_axes_info(ocn_grid, GV, US, param_file, diag)

call initialize_ice_shelf(param_file, ocn_grid, Time, ice_shelf_CSp, diag, &
Start_time, dirs%output_directory, fluxes_in=fluxes, solo_ice_sheet_in=.true.)

call initialize_ice_SMB(fluxes%shelf_sfc_mass_flux, ocn_grid, US, param_file)

! This is the end of the code that is the counterpart of MOM_initialization.
call callTree_waypoint("End of ice shelf initialization.")
Expand Down Expand Up @@ -378,7 +394,7 @@ program Shelf_main

! This call steps the model over a time time_step.
Time1 = Master_Time ; Time = Master_Time
call solo_step_ice_shelf(ice_shelf_CSp, Time_step_shelf, ns_ice, Time)
call solo_step_ice_shelf(ice_shelf_CSp, Time_step_shelf, ns_ice, Time, fluxes_in=fluxes)

! Time = Time + Time_step_shelf
! This is here to enable fractional-second time steps.
Expand Down Expand Up @@ -412,6 +428,20 @@ program Shelf_main
if (BTEST(Restart_control,0)) then
call ice_shelf_save_restart(ice_shelf_CSp, Time, dirs%restart_output_dir)
endif
! Write ice shelf solo restart file.
if (is_root_pe())then
call open_ASCII_file(unit, trim(dirs%restart_output_dir)//'shelf.res')
write(unit, '(i6,8x,a)') calendar_type, &
'(Calendar: no_calendar=0, thirty_day_months=1, julian=2, gregorian=3, noleap=4)'

call get_date(Start_time, yr, mon, day, hr, mins, sec)
write(unit, '(6i6,8x,a)') yr, mon, day, hr, mins, sec, &
'Model start time: year, month, day, hour, minute, second'
call get_date(Time, yr, mon, day, hr, mins, sec)
write(unit, '(6i6,8x,a)') yr, mon, day, hr, mins, sec, &
'Current model time: year, month, day, hour, minute, second'
call close_file(unit)
endif
restart_time = restart_time + restint
endif

Expand Down Expand Up @@ -456,12 +486,11 @@ program Shelf_main
endif

call callTree_waypoint("End Shelf_main")
call ice_shelf_end(ice_shelf_CSp)
call diag_mediator_end(Time, diag, end_diag_manager=.true.)
if (cpu_steps > 0) call write_cputime(Time, ns-1, write_CPU_CSp, call_end=.true.)
call cpu_clock_end(termClock)

call io_infra_end ; call MOM_infra_end

call ice_shelf_end(ice_shelf_CSp)

end program Shelf_main
Loading

0 comments on commit 2d28042

Please sign in to comment.