Skip to content

Commit 40fa6b4

Browse files
add PIO switch
1 parent abe1e79 commit 40fa6b4

File tree

7 files changed

+34
-4
lines changed

7 files changed

+34
-4
lines changed

model/bin/switch_meshcap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +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
1+
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

model/bin/switch_meshcap_pdlib

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +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
1+
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

model/src/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,10 @@ if("MPI" IN_LIST switches)
174174
target_link_libraries(ww3_lib PUBLIC MPI::MPI_Fortran)
175175
endif()
176176

177+
if("PIO" IN_LIST switches)
178+
target_sources(ww3_lib PRIVATE ${pio_src})
179+
endif()
180+
177181
# Handle PDLIB, SCRIP, SCRIPNC build files directly instead of through configuration file
178182
if("PDLIB" IN_LIST switches)
179183
if("SCOTCH" IN_LIST switches)

model/src/cmake/src_list.cmake

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,13 @@ set(ftn_src
5555
wmupdtmd.F90
5656
wmwavemd.F90
5757
w3tidemd.F90
58-
wav_history_mod.F90
5958
wav_shr_flags.F90
6059
)
6160

61+
set(pio_src
62+
wav_history_mod.F90
63+
)
64+
6265
set(nuopc_mesh_cap_src
6366
wav_kind_mod.F90
6467
wav_shr_mod.F90

model/src/cmake/switches.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -745,6 +745,17 @@
745745
}
746746
]
747747
},
748+
{
749+
"name": "pio",
750+
"num_switches": "upto1",
751+
"description": "use pio library",
752+
"valid-options":[
753+
{
754+
"name": "PIO",
755+
"requires": ["MPI"]
756+
}
757+
]
758+
},
748759
{
749760
"name": "pdlib",
750761
"num_switches": "upto1",

model/src/w3initmd.F90

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,9 @@ SUBROUTINE W3INIT ( IMOD, IsMulti, FEXT, MDS, MTRACE, ODAT, FLGRD, FLGR2, FLGD,
448448
use w3timemd, only : set_user_timestring
449449
use w3odatmd, only : runtype, restart_from_binary, use_restartnc, user_restfname
450450
use w3odatmd, only : logfile_is_assigned
451+
#ifdef W3_PIO
451452
use wav_restart_mod, only : read_restart
453+
#endif
452454
!/
453455
#ifdef W3_MPI
454456
INCLUDE "mpif.h"
@@ -972,13 +974,17 @@ SUBROUTINE W3INIT ( IMOD, IsMulti, FEXT, MDS, MTRACE, ODAT, FLGRD, FLGR2, FLGD,
972974
if (restart_from_binary) then
973975
call w3iors('READ', nds(6), sig(nk), imod, filename=trim(fname))
974976
else
977+
#ifdef W3_PIO
975978
call read_restart(trim(fname), va=va, mapsta=mapsta, mapst2=mapst2)
979+
#endif
976980
end if
977981
else
978982
call extcde (60, msg="required restart file " // trim(fname) // " does not exist")
979983
end if
980984
else
985+
#ifdef W3_PIO
981986
call read_restart('none')
987+
#endif
982988
! mapst2 is module variable defined in read of mod_def; maptst is from 2.b above
983989
flcold = .true.
984990
end if

model/src/w3wavemd.F90

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,8 +491,10 @@ SUBROUTINE W3WAVE ( IMOD, ODAT, TEND, STAMP, NO_OUT &
491491
#ifdef W3_TIMINGS
492492
USE W3PARALL, only : PRINT_MY_TIME
493493
#endif
494+
#ifdef W3_PIO
494495
use wav_restart_mod , only : write_restart
495496
use wav_history_mod , only : write_history
497+
#endif
496498
use w3odatmd , only : histwr, rstwr, use_historync, use_restartnc, user_restfname
497499
use w3odatmd , only : verboselog
498500
use w3timemd , only : set_user_timestring
@@ -2361,15 +2363,19 @@ SUBROUTINE W3WAVE ( IMOD, ODAT, TEND, STAMP, NO_OUT &
23612363
if (histwr) then
23622364
call w3cprt (imod)
23632365
call w3outg (va, flpfld, .true., .false. )
2366+
#ifdef W3_PIO
23642367
call write_history(tend)
2368+
#endif
23652369
end if
23662370
end if
23672371

23682372
if (use_restartnc) then
23692373
if (rstwr) then
23702374
call set_user_timestring(tend,user_timestring)
23712375
fname = trim(user_restfname)//trim(user_timestring)//'.nc'
2376+
#ifdef W3_PIO
23722377
call write_restart(trim(fname), va, mapsta+8*mapst2)
2378+
#endif
23732379
end if
23742380
end if
23752381
end if
@@ -2524,8 +2530,8 @@ SUBROUTINE W3WAVE ( IMOD, ODAT, TEND, STAMP, NO_OUT &
25242530
#ifdef W3_MPI
25252531
END IF
25262532
END IF
2527-
#endif
25282533
end if ! if (.not. use_restartnc)
2534+
#endif
25292535
!
25302536
#ifdef W3_MPI
25312537
IF ( FLOUT(5) .AND. NRQBP.NE.0 ) THEN

0 commit comments

Comments
 (0)