Skip to content

Commit

Permalink
Merge pull request NOAA-EMC#3 from mvertens/feature/emc_update
Browse files Browse the repository at this point in the history
Update to unstructured mesh changes from NOAA/EMC update
  • Loading branch information
mvertens authored May 18, 2023
2 parents c44d99e + 95437f0 commit a59c6a0
Show file tree
Hide file tree
Showing 9 changed files with 193 additions and 196 deletions.
2 changes: 1 addition & 1 deletion model/bin/switch_meshcap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
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
2 changes: 1 addition & 1 deletion model/bin/switch_meshcap_pdlib
Original file line number Diff line number Diff line change
@@ -1 +1 @@
PDLIB METIS 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 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
28 changes: 14 additions & 14 deletions model/bin/ww3_from_ftp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ fi

dir0=$(cd $(dirname $0) > /dev/null && pwd -P)
ww3dir=$(dirname $(dirname $dir0))
#Get top level directory of ww3 from user:

#Get top level directory of ww3 from user:
echo -e "\n\n This script will download data from the ftp for WAVEWATCH III "
if [ "$interactive" = "n" ]
then
Expand All @@ -55,19 +55,19 @@ else
echo -e "Enter the absolute or relative path to the main/top directory, "
echo -e "this would be '../../' if in the model/bin directory "
echo -e "or './' if already in the top/main directory:"
read ww3dir
read ww3dir
fi

#Move to top level directory of ww3:
cd $ww3dir
#Move to top level directory of ww3:
cd $ww3dir

#Download from ftp and uptar:
echo -e "Downloading and untaring file from ftp:"
#Download from ftp and uptar:
echo -e "Downloading and untaring file from ftp:"
wget --no-check-certificate https://ftp.emc.ncep.noaa.gov/static_files/public/WW3/ww3_from_ftp.${ww3ver}.tar.gz
tar -xvzf ww3_from_ftp.${ww3ver}.tar.gz

#Move regtest info from data_regtests to regtests:
echo -e "Moving data from data_regtests to regtests"
echo -e "Moving data from data_regtests to regtests"
cp -r data_regtests/ww3_tp2.18/input/*.nc regtests/ww3_tp2.18/input/
cp -r data_regtests/ww3_tp2.15/input/wind.nc regtests/ww3_tp2.15/input/
cp -r data_regtests/ww3_tp2.15/input/*.nc regtests/ww3_tp2.15/input_rho/
Expand All @@ -93,7 +93,7 @@ if [ ! -d regtests/ww3_tp2.14/input/oasis3-mct/doc ]
then
mkdir regtests/ww3_tp2.14/input/oasis3-mct/doc
fi
cp -r data_regtests/ww3_tp2.14/input/oasis3-mct/doc/* regtests/ww3_tp2.14/input/oasis3-mct/doc/
cp -r data_regtests/ww3_tp2.14/input/oasis3-mct/doc/* regtests/ww3_tp2.14/input/oasis3-mct/doc/
cp -r data_regtests/ww3_tp2.14/input/toy/*.nc.OAS*CM regtests/ww3_tp2.14/input/toy/
cp -r data_regtests/ww3_tp2.14/input/toy/r-toy.nc.OASACM regtests/ww3_tp2.14/input/toy/r-toy.nc.OASACM2
cp -r data_regtests/ww3_tp2.14/input/toy/toy_coupled_field.nc.OASACM regtests/ww3_tp2.14/input/toy/toy_coupled_field.nc.OASACM2
Expand All @@ -110,7 +110,7 @@ cp -r data_regtests/ww3_ufs1.1/input_unstr/* regtests/ww3_ufs1.1/input_unstr
cp -r data_regtests/ww3_ufs1.1/input/*.nc regtests/ww3_ufs1.2/input/
cp -r data_regtests/ww3_ufs1.2/input/* regtests/ww3_ufs1.2/input/
cp -r data_regtests/ww3_ufs1.3/input/*nc regtests/ww3_ufs1.3/input/
#Do you want to clean up (aka delete tar file, delete the data_regtests directory)
#Do you want to clean up (aka delete tar file, delete the data_regtests directory)
echo -e "\n\n Do you want to delete the tar file ww3_from_ftp.${ww3ver}.tar.gz [y|n]: "
if [ "$interactive" = "n" ]
then
Expand All @@ -120,10 +120,10 @@ else
fi
if [ "${keep}" = "N" ] || [ "${keep}" = "n" ]
then
echo -e '\n Deleting tar file ww3_from_ftp.${ww3ver}.tar.gz'
echo -e "\n Deleting tar file ww3_from_ftp.${ww3ver}.tar.gz"
rm ww3_from_ftp.${ww3ver}.tar.gz
else
echo -e ' Not deleting tar file.'
echo -e ' Not deleting tar file.'
fi

echo -e "\n\n Files were copied from the data_regtests to the regtests folder."
Expand All @@ -139,9 +139,9 @@ then
echo -e '\n Deleting the data_regtests folder'
rm -rf data_regtests
else
echo -e ' Not deleting the data_regtests folder.'
echo -e ' Not deleting the data_regtests folder.'
fi

#move back to original directory:
#move back to original directory:
cd $curr_dir
echo -e "End of ww3_from_ftp.sh"
11 changes: 6 additions & 5 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, trigp, ntri
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,7 +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
use wav_shr_mod, only : unstr_mesh
!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 Down Expand Up @@ -135,7 +136,7 @@ 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 (unstr_mesh) then
if (gtype .eq. ungtype) then
ierr = nf90_def_dim(ncid, 'ne' , ntri, xeid)
ierr = nf90_def_dim(ncid, 'nn' , 3, ztid)
end if
Expand All @@ -162,7 +163,7 @@ subroutine w3iogoncd ()
ierr = nf90_put_att(ncid, varid, 'units', 'unitless')
ierr = nf90_put_att(ncid, varid, 'long_name', 'map status')

if (unstr_mesh) then
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')
Expand Down Expand Up @@ -216,7 +217,7 @@ subroutine w3iogoncd ()
ierr = nf90_put_var(ncid, varid, elapsed_secs)
call handle_err(ierr, 'put time')

if (unstr_mesh) then
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)
Expand Down
10 changes: 6 additions & 4 deletions model/src/w3iorsmd.F90
Original file line number Diff line number Diff line change
Expand Up @@ -880,10 +880,12 @@ SUBROUTINE W3IORS ( INXOUT, NDSR, DUMFPI, IMOD, FLRSTRT )
IF ( IAPROC .EQ. NAPRST ) THEN
!
#ifdef W3_MPI
ALLOCATE ( STAT2(MPI_STATUS_SIZE,NRQRS) )
CALL MPI_WAITALL &
( NRQRS, IRQRS , STAT2, IERR_MPI )
DEALLOCATE ( STAT2 )
if (associated(irqrs)) then
ALLOCATE ( STAT2(MPI_STATUS_SIZE,NRQRS) )
CALL MPI_WAITALL &
( NRQRS, IRQRS , STAT2, IERR_MPI )
DEALLOCATE ( STAT2 )
end if
#endif
!
RPOS = 1_8 + LRECL*(NREC-1_8)
Expand Down
2 changes: 1 addition & 1 deletion model/src/wav_comp_nuopc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc)
#endif
use wav_shel_inp , only : set_shel_io
use wav_grdout , only : wavinit_grdout
use wav_shr_mod , only : diagnose_mesh, write_meshdecomp
use wav_shr_mod , only : diagnose_mesh, write_meshdecomp
#ifdef W3_PDLIB
use yowNodepool , only : ng
#endif
Expand Down
56 changes: 28 additions & 28 deletions model/src/wav_shel_inp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -738,20 +738,20 @@ subroutine read_shel_config(mpi_comm, mds, time0_overwrite, timen_overwrite)
end do
end if

if ( ( flh(-7) .and. (nh(-7).eq.0) ) .or. &
( flh(-6) .and. (nh(-6).eq.0) ) .or. &
( flh(-5) .and. (nh(-5).eq.0) ) .or. &
( flh(-4) .and. (nh(-4).eq.0) ) .or. &
( flh(-3) .and. (nh(-3).eq.0) ) .or. &
( flh(-2) .and. (nh(-2).eq.0) ) .or. &
( flh(-1) .and. (nh(-1).eq.0) ) .or. &
( flh(0) .and. (nh(0).eq.0) ) .or. &
( flh(1) .and. (nh(1).eq.0) ) .or. &
( flh(2) .and. (nh(2).eq.0) ) .or. &
( flh(3) .and. (nh(3).eq.0) ) .or. &
( flh(4) .and. (nh(4).eq.0) ) .or. &
( flh(5) .and. (nh(5).eq.0) ) .or. &
( flh(6) .and. (nh(6).eq.0) ) .or. &
if ( ( flh(-7) .and. (nh(-7).eq.0) ) .or. &
( flh(-6) .and. (nh(-6).eq.0) ) .or. &
( flh(-5) .and. (nh(-5).eq.0) ) .or. &
( flh(-4) .and. (nh(-4).eq.0) ) .or. &
( flh(-3) .and. (nh(-3).eq.0) ) .or. &
( flh(-2) .and. (nh(-2).eq.0) ) .or. &
( flh(-1) .and. (nh(-1).eq.0) ) .or. &
( flh(0) .and. (nh(0).eq.0) ) .or. &
( flh(1) .and. (nh(1).eq.0) ) .or. &
( flh(2) .and. (nh(2).eq.0) ) .or. &
( flh(3) .and. (nh(3).eq.0) ) .or. &
( flh(4) .and. (nh(4).eq.0) ) .or. &
( flh(5) .and. (nh(5).eq.0) ) .or. &
( flh(6) .and. (nh(6).eq.0) ) .or. &
( flh(10) .and. (nh(10).eq.0) ) ) goto 2007

end if ! flhom
Expand Down Expand Up @@ -1207,20 +1207,20 @@ subroutine read_shel_config(mpi_comm, mds, time0_overwrite, timen_overwrite)
end do
end if

if ( ( flh(-7) .and. (nh(-7).eq.0) ) .or. &
( flh(-6) .and. (nh(-6).eq.0) ) .or. &
( flh(-5) .and. (nh(-5).eq.0) ) .or. &
( flh(-4) .and. (nh(-4).eq.0) ) .or. &
( flh(-3) .and. (nh(-3).eq.0) ) .or. &
( flh(-2) .and. (nh(-2).eq.0) ) .or. &
( flh(-1) .and. (nh(-1).eq.0) ) .or. &
( flh(0) .and. (nh(0).eq.0) ) .or. &
( flh(1) .and. (nh(1).eq.0) ) .or. &
( flh(2) .and. (nh(2).eq.0) ) .or. &
( flh(3) .and. (nh(3).eq.0) ) .or. &
( flh(4) .and. (nh(4).eq.0) ) .or. &
( flh(5) .and. (nh(5).eq.0) ) .or. &
( flh(6) .and. (nh(6).eq.0) ) .or. &
if ( ( flh(-7) .and. (nh(-7).eq.0) ) .or. &
( flh(-6) .and. (nh(-6).eq.0) ) .or. &
( flh(-5) .and. (nh(-5).eq.0) ) .or. &
( flh(-4) .and. (nh(-4).eq.0) ) .or. &
( flh(-3) .and. (nh(-3).eq.0) ) .or. &
( flh(-2) .and. (nh(-2).eq.0) ) .or. &
( flh(-1) .and. (nh(-1).eq.0) ) .or. &
( flh(0) .and. (nh(0).eq.0) ) .or. &
( flh(1) .and. (nh(1).eq.0) ) .or. &
( flh(2) .and. (nh(2).eq.0) ) .or. &
( flh(3) .and. (nh(3).eq.0) ) .or. &
( flh(4) .and. (nh(4).eq.0) ) .or. &
( flh(5) .and. (nh(5).eq.0) ) .or. &
( flh(6) .and. (nh(6).eq.0) ) .or. &
( flh(10) .and. (nh(10).eq.0) ) ) goto 2007

end if ! flhom
Expand Down
39 changes: 17 additions & 22 deletions model/src/wav_shr_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -177,40 +177,40 @@ subroutine diagnose_mesh(EMeshIn, gindex_size, mesh_name, rc)
write(msgString,'(5(a,i6))')trim(mesh_name)//' Info: Node Cnt = ',ncnt,' Elem Cnt = ',ecnt, &
' num Owned Elms = ',nownde,' num Owned Nodes = ',nowndn,&
' Gindex size = ',gindex_size
call ESMF_LogWrite(trim(msgString), rc=rc)
call ESMF_LogWrite(trim(msgString), ESMF_LOGMSG_INFO)

allocate(nids(ncnt))
allocate(nowners(ncnt))
allocate(eids(ecnt))

if (elementDistGridIsPresent) call ESMF_LogWrite('element Distgrid is Present', rc=rc)
if (nodalDistGridIsPresent) call ESMF_LogWrite('nodal Distgrid is Present', rc=rc)
if (elementMaskIsPresent) call ESMF_LogWrite('element Mask is Present', rc=rc)
if (nodeMaskIsPresent) call ESMF_LogWrite('node Mask is Present', rc=rc)
if (elementCoordsIsPresent) call ESMF_LogWrite('element Coords is Present', rc=rc)
if (elementDistGridIsPresent) call ESMF_LogWrite('element Distgrid is Present', ESMF_LOGMSG_INFO)
if (nodalDistGridIsPresent) call ESMF_LogWrite('nodal Distgrid is Present', ESMF_LOGMSG_INFO)
if (elementMaskIsPresent) call ESMF_LogWrite('element Mask is Present', ESMF_LOGMSG_INFO)
if (nodeMaskIsPresent) call ESMF_LogWrite('node Mask is Present', ESMF_LOGMSG_INFO)
if (elementCoordsIsPresent) call ESMF_LogWrite('element Coords is Present', ESMF_LOGMSG_INFO)

call ESMF_MeshGet(EMeshIn, nodeIds=nids, nodeOwners=nowners, rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
lb = lbound(nids,1); ub = ubound(nids,1)
write(msgString,'(a,12i8)')trim(mesh_name)//' : NodeIds(lb:lb+9) = ',lb,ub,nids(lb:lb+9)
call ESMF_LogWrite(trim(msgString), rc=rc)
call ESMF_LogWrite(trim(msgString), ESMF_LOGMSG_INFO)
write(msgString,'(a,12i8)')trim(mesh_name)//' : NodeOwners(lb:lb+9) = ',lb,ub,nowners(lb:lb+9)
call ESMF_LogWrite(trim(msgString), rc=rc)
call ESMF_LogWrite(trim(msgString), ESMF_LOGMSG_INFO)
write(msgString,'(a,12i8)')trim(mesh_name)//' : NodeIds(ub-9:ub) = ',lb,ub,nids(ub-9:ub)
call ESMF_LogWrite(trim(msgString), rc=rc)
call ESMF_LogWrite(trim(msgString), ESMF_LOGMSG_INFO)
write(msgString,'(a,12i8)')trim(mesh_name)//' : NodeOwners(ub-9:ub) = ',lb,ub,nowners(ub-9:ub)
call ESMF_LogWrite(trim(msgString), rc=rc)
call ESMF_LogWrite(trim(msgString), ESMF_LOGMSG_INFO)
write(msgString,'(a,12i8)')trim(mesh_name)//' : NodeOwners min,max = ',minval(nowners),maxval(nowners)
call ESMF_LogWrite(trim(msgString), rc=rc)
call ESMF_LogWrite(trim(msgString), ESMF_LOGMSG_INFO)

! some methods not avail when using a dual mesh
if (.not. unstr_mesh) then
call ESMF_MeshGet(EMeshIn, elementIds=eids, rc=rc)
lb = lbound(eids,1); ub = ubound(eids,1)
write(msgString,'(a,12i8)')trim(mesh_name)//' : ElemIds(lb:lb+9) = ',lb,ub,eids(lb:lb+9)
call ESMF_LogWrite(trim(msgString), rc=rc)
call ESMF_LogWrite(trim(msgString), ESMF_LOGMSG_INFO)
write(msgString,'(a,12i8)')trim(mesh_name)//' : ElemIds(ub-9:ub) = ',lb,ub,eids(ub-9:ub)
call ESMF_LogWrite(trim(msgString), rc=rc)
call ESMF_LogWrite(trim(msgString), ESMF_LOGMSG_INFO)
end if
deallocate(nids)
deallocate(eids)
Expand Down Expand Up @@ -561,7 +561,7 @@ subroutine state_getfldptr_1d(State, fldname, fldptr, rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

if (status /= ESMF_FIELDSTATUS_COMPLETE) then
call ESMF_LogWrite(trim(subname)//": ERROR data not allocated ", ESMF_LOGMSG_INFO, rc=rc)
call ESMF_LogWrite(trim(subname)//": ERROR data not allocated ", ESMF_LOGMSG_ERROR)
rc = ESMF_FAILURE
return
else
Expand Down Expand Up @@ -775,11 +775,11 @@ subroutine field_getfldptr(field, fldptr1, fldptr2, rank, abort, rc)
if (status /= ESMF_FIELDSTATUS_COMPLETE) then
lrank = 0
if (labort) then
call ESMF_LogWrite(trim(subname)//": ERROR data not allocated ", ESMF_LOGMSG_INFO, rc=rc)
call ESMF_LogWrite(trim(subname)//": ERROR data not allocated ", ESMF_LOGMSG_ERROR)
rc = ESMF_FAILURE
return
else
call ESMF_LogWrite(trim(subname)//": WARNING data not allocated ", ESMF_LOGMSG_INFO, rc=rc)
call ESMF_LogWrite(trim(subname)//": WARNING data not allocated ", ESMF_LOGMSG_INFO)
endif
else

Expand All @@ -798,8 +798,7 @@ subroutine field_getfldptr(field, fldptr1, fldptr2, rank, abort, rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
if (nnodes == 0 .and. nelements == 0) lrank = 0
else
call ESMF_LogWrite(trim(subname)//": ERROR geomtype not supported ", &
ESMF_LOGMSG_INFO, rc=rc)
call ESMF_LogWrite(trim(subname)//": ERROR geomtype not supported ", ESMF_LOGMSG_ERROR)
rc = ESMF_FAILURE
return
endif ! geomtype
Expand Down Expand Up @@ -941,10 +940,6 @@ subroutine alarmInit( clock, alarm, option, &
if (chkerr(rc,__LINE__,u_FILE_u)) return
update_nextalarm = .false.

call ESMF_LogWrite(trim(subname)//": ERROR geomtype not supported ", &
ESMF_LOGMSG_INFO, rc=rc)
rc = ESMF_FAILURE

case (optDate)
if (.not. present(opt_ymd)) then
call ESMF_LogWrite(trim(subname)//trim(option)//' requires opt_ymd', &
Expand Down
Loading

0 comments on commit a59c6a0

Please sign in to comment.