Skip to content

Commit

Permalink
Update to latest MOM6
Browse files Browse the repository at this point in the history
- update patch files for updated MOM6 version

- Add new modules to MOM CMakeLists

    Co-authored-by: Dougie Squire <[email protected]>
  • Loading branch information
anton-seaice committed Jan 24, 2025
1 parent 41ca3be commit 6f4670c
Show file tree
Hide file tree
Showing 10 changed files with 65 additions and 69 deletions.
6 changes: 6 additions & 0 deletions MOM6/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ target_sources(OM3_mom6 PRIVATE
MOM6/src/core/MOM_CoriolisAdv.F90
MOM6/src/core/MOM_density_integrals.F90
MOM6/src/core/MOM_dynamics_split_RK2.F90
MOM6/src/core/MOM_dynamics_split_RK2b.F90
MOM6/src/core/MOM_dynamics_unsplit.F90
MOM6/src/core/MOM_dynamics_unsplit_RK2.F90
MOM6/src/core/MOM.F90
Expand All @@ -80,7 +81,9 @@ target_sources(OM3_mom6 PRIVATE
MOM6/src/core/MOM_verticalGrid.F90

MOM6/src/diagnostics/MOM_debugging.F90
MOM6/src/diagnostics/MOM_diagnose_MLD.F90
MOM6/src/diagnostics/MOM_diagnostics.F90
MOM6/src/diagnostics/MOM_harmonic_analysis.F90
MOM6/src/diagnostics/MOM_obsolete_diagnostics.F90
MOM6/src/diagnostics/MOM_obsolete_params.F90
MOM6/src/diagnostics/MOM_spatial_means.F90
Expand All @@ -97,6 +100,7 @@ target_sources(OM3_mom6 PRIVATE
MOM6/src/equation_of_state/MOM_EOS_Wright.F90
MOM6/src/equation_of_state/MOM_EOS_Wright_full.F90
MOM6/src/equation_of_state/MOM_EOS_Wright_red.F90
MOM6/src/equation_of_state/MOM_EOS_base_type.F90
MOM6/src/equation_of_state/MOM_temperature_convert.F90
MOM6/src/equation_of_state/MOM_TFreeze.F90

Expand Down Expand Up @@ -201,7 +205,9 @@ target_sources(OM3_mom6 PRIVATE
MOM6/src/parameterizations/lateral/MOM_MEKE.F90
MOM6/src/parameterizations/lateral/MOM_MEKE_types.F90
MOM6/src/parameterizations/lateral/MOM_mixed_layer_restrat.F90
MOM6/src/parameterizations/lateral/MOM_self_attr_load.F90
MOM6/src/parameterizations/lateral/MOM_spherical_harmonics.F90
MOM6/src/parameterizations/lateral/MOM_streaming_filter.F90
MOM6/src/parameterizations/lateral/MOM_thickness_diffuse.F90
MOM6/src/parameterizations/lateral/MOM_tidal_forcing.F90
MOM6/src/parameterizations/lateral/MOM_Zanna_Bolton.F90
Expand Down
2 changes: 1 addition & 1 deletion MOM6/MOM6
Submodule MOM6 updated 259 files
22 changes: 10 additions & 12 deletions MOM6/patches/MOM_PointAccel.F90.patch
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
--- ../MOM6/src/diagnostics/MOM_PointAccel.F90 2024-10-23 10:07:22.000000000 +1100
+++ ../MOM6/src/diagnostics/MOM_PointAccel.F90.new 2024-10-23 10:15:54.000000000 +1100
@@ -122,8 +122,8 @@
if (CS%u_file < 0) then
diff --git a/MOM6/src/diagnostics/MOM_PointAccel.F90 b/MOM6/src/diagnostics/MOM_PointAccel.F90.new
index 30f0803..7f91f79 100644
--- a/MOM6/src/diagnostics/MOM_PointAccel.F90
+++ b/MOM6/src/diagnostics/MOM_PointAccel.F90.new
@@ -124,7 +124,7 @@ subroutine write_u_accel(I, j, um, hin, ADp, CDp, dt, G, GV, US, CS, vel_rpt, st
if (CS%u_file == -1) then
if (len_trim(CS%u_trunc_file) < 1) return
call open_ASCII_file(CS%u_file, trim(CS%u_trunc_file), action=APPEND_FILE, &
- threading=MULTIPLE, fileset=SINGLE_FILE)
- if (CS%u_file < 0) then
+ threading=MULTIPLE, fileset=MULTIPLE)
+ if (CS%u_file == -1) then
if (CS%u_file == -1) then
call MOM_error(NOTE, 'Unable to open file '//trim(CS%u_trunc_file)//'.')
return
endif
@@ -461,8 +461,8 @@
if (CS%v_file < 0) then
@@ -465,7 +465,7 @@ subroutine write_v_accel(i, J, vm, hin, ADp, CDp, dt, G, GV, US, CS, vel_rpt, st
if (CS%v_file == -1) then
if (len_trim(CS%v_trunc_file) < 1) return
call open_ASCII_file(CS%v_file, trim(CS%v_trunc_file), action=APPEND_FILE, &
- threading=MULTIPLE, fileset=SINGLE_FILE)
- if (CS%v_file < 0) then
+ threading=MULTIPLE, fileset=MULTIPLE)
+ if (CS%v_file == -1) then
if (CS%v_file == -1) then
call MOM_error(NOTE, 'Unable to open file '//trim(CS%v_trunc_file)//'.')
return
endif
6 changes: 3 additions & 3 deletions MOM6/patches/MOM_coupler_types.F90.patch
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
diff --git a/MOM6/src/framework/MOM_coupler_types.F90 b/MOM6/src/framework/MOM_coupler_types.F90.new
index f87b409..124d786 100644
index b931a2d..cac9309 100644
--- a/MOM6/src/framework/MOM_coupler_types.F90
+++ b/MOM6/src/framework/MOM_coupler_types.F90.new
@@ -8,7 +8,10 @@ use MOM_couplertype_infra, only : CT_set_diags, CT_send_data, CT_write_chksums,
@@ -9,7 +9,10 @@ use MOM_couplertype_infra, only : CT_set_diags, CT_send_data, CT_write_chksums,
use MOM_couplertype_infra, only : CT_copy_data, CT_increment_data, CT_rescale_data
use MOM_couplertype_infra, only : CT_set_data, CT_extract_data, CT_redistribute_data
use MOM_couplertype_infra, only : coupler_1d_bc_type, coupler_2d_bc_type, coupler_3d_bc_type
Expand All @@ -14,7 +14,7 @@ index f87b409..124d786 100644
use MOM_domain_infra, only : domain2D
use MOM_time_manager, only : time_type

@@ -22,7 +25,10 @@ public :: atmos_ocn_coupler_flux, coupler_type_data_override
@@ -23,7 +26,10 @@ public :: atmos_ocn_coupler_flux, coupler_type_data_override
public :: coupler_1d_bc_type, coupler_2d_bc_type, coupler_3d_bc_type
! These are encoding constant parameters that indicate whether a flux, solubility or
! surface ocean concentration are being set or accessed with an inquiry.
Expand Down
4 changes: 2 additions & 2 deletions MOM6/patches/MOM_forcing_type.F90.patch
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
diff --git a/MOM6/src/core/MOM_forcing_type.F90 b/MOM6/src/core/MOM_forcing_type.F90.new
index 200bbd7..fca9187 100644
index 998713d..a2efcaa 100644
--- a/MOM6/src/core/MOM_forcing_type.F90
+++ b/MOM6/src/core/MOM_forcing_type.F90.new
@@ -2080,6 +2080,11 @@ subroutine fluxes_accumulate(flux_tmp, fluxes, G, wt2, forces)
@@ -2280,6 +2280,11 @@ subroutine fluxes_accumulate(flux_tmp, fluxes, G, wt2, forces)

fluxes%salt_flux(i,j) = wt1*fluxes%salt_flux(i,j) + wt2*flux_tmp%salt_flux(i,j)
enddo ; enddo
Expand Down
15 changes: 2 additions & 13 deletions MOM6/patches/MOM_generic_tracer.F90.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/MOM6/src/tracer/MOM_generic_tracer.F90 b/MOM6/src/tracer/MOM_generic_tracer.F90.new
index 131110e..ae75b2e 100644
index 6b10d15..e092aa7 100644
--- a/MOM6/src/tracer/MOM_generic_tracer.F90
+++ b/MOM6/src/tracer/MOM_generic_tracer.F90.new
@@ -21,7 +21,7 @@ module MOM_generic_tracer
Expand All @@ -11,18 +11,7 @@ index 131110e..ae75b2e 100644

use g_tracer_utils, only: g_tracer_get_name,g_tracer_set_values,g_tracer_set_common,g_tracer_get_common
use g_tracer_utils, only: g_tracer_get_next,g_tracer_type,g_tracer_is_prog,g_tracer_flux_init
@@ -352,7 +352,9 @@ contains
enddo ; enddo ; enddo

!jgj: Reset CASED to 0 below K=1
- if ( (trim(g_tracer_name) == 'cased') .or. (trim(g_tracer_name) == 'ca13csed') ) then
+ ! dts: also WOMBAT sediment tracers
+ if ( (trim(g_tracer_name) == 'cased') .or. (trim(g_tracer_name) == 'ca13csed') .or. &
+ (trim(g_tracer_name) == 'det_sediment') .or. (trim(g_tracer_name) == 'caco3_sediment')) then
do k=2,nk ; do j=jsc,jec ; do i=isc,iec
if (tr_ptr(i,j,k) /= CS%tracer_land_val) then
tr_ptr(i,j,k) = 0.0
@@ -507,6 +509,11 @@ contains
@@ -527,6 +527,11 @@ contains
! the fluxes without coming into this subroutine.
! MOM5 has to modified to conform.

Expand Down
10 changes: 6 additions & 4 deletions MOM6/patches/MOM_io_infra.F90.patch
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
--- ../MOM6/config_src/infra/FMS2/MOM_io_infra.F90 2024-10-23 10:07:33.000000000 +1100
+++ ../MOM6/config_src/infra/FMS2/MOM_io_infra.F90.new 2024-10-23 10:16:45.000000000 +1100
@@ -376,8 +376,7 @@
diff --git a/MOM6/config_src/infra/FMS2/MOM_io_infra.F90 b/MOM6/config_src/infra/FMS2/MOM_io_infra.F90.new
index a43b4e9..169ed25 100644
--- a/MOM6/config_src/infra/FMS2/MOM_io_infra.F90
+++ b/MOM6/config_src/infra/FMS2/MOM_io_infra.F90.new
@@ -376,8 +376,7 @@ subroutine open_ASCII_file(unit, file, action, threading, fileset)
logical :: exists
logical :: is_open
character(len=6) :: action_arg, position_arg
Expand All @@ -10,7 +12,7 @@
! NOTE: This function is written to emulate the original behavior of mpp_open
! from the FMS1 library, on which the MOM API is still based. Much of this
! can be removed if we choose to drop this compatibility, but for now we
@@ -433,12 +432,12 @@
@@ -433,12 +432,12 @@ subroutine open_ASCII_file(unit, file, action, threading, fileset)
endif
endif

Expand Down
32 changes: 16 additions & 16 deletions MOM6/patches/mom_cap.F90.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/MOM6/config_src/drivers/nuopc_cap/mom_cap.F90 b/MOM6/config_src/drivers/nuopc_cap/mom_cap.F90.new
index 3574943..f948684 100644
index fab6fe1..541d7f1 100644
--- a/MOM6/config_src/drivers/nuopc_cap/mom_cap.F90
+++ b/MOM6/config_src/drivers/nuopc_cap/mom_cap.F90.new
@@ -2,8 +2,9 @@
Expand Down Expand Up @@ -53,7 +53,7 @@ index 3574943..f948684 100644
end type

!> Wrapper-derived type required to associate an internal state instance
@@ -408,6 +422,10 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
@@ -416,6 +430,10 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
type (ocean_public_type), pointer :: ocean_public => NULL()
type (ocean_state_type), pointer :: ocean_state => NULL()
type(ice_ocean_boundary_type), pointer :: Ice_ocean_boundary => NULL()
Expand All @@ -64,15 +64,15 @@ index 3574943..f948684 100644
type(ocean_internalstate_wrapper) :: ocean_internalstate
type(ocean_grid_type), pointer :: ocean_grid => NULL()
type(directories) :: dirs
@@ -439,6 +457,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
@@ -447,6 +465,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
character(len=512) :: restartfile ! Path/Name of restart file
character(len=2048) :: restartfiles ! Path/Name of restart files
! (same as restartfile if single restart file)
+ character(240) :: additional_restart_dir
character(len=*), parameter :: subname='(MOM_cap:InitializeAdvertise)'
character(len=32) :: calendar
character(len=:), allocatable :: rpointer_filename
@@ -517,6 +536,8 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
@@ -525,6 +544,8 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
call MOM_infra_init(mpi_comm_mom)

Expand All @@ -81,7 +81,7 @@ index 3574943..f948684 100644
! determine the calendar
if (cesm_coupled) then
call NUOPC_CompAttributeGet(gcomp, name="calendar", value=cvalue, &
@@ -648,13 +669,44 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
@@ -656,13 +677,44 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)

endif

Expand Down Expand Up @@ -126,7 +126,7 @@ index 3574943..f948684 100644

! GMM, this call is not needed in CESM. Check with EMC if it can be deleted.
call ocean_model_flux_init(ocean_state)
@@ -721,6 +773,31 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
@@ -729,6 +781,31 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
Ice_ocean_boundary%hcond = 0.0
endif

Expand Down Expand Up @@ -158,7 +158,7 @@ index 3574943..f948684 100644
call query_ocean_state(ocean_state, use_waves=use_waves, wave_method=wave_method)
if (use_waves) then
if (wave_method == "EFACTOR") then
@@ -789,6 +866,15 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
@@ -797,6 +874,15 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
endif
endif

Expand All @@ -174,7 +174,7 @@ index 3574943..f948684 100644
!--------- export fields -------------
call fld_list_add(fldsFrOcn_num, fldsFrOcn, "So_omask" , "will provide")
call fld_list_add(fldsFrOcn_num, fldsFrOcn, "So_t" , "will provide")
@@ -800,6 +886,8 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
@@ -808,6 +894,8 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
call fld_list_add(fldsFrOcn_num, fldsFrOcn, "Fioo_q" , "will provide")
call fld_list_add(fldsFrOcn_num, fldsFrOcn, "So_bldepth" , "will provide")

Expand All @@ -183,7 +183,7 @@ index 3574943..f948684 100644
do n = 1,fldsToOcn_num
call NUOPC_Advertise(importState, standardName=fldsToOcn(n)%stdname, name=fldsToOcn(n)%shortname, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
@@ -1611,11 +1699,14 @@ subroutine ModelAdvance(gcomp, rc)
@@ -1619,11 +1707,14 @@ subroutine ModelAdvance(gcomp, rc)
type (ocean_public_type), pointer :: ocean_public => NULL()
type (ocean_state_type), pointer :: ocean_state => NULL()
type(ice_ocean_boundary_type), pointer :: Ice_ocean_boundary => NULL()
Expand All @@ -198,7 +198,7 @@ index 3574943..f948684 100644
integer :: dth, dtm, dts
integer :: nc
type(ESMF_Time) :: MyTime
@@ -1627,12 +1718,13 @@ subroutine ModelAdvance(gcomp, rc)
@@ -1635,12 +1726,13 @@ subroutine ModelAdvance(gcomp, rc)
integer :: writeunit
integer :: localPet
type(ESMF_VM) :: vm
Expand All @@ -213,15 +213,15 @@ index 3574943..f948684 100644
integer :: num_rest_files
real(8) :: MPI_Wtime, timers
logical :: write_restart
@@ -1673,6 +1765,7 @@ subroutine ModelAdvance(gcomp, rc)
@@ -1683,6 +1775,7 @@ subroutine ModelAdvance(gcomp, rc)

Time_step_coupled = esmf2fms_time(timeStep)
Time = esmf2fms_time(currTime)
+ Time_import = Time

!---------------
! Apply ocean lag for startup runs:
@@ -1748,8 +1841,39 @@ subroutine ModelAdvance(gcomp, rc)
@@ -1758,8 +1851,39 @@ subroutine ModelAdvance(gcomp, rc)
! Import data
!---------------

Expand Down Expand Up @@ -261,7 +261,7 @@ index 3574943..f948684 100644

!---------------
! Update MOM6
@@ -1811,7 +1935,7 @@ subroutine ModelAdvance(gcomp, rc)
@@ -1831,7 +1955,7 @@ subroutine ModelAdvance(gcomp, rc)
! determine restart filename
call ESMF_ClockGetNextTime(clock, MyTime, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
Expand All @@ -270,7 +270,7 @@ index 3574943..f948684 100644
if (ChkErr(rc,__LINE__,u_FILE_u)) return

if (cesm_coupled) then
@@ -1869,6 +1993,14 @@ subroutine ModelAdvance(gcomp, rc)
@@ -1889,6 +2013,14 @@ subroutine ModelAdvance(gcomp, rc)

endif

Expand All @@ -285,15 +285,15 @@ index 3574943..f948684 100644
if (is_root_pe()) then
write(stdout,*) subname//' writing restart file ',trim(restartname)
endif
@@ -2149,6 +2281,7 @@ subroutine ocean_model_finalize(gcomp, rc)
@@ -2169,6 +2301,7 @@ subroutine ocean_model_finalize(gcomp, rc)
integer :: alarmCount
character(len=64) :: timestamp
logical :: write_restart
+ character(240) :: additional_restart_dir
character(len=*),parameter :: subname='(MOM_cap:ocean_model_finalize)'
real(8) :: MPI_Wtime, timefs

@@ -2182,6 +2315,18 @@ subroutine ocean_model_finalize(gcomp, rc)
@@ -2202,6 +2335,18 @@ subroutine ocean_model_finalize(gcomp, rc)

call ocean_model_end(ocean_public, ocean_State, Time, write_restart=write_restart)

Expand Down
19 changes: 10 additions & 9 deletions MOM6/patches/mom_cap_methods.F90.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/MOM6/config_src/drivers/nuopc_cap/mom_cap_methods.F90 b/MOM6/config_src/drivers/nuopc_cap/mom_cap_methods.F90.new
index 125bae5..67f3314 100644
index 125bae5..3f81f6a 100644
--- a/MOM6/config_src/drivers/nuopc_cap/mom_cap_methods.F90
+++ b/MOM6/config_src/drivers/nuopc_cap/mom_cap_methods.F90.new
@@ -20,8 +20,15 @@ use MOM_ocean_model_nuopc, only: ocean_public_type, ocean_state_type
Expand All @@ -18,25 +18,26 @@ index 125bae5..67f3314 100644
! By default make data private
implicit none; private

@@ -72,11 +79,16 @@ end subroutine mom_set_geomtype
@@ -72,11 +79,17 @@ end subroutine mom_set_geomtype
!> This function has a few purposes:
!! (1) it imports surface fluxes using data from the mediator; and
!! (2) it can apply restoring in SST and SSS.
-subroutine mom_import(ocean_public, ocean_grid, importState, ice_ocean_boundary, rc)
+!! (3) optional: if atm_fields is provided, it imports and sets the fields in atm_fields required for the
+!! calculation of coupled generic tracer fluxes
+!! (3) optional: if atm_fields is provided, it imports and sets the fields in atm_fields required
+!! for the calculation of coupled generic tracer fluxes
+subroutine mom_import(ocean_public, ocean_grid, importState, ice_ocean_boundary, atm_fields, rc)
type(ocean_public_type) , intent(in) :: ocean_public !< Ocean surface state
type(ocean_grid_type) , intent(in) :: ocean_grid !< Ocean model grid
type(ESMF_State) , intent(inout) :: importState !< incoming data from mediator
type(ice_ocean_boundary_type) , intent(inout) :: ice_ocean_boundary !< Ocean boundary forcing
+ type(coupler_2d_bc_type), optional, intent(inout) :: atm_fields !< If present, this type describes the atmospheric
+ !! tracer fields to be imported for the calculation
+ !! of generic tracer fluxes.
+ type(coupler_2d_bc_type), optional, intent(inout) :: atm_fields !< If present, this type
+ !! describes the atmospheric tracer fields to
+ !! be imported for the calculation of generic
+ !! tracer fluxes.
integer , intent(inout) :: rc !< Return code

! Local Variables
@@ -88,7 +100,10 @@ subroutine mom_import(ocean_public, ocean_grid, importState, ice_ocean_boundary,
@@ -88,7 +101,10 @@ subroutine mom_import(ocean_public, ocean_grid, importState, ice_ocean_boundary,
real(ESMF_KIND_R8), allocatable :: tauy(:,:)
real(ESMF_KIND_R8), allocatable :: stkx(:,:,:)
real(ESMF_KIND_R8), allocatable :: stky(:,:,:)
Expand All @@ -47,7 +48,7 @@ index 125bae5..67f3314 100644

rc = ESMF_SUCCESS

@@ -364,6 +379,48 @@ subroutine mom_import(ocean_public, ocean_grid, importState, ice_ocean_boundary,
@@ -364,6 +380,48 @@ subroutine mom_import(ocean_public, ocean_grid, importState, ice_ocean_boundary,
deallocate(stkx,stky)
endif

Expand Down
Loading

0 comments on commit 6f4670c

Please sign in to comment.