Skip to content

Commit

Permalink
Add PIO switch (#1324)
Browse files Browse the repository at this point in the history
  • Loading branch information
JessicaMeixner-NOAA authored Dec 5, 2024
1 parent abe1e79 commit 4f518cf
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 9 deletions.
2 changes: 1 addition & 1 deletion model/bin/switch_meshcap
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion model/bin/switch_meshcap_pdlib
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions model/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
15 changes: 9 additions & 6 deletions model/src/cmake/src_list.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 11 additions & 0 deletions model/src/cmake/switches.json
Original file line number Diff line number Diff line change
Expand Up @@ -745,6 +745,17 @@
}
]
},
{
"name": "pio",
"num_switches": "upto1",
"description": "use pio library",
"valid-options":[
{
"name": "PIO",
"requires": ["MPI"]
}
]
},
{
"name": "pdlib",
"num_switches": "upto1",
Expand Down
7 changes: 7 additions & 0 deletions model/src/w3initmd.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
Expand All @@ -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
Expand Down Expand Up @@ -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
!
Expand Down
9 changes: 8 additions & 1 deletion model/src/w3wavemd.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand All @@ -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.
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 4f518cf

Please sign in to comment.