From ed9e08b0d2a327ea7b6947981ac2589f8498dfe1 Mon Sep 17 00:00:00 2001 From: anton-seaice Date: Fri, 6 Dec 2024 15:49:17 +1100 Subject: [PATCH 1/6] Update CESM share to 1.1.5 and incorporate upstream fix for missing #ifdef timing in CESM_share Co-authored-by: Dougie Squire <42455466+dougiesquire@users.noreply.github.com> --- share/CESM_share | 2 +- share/CMakeLists.txt | 3 +- share/patches/nuopc_shr_methods.F90.patch | 55 +++++++++++++++++++++++ 3 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 share/patches/nuopc_shr_methods.F90.patch diff --git a/share/CESM_share b/share/CESM_share index cfd5480..a48ff87 160000 --- a/share/CESM_share +++ b/share/CESM_share @@ -1 +1 @@ -Subproject commit cfd54802cb771d5d165803b8acf7712ec5d662b6 +Subproject commit a48ff8790a21d3831873ed9f023a43c606a1ef03 diff --git a/share/CMakeLists.txt b/share/CMakeLists.txt index 57aa67b..9367f14 100644 --- a/share/CMakeLists.txt +++ b/share/CMakeLists.txt @@ -1,4 +1,3 @@ -### Targets ## share library add_fortran_library(OM3_share mod/share STATIC) @@ -46,7 +45,9 @@ target_sources(OM3_share PRIVATE # The following file is a stub. stubs/mct_mod.F90 ) +add_patched_source(OM3_share CESM_share/src/nuopc_shr_methods.F90) add_patched_source(OM3_share CESM_share/src/shr_const_mod.F90) + if(CMAKE_Fortran_COMPILER_ID MATCHES "Intel") # CESM reduces the precision and increases speed for the following file set_source_files_properties(CESM_share/src/shr_wv_sat_mod.F90 PROPERTIES COMPILE_FLAGS "-fimf-precision=low -fp-model fast") diff --git a/share/patches/nuopc_shr_methods.F90.patch b/share/patches/nuopc_shr_methods.F90.patch new file mode 100644 index 0000000..afe9086 --- /dev/null +++ b/share/patches/nuopc_shr_methods.F90.patch @@ -0,0 +1,55 @@ +diff --git a/src/nuopc_shr_methods.F90 b/src/nuopc_shr_methods.F90 +index 07cf7e5..8bdf11f 100644 +--- a/src/nuopc_shr_methods.F90 ++++ b/src/nuopc_shr_methods.F90 +@@ -820,9 +820,9 @@ contains + + ! local vars + integer :: yr, mon, day +- character(len=16) timestr +- logical :: isPresent +- character(len=ESMF_MAXSTR) :: inst_suffix ++ character(len=17) timestr ++ logical :: isPresent , isSet ++ character(len=ESMF_MAXSTR) :: inst_suffix , pointer_date + character(len=*), parameter :: subname='shr_get_rpointer_name' + + rc = ESMF_SUCCESS +@@ -832,19 +832,31 @@ contains + if (ChkErr(rc,__LINE__,u_FILE_u)) return + if(ispresent) call NUOPC_CompAttributeGet(gcomp, name='inst_suffix', value=inst_suffix, rc=rc) + +- yr = ymd/10000 +- mon = (ymd - yr*10000)/100 +- day = (ymd - yr*10000 - mon*100) +- write(timestr,'(i4.4,a,i2.2,a,i2.2,a,i5.5)') yr,'-',mon,'-',day,'-',time +- write(rpfile,*) "rpointer."//compname//trim(inst_suffix)//'.'//trim(timestr) ++ ! if restart_pointer_append_date is false then don't append timestamp ++ timestr = "" ++ pointer_date = ".true." ++ call NUOPC_CompAttributeGet(gcomp, name="restart_pointer_append_date", isPresent=isPresent, isSet=isSet, rc=rc) ++ if (ChkErr(rc,__LINE__,u_FILE_u)) return ++ if (isPresent .and. isSet) then ++ call NUOPC_CompAttributeGet(gcomp, name='restart_pointer_append_date', value=pointer_date, rc=rc) ++ endif ++ if (trim(pointer_date) .eq. '.true.') then ++ yr = ymd/10000 ++ mon = (ymd - yr*10000)/100 ++ day = (ymd - yr*10000 - mon*100) ++ write(timestr,'(a,i4.4,a,i2.2,a,i2.2,a,i5.5)') '.',yr,'-',mon,'-',day,'-',time ++ endif ++ ++ write(rpfile,*) "rpointer."//compname//trim(inst_suffix)//trim(timestr) + rpfile = adjustl(rpfile) ++ + if (mode.eq.'read') then + inquire(file=trim(rpfile), exist=isPresent) + if(.not. isPresent) then + rpfile = "rpointer."//compname//trim(inst_suffix) + inquire(file=trim(rpfile), exist=isPresent) + if(.not. isPresent) then +- call shr_sys_abort( subname//'ERROR no rpointer file found in '//rpfile//' or in '//rpfile//'.'//timestr ) ++ call shr_sys_abort( subname//'ERROR no rpointer file found in '//rpfile//' or in '//rpfile//trim(inst_suffix)//trim(timestr) ) + endif + endif + endif From dac84a2183ab9b18f40fbc1b8b99700685739d9a Mon Sep 17 00:00:00 2001 From: anton-seaice Date: Fri, 6 Dec 2024 16:10:29 +1100 Subject: [PATCH 2/6] Update to cmeps1.0.25 --- CMEPS/CMEPS | 2 +- CMEPS/CMakeLists.txt | 5 +---- CMEPS/patches/med_phases_history_mod.F90.patch | 13 ------------- 3 files changed, 2 insertions(+), 18 deletions(-) delete mode 100644 CMEPS/patches/med_phases_history_mod.F90.patch diff --git a/CMEPS/CMEPS b/CMEPS/CMEPS index ffb5737..959e9a0 160000 --- a/CMEPS/CMEPS +++ b/CMEPS/CMEPS @@ -1 +1 @@ -Subproject commit ffb573791c7670ada8660dbac96c6c84886f62d3 +Subproject commit 959e9a0b1aa3c602de4674f0553875efa8f6c1b6 diff --git a/CMEPS/CMakeLists.txt b/CMEPS/CMakeLists.txt index e91036b..6aa109b 100644 --- a/CMEPS/CMakeLists.txt +++ b/CMEPS/CMakeLists.txt @@ -12,6 +12,7 @@ if(OpenMP_Fortran_FOUND) endif() target_sources(OM3_cmeps PRIVATE CMEPS/cesm/flux_atmocn/shr_flux_mod.F90 + CMEPS/mediator/med_phases_history_mod.F90 CMEPS/mediator/med_phases_restart_mod.F90 CMEPS/mediator/med_map_mod.F90 CMEPS/mediator/med_methods_mod.F90 @@ -31,7 +32,6 @@ target_sources(OM3_cmeps PRIVATE CMEPS/mediator/med_phases_prep_ocn_mod.F90 CMEPS/mediator/esmFlds.F90 CMEPS/mediator/med.F90 - CMEPS/mediator/med_time_mod.F90 CMEPS/mediator/med_phases_ocnalb_mod.F90 CMEPS/mediator/med_phases_prep_wav_mod.F90 CMEPS/mediator/med_utils_mod.F90 @@ -48,8 +48,6 @@ target_sources(OM3_cmeps PRIVATE CMEPS/mediator/med_phases_post_wav_mod.F90 ) -add_patched_source(OM3_cmeps CMEPS/mediator/med_phases_history_mod.F90) - ## NUOPC cap share add_fortran_library(OM3_nuopc_cap_share mod/nuopc_cap_share STATIC) add_library(AccessOM3::nuopc_cap_share ALIAS OM3_nuopc_cap_share) @@ -61,7 +59,6 @@ target_sources(OM3_nuopc_cap_share PRIVATE CMEPS/cesm/nuopc_cap_share/driver_pio_mod.F90 CMEPS/cesm/nuopc_cap_share/esm_utils_mod.F90 CMEPS/cesm/nuopc_cap_share/glc_elevclass_mod.F90 - CMEPS/cesm/nuopc_cap_share/nuopc_shr_methods.F90 ) diff --git a/CMEPS/patches/med_phases_history_mod.F90.patch b/CMEPS/patches/med_phases_history_mod.F90.patch deleted file mode 100644 index 1265aca..0000000 --- a/CMEPS/patches/med_phases_history_mod.F90.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/mediator/med_phases_history_mod.F90 b/mediator/med_phases_history_mod.F90 -index 5f150a4b..97864ec6 100644 ---- a/mediator/med_phases_history_mod.F90 -+++ b/mediator/med_phases_history_mod.F90 -@@ -1300,7 +1300,7 @@ contains - call med_io_write(auxcomp%files(nf)%io_file, is_local%wrap%FBimp(compid,compid), & - whead(1), wdata(1), nx, ny, nt=auxcomp%files(nf)%nt, & - pre=trim(compname(compid))//'Imp', flds=auxcomp%files(nf)%flds, & -- use_float=.true., rc=rc) -+ use_float=.false., rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - ! end definition phase From 18c160a8c09d51adeca8a590b2dd20723eaf0196 Mon Sep 17 00:00:00 2001 From: anton-seaice Date: Fri, 6 Dec 2024 16:23:32 +1100 Subject: [PATCH 3/6] Update to CDEPS 1.0.59 and get upstream fix for correct pointer file in dshr --- CDEPS/CDEPS | 2 +- CDEPS/CMakeLists.txt | 4 +- .../datm_datamode_jra55do_mod.F90 | 39 +----------- CDEPS/patches/atm_comp_nuopc.F90.patch | 61 +++++++++---------- 4 files changed, 35 insertions(+), 71 deletions(-) diff --git a/CDEPS/CDEPS b/CDEPS/CDEPS index 3c70fc8..8197f05 160000 --- a/CDEPS/CDEPS +++ b/CDEPS/CDEPS @@ -1 +1 @@ -Subproject commit 3c70fc852aac65ea46c79d727b42d30d97a4a0e0 +Subproject commit 8197f05ef2549d3c53e4050c9821a683e2728bab diff --git a/CDEPS/CMakeLists.txt b/CDEPS/CMakeLists.txt index 68a90f7..16d7f10 100644 --- a/CDEPS/CMakeLists.txt +++ b/CDEPS/CMakeLists.txt @@ -14,9 +14,9 @@ target_sources(OM3_cdeps_common PRIVATE CDEPS/streams/dshr_stream_mod.F90 CDEPS/streams/dshr_tinterp_mod.F90 + CDEPS/dshr/dshr_mod.F90 CDEPS/dshr/dshr_dfield_mod.F90 CDEPS/dshr/dshr_fldlist_mod.F90 - CDEPS/dshr/dshr_mod.F90 ) ## DATM @@ -52,6 +52,8 @@ target_sources(OM3_cdeps_docn PRIVATE CDEPS/docn/docn_datamode_aquaplanet_mod.F90 CDEPS/docn/docn_datamode_copyall_mod.F90 CDEPS/docn/docn_datamode_cplhist_mod.F90 + CDEPS/docn/docn_datamode_multilev_mod.F90 + CDEPS/docn/docn_datamode_multilev_dom_mod.F90 CDEPS/docn/docn_datamode_iaf_mod.F90 CDEPS/docn/docn_datamode_som_mod.F90 CDEPS/docn/docn_import_data_mod.F90 diff --git a/CDEPS/extra_sources/datm_datamode_jra55do_mod.F90 b/CDEPS/extra_sources/datm_datamode_jra55do_mod.F90 index 2d6acad..d97837b 100644 --- a/CDEPS/extra_sources/datm_datamode_jra55do_mod.F90 +++ b/CDEPS/extra_sources/datm_datamode_jra55do_mod.F90 @@ -10,7 +10,6 @@ module datm_datamode_jra55do_mod use shr_const_mod , only : shr_const_tkfrz, shr_const_pi, shr_const_rdair use dshr_strdata_mod , only : shr_strdata_get_stream_pointer, shr_strdata_type use dshr_methods_mod , only : dshr_state_getfldptr, dshr_fldbun_getfldptr, dshr_fldbun_regrid, chkerr - use dshr_mod , only : dshr_restart_read, dshr_restart_write use dshr_strdata_mod , only : shr_strdata_type use dshr_fldlist_mod , only : fldlist_type, dshr_fldlist_add @@ -20,8 +19,7 @@ module datm_datamode_jra55do_mod public :: datm_datamode_jra55do_advertise public :: datm_datamode_jra55do_init_pointers public :: datm_datamode_jra55do_advance - public :: datm_datamode_jra55do_restart_write - public :: datm_datamode_jra55do_restart_read + ! export state pointers real(r8), pointer :: Sa_z(:) => null() @@ -283,39 +281,4 @@ subroutine datm_datamode_jra55do_advance(exportstate, target_ymd, target_tod, mo end subroutine datm_datamode_jra55do_advance - !=============================================================================== - subroutine datm_datamode_jra55do_restart_write(case_name, inst_suffix, ymd, tod, & - logunit, my_task, sdat) - - ! input/output variables - character(len=*) , intent(in) :: case_name - character(len=*) , intent(in) :: inst_suffix - integer , intent(in) :: ymd ! model date - integer , intent(in) :: tod ! model sec into model date - integer , intent(in) :: logunit - integer , intent(in) :: my_task - type(shr_strdata_type) , intent(inout) :: sdat - !------------------------------------------------------------------------------- - - call dshr_restart_write(rpfile, case_name, 'datm', inst_suffix, ymd, tod, & - logunit, my_task, sdat) - - end subroutine datm_datamode_jra55do_restart_write - - !=============================================================================== - subroutine datm_datamode_jra55do_restart_read(rest_filem, inst_suffix, logunit, my_task, mpicom, sdat) - - ! input/output arguments - character(len=*) , intent(inout) :: rest_filem - character(len=*) , intent(in) :: inst_suffix - integer , intent(in) :: logunit - integer , intent(in) :: my_task - integer , intent(in) :: mpicom - type(shr_strdata_type) , intent(inout) :: sdat - !------------------------------------------------------------------------------- - - call dshr_restart_read(rest_filem, rpfile, inst_suffix, nullstr, logunit, my_task, mpicom, sdat) - - end subroutine datm_datamode_jra55do_restart_read - end module datm_datamode_jra55do_mod diff --git a/CDEPS/patches/atm_comp_nuopc.F90.patch b/CDEPS/patches/atm_comp_nuopc.F90.patch index 1e176df..3e8dd23 100644 --- a/CDEPS/patches/atm_comp_nuopc.F90.patch +++ b/CDEPS/patches/atm_comp_nuopc.F90.patch @@ -1,27 +1,27 @@ ---- CDEPS/datm/atm_comp_nuopc.F90 2023-08-31 10:49:23.508874000 +1000 -+++ extra_sources/atm_comp_nuopc.F90 2023-08-31 10:48:55.428272000 +1000 -@@ -52,6 +52,12 @@ - use datm_datamode_jra_mod , only : datm_datamode_jra_restart_write - use datm_datamode_jra_mod , only : datm_datamode_jra_restart_read +diff --git a/datm/atm_comp_nuopc.F90 b/datm/atm_comp_nuopc.F90 +index b74e0d3..bb31c22 100644 +--- a/datm/atm_comp_nuopc.F90 ++++ b/datm/atm_comp_nuopc.F90 +@@ -48,6 +48,10 @@ module cdeps_datm_comp + use datm_datamode_jra_mod , only : datm_datamode_jra_init_pointers + use datm_datamode_jra_mod , only : datm_datamode_jra_advance + use datm_datamode_jra55do_mod , only : datm_datamode_jra55do_advertise + use datm_datamode_jra55do_mod , only : datm_datamode_jra55do_init_pointers + use datm_datamode_jra55do_mod , only : datm_datamode_jra55do_advance -+ use datm_datamode_jra55do_mod , only : datm_datamode_jra55do_restart_write -+ use datm_datamode_jra55do_mod , only : datm_datamode_jra55do_restart_read + use datm_datamode_clmncep_mod , only : datm_datamode_clmncep_advertise use datm_datamode_clmncep_mod , only : datm_datamode_clmncep_init_pointers use datm_datamode_clmncep_mod , only : datm_datamode_clmncep_advance -@@ -342,6 +348,7 @@ +@@ -357,6 +361,7 @@ contains if ( trim(datamode) == 'CORE2_NYF' .or. & trim(datamode) == 'CORE2_IAF' .or. & trim(datamode) == 'CORE_IAF_JRA' .or. & -+ trim(datamode) == 'JRA55do'.or. & ++ trim(datamode) == 'JRA55do' .or. & trim(datamode) == 'CLMNCEP' .or. & trim(datamode) == 'CPLHIST' .or. & trim(datamode) == 'GEFS' .or. & -@@ -361,6 +368,10 @@ +@@ -377,6 +382,10 @@ contains call datm_datamode_jra_advertise(exportState, fldsExport, flds_scalar_name, & flds_co2, flds_wiso, flds_presaero, flds_presndep, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -32,7 +32,7 @@ case ('CLMNCEP') call datm_datamode_clmncep_advertise(exportState, fldsExport, flds_scalar_name, & flds_co2, flds_wiso, flds_presaero, flds_presndep, flds_preso3, rc) -@@ -606,6 +617,9 @@ +@@ -627,6 +636,9 @@ contains case('CORE_IAF_JRA') call datm_datamode_jra_init_pointers(exportState, sdat, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -42,16 +42,16 @@ case('CLMNCEP') call datm_datamode_clmncep_init_pointers(importState, exportState, sdat, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return -@@ -630,6 +644,8 @@ - call datm_datamode_core2_restart_read(restfilm, inst_suffix, logunit, my_task, mpicom, sdat) - case('CORE_IAF_JRA') - call datm_datamode_jra_restart_read(restfilm, inst_suffix, logunit, my_task, mpicom, sdat) -+ case('JRA55do') -+ call datm_datamode_jra55do_restart_read(restfilm, inst_suffix, logunit, my_task, mpicom, sdat) - case('CLMNCEP') - call datm_datamode_clmncep_restart_read(restfilm, inst_suffix, logunit, my_task, mpicom, sdat) - case('CPLHIST') -@@ -677,6 +693,9 @@ +@@ -652,7 +664,7 @@ contains + call shr_get_rpointer_name(gcomp, 'atm', target_ymd, target_tod, rpfile, 'read', rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + select case (trim(datamode)) +- case('CORE2_NYF','CORE2_IAF','CORE_IAF_JRA','CLMNCEP','CPLHIST','ERA5','GEFS','CFSR','SIMPLE') ++ case('CORE2_NYF','CORE2_IAF','CORE_IAF_JRA','JRA55do','CLMNCEP','CPLHIST','ERA5','GEFS','CFSR','SIMPLE') + call dshr_restart_read(restfilm, rpfile, logunit, my_task, mpicom, sdat, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + case default +@@ -694,6 +706,9 @@ contains case('CORE_IAF_JRA') call datm_datamode_jra_advance(exportstate, target_ymd, target_tod, sdat%model_calendar, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -61,13 +61,12 @@ case('CLMNCEP') call datm_datamode_clmncep_advance(mainproc, logunit, mpicom, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return -@@ -705,6 +724,9 @@ - case('CORE_IAF_JRA') - call datm_datamode_jra_restart_write(case_name, inst_suffix, target_ymd, target_tod, & - logunit, my_task, sdat) -+ case('JRA55do') -+ call datm_datamode_jra55do_restart_write(case_name, inst_suffix, target_ymd, target_tod, & -+ logunit, my_task, sdat) - case('CLMNCEP') - call datm_datamode_clmncep_restart_write(case_name, inst_suffix, target_ymd, target_tod, & - logunit, my_task, sdat) +@@ -722,7 +737,7 @@ contains + call shr_get_rpointer_name(gcomp, 'atm', target_ymd, target_tod, rpfile, 'write', rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + select case (trim(datamode)) +- case('CORE2_NYF','CORE2_IAF','CORE_IAF_JRA','CLMNCEP','CPLHIST','ERA5','GEFS','CFSR','SIMPLE') ++ case('CORE2_NYF','CORE2_IAF','CORE_IAF_JRA','JRA55do','CLMNCEP','CPLHIST','ERA5','GEFS','CFSR','SIMPLE') + call dshr_restart_write(rpfile, case_name, 'datm', inst_suffix, target_ymd, target_tod, logunit, & + my_task, sdat, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return From 335a4f6e55d94f239dd4a3d9f91f1a600de89342 Mon Sep 17 00:00:00 2001 From: anton-seaice Date: Fri, 6 Dec 2024 16:29:11 +1100 Subject: [PATCH 4/6] Update to CICE 6.6.0 with access-nri branch with reading MOM supergrid and rpointer fix CICE 2025.01.0 from access-nri fork --- .gitmodules | 4 +- CICE/CICE | 2 +- CICE/CMakeLists.txt | 7 +-- CICE/patches/ice_distribution.F90.patch | 16 ----- CICE/patches/ice_domain.F90.patch | 83 ------------------------- CICE/patches/ice_init.F90.patch | 13 ---- 6 files changed, 6 insertions(+), 119 deletions(-) delete mode 100644 CICE/patches/ice_distribution.F90.patch delete mode 100644 CICE/patches/ice_domain.F90.patch delete mode 100644 CICE/patches/ice_init.F90.patch diff --git a/.gitmodules b/.gitmodules index 4d18ee5..28899af 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,9 +1,9 @@ [submodule "MOM6/MOM6"] path = MOM6/MOM6 - url = https://github.com/ACCESS-NRI/mom6 + url = https://github.com/ACCESS-NRI/MOM6 [submodule "CICE6/CICE6"] path = CICE/CICE - url = https://github.com/ESCOMP/CICE + url = https://github.com/ACCESS-NRI/CICE [submodule "CMEPS/CMEPS"] path = CMEPS/CMEPS url = https://github.com/ESCOMP/CMEPS diff --git a/CICE/CICE b/CICE/CICE index 12dd204..e68e05b 160000 --- a/CICE/CICE +++ b/CICE/CICE @@ -1 +1 @@ -Subproject commit 12dd204349090058a66715163932ae3243f9632c +Subproject commit e68e05b7962fc926c8a35397bca464d6b1e06ab9 diff --git a/CICE/CMakeLists.txt b/CICE/CMakeLists.txt index 1c5e7c4..25c67cf 100644 --- a/CICE/CMakeLists.txt +++ b/CICE/CMakeLists.txt @@ -26,6 +26,7 @@ target_sources(OM3_cice PRIVATE CICE/cicecore/shared/ice_arrays_column.F90 CICE/cicecore/shared/ice_calendar.F90 CICE/cicecore/shared/ice_constants.F90 + CICE/cicecore/shared/ice_distribution.F90 CICE/cicecore/shared/ice_domain_size.F90 CICE/cicecore/shared/ice_fileunits.F90 CICE/cicecore/shared/ice_init_column.F90 @@ -61,11 +62,13 @@ target_sources(OM3_cice PRIVATE CICE/cicecore/cicedyn/general/ice_flux_bgc.F90 CICE/cicecore/cicedyn/general/ice_forcing.F90 CICE/cicecore/cicedyn/general/ice_forcing_bgc.F90 + CICE/cicecore/cicedyn/general/ice_init.F90 CICE/cicecore/cicedyn/general/ice_state.F90 CICE/cicecore/cicedyn/general/ice_step_mod.F90 # Infrastructure CICE/cicecore/cicedyn/infrastructure/ice_blocks.F90 + CICE/cicecore/cicedyn/infrastructure/ice_domain.F90 CICE/cicecore/cicedyn/infrastructure/ice_grid.F90 CICE/cicecore/cicedyn/infrastructure/ice_memusage.F90 CICE/cicecore/cicedyn/infrastructure/ice_memusage_gptl.c @@ -152,10 +155,6 @@ elseif(OM3_CICE_IO MATCHES "Binary") ) endif() -add_patched_source(OM3_cice CICE/cicecore/cicedyn/infrastructure/ice_domain.F90) -add_patched_source(OM3_cice CICE/cicecore/shared/ice_distribution.F90) -add_patched_source(OM3_cice CICE/cicecore/cicedyn/general/ice_init.F90) - ### Install and Export ## Library diff --git a/CICE/patches/ice_distribution.F90.patch b/CICE/patches/ice_distribution.F90.patch deleted file mode 100644 index fccefe2..0000000 --- a/CICE/patches/ice_distribution.F90.patch +++ /dev/null @@ -1,16 +0,0 @@ -diff --git a/cicecore/shared/ice_distribution.F90 b/cicecore/shared/ice_distribution.F90 -old mode 100644 -new mode 100755 -index 0f3f6c1..6e06069 ---- a/cicecore/shared/ice_distribution.F90 -+++ b/cicecore/shared/ice_distribution.F90 -@@ -41,7 +41,8 @@ module ice_distribution - ice_distributionGet, & - ice_distributionGetBlockLoc, & - ice_distributionGetBlockID, & -- create_local_block_ids -+ create_local_block_ids, & -+ proc_decomposition - - character (char_len), public :: & - processor_shape ! 'square-pop' (approx) POP default config diff --git a/CICE/patches/ice_domain.F90.patch b/CICE/patches/ice_domain.F90.patch deleted file mode 100644 index f769ddd..0000000 --- a/CICE/patches/ice_domain.F90.patch +++ /dev/null @@ -1,83 +0,0 @@ -diff --git a/cicecore/cicedyn/infrastructure/ice_domain.F90 b/cicecore/cicedyn/infrastructure/ice_domain.F90 -index 8b680f2..47a0f00 100644 ---- a/cicecore/cicedyn/infrastructure/ice_domain.F90 -+++ b/cicecore/cicedyn/infrastructure/ice_domain.F90 -@@ -101,7 +101,7 @@ subroutine init_domain_blocks - ! This routine reads in domain information and calls the routine - ! to set up the block decomposition. - -- use ice_distribution, only: processor_shape -+ use ice_distribution, only: processor_shape, proc_decomposition - use ice_domain_size, only: ncat, nilyr, nslyr, max_blocks, & - nx_global, ny_global, block_size_x, block_size_y - use ice_fileunits, only: goto_nml -@@ -112,7 +112,8 @@ subroutine init_domain_blocks - !---------------------------------------------------------------------- - - integer (int_kind) :: & -- nml_error ! namelist read error flag -+ nml_error, & ! namelist read error flag -+ nprocs_x, nprocs_y ! procs decomposed into blocks - - character(len=char_len) :: nml_name ! text namelist name - character(len=char_len_long) :: tmpstr2 ! for namelist check -@@ -216,21 +217,33 @@ subroutine init_domain_blocks - call broadcast_scalar(maskhalo_bound, master_task) - call broadcast_scalar(add_mpi_barriers, master_task) - call broadcast_scalar(debug_blocks, master_task) -- if (my_task == master_task) then -- if (max_blocks < 1) then -- max_blocks=( ((nx_global-1)/block_size_x + 1) * & -- ((ny_global-1)/block_size_y + 1) - 1) / nprocs + 1 -- max_blocks=max(1,max_blocks) -- write(nu_diag,'(/,a52,i6,/)') & -- '(ice_domain): max_block < 1: max_block estimated to ',max_blocks -- endif -- endif - call broadcast_scalar(max_blocks, master_task) - call broadcast_scalar(block_size_x, master_task) - call broadcast_scalar(block_size_y, master_task) - call broadcast_scalar(nx_global, master_task) - call broadcast_scalar(ny_global, master_task) - -+ ! Set nprocs if not set in namelist -+ if (nprocs == -1) then -+ nprocs = get_num_procs() -+ else if (nprocs /= get_num_procs()) then -+ write(nu_diag,*) subname,' ERROR: nprocs, get_num_procs = ',nprocs,get_num_procs() -+ call abort_ice(subname//' ERROR: Input nprocs not same as system request', file=__FILE__, line=__LINE__) -+ endif -+ -+ ! Determine max_blocks if not set -+ if (max_blocks < 1) then -+ call proc_decomposition(nprocs, nprocs_x, nprocs_y) -+ max_blocks=((nx_global-1)/block_size_x/nprocs_x+1) * & -+ ((ny_global-1)/block_size_y/nprocs_y+1) -+ max_blocks=max(1,max_blocks) -+ if (my_task == master_task) then -+ write(nu_diag,'(/,a52,i6,/)') & -+ '(ice_domain): max_block < 1: max_block estimated to ',max_blocks -+ endif -+ endif -+ -+ - !---------------------------------------------------------------------- - ! - ! perform some basic checks on domain -@@ -242,16 +255,6 @@ subroutine init_domain_blocks - !*** domain size zero or negative - !*** - call abort_ice(subname//' ERROR: Invalid domain: size < 1', file=__FILE__, line=__LINE__) ! no domain -- else if (nprocs /= get_num_procs()) then -- !*** -- !*** input nprocs does not match system (eg MPI) request -- !*** --#if (defined CESMCOUPLED) -- nprocs = get_num_procs() --#else -- write(nu_diag,*) subname,' ERROR: nprocs, get_num_procs = ',nprocs,get_num_procs() -- call abort_ice(subname//' ERROR: Input nprocs not same as system request', file=__FILE__, line=__LINE__) --#endif - else if (nghost < 1) then - !*** - !*** must have at least 1 layer of ghost cells diff --git a/CICE/patches/ice_init.F90.patch b/CICE/patches/ice_init.F90.patch deleted file mode 100644 index 3f89ccb..0000000 --- a/CICE/patches/ice_init.F90.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/cicecore/cicedyn/general/ice_init.F90 b/cicecore/cicedyn/general/ice_init.F90 -index 24ac40db..4ad296aa 100644 ---- a/cicecore/cicedyn/general/ice_init.F90 -+++ b/cicecore/cicedyn/general/ice_init.F90 -@@ -872,7 +872,7 @@ subroutine input_data - ! runid and runtype are obtained from the driver, not from the namelist - - if (my_task == master_task) then -- history_file = trim(runid) // ".cice" // trim(inst_suffix) //".h" -+ history_file = trim(runid) // ".cice" // trim(inst_suffix) - restart_file = trim(runid) // ".cice" // trim(inst_suffix) //".r" - incond_file = trim(runid) // ".cice" // trim(inst_suffix) //".i" - ! Note by tcraig - this if test is needed because the nuopc cap sets From 41ca3be05f458053b8bbbaf17175ec9586630282 Mon Sep 17 00:00:00 2001 From: anton-seaice Date: Mon, 9 Dec 2024 11:28:13 +1100 Subject: [PATCH 5/6] update to WW3 dev/unified_0.0.12 --- WW3/CMakeLists.txt | 7 ++++--- WW3/WW3 | 2 +- WW3/patches/w3srcemd.F90.patch | 22 ++++++++++++++++++++++ 3 files changed, 27 insertions(+), 4 deletions(-) create mode 100644 WW3/patches/w3srcemd.F90.patch diff --git a/WW3/CMakeLists.txt b/WW3/CMakeLists.txt index 19bf671..16d92e9 100644 --- a/WW3/CMakeLists.txt +++ b/WW3/CMakeLists.txt @@ -44,6 +44,7 @@ target_sources(OM3_ww3 PRIVATE WW3/model/src/w3iogomd.F90 WW3/model/src/w3iogrmd.F90 WW3/model/src/w3iopomd.F90 + WW3/model/src/w3iorsmd.F90 WW3/model/src/w3iosfmd.F90 WW3/model/src/w3iotrmd.F90 WW3/model/src/w3macros.h @@ -62,7 +63,6 @@ target_sources(OM3_ww3 PRIVATE WW3/model/src/w3parall.F90 WW3/model/src/w3partmd.F90 WW3/model/src/w3servmd.F90 - WW3/model/src/w3srcemd.F90 WW3/model/src/w3strkmd.F90 WW3/model/src/w3timemd.F90 WW3/model/src/w3triamd.F90 @@ -83,17 +83,18 @@ target_sources(OM3_ww3 PRIVATE WW3/model/src/wav_grdout.F90 WW3/model/src/w3iogoncdmd.F90 WW3/model/src/wav_shr_flags.F90 - + WW3/model/src/wav_kind_mod.F90 WW3/model/src/wav_shr_mod.F90 WW3/model/src/wav_shel_inp.F90 WW3/model/src/wav_comp_nuopc.F90 WW3/model/src/wav_import_export.F90 + WW3/model/src/wav_wrapper_mod.F90 ${switch_files} ) -add_patched_source(OM3_ww3 WW3/model/src/w3iorsmd.F90) +add_patched_source(OM3_ww3 WW3/model/src/w3srcemd.F90) ## Utilities diff --git a/WW3/WW3 b/WW3/WW3 index 97740a1..1c11fc1 160000 --- a/WW3/WW3 +++ b/WW3/WW3 @@ -1 +1 @@ -Subproject commit 97740a1abb36b7ba6e52a7d6f7a37dd06f915633 +Subproject commit 1c11fc175793cb52a8bb4ebac70623a813fe00cd diff --git a/WW3/patches/w3srcemd.F90.patch b/WW3/patches/w3srcemd.F90.patch new file mode 100644 index 0000000..9830695 --- /dev/null +++ b/WW3/patches/w3srcemd.F90.patch @@ -0,0 +1,22 @@ +diff --git a/model/src/w3srcemd.F90 b/model/src/w3srcemd.F90 +index 9bd97c6f..c51a8609 100644 +--- a/model/src/w3srcemd.F90 ++++ b/model/src/w3srcemd.F90 +@@ -2088,7 +2088,7 @@ CONTAINS + #ifdef W3_IC3 + CALL W3SIC3 ( SPEC,DEPTH, CG1, WN1, IX, IY, VSIC, VDIC ) + #endif +-#ifndef W3_IC4_NUMERICS ++#if defined(W3_IC4) && !defined(W3_IC4_NUMERICS) + CALL W3SIC4 ( SPEC,DEPTH, CG1, IX, IY, VSIC, VDIC ) + #endif + #ifdef W3_IC5 +@@ -2119,7 +2119,7 @@ CONTAINS + #ifdef W3_IC3 + ATT=EXP(ICE*VDIC(IS)*DTG) + #endif +-#ifndef W3_IC4_NUMERICS ++#if defined(W3_IC4) && !defined(W3_IC4_NUMERICS) + ATT=EXP(ICE*VDIC(IS)*DTG) + #endif + #ifdef W3_IC5 From f05ae2c8ec646adc26cb82aa4024a1e12c000810 Mon Sep 17 00:00:00 2001 From: anton-seaice Date: Wed, 22 Jan 2025 15:36:14 +1100 Subject: [PATCH 6/6] Update to latest MOM6 - update patch files for updated MOM6 version - Add new modules to MOM CMakeLists Co-authored-by: Dougie Squire <42455466+dougiesquire@users.noreply.github.com> --- MOM6/CMakeLists.txt | 6 ++++ MOM6/MOM6 | 2 +- MOM6/patches/MOM_PointAccel.F90.patch | 22 ++++++-------- MOM6/patches/MOM_coupler_types.F90.patch | 6 ++-- MOM6/patches/MOM_forcing_type.F90.patch | 4 +-- MOM6/patches/MOM_generic_tracer.F90.patch | 15 ++------- MOM6/patches/MOM_io_infra.F90.patch | 10 +++--- MOM6/patches/mom_cap.F90.patch | 32 ++++++++++---------- MOM6/patches/mom_cap_methods.F90.patch | 19 ++++++------ MOM6/patches/mom_ocean_model_nuopc.F90.patch | 18 +++++------ 10 files changed, 65 insertions(+), 69 deletions(-) diff --git a/MOM6/CMakeLists.txt b/MOM6/CMakeLists.txt index ff501e6..5a87d00 100644 --- a/MOM6/CMakeLists.txt +++ b/MOM6/CMakeLists.txt @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/MOM6/MOM6 b/MOM6/MOM6 index e92c971..776be84 160000 --- a/MOM6/MOM6 +++ b/MOM6/MOM6 @@ -1 +1 @@ -Subproject commit e92c971084e185cfd3902f18072320b45d583a54 +Subproject commit 776be843e904d85c7035ffa00233b962a03bfbb4 diff --git a/MOM6/patches/MOM_PointAccel.F90.patch b/MOM6/patches/MOM_PointAccel.F90.patch index a19ffd6..07195c9 100644 --- a/MOM6/patches/MOM_PointAccel.F90.patch +++ b/MOM6/patches/MOM_PointAccel.F90.patch @@ -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 diff --git a/MOM6/patches/MOM_coupler_types.F90.patch b/MOM6/patches/MOM_coupler_types.F90.patch index 25a2759..2f8bfc3 100644 --- a/MOM6/patches/MOM_coupler_types.F90.patch +++ b/MOM6/patches/MOM_coupler_types.F90.patch @@ -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 @@ -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. diff --git a/MOM6/patches/MOM_forcing_type.F90.patch b/MOM6/patches/MOM_forcing_type.F90.patch index 76bccef..7d5caeb 100644 --- a/MOM6/patches/MOM_forcing_type.F90.patch +++ b/MOM6/patches/MOM_forcing_type.F90.patch @@ -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 diff --git a/MOM6/patches/MOM_generic_tracer.F90.patch b/MOM6/patches/MOM_generic_tracer.F90.patch index 92ffb2d..ddaf55b 100644 --- a/MOM6/patches/MOM_generic_tracer.F90.patch +++ b/MOM6/patches/MOM_generic_tracer.F90.patch @@ -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 @@ -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. diff --git a/MOM6/patches/MOM_io_infra.F90.patch b/MOM6/patches/MOM_io_infra.F90.patch index d631f31..79e150c 100644 --- a/MOM6/patches/MOM_io_infra.F90.patch +++ b/MOM6/patches/MOM_io_infra.F90.patch @@ -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 @@ -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 diff --git a/MOM6/patches/mom_cap.F90.patch b/MOM6/patches/mom_cap.F90.patch index dee5a39..dbd5b8d 100644 --- a/MOM6/patches/mom_cap.F90.patch +++ b/MOM6/patches/mom_cap.F90.patch @@ -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 @@ @@ -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() @@ -64,7 +64,7 @@ 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) @@ -72,7 +72,7 @@ index 3574943..f948684 100644 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) @@ -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 @@ -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 @@ -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 @@ -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") @@ -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() @@ -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 @@ -213,7 +213,7 @@ 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) @@ -221,7 +221,7 @@ index 3574943..f948684 100644 !--------------- ! Apply ocean lag for startup runs: -@@ -1748,8 +1841,39 @@ subroutine ModelAdvance(gcomp, rc) +@@ -1758,8 +1851,39 @@ subroutine ModelAdvance(gcomp, rc) ! Import data !--------------- @@ -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 @@ -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 @@ -285,7 +285,7 @@ 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 @@ -293,7 +293,7 @@ index 3574943..f948684 100644 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) diff --git a/MOM6/patches/mom_cap_methods.F90.patch b/MOM6/patches/mom_cap_methods.F90.patch index b87c0b2..c5daf29 100644 --- a/MOM6/patches/mom_cap_methods.F90.patch +++ b/MOM6/patches/mom_cap_methods.F90.patch @@ -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 @@ -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(:,:,:) @@ -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 diff --git a/MOM6/patches/mom_ocean_model_nuopc.F90.patch b/MOM6/patches/mom_ocean_model_nuopc.F90.patch index 273a96a..1100381 100644 --- a/MOM6/patches/mom_ocean_model_nuopc.F90.patch +++ b/MOM6/patches/mom_ocean_model_nuopc.F90.patch @@ -1,8 +1,8 @@ diff --git a/MOM6/config_src/drivers/nuopc_cap/mom_ocean_model_nuopc.F90 b/MOM6/config_src/drivers/nuopc_cap/mom_ocean_model_nuopc.F90.new -index 04b60b0..9855c24 100644 +index 9ac40da..b6cc4de 100644 --- a/MOM6/config_src/drivers/nuopc_cap/mom_ocean_model_nuopc.F90 +++ b/MOM6/config_src/drivers/nuopc_cap/mom_ocean_model_nuopc.F90.new -@@ -19,6 +19,7 @@ use MOM_coms, only : field_chksum +@@ -20,6 +20,7 @@ use MOM_coms, only : field_chksum use MOM_constants, only : CELSIUS_KELVIN_OFFSET, hlf use MOM_diag_mediator, only : diag_ctrl, enable_averages, disable_averaging use MOM_diag_mediator, only : diag_mediator_close_registration, diag_mediator_end @@ -28,9 +28,9 @@ index 04b60b0..9855c24 100644 !! Following MOM5, stagger is BGRID_NE by default when the !! ocean is initialized, but here it is set to -999 so that !! a global max across ocean and non-ocean processors can be -@@ -410,14 +409,7 @@ subroutine ocean_model_init(Ocean_sfc, OS, Time_init, Time_in, gas_fields_ocn, i +@@ -407,14 +406,7 @@ subroutine ocean_model_init(Ocean_sfc, OS, Time_init, Time_in, gas_fields_ocn, i ! it also initializes statistical waves. - call MOM_wave_interface_init(OS%Time, OS%grid, OS%GV, OS%US, param_file, OS%Waves, OS%diag, OS%restart_CSp) + call MOM_wave_interface_init(OS%Time, OS%grid, OS%GV, OS%US, param_file, OS%Waves, OS%diag) - if (associated(OS%grid%Domain%maskmap)) then - call initialize_ocean_public_type(OS%grid%Domain%mpp_domain, Ocean_sfc, & @@ -44,7 +44,7 @@ index 04b60b0..9855c24 100644 ! This call can only occur here if the coupler_bc_type variables have been ! initialized already using the information from gas_fields_ocn. -@@ -532,8 +524,7 @@ subroutine update_ocean_model(Ice_ocean_boundary, OS, Ocean_sfc, & +@@ -529,8 +521,7 @@ subroutine update_ocean_model(Ice_ocean_boundary, OS, Ocean_sfc, & (/is,is,ie,ie/), (/js,js,je,je/), as_needed=.true.) ! Translate Ice_ocean_boundary into fluxes. @@ -54,7 +54,7 @@ index 04b60b0..9855c24 100644 weight = 1.0 -@@ -795,7 +786,7 @@ end subroutine ocean_model_end +@@ -792,7 +783,7 @@ end subroutine ocean_model_end subroutine ocean_model_save_restart(OS, Time, directory, filename_suffix) type(ocean_state_type), pointer :: OS !< A pointer to the structure containing the !! internal ocean state (in). @@ -63,7 +63,7 @@ index 04b60b0..9855c24 100644 character(len=*), optional, intent(in) :: directory !< An optional directory into which to !! write these restart files. character(len=*), optional, intent(in) :: filename_suffix !< An optional suffix (e.g., a time-stamp) -@@ -827,16 +818,12 @@ subroutine ocean_model_save_restart(OS, Time, directory, filename_suffix) +@@ -823,16 +814,12 @@ subroutine ocean_model_save_restart(OS, Time, directory, filename_suffix) end subroutine ocean_model_save_restart !> Initialize the public ocean type @@ -85,7 +85,7 @@ index 04b60b0..9855c24 100644 type(coupler_1d_bc_type), & optional, intent(in) :: gas_fields_ocn !< If present, this type describes the !! ocean and surface-ice fields that will participate -@@ -848,14 +835,9 @@ subroutine initialize_ocean_public_type(input_domain, Ocean_sfc, diag, maskmap, +@@ -844,14 +831,9 @@ subroutine initialize_ocean_public_type(input_domain, Ocean_sfc, diag, maskmap, ! and have no halos. integer :: isc, iec, jsc, jec @@ -103,7 +103,7 @@ index 04b60b0..9855c24 100644 allocate ( Ocean_sfc%t_surf (isc:iec,jsc:jec), & Ocean_sfc%s_surf (isc:iec,jsc:jec), & -@@ -911,8 +893,7 @@ subroutine convert_state_to_ocean_type(sfc_state, Ocean_sfc, G, US, patm, press_ +@@ -907,8 +889,7 @@ subroutine convert_state_to_ocean_type(sfc_state, Ocean_sfc, G, US, patm, press_ is = G%isc ; ie = G%iec ; js = G%jsc ; je = G%jec call pass_vector(sfc_state%u, sfc_state%v, G%Domain)