From 30f7d3b8d0371d657b3366569b4717bebb74516f Mon Sep 17 00:00:00 2001 From: Denise Worthen Date: Thu, 22 Dec 2022 13:24:51 -0500 Subject: [PATCH 1/3] use ungridded dimension for pstokes and remover pointers that are no longer used --- config_src/drivers/nuopc_cap/mom_cap.F90 | 21 ++------ .../drivers/nuopc_cap/mom_cap_methods.F90 | 50 ------------------- 2 files changed, 4 insertions(+), 67 deletions(-) diff --git a/config_src/drivers/nuopc_cap/mom_cap.F90 b/config_src/drivers/nuopc_cap/mom_cap.F90 index d244205b1b..2f0128b7cb 100644 --- a/config_src/drivers/nuopc_cap/mom_cap.F90 +++ b/config_src/drivers/nuopc_cap/mom_cap.F90 @@ -754,23 +754,10 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) if (wave_method == "EFACTOR") then call fld_list_add(fldsToOcn_num, fldsToOcn, "Sw_lamult" , "will provide") else if (wave_method == "SURFACE_BANDS") then - if (cesm_coupled) then - call fld_list_add(fldsToOcn_num, fldsToOcn, "Sw_pstokes_x", "will provide", & - ungridded_lbound=1, ungridded_ubound=Ice_ocean_boundary%num_stk_bands) - call fld_list_add(fldsToOcn_num, fldsToOcn, "Sw_pstokes_y", "will provide", & - ungridded_lbound=1, ungridded_ubound=Ice_ocean_boundary%num_stk_bands) - else ! below is the old approach of importing partitioned stokes drift components. after the planned ww3 nuopc - ! cap unification, this else block should be removed in favor of the more flexible import approach above. - if (Ice_ocean_boundary%num_stk_bands > 3) then - call MOM_error(FATAL, "Number of Stokes Bands > 3, NUOPC cap not set up for this") - endif - call fld_list_add(fldsToOcn_num, fldsToOcn, "eastward_partitioned_stokes_drift_1" , "will provide") - call fld_list_add(fldsToOcn_num, fldsToOcn, "northward_partitioned_stokes_drift_1", "will provide") - call fld_list_add(fldsToOcn_num, fldsToOcn, "eastward_partitioned_stokes_drift_2" , "will provide") - call fld_list_add(fldsToOcn_num, fldsToOcn, "northward_partitioned_stokes_drift_2", "will provide") - call fld_list_add(fldsToOcn_num, fldsToOcn, "eastward_partitioned_stokes_drift_3" , "will provide") - call fld_list_add(fldsToOcn_num, fldsToOcn, "northward_partitioned_stokes_drift_3", "will provide") - endif + call fld_list_add(fldsToOcn_num, fldsToOcn, "Sw_pstokes_x", "will provide", & + ungridded_lbound=1, ungridded_ubound=Ice_ocean_boundary%num_stk_bands) + call fld_list_add(fldsToOcn_num, fldsToOcn, "Sw_pstokes_y", "will provide", & + ungridded_lbound=1, ungridded_ubound=Ice_ocean_boundary%num_stk_bands) else call MOM_error(FATAL, "Unsupported WAVE_METHOD encountered in NUOPC cap.") endif diff --git a/config_src/drivers/nuopc_cap/mom_cap_methods.F90 b/config_src/drivers/nuopc_cap/mom_cap_methods.F90 index 083e92eaf6..66ffbcc979 100644 --- a/config_src/drivers/nuopc_cap/mom_cap_methods.F90 +++ b/config_src/drivers/nuopc_cap/mom_cap_methods.F90 @@ -87,8 +87,6 @@ subroutine mom_import(ocean_public, ocean_grid, importState, ice_ocean_boundary, character(len=128) :: fldname real(ESMF_KIND_R8), allocatable :: taux(:,:) real(ESMF_KIND_R8), allocatable :: tauy(:,:) - real(ESMF_KIND_R8), allocatable :: stkx1(:,:),stkx2(:,:),stkx3(:,:) - real(ESMF_KIND_R8), allocatable :: stky1(:,:),stky2(:,:),stky3(:,:) real(ESMF_KIND_R8), allocatable :: stkx(:,:,:) real(ESMF_KIND_R8), allocatable :: stky(:,:,:) character(len=*) , parameter :: subname = '(mom_import)' @@ -329,8 +327,6 @@ subroutine mom_import(ocean_public, ocean_grid, importState, ice_ocean_boundary, ! Partitioned Stokes Drift Components !---- if ( associated(ice_ocean_boundary%ustkb) ) then - - if (cesm_coupled) then nsc = Ice_ocean_boundary%num_stk_bands allocate(stkx(isc:iec,jsc:jec,1:nsc)) allocate(stky(isc:iec,jsc:jec,1:nsc)) @@ -358,52 +354,6 @@ subroutine mom_import(ocean_public, ocean_grid, importState, ice_ocean_boundary, enddo enddo deallocate(stkx,stky) - - else ! below is the old approach of importing partitioned stokes drift components. after the planned ww3 nuopc - ! cap unification, this else block should be removed in favor of the more flexible import approach above. - allocate(stkx1(isc:iec,jsc:jec)) - allocate(stky1(isc:iec,jsc:jec)) - allocate(stkx2(isc:iec,jsc:jec)) - allocate(stky2(isc:iec,jsc:jec)) - allocate(stkx3(isc:iec,jsc:jec)) - allocate(stky3(isc:iec,jsc:jec)) - - call state_getimport(importState,'eastward_partitioned_stokes_drift_1' , isc, iec, jsc, jec, stkx1,rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport(importState,'northward_partitioned_stokes_drift_1', isc, iec, jsc, jec, stky1,rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport(importState,'eastward_partitioned_stokes_drift_2' , isc, iec, jsc, jec, stkx2,rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport(importState,'northward_partitioned_stokes_drift_2', isc, iec, jsc, jec, stky2,rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport(importState,'eastward_partitioned_stokes_drift_3' , isc, iec, jsc, jec, stkx3,rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport(importState,'northward_partitioned_stokes_drift_3', isc, iec, jsc, jec, stky3,rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - ! rotate from true zonal/meridional to local coordinates - do j = jsc, jec - jg = j + ocean_grid%jsc - jsc - do i = isc, iec - ig = i + ocean_grid%isc - isc - ice_ocean_boundary%ustkb(i,j,1) = ocean_grid%cos_rot(ig,jg)*stkx1(i,j) & - - ocean_grid%sin_rot(ig,jg)*stky1(i,j) - ice_ocean_boundary%vstkb(i,j,1) = ocean_grid%cos_rot(ig,jg)*stky1(i,j) & - + ocean_grid%sin_rot(ig,jg)*stkx1(i,j) - - ice_ocean_boundary%ustkb(i,j,2) = ocean_grid%cos_rot(ig,jg)*stkx2(i,j) & - - ocean_grid%sin_rot(ig,jg)*stky2(i,j) - ice_ocean_boundary%vstkb(i,j,2) = ocean_grid%cos_rot(ig,jg)*stky2(i,j) & - + ocean_grid%sin_rot(ig,jg)*stkx2(i,j) - - ice_ocean_boundary%ustkb(i,j,3) = ocean_grid%cos_rot(ig,jg)*stkx3(i,j) & - - ocean_grid%sin_rot(ig,jg)*stky3(i,j) - ice_ocean_boundary%vstkb(i,j,3) = ocean_grid%cos_rot(ig,jg)*stky3(i,j) & - + ocean_grid%sin_rot(ig,jg)*stkx3(i,j) - enddo - enddo - deallocate(stkx1,stkx2,stkx3,stky1,stky2,stky3) - endif endif end subroutine mom_import From 8993fc07121eb1950b98985f4857d143925e029d Mon Sep 17 00:00:00 2001 From: Alistair Adcroft Date: Wed, 7 Dec 2022 13:58:54 -0500 Subject: [PATCH 2/3] Switch from mpich to openmpi Testing to see if GH actions is failing due to MPI installation --- .github/actions/ubuntu-setup/action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/ubuntu-setup/action.yml b/.github/actions/ubuntu-setup/action.yml index 3fd2ea13cf..3f3ba5f0b6 100644 --- a/.github/actions/ubuntu-setup/action.yml +++ b/.github/actions/ubuntu-setup/action.yml @@ -13,7 +13,7 @@ runs: sudo apt-get install netcdf-bin sudo apt-get install libnetcdf-dev sudo apt-get install libnetcdff-dev - sudo apt-get install mpich - sudo apt-get install libmpich-dev + sudo apt-get install openmpi-bin + sudo apt-get install libopenmpi-dev sudo apt-get install linux-tools-common echo "::endgroup::" From 6c69e610c86ee6819bb145697be93506ebf4700d Mon Sep 17 00:00:00 2001 From: Denise Worthen Date: Sat, 4 Feb 2023 16:10:33 -0500 Subject: [PATCH 3/3] update how UFS names restarts * write all restarts as YYYYMMDD.HHMMSS.MOM.resX * includes stoch restarts * write final restart with timestamp * change nems=>ufs --- config_src/drivers/nuopc_cap/mom_cap.F90 | 16 +++++----------- config_src/drivers/nuopc_cap/mom_cap_methods.F90 | 2 +- .../nuopc_cap/mom_surface_forcing_nuopc.F90 | 1 - 3 files changed, 6 insertions(+), 13 deletions(-) diff --git a/config_src/drivers/nuopc_cap/mom_cap.F90 b/config_src/drivers/nuopc_cap/mom_cap.F90 index 2f0128b7cb..14bd438424 100644 --- a/config_src/drivers/nuopc_cap/mom_cap.F90 +++ b/config_src/drivers/nuopc_cap/mom_cap.F90 @@ -1699,16 +1699,10 @@ subroutine ModelAdvance(gcomp, rc) close(writeunit) endif else ! not cesm_coupled - ! write the final restart without a timestamp - if (ESMF_AlarmIsRinging(stop_alarm, rc=rc)) then - write(restartname,'(A)')"MOM.res" - write(stoch_restartname,'(A)')"ocn_stoch.res.nc" - else - write(restartname,'(A,I4.4,"-",I2.2,"-",I2.2,"-",I2.2,"-",I2.2,"-",I2.2)') & - "MOM.res.", year, month, day, hour, minute, seconds - write(stoch_restartname,'(A,I4.4,"-",I2.2,"-",I2.2,"-",I2.2,"-",I2.2,"-",I2.2,A)') & - "ocn_stoch.res.", year, month, day, hour, minute, seconds,".nc" - endif + write(restartname,'(i4.4,2(i2.2),A,3(i2.2),A)') year, month, day,".", hour, minute, seconds, & + ".MOM.res" + write(stoch_restartname,'(i4.4,2(i2.2),A,3(i2.2),A)') year, month, day,".", hour, minute, seconds, & + ".ocn_stoch.res.nc" call ESMF_LogWrite("MOM_cap: Writing restart : "//trim(restartname), ESMF_LOGMSG_INFO) ! write restart file(s) @@ -1868,7 +1862,7 @@ subroutine ModelSetRunClock(gcomp, rc) line=__LINE__, file=__FILE__, rcToReturn=rc) return endif - ! not used in nems + ! not used in ufs call NUOPC_CompAttributeGet(gcomp, name="restart_ymd", value=cvalue, & isPresent=isPresent, isSet=isSet, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return diff --git a/config_src/drivers/nuopc_cap/mom_cap_methods.F90 b/config_src/drivers/nuopc_cap/mom_cap_methods.F90 index 66ffbcc979..db8bc33c90 100644 --- a/config_src/drivers/nuopc_cap/mom_cap_methods.F90 +++ b/config_src/drivers/nuopc_cap/mom_cap_methods.F90 @@ -1,4 +1,4 @@ -!> Contains import/export methods for both NEMS and CMEPS. +!> Contains import/export methods for CMEPS. module MOM_cap_methods use ESMF, only: ESMF_Clock, ESMF_ClockGet, ESMF_time, ESMF_TimeGet diff --git a/config_src/drivers/nuopc_cap/mom_surface_forcing_nuopc.F90 b/config_src/drivers/nuopc_cap/mom_surface_forcing_nuopc.F90 index 8691f564dd..b211d7fd34 100644 --- a/config_src/drivers/nuopc_cap/mom_surface_forcing_nuopc.F90 +++ b/config_src/drivers/nuopc_cap/mom_surface_forcing_nuopc.F90 @@ -769,7 +769,6 @@ subroutine convert_IOB_to_forces(IOB, forces, index_bounds, Time, G, US, CS) endif forces%accumulate_p_surf = .true. ! Multiple components may contribute to surface pressure. - ! TODO: this does not seem correct for NEMS #ifdef CESMCOUPLED wind_stagger = AGRID #else