From 4f0c3efc990cc1d2d568c276631078ade28299dd Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Mon, 29 Jul 2024 09:45:36 -0400 Subject: [PATCH 1/4] v2: Support for MOM6 as of 2024-Jul-29 --- MOM6_GEOSPlug/mom6_cmake/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MOM6_GEOSPlug/mom6_cmake/CMakeLists.txt b/MOM6_GEOSPlug/mom6_cmake/CMakeLists.txt index 6c378e3..41ee84e 100644 --- a/MOM6_GEOSPlug/mom6_cmake/CMakeLists.txt +++ b/MOM6_GEOSPlug/mom6_cmake/CMakeLists.txt @@ -50,6 +50,7 @@ list( APPEND MOM6_SRCS src/core/MOM_CoriolisAdv.F90 src/core/MOM_density_integrals.F90 src/core/MOM_dynamics_split_RK2.F90 + src/core/MOM_dynamics_split_RK2b.F90 src/core/MOM_dynamics_unsplit.F90 src/core/MOM_dynamics_unsplit_RK2.F90 src/core/MOM.F90 @@ -76,6 +77,7 @@ list( APPEND MOM6_SRCS src/diagnostics/MOM_sum_output.F90 src/diagnostics/MOM_wave_speed.F90 src/equation_of_state/MOM_EOS.F90 + src/equation_of_state/MOM_EOS_base_type.F90 src/equation_of_state/MOM_EOS_Jackett06.F90 src/equation_of_state/MOM_EOS_Roquet_SpV.F90 src/equation_of_state/MOM_EOS_Roquet_rho.F90 From 5b6e23643b2e169b4fc9b67db6ffe8a641a1bedd Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Thu, 15 Aug 2024 11:13:57 -0400 Subject: [PATCH 2/4] Remove DEFAULT_2018_ANSWERS as obsolete --- MOM6_GEOSPlug/mom6_app/1440x1080/MOM_input | 2 -- MOM6_GEOSPlug/mom6_app/1440x1080/MOM_override | 1 - MOM6_GEOSPlug/mom6_app/1440x1080/MOM_parameter_doc.all | 2 -- MOM6_GEOSPlug/mom6_app/540x458/MOM_parameter_doc.all | 2 -- MOM6_GEOSPlug/mom6_app/72x36/MOM_parameter_doc.all | 2 -- 5 files changed, 9 deletions(-) diff --git a/MOM6_GEOSPlug/mom6_app/1440x1080/MOM_input b/MOM6_GEOSPlug/mom6_app/1440x1080/MOM_input index 546b538..3fbe312 100644 --- a/MOM6_GEOSPlug/mom6_app/1440x1080/MOM_input +++ b/MOM6_GEOSPlug/mom6_app/1440x1080/MOM_input @@ -87,8 +87,6 @@ BAD_VAL_SST_MAX = 55.0 ! [deg C] default = 45.0 BAD_VAL_SST_MIN = -3.0 ! [deg C] default = -2.1 ! The value of SST below which a bad value message is triggered, if ! CHECK_BAD_SURFACE_VALS is true. -DEFAULT_2018_ANSWERS = True ! [Boolean] default = True - ! This sets the default value for the various _2018_ANSWERS parameters. WRITE_GEOM = 0 ! default = 1 ! If =0, never write the geometry and vertical grid files. If =1, write the ! geometry and vertical grid files only for a new simulation. If =2, always diff --git a/MOM6_GEOSPlug/mom6_app/1440x1080/MOM_override b/MOM6_GEOSPlug/mom6_app/1440x1080/MOM_override index 309ba73..dd28cee 100644 --- a/MOM6_GEOSPlug/mom6_app/1440x1080/MOM_override +++ b/MOM6_GEOSPlug/mom6_app/1440x1080/MOM_override @@ -51,5 +51,4 @@ RESTART_CHECKSUMS_REQUIRED = False #override PRESSURE_DEPENDENT_FRAZIL = False ! ! update answers -#override DEFAULT_2018_ANSWERS = False ! diff --git a/MOM6_GEOSPlug/mom6_app/1440x1080/MOM_parameter_doc.all b/MOM6_GEOSPlug/mom6_app/1440x1080/MOM_parameter_doc.all index aca7160..daa533d 100644 --- a/MOM6_GEOSPlug/mom6_app/1440x1080/MOM_parameter_doc.all +++ b/MOM6_GEOSPlug/mom6_app/1440x1080/MOM_parameter_doc.all @@ -150,8 +150,6 @@ BAD_VAL_COLUMN_THICKNESS = 0.0 ! [m] default = 0.0 ! CHECK_BAD_SURFACE_VALS is true. DEFAULT_ANSWER_DATE = 99991231 ! default = 99991231 ! This sets the default value for the various _ANSWER_DATE parameters. -DEFAULT_2018_ANSWERS = False ! [Boolean] default = False - ! This sets the default value for the various _2018_ANSWERS parameters. SURFACE_2018_ANSWERS = False ! [Boolean] default = False ! If true, use expressions for the surface properties that recover the answers ! from the end of 2018. Otherwise, use more appropriate expressions that differ diff --git a/MOM6_GEOSPlug/mom6_app/540x458/MOM_parameter_doc.all b/MOM6_GEOSPlug/mom6_app/540x458/MOM_parameter_doc.all index 4fd1781..85245ab 100644 --- a/MOM6_GEOSPlug/mom6_app/540x458/MOM_parameter_doc.all +++ b/MOM6_GEOSPlug/mom6_app/540x458/MOM_parameter_doc.all @@ -150,8 +150,6 @@ BAD_VAL_COLUMN_THICKNESS = 0.0 ! [m] default = 0.0 ! CHECK_BAD_SURFACE_VALS is true. DEFAULT_ANSWER_DATE = 99991231 ! default = 99991231 ! This sets the default value for the various _ANSWER_DATE parameters. -DEFAULT_2018_ANSWERS = False ! [Boolean] default = False - ! This sets the default value for the various _2018_ANSWERS parameters. SURFACE_2018_ANSWERS = False ! [Boolean] default = False ! If true, use expressions for the surface properties that recover the answers ! from the end of 2018. Otherwise, use more appropriate expressions that differ diff --git a/MOM6_GEOSPlug/mom6_app/72x36/MOM_parameter_doc.all b/MOM6_GEOSPlug/mom6_app/72x36/MOM_parameter_doc.all index c414eda..f1dcff3 100644 --- a/MOM6_GEOSPlug/mom6_app/72x36/MOM_parameter_doc.all +++ b/MOM6_GEOSPlug/mom6_app/72x36/MOM_parameter_doc.all @@ -127,8 +127,6 @@ BAD_VAL_SST_MIN = -3.0 ! [deg C] default = -2.1 BAD_VAL_COLUMN_THICKNESS = 0.0 ! [m] default = 0.0 ! The value of column thickness below which a bad value message is triggered, if ! CHECK_BAD_SURFACE_VALS is true. -DEFAULT_2018_ANSWERS = False ! [Boolean] default = False - ! This sets the default value for the various _2018_ANSWERS parameters. SURFACE_2018_ANSWERS = False ! [Boolean] default = False ! If true, use expressions for the surface properties that recover the answers ! from the end of 2018. Otherwise, use more appropriate expressions that differ From 493ad653e026012785043faee457f92fa44417cc Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Tue, 20 Aug 2024 09:39:47 -0400 Subject: [PATCH 3/4] Update MOM6 Overrides to match current MOM6 results With the merge of https://github.com/mom-ocean/MOM6/pull/1631 into our MOM6 fork in [MOM6 geos/v3.2](https://github.com/GEOS-ESM/MOM6/releases/tag/geos%2Fv3.2) without any changes, the answers will change. So, until these can be tested, we set: ``` USE_HUYNH_STENCIL_BUG = True EPBL_ANSWER_DATE = 20231231 ``` in the `MOM_override` files. --- MOM6_GEOSPlug/mom6_app/1440x1080/MOM_override | 7 +++++++ MOM6_GEOSPlug/mom6_app/540x458/MOM_override | 6 ++++++ MOM6_GEOSPlug/mom6_app/72x36/MOM_override | 7 +++++++ 3 files changed, 20 insertions(+) diff --git a/MOM6_GEOSPlug/mom6_app/1440x1080/MOM_override b/MOM6_GEOSPlug/mom6_app/1440x1080/MOM_override index 309ba73..cfef646 100644 --- a/MOM6_GEOSPlug/mom6_app/1440x1080/MOM_override +++ b/MOM6_GEOSPlug/mom6_app/1440x1080/MOM_override @@ -53,3 +53,10 @@ RESTART_CHECKSUMS_REQUIRED = False ! update answers #override DEFAULT_2018_ANSWERS = False ! + +! Overrides to match results from previous MOM6 version +! See https://github.com/GEOS-ESM/MOM6/releases/tag/geos%2Fv3.2 +! and https://github.com/mom-ocean/MOM6/pull/1631#issuecomment-2252914251 + +#override USE_HUYNH_STENCIL_BUG = True +#override EPBL_ANSWER_DATE = 20231231 diff --git a/MOM6_GEOSPlug/mom6_app/540x458/MOM_override b/MOM6_GEOSPlug/mom6_app/540x458/MOM_override index f4e047b..74cc06e 100755 --- a/MOM6_GEOSPlug/mom6_app/540x458/MOM_override +++ b/MOM6_GEOSPlug/mom6_app/540x458/MOM_override @@ -68,3 +68,9 @@ TOPO_FILE = "ocean_topog.nc" #override BAD_VAL_SST_MAX = 55.0 #override BAD_VAL_SST_MIN = -3.0 +! Overrides to match results from previous MOM6 version +! See https://github.com/GEOS-ESM/MOM6/releases/tag/geos%2Fv3.2 +! and https://github.com/mom-ocean/MOM6/pull/1631#issuecomment-2252914251 + +#override USE_HUYNH_STENCIL_BUG = True +#override EPBL_ANSWER_DATE = 20231231 diff --git a/MOM6_GEOSPlug/mom6_app/72x36/MOM_override b/MOM6_GEOSPlug/mom6_app/72x36/MOM_override index 143ec4a..68d3aa0 100755 --- a/MOM6_GEOSPlug/mom6_app/72x36/MOM_override +++ b/MOM6_GEOSPlug/mom6_app/72x36/MOM_override @@ -31,3 +31,10 @@ #override HFREEZE = 10.0 #override BAD_VAL_SST_MIN = -3.0 #override BAD_VAL_SSS_MAX = 55.0 + +! Overrides to match results from previous MOM6 version +! See https://github.com/GEOS-ESM/MOM6/releases/tag/geos%2Fv3.2 +! and https://github.com/mom-ocean/MOM6/pull/1631#issuecomment-2252914251 + +#override USE_HUYNH_STENCIL_BUG = True +#override EPBL_ANSWER_DATE = 20231231 From 29625b1a8e6730c4674d77f701f0443ef19c75ae Mon Sep 17 00:00:00 2001 From: Michael Mehari Date: Fri, 28 Feb 2025 13:22:01 -0500 Subject: [PATCH 4/4] Added export for MOM6 T, S and DH fields to be imported by NOBM --- MOM6_GEOSPlug/MOM6_GEOSPlug.F90 | 90 +++++++++++++++++++---- MOM6_GEOSPlug/MOM6_GEOSPlug_StateSpecs.rc | 8 +- 2 files changed, 78 insertions(+), 20 deletions(-) diff --git a/MOM6_GEOSPlug/MOM6_GEOSPlug.F90 b/MOM6_GEOSPlug/MOM6_GEOSPlug.F90 index 58f07b7..9a6fc7e 100644 --- a/MOM6_GEOSPlug/MOM6_GEOSPlug.F90 +++ b/MOM6_GEOSPlug/MOM6_GEOSPlug.F90 @@ -44,16 +44,19 @@ module MOM6_GEOSPlugMod use MOM_grid, only: ocean_grid_type - use ocean_model_mod, only: get_ocean_grid, & - ocean_model_init, & - ocean_model_init_sfc, & - update_ocean_model, & - ocean_model_end, & - ocean_model_restart, & - ocean_model_data_get, & - ocean_public_type, & - ocean_state_type, & - ocean_model_get_UV_surf + use ocean_model_mod, only: get_ocean_grid, & + ocean_model_init, & + ocean_model_init_sfc, & + update_ocean_model, & + ocean_model_end, & + ocean_model_restart, & + ocean_model_data_get, & + ocean_public_type, & + ocean_state_type, & + ocean_model_get_UV_surf, & + ocean_model_get_thickness, & + ocean_model_get_prog_tracer, & + ocean_model_get_prog_tracer_index use MOM_surface_forcing_gfdl, only: ice_ocean_boundary_type @@ -182,7 +185,7 @@ subroutine Initialize ( GC, IMPORT, EXPORT, CLOCK, RC ) integer :: Comm integer :: isc,iec,jsc,jec integer :: isd,ied,jsd,jed - integer :: IM, JM + integer :: IM, JM, LM integer :: g_isc,g_iec,g_jsc,g_jec integer :: g_isd,g_ied,g_jsd,g_jed integer :: YEAR,MONTH,DAY,HR,MN,SC @@ -216,11 +219,14 @@ subroutine Initialize ( GC, IMPORT, EXPORT, CLOCK, RC ) REAL_, pointer :: MOM_2D_MASK(:,:) => null() REAL_, pointer :: SLV(:,:) => null() - real, allocatable :: Tmp2(:,:) + real, allocatable :: Tmp2(:,:), Tmp3(:,:,:) + + REAL_, pointer, dimension(:, :, :) :: DH, TL, SL integer :: DT_OCEAN character(len=7) :: wind_stagger ! 'AGRID' or 'BGRID' or 'CGRID' integer ::iwind_stagger ! AGRID or BGRID or CGRID + integer :: i __Iam__('Initialize') @@ -353,6 +359,9 @@ subroutine Initialize ( GC, IMPORT, EXPORT, CLOCK, RC ) ASSERT_(counts(1)==IM) ASSERT_(counts(2)==JM) + call get_ocean_grid(Ocean_state, Ocean_grid) + LM=Ocean_grid%ke + ! Check run time surface current stagger option set in MOM_input ! to make sure it matches what is expected here !--------------------------------------------------------------- @@ -443,6 +452,24 @@ subroutine Initialize ( GC, IMPORT, EXPORT, CLOCK, RC ) call MAPL_GetPointer(EXPORT, SW, 'SW' , alloc=.true., _RC) call MAPL_GetPointer(EXPORT, AREA, 'AREA', alloc=.true., _RC) call MAPL_GetPointer(EXPORT, SLV, 'SLV', alloc=.true., _RC) + call MAPL_GetPointer(EXPORT, DH, 'DH' , alloc=.true., _RC) + call MAPL_GetPointer(EXPORT, TL, 'T', alloc=.true., _RC) + call MAPL_GetPointer(EXPORT, SL, 'S', alloc=.true., _RC) + +! Get the 3-D MOM data +!--------------------- + allocate(Tmp3(IM,JM,LM), __STAT__) + + call ocean_model_get_thickness(Ocean_State, tmp3, isc, jsc) + DH = real(tmp3, kind=GeosKind) + + call ocean_model_get_prog_tracer_index(Ocean_State,i,'temp') + call ocean_model_get_prog_tracer(Ocean_State,i, tmp3, isc, jsc) + TL = real(tmp3,kind=GeosKind) + MAPL_TICE + + call ocean_model_get_prog_tracer_index(Ocean_State,i,'salt') + call ocean_model_get_prog_tracer(Ocean_State, i, tmp3, isc, jsc) + SL = real(tmp3,kind=GeosKind) ! Get the 2-D MOM data !--------------------- @@ -471,6 +498,7 @@ subroutine Initialize ( GC, IMPORT, EXPORT, CLOCK, RC ) end if deallocate(Tmp2, __STAT__) + deallocate(Tmp3, __STAT__) RETURN_(ESMF_SUCCESS) end subroutine Initialize @@ -512,6 +540,7 @@ subroutine Run ( GC, IMPORT, EXPORT, CLOCK, RC ) type(ocean_public_type), pointer :: Ocean => null() type(ocean_state_type), pointer :: Ocean_State => null() type(MOM_MAPL_Type), pointer :: MOM_MAPL_internal_state => null() + type(ocean_grid_type), pointer :: Ocean_grid => null() type(MOM_MAPLWrap_Type) :: wrap !#include "MOM6_GEOSPlug_DeclarePointer___.h" ! Because these are "real(kind=GeosKind)" not using ACG. @@ -531,6 +560,9 @@ subroutine Run ( GC, IMPORT, EXPORT, CLOCK, RC ) REAL_, pointer :: MOM_2D_MASK (:,:) => null() REAL_, pointer :: AREA (:,:) => null() REAL_, pointer :: T_Freeze (:,:) => null() + REAL_, pointer :: DH (:,:,:) => null() + REAL_, pointer :: TL (:,:,:) => null() + REAL_, pointer :: SL (:,:,:) => null() ! Imports REAL_, pointer :: TAUX(:,:) => null() @@ -555,11 +587,11 @@ subroutine Run ( GC, IMPORT, EXPORT, CLOCK, RC ) REAL_, pointer :: TAUYBOT(:,:) => null() ! Temporaries - real, allocatable :: U (:,:), V(:,:) + real, allocatable :: U(:,:), V(:,:), H(:,:,:) real, allocatable :: cos_rot(:,:) real, allocatable :: sin_rot(:,:) - integer :: IM, JM + integer :: IM, JM, LM integer :: steady_state_ocean = 0 ! SA: Per Atanas T, "name" of this var is misleading ! We run ocean model only when it = 0 @@ -575,6 +607,7 @@ subroutine Run ( GC, IMPORT, EXPORT, CLOCK, RC ) real :: pice_scaling = 1.0 real :: dTf_dS integer :: DT_OCEAN + integer :: tracer_index REAL_, pointer, dimension(:,:) :: LATS => null() REAL_, pointer, dimension(:,:) :: LONS => null() @@ -626,11 +659,15 @@ subroutine Run ( GC, IMPORT, EXPORT, CLOCK, RC ) IM=iec-isc+1 JM=jec-jsc+1 + call get_ocean_grid (Ocean_state, Ocean_grid) + LM=Ocean_grid%ke + ! Temporaries with MOM default reals !----------------------------------- allocate(U(IM,JM ), __STAT__) allocate(V(IM,JM ), __STAT__) + allocate(H(IM,JM,LM), __STAT__) allocate(cos_rot(IM,JM), __STAT__) allocate(sin_rot(IM,JM), __STAT__) @@ -662,6 +699,10 @@ subroutine Run ( GC, IMPORT, EXPORT, CLOCK, RC ) ! Get EXPORT pointers !-------------------- + call MAPL_GetPointer(EXPORT, DH, 'DH' , _RC) + call MAPL_GetPointer(EXPORT, TL, 'T' , _RC) + call MAPL_GetPointer(EXPORT, SL, 'S' , _RC) + call MAPL_GetPointer(EXPORT, UW, 'UW' , _RC) call MAPL_GetPointer(EXPORT, VW, 'VW' , _RC) call MAPL_GetPointer(EXPORT, UWB, 'UWB' , _RC) @@ -765,7 +806,23 @@ subroutine Run ( GC, IMPORT, EXPORT, CLOCK, RC ) ! Get required Exports at GEOS precision !--------------------------------------- -! mask +!MOM 3D fields +! Thickness + call ocean_model_get_thickness(Ocean_State, H, isc, jsc) + DH = real(H, kind=GeosKind) + +! Temp + call ocean_model_get_prog_tracer_index(Ocean_State,tracer_index,'temp') + call ocean_model_get_prog_tracer(Ocean_State,tracer_index, H, isc, jsc) + TL = real(H,kind=GeosKind) + MAPL_TICE + +! Salt + call ocean_model_get_prog_tracer_index(Ocean_State,tracer_index,'salt') + call ocean_model_get_prog_tracer(Ocean_State, tracer_index, H, isc, jsc) + SL = real(H,kind=GeosKind) + +!MOM 2D fields +! 2D mask U = 0.0 call ocean_model_data_get(Ocean_State, Ocean, 'mask', U, isc, jsc) MOM_2D_MASK = real(U, kind=GeosKind) @@ -905,11 +962,12 @@ subroutine Run ( GC, IMPORT, EXPORT, CLOCK, RC ) ! Optional Exports at GEOS precision !----------------------------------- ! none -! 3d exports with MOM6, such as depths, T, S, U, V, etc +! 3d exports with MOM6, other than depth, T, S (needed by NOBM), such as U, V, etc ! will not be exported. If needed, write them directly from MOM6 deallocate(U, V, __STAT__) deallocate(cos_rot,sin_rot, __STAT__) + deallocate(H, __STAT__) call MAPL_TimerOff(MAPL,"RUN" ) call MAPL_TimerOff(MAPL,"TOTAL" ) diff --git a/MOM6_GEOSPlug/MOM6_GEOSPlug_StateSpecs.rc b/MOM6_GEOSPlug/MOM6_GEOSPlug_StateSpecs.rc index 30e5fbe..41e7a62 100644 --- a/MOM6_GEOSPlug/MOM6_GEOSPlug_StateSpecs.rc +++ b/MOM6_GEOSPlug/MOM6_GEOSPlug_StateSpecs.rc @@ -49,10 +49,10 @@ SLV | m | xy | N | sea_level_with_ice_loading_and_inv FRAZIL | W m-2 | xy | N | heating_from_frazil_formation MELT_POT | W m-2 | xy | N | heat_that_can_be_used_to_melt_sea_ice FRZMLT | W m-2 | xy | N | freeze_melt_potential -T_Freeze | degC | xy | N | freezing_temperature_calculated_using_salinity -DH | m OR kg m-2 | xyz | C | DUMMY_EXPORT_layer_thickness -T | K | xyz | C | DUMMY_EXPORT_potential_temperature -S | PSU | xyz | C | DUMMY_EXPORT_salinity +T_Freeze | degC | xy | N | freezing_temperature_calculated_using_salinity +DH | m OR kg m-2 | xyz | C | layer_thickness +T | K | xyz | C | potential_temperature +S | PSU | xyz | C | salinity category: INTERNAL #----------------------------------------------------------------------------------------