diff --git a/model/bin/switch_meshcap b/model/bin/switch_meshcap index 97d635b69..7a11c569b 100644 --- a/model/bin/switch_meshcap +++ b/model/bin/switch_meshcap @@ -1 +1 @@ -NCO NOGRB DIST MPI OMPG OMPH PR3 UQ FLX0 SEED ST4 STAB0 NL1 BT1 DB1 MLIM FLD2 TR0 BS0 RWND WNX1 WNT1 CRX1 CRT1 O0 O1 O2 O3 O4 O5 O6 O7 O14 O15 IC0 IS0 REF0 +NCO NOGRB DIST MPI OMPG OMPH PIO PR3 UQ FLX0 SEED ST4 STAB0 NL1 BT1 DB1 MLIM FLD2 TR0 BS0 RWND WNX1 WNT1 CRX1 CRT1 O0 O1 O2 O3 O4 O5 O6 O7 O14 O15 IC0 IS0 REF0 diff --git a/model/bin/switch_meshcap_pdlib b/model/bin/switch_meshcap_pdlib index 3b43c7146..6be94e6d0 100644 --- a/model/bin/switch_meshcap_pdlib +++ b/model/bin/switch_meshcap_pdlib @@ -1 +1 @@ -NCO PDLIB SCOTCH NOGRB DIST MPI PR3 UQ FLX0 SEED ST4 STAB0 NL1 BT1 DB1 MLIM FLD2 TR0 BS0 RWND WNX1 WNT1 CRX1 CRT1 O0 O1 O2 O3 O4 O5 O6 O7 O14 O15 IC0 IS0 REF0 +NCO PDLIB SCOTCH NOGRB DIST MPI PIO PR3 UQ FLX0 SEED ST4 STAB0 NL1 BT1 DB1 MLIM FLD2 TR0 BS0 RWND WNX1 WNT1 CRX1 CRT1 O0 O1 O2 O3 O4 O5 O6 O7 O14 O15 IC0 IS0 REF0 diff --git a/model/src/CMakeLists.txt b/model/src/CMakeLists.txt index 9eaa67441..75f3abe97 100644 --- a/model/src/CMakeLists.txt +++ b/model/src/CMakeLists.txt @@ -174,6 +174,10 @@ if("MPI" IN_LIST switches) target_link_libraries(ww3_lib PUBLIC MPI::MPI_Fortran) endif() +if("PIO" IN_LIST switches) + target_sources(ww3_lib PRIVATE ${pio_src}) +endif() + # Handle PDLIB, SCRIP, SCRIPNC build files directly instead of through configuration file if("PDLIB" IN_LIST switches) if("SCOTCH" IN_LIST switches) diff --git a/model/src/cmake/src_list.cmake b/model/src/cmake/src_list.cmake index 825f5d637..00fb33cad 100644 --- a/model/src/cmake/src_list.cmake +++ b/model/src/cmake/src_list.cmake @@ -55,19 +55,22 @@ set(ftn_src wmupdtmd.F90 wmwavemd.F90 w3tidemd.F90 - wav_history_mod.F90 wav_shr_flags.F90 ) -set(nuopc_mesh_cap_src - wav_kind_mod.F90 +set(pio_src + wav_history_mod.F90 + wav_pio_mod.F90 + wav_restart_mod.F90 wav_shr_mod.F90 + wav_kind_mod.F90 + wav_import_export.F90 + ) + +set(nuopc_mesh_cap_src wav_shel_inp.F90 wav_comp_nuopc.F90 - wav_import_export.F90 wav_wrapper_mod.F90 - wav_pio_mod.F90 - wav_restart_mod.F90 ) set(esmf_multi_cap_src diff --git a/model/src/cmake/switches.json b/model/src/cmake/switches.json index ca01708af..120da73ef 100644 --- a/model/src/cmake/switches.json +++ b/model/src/cmake/switches.json @@ -745,6 +745,17 @@ } ] }, + { + "name": "pio", + "num_switches": "upto1", + "description": "use pio library", + "valid-options":[ + { + "name": "PIO", + "requires": ["MPI"] + } + ] + }, { "name": "pdlib", "num_switches": "upto1", diff --git a/model/src/w3initmd.F90 b/model/src/w3initmd.F90 index 0f1362277..da95068b3 100644 --- a/model/src/w3initmd.F90 +++ b/model/src/w3initmd.F90 @@ -448,7 +448,9 @@ SUBROUTINE W3INIT ( IMOD, IsMulti, FEXT, MDS, MTRACE, ODAT, FLGRD, FLGR2, FLGD, use w3timemd, only : set_user_timestring use w3odatmd, only : runtype, restart_from_binary, use_restartnc, user_restfname use w3odatmd, only : logfile_is_assigned +#ifdef W3_PIO use wav_restart_mod, only : read_restart +#endif !/ #ifdef W3_MPI INCLUDE "mpif.h" @@ -959,6 +961,7 @@ SUBROUTINE W3INIT ( IMOD, IsMulti, FEXT, MDS, MTRACE, ODAT, FLGRD, FLGR2, FLGD, ! 3.a Read restart file ! VA(:,:) = 0. +#ifdef W3_PIO if (use_restartnc) then if (runtype == 'continue' )then call set_user_timestring(time,user_timestring) @@ -983,6 +986,8 @@ SUBROUTINE W3INIT ( IMOD, IsMulti, FEXT, MDS, MTRACE, ODAT, FLGRD, FLGR2, FLGD, flcold = .true. end if else +#endif + #ifdef W3_DEBUGCOH CALL ALL_VA_INTEGRAL_PRINT(IMOD, "Before W3IORS call", 1) #endif @@ -1016,7 +1021,9 @@ SUBROUTINE W3INIT ( IMOD, IsMulti, FEXT, MDS, MTRACE, ODAT, FLGRD, FLGR2, FLGD, #ifdef W3_TIMINGS CALL PRINT_MY_TIME("After restart inits") #endif +#ifdef W3_PIO end if ! if (use_restartnc) +#endif ! ! 3.b Compare MAPSTA from grid and restart ! diff --git a/model/src/w3wavemd.F90 b/model/src/w3wavemd.F90 index c6b5520d6..f635c2369 100644 --- a/model/src/w3wavemd.F90 +++ b/model/src/w3wavemd.F90 @@ -491,8 +491,10 @@ SUBROUTINE W3WAVE ( IMOD, ODAT, TEND, STAMP, NO_OUT & #ifdef W3_TIMINGS USE W3PARALL, only : PRINT_MY_TIME #endif +#ifdef W3_PIO use wav_restart_mod , only : write_restart use wav_history_mod , only : write_history +#endif use w3odatmd , only : histwr, rstwr, use_historync, use_restartnc, user_restfname use w3odatmd , only : verboselog use w3timemd , only : set_user_timestring @@ -2354,7 +2356,9 @@ SUBROUTINE W3WAVE ( IMOD, ODAT, TEND, STAMP, NO_OUT & ! Delay if data assimilation time. ! ! +#ifdef W3_PIO if (dsec21(time,tend) == 0.0) then ! req'd in case waves are running in slow loop + if (use_historync) then floutg = .false. floutg2 = .false. @@ -2372,7 +2376,10 @@ SUBROUTINE W3WAVE ( IMOD, ODAT, TEND, STAMP, NO_OUT & call write_restart(trim(fname), va, mapsta+8*mapst2) end if end if + end if +#endif + IF ( TOFRST(1) .EQ. -1 ) THEN DTTST = 1. @@ -2524,8 +2531,8 @@ SUBROUTINE W3WAVE ( IMOD, ODAT, TEND, STAMP, NO_OUT & #ifdef W3_MPI END IF END IF -#endif end if ! if (.not. use_restartnc) +#endif ! #ifdef W3_MPI IF ( FLOUT(5) .AND. NRQBP.NE.0 ) THEN