Skip to content

Commit

Permalink
Extend mesh-based NUOPC cap to unstructured WW3 meshes (#1002)
Browse files Browse the repository at this point in the history
  • Loading branch information
DeniseWorthen committed May 15, 2023
1 parent 7c93224 commit c4b1168
Show file tree
Hide file tree
Showing 11 changed files with 634 additions and 379 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
watch3.env
cases
data_regtests
smc_docs/*.pdf
smc_docs/*.pdf
smc_docs/SMCG_TKs/*.ps
ww3_from_ftp.tar.gz
ww3_from_ftp.v6.07.tar.gz
Expand Down Expand Up @@ -133,7 +133,7 @@ regtests/ww3_ufs1.2/input/glo_15mxt.obs
regtests/ww3_ufs1.2/input/gnh_10m.mask
regtests/ww3_ufs1.2/input/gnh_10m.obs
regtests/ww3_ufs1.2/input/gsh_15m.bot
regtests/ww3_ufs1.2/input/gsh_15m.mask
regtests/ww3_ufs1.2/input/gsh_15m.mask
regtests/ww3_ufs1.2/input/gsh_15m.obs
regtests/ww3_ufs1.2/input/gnh_10m.bot
regtests/ww3_ufs1.2/input/gsh_15m.mask
Expand Down
2 changes: 1 addition & 1 deletion model/bin/switch_meshcap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
UWM 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 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 change: 1 addition & 0 deletions model/bin/switch_meshcap_pdlib
Original file line number Diff line number Diff line change
@@ -0,0 +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
2 changes: 0 additions & 2 deletions model/src/cmake/src_list.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -107,5 +107,3 @@ set(scripnc_src
${CMAKE_CURRENT_SOURCE_DIR}/SCRIP/scrip_remap_write.f
${CMAKE_CURRENT_SOURCE_DIR}/SCRIP/scrip_remap_read.f
)


39 changes: 36 additions & 3 deletions model/src/w3iogoncdmd.F90
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ module w3iogoncdmd
subroutine w3iogoncd ()

use w3odatmd , only : fnmpre
use w3gdatmd , only : filext
use w3gdatmd , only : filext, trigp, ntri, ungtype, gtype
use w3servmd , only : extcde
use w3wdatmd , only : w3setw, w3dimw, time, wlv, ice, icef, iceh, berg, ust, ustdir, asf, rhoair
use w3gdatmd , only : xgrd, ygrd
Expand Down Expand Up @@ -67,6 +67,8 @@ subroutine w3iogoncd ()
use w3timemd , only : set_user_timestring
use w3odatmd , only : time_origin, calendar_name, elapsed_secs
use w3odatmd , only : use_user_histname, user_histfname
!TODO: use unstr_mesh from wav_shr_mod; currently fails due to CI
!use wav_shr_mod, only : unstr_mesh

! local variables
integer :: igrd
Expand All @@ -76,7 +78,7 @@ subroutine w3iogoncd ()
character(len=12) :: vname
character(len=16) :: user_timestring !YYYY-MM-DD-SSSSS

integer :: n, xtid, ytid, stid, mtid, ptid, ktid, timid, varid
integer :: n, xtid, ytid, xeid, ztid, stid, mtid, ptid, ktid, timid, varid
logical :: s_axis = .false., m_axis = .false., p_axis = .false., k_axis = .false.

!-------------------------------------------------------------------------------
Expand Down Expand Up @@ -134,6 +136,10 @@ subroutine w3iogoncd ()
if (m_axis) ierr = nf90_def_dim(ncid, 'nm' , len_m, mtid)
if (p_axis) ierr = nf90_def_dim(ncid, 'np' , len_p, ptid)
if (k_axis) ierr = nf90_def_dim(ncid, 'freq' , len_k, ktid)
if (gtype .eq. ungtype) then
ierr = nf90_def_dim(ncid, 'ne' , ntri, xeid)
ierr = nf90_def_dim(ncid, 'nn' , 3, ztid)
end if

! define the time variable
ierr = nf90_def_var(ncid, 'time', nf90_double, timid, varid)
Expand All @@ -151,6 +157,19 @@ subroutine w3iogoncd ()
call handle_err(ierr,'def_latvar')
ierr = nf90_put_att(ncid, varid, 'units', 'degrees_north')

! add mapsta
ierr = nf90_def_var(ncid, 'mapsta', nf90_int, (/xtid, ytid, timid/), varid)
call handle_err(ierr, 'def_mapsta')
ierr = nf90_put_att(ncid, varid, 'units', 'unitless')
ierr = nf90_put_att(ncid, varid, 'long_name', 'map status')

if (gtype .eq. ungtype) then
ierr = nf90_def_var(ncid, 'nconn', nf90_int, (/ztid,xeid/), varid)
call handle_err(ierr,'def_nodeconnections')
ierr = nf90_put_att(ncid, varid, 'units', 'unitless')
ierr = nf90_put_att(ncid, varid, 'long_name', 'node connectivity')
end if

! define the variables
dimid3(1:2) = (/xtid, ytid/)
dimid4(1:2) = (/xtid, ytid/)
Expand Down Expand Up @@ -197,6 +216,20 @@ subroutine w3iogoncd ()
call handle_err(ierr, 'inquire variable time ')
ierr = nf90_put_var(ncid, varid, elapsed_secs)
call handle_err(ierr, 'put time')

if (gtype .eq. ungtype) then
ierr = nf90_inq_varid(ncid, 'nconn', varid)
call handle_err(ierr, 'inquire variable nconn ')
ierr = nf90_put_var(ncid, varid, trigp)
call handle_err(ierr, 'put trigp')
end if

!maps
ierr = nf90_inq_varid(ncid, 'mapsta', varid)
call handle_err(ierr, 'inquire variable mapsta ')
ierr = nf90_put_var(ncid, varid, transpose(mapsta))
call handle_err(ierr, 'put mapsta')

! close the file
ierr = nf90_close(ncid)

Expand Down Expand Up @@ -290,7 +323,7 @@ subroutine w3iogoncd ()
! Group 5
if (vname .eq. 'USTX') call write_var2d(vname, ust (1:nsea)*asf(1:nsea), dir=cos(ustdir(1:nsea)), usemask='true')
if (vname .eq. 'USTY') call write_var2d(vname, ust (1:nsea)*asf(1:nsea), dir=sin(ustdir(1:nsea)), usemask='true')
if (vname .eq. 'CHA') call write_var2d(vname, charn (1:nsea) )
if (vname .eq. 'CHARN') call write_var2d(vname, charn (1:nsea) )
if (vname .eq. 'CGE') call write_var2d(vname, cge (1:nsea) )
if (vname .eq. 'PHIAW') call write_var2d(vname, phiaw (1:nsea), init2='true')
if (vname .eq. 'TAUWIX') call write_var2d(vname, tauwix (1:nsea), init2='true')
Expand Down
4 changes: 2 additions & 2 deletions model/src/w3wavemd.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2463,7 +2463,7 @@ SUBROUTINE W3WAVE ( IMOD, ODAT, TEND, STAMP, NO_OUT &
CALL DO_OUTPUT_EXCHANGES(IMOD)
#endif
END IF ! IF (.NOT. LPDLIB) THEN
END IF
END IF ! if (do_startall)
#endif
call print_memcheck(memunit, 'memcheck_____:'//' WW3_WAVE AFTER TIME LOOP 1')
!
Expand Down Expand Up @@ -2591,7 +2591,7 @@ SUBROUTINE W3WAVE ( IMOD, ODAT, TEND, STAMP, NO_OUT &
if (do_gridded_output) then
if (user_netcdf_grdout) then
#ifdef W3_MPI
CALL MPI_WAITALL( NRQGO, IRQGO, STATIO, IERR_MPI )
IF ( FLGMPI(0) )CALL MPI_WAITALL( NRQGO, IRQGO, STATIO, IERR_MPI )
FLGMPI(0) = .FALSE.
#endif
IF ( IAPROC .EQ. NAPFLD ) THEN
Expand Down
Loading

0 comments on commit c4b1168

Please sign in to comment.