Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix/nml #1070

Merged
merged 6 commits into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
157 changes: 66 additions & 91 deletions model/src/wminitmd.F90
Original file line number Diff line number Diff line change
Expand Up @@ -3499,6 +3499,7 @@ SUBROUTINE WMINITNML ( IDSI, IDSO, IDSS, IDST, IDSE, IFNAME, &
!/ Add ESMF override for STIME & ETIME ( version 6.02 )
!/ (T. J. Campbell, NRL)
!/ 15-May-2018 : Update namelist ( version 6.05 )
!/ 28-Oct-2020 : Add SMCTYPE for SMC sub-grid. JGLi ( version 7.13 )
!/ 22-Mar-2021 : Add momentum and air density input ( version 7.13 )
!/
! 1. Purpose :
Expand All @@ -3518,8 +3519,8 @@ SUBROUTINE WMINITNML ( IDSI, IDSO, IDSS, IDST, IDSE, IFNAME, &
! IDST Int. I Unit number for test output.
! IDSE Int. I Unit number for error output.
! IFNAME Char I File name for input file.
! MPI_COMM Int. I MPI communicator to be used.
! PREAMB Char I File name preamble (optiona).
! MPI_COMM Int. I MPI communicator to be used.
! PREAMB Char I File name preamble (optional).
! ----------------------------------------------------------------
!
! 4. Subroutines used :
Expand Down Expand Up @@ -3726,11 +3727,11 @@ SUBROUTINE WMINITNML ( IDSI, IDSO, IDSS, IDST, IDSE, IFNAME, &
#endif
USE W3WDATMD, ONLY: TIME
USE W3ADATMD, ONLY: WADATS
USE W3IDATMD, ONLY: INFLAGS1, INPUTS, IINIT, &
JFIRST, INFLAGS2
USE W3IDATMD, ONLY: INFLAGS1, INFLAGS2, INPUTS, IINIT, &
JFIRST
USE W3ODATMD, ONLY: NOGRP, NGRPP, FLOUT, TONEXT, FLBPI, &
FLBPO, NFBPO, NBI, NDS, IAPROC, &
NAPFLD, NAPPNT, NAPTRK, NAPBPT, &
NAPFLD, NAPPNT, NAPTRK, NAPBPT, &
NAPPRT, NAPROC, FNMPRE, OUTPTS, NDST, NDSE, &
NOPTS, IOSTYP, UNIPTS, UPPROC, DTOUT, &
TOLAST, NOTYPE
Expand Down Expand Up @@ -4099,12 +4100,13 @@ SUBROUTINE WMINITNML ( IDSI, IDSO, IDSS, IDST, IDSE, IFNAME, &
FLGRD(NOGRP,NGRPP,NRGRD), OT2(0:NRGRD), FLGD(NOGRP,NRGRD), &
MDSF(-NRINP:NRGRD,JFIRST:9), IPRT(6,NRGRD), LPRT(NRGRD), &
FLGR2(NOGRP,NGRPP,NRGRD),FLG2D(NOGRP,NGRPP), FLG1D(NOGRP), &
FLG2(NOGRP,NRGRD) &
,OUTFF(7,0:NRGRD))
FLG2(NOGRP,NRGRD),OUTFF(7,0:NRGRD))
!
MDS = -1
MDSF = -1
FLGR2 = .FALSE.
FLG2 = .FALSE.
LPRT = .FALSE.
IPRT = 0
!
! ... Fixed and recycleable unit numbers.
Expand Down Expand Up @@ -4148,9 +4150,9 @@ SUBROUTINE WMINITNML ( IDSI, IDSO, IDSS, IDST, IDSE, IFNAME, &
! sources, and from communication rather than
! files.
!
ALLOCATE ( INAMES(2*NRGRD,-7:9), MNAMES(-NRINP:2*NRGRD), &
TMPRNK(2*NRGRD), TMPGRP(2*NRGRD), NINGRP(2*NRGRD), &
RP1(2*NRGRD), RPN(2*NRGRD), BCDTMP(NRGRD+1:2*NRGRD))
ALLOCATE ( INAMES(2*NRGRD,-7:9), MNAMES(-NRINP:2*NRGRD), &
TMPRNK(2*NRGRD), TMPGRP(2*NRGRD), NINGRP(2*NRGRD), &
RP1(2*NRGRD), RPN(2*NRGRD), BCDTMP(NRGRD+1:2*NRGRD) )
ALLOCATE ( GRANK(NRGRD), GRGRP(NRGRD), USEINP(NRINP) )
ALLOCATE ( CPLINP(NRINP) )
GRANK = -1
Expand Down Expand Up @@ -4615,31 +4617,39 @@ SUBROUTINE WMINITNML ( IDSI, IDSO, IDSS, IDST, IDSE, IFNAME, &
!
DO I=1, NRGRD
IF ( MDSS.NE.MDSO .AND. NMPSCR.EQ.IMPROC ) WRITE (MDSS,950) TRIM(MNAMES(NRGRD+I))
NOTYPE = 6

NOTYPE = 8
! OTYPE 1
READ(NML_OUTPUT_DATE(I)%FIELD%START, *) ODAT(1,I), ODAT(2,I)
READ(NML_OUTPUT_DATE(I)%FIELD%STRIDE, *) ODAT(3,I)
READ(NML_OUTPUT_DATE(I)%FIELD%STOP, *) ODAT(4,I), ODAT(5,I)
READ(NML_OUTPUT_DATE(I)%FIELD%OUTFFILE, *) OUTFF(1,I)
! OTYPE 2
READ(NML_OUTPUT_DATE(I)%POINT%START, *) ODAT(6,I), ODAT(7,I)
READ(NML_OUTPUT_DATE(I)%POINT%STRIDE, *) ODAT(8,I)
READ(NML_OUTPUT_DATE(I)%POINT%STOP, *) ODAT(9,I), ODAT(10,I)
READ(NML_OUTPUT_DATE(I)%POINT%OUTFFILE, *) OUTFF(2,I)
! OTYPE 3
READ(NML_OUTPUT_DATE(I)%TRACK%START, *) ODAT(11,I), ODAT(12,I)
READ(NML_OUTPUT_DATE(I)%TRACK%STRIDE, *) ODAT(13,I)
READ(NML_OUTPUT_DATE(I)%TRACK%STOP, *) ODAT(14,I), ODAT(15,I)
! OTYPE 4
READ(NML_OUTPUT_DATE(I)%RESTART%START, *) ODAT(16,I), ODAT(17,I)
READ(NML_OUTPUT_DATE(I)%RESTART%STRIDE, *) ODAT(18,I)
READ(NML_OUTPUT_DATE(I)%RESTART%STOP, *) ODAT(19,I), ODAT(20,I)
READ(NML_OUTPUT_DATE(I)%RESTART2%START, *) ODAT(36,I), ODAT(37,I)
READ(NML_OUTPUT_DATE(I)%RESTART2%STRIDE, *) ODAT(38,I)
READ(NML_OUTPUT_DATE(I)%RESTART2%STOP, *) ODAT(39,I), ODAT(40,I)
!OTYPE 5
READ(NML_OUTPUT_DATE(I)%BOUNDARY%START, *) ODAT(21,I), ODAT(22,I)
READ(NML_OUTPUT_DATE(I)%BOUNDARY%STRIDE, *) ODAT(23,I)
READ(NML_OUTPUT_DATE(I)%BOUNDARY%STOP, *) ODAT(24,I), ODAT(25,I)
!OTYPE 6
READ(NML_OUTPUT_DATE(I)%PARTITION%START, *) ODAT(26,I), ODAT(27,I)
READ(NML_OUTPUT_DATE(I)%PARTITION%STRIDE, *) ODAT(28,I)
READ(NML_OUTPUT_DATE(I)%PARTITION%STOP, *) ODAT(29,I), ODAT(30,I)
!OTYPE 7
! for coupling but not implemented yet
!OTYPE 8
READ(NML_OUTPUT_DATE(I)%RESTART2%START, *) ODAT(36,I), ODAT(37,I)
READ(NML_OUTPUT_DATE(I)%RESTART2%STRIDE, *) ODAT(38,I)
READ(NML_OUTPUT_DATE(I)%RESTART2%STOP, *) ODAT(39,I), ODAT(40,I)

! set the time stride at 0 or more
ODAT(3,I) = MAX ( 0 , ODAT(3,I) )
Expand Down Expand Up @@ -4852,6 +4862,10 @@ SUBROUTINE WMINITNML ( IDSI, IDSO, IDSS, IDST, IDSE, IFNAME, &
!
! ... End of output type selecttion ELSE IF
!
ELSE IF ( J .EQ. 8 ) THEN
!
! 5.i Type 8: checkpoint files (no additional data)
!
END IF
!
! ... End of IF in 5.b
Expand All @@ -4861,45 +4875,6 @@ SUBROUTINE WMINITNML ( IDSI, IDSO, IDSS, IDST, IDSE, IFNAME, &
! ... End of loop J on NOTYPE in 5.a
!
END DO
!xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
! Checkpoint
J=8
!OUTPTS(I)%FLOUT(8)=.FALSE.
IF ( ODAT(5*(J-1)+3,I) .NE. 0 ) THEN
!OUTPTS(I)%FLOUT(8)=.TRUE.
IF ( MDSS.NE.MDSO .AND. NMPSCR.EQ.IMPROC ) &
WRITE (MDSS,951) J, IDOTYP(J)
TTIME(1) = ODAT(5*(J-1)+1,I)
TTIME(2) = ODAT(5*(J-1)+2,I)
CALL STME21 ( TTIME , DTME21 )
IF ( MDSS.NE.MDSO .AND. NMPSCR.EQ.IMPROC ) &
WRITE (MDSS,952) DTME21
TTIME(1) = ODAT(5*(J-1)+4,I)
TTIME(2) = ODAT(5*(J-1)+5,I)
CALL STME21 ( TTIME , DTME21 )
IF ( MDSS.NE.MDSO .AND. NMPSCR.EQ.IMPROC ) &
WRITE (MDSS,953) DTME21
TTIME(1) = 0
TTIME(2) = 0
DTTST = REAL ( ODAT(5*(J-1)+3,I) )
CALL TICK21 ( TTIME , DTTST )
CALL STME21 ( TTIME , DTME21 )
IF ( ( ODAT(5*(J-1)+1,I) .NE. ODAT(5*(J-1)+4,I) .OR. &
ODAT(5*(J-1)+2,I) .NE. ODAT(5*(J-1)+5,I) ) .AND. &
MDSS.NE.MDSO .AND. NMPSCR.EQ.IMPROC ) THEN
DO II=1, 18
IF ( DTME21(II:II).NE.'0' .AND. &
DTME21(II:II).NE.'/' .AND. &
DTME21(II:II).NE.' ' .AND. &
DTME21(II:II).NE.':' ) EXIT
DTME21(II:II) = ' '
END DO
WRITE (MDSS,954) DTME21(1:19)
END IF
!ELSE
!OUTPTS(I)%FLOUT(8) = .FALSE.
END IF
!xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
!
! ... End of loop I on NRGRD in 5.a
!
Expand Down Expand Up @@ -5015,16 +4990,17 @@ SUBROUTINE WMINITNML ( IDSI, IDSO, IDSS, IDST, IDSE, IFNAME, &
!
IF ( IOSTYP .GT. 1 ) THEN
DO I=1, NRGRD
! FIELD
IF ( ODAT( 3,I) .GT. 0 ) NDPOUT(I) = NDPOUT(I) + 1
! TRACK
IF ( ODAT(13,I) .GT. 0 ) NDPOUT(I) = NDPOUT(I) + 1
! PARTITION
IF ( ODAT(28,I) .GT. 0 ) NDPOUT(I) = NDPOUT(I) + 1
!xxx
! Checkpoint
IF ( ODAT(38,I) .GT. 0 ) NDPOUT(I) = NDPOUT(I) + 1
!xxx
! POINT .OR. RESTART .OR. BOUNDARY
IF ( ODAT( 8,I) .GT. 0 .OR. ODAT(18,I) .GT. 0 .OR. &
ODAT(23,I) .GT. 0 ) &
NDPOUT(I) = NDPOUT(I) + 1
ODAT(23,I) .GT. 0 ) NDPOUT(I) = NDPOUT(I) + 1
! RESTART2
IF ( ODAT(38,I) .GT. 0 ) NDPOUT(I) = NDPOUT(I) + 1
IF ( IOSTYP .EQ. 2 ) NDPOUT(I) = MIN ( 1 , NDPOUT(I) )
END DO
END IF
Expand Down Expand Up @@ -5437,11 +5413,12 @@ SUBROUTINE WMINITNML ( IDSI, IDSO, IDSS, IDST, IDSE, IFNAME, &
! ..... Model initialization
!
IF ( MDSS.NE.MDSO .AND. NMPSC2.EQ.IMPROC ) WRITE (MDSS,982)
!
CALL W3INIT ( I, .TRUE., MNAMES(I), MDS(:,I), NTRACE(:,I), ODAT(:,I), &

CALL W3INIT ( I, .TRUE., MNAMES(I), MDS(:,I), NTRACE(:,I), &
ODAT(:,I), &
FLGRD(:,:,I),FLGR2(:,:,I),FLGD(:,I),FLG2(:,I), &
OT2(I)%NPTS, OT2(I)%X, OT2(I)%Y, OT2(I)%PNAMES, &
IPRT(:,I), LPRT(I), MPI_COMM_LOC )
IPRT(:,I), LPRT(I), MPI_COMM_LOC)
!
! ..... Finalize I/O file hook up
!
Expand Down Expand Up @@ -5533,16 +5510,26 @@ SUBROUTINE WMINITNML ( IDSI, IDSO, IDSS, IDST, IDSE, IFNAME, &
IF ( MDSS.NE.MDSO .AND. NMPSC2.EQ.IMPROC ) WRITE (MDSS,983)
CALL W3SETI ( I, MDSE, MDST )
!
!!Li Stop modifying GTYPE from input forcing file. JGLi08Apr2021.
JJJ = GTYPE
!
! ..... regular input files
!
DO J=JFIRST, 6
IF ( INFLAGS1(J) ) THEN
IDINP(I,J) = IDSTR(J)
IF ( INPMAP(I,J) .LT. 0 ) CYCLE
CALL W3FLDO ('READ', IDINP(I,J), MDSF(I,J), MDST, MDSE2,&
NX, NY, GTYPE, IERR, MNAMES(I), &
!!Li NX, NY, GTYPE, IERR, MNAMES(I), &
NX, NY, JJJ, IERR, MNAMES(I), &
TRIM(FNMPRE) )
IF ( IERR .NE. 0 ) GOTO 2080
!
!!Li Print a warning message when GTYPE not matching forcing field one.
IF ( (JJJ .NE. GTYPE) .AND. (IMPROC .EQ. NMPSC2) ) &
WRITE (MDSE, *) ' *** Warning: grid', I, ' GTYPE=', &
GTYPE, ' not matching field', J, ' grid type', JJJ
!
IF ( MDSS.NE.MDSO .AND. NMPSC2.EQ.IMPROC ) &
WRITE (MDSS,985) IDFLDS(J)
ELSE
Expand Down Expand Up @@ -5606,8 +5593,8 @@ SUBROUTINE WMINITNML ( IDSI, IDSO, IDSS, IDST, IDSE, IFNAME, &
IF ( J.EQ.6 ) ALLOCATE ( WADATS(I)%RA0(NSEA) , &
WADATS(I)%RAI(NSEA) )
!
END IF
END DO
END IF ! IF ( INPMAP(I,J) .NE. 0 ) THEN
END DO ! DO J=JFIRST, 9
!
INFLAGS1 = TFLAGS
CALL W3SETI ( I, MDSE, MDST )
Expand All @@ -5626,34 +5613,20 @@ SUBROUTINE WMINITNML ( IDSI, IDSO, IDSS, IDST, IDSE, IFNAME, &
END IF
END DO
!
! Checkpoint
J=8
OUTPTS(I)%FLOUT(8)=.FALSE.
IF ( ODAT(5*(J-1)+3,I) .NE. 0 ) THEN
OUTPTS(I)%FLOUT(8)=.TRUE.
ELSE
OUTPTS(I)%FLOUT(8)=.FALSE.
ENDIF

IF ( FLOUT(J) ) THEN
IF ( TOUTP(1,I) .EQ. -1 ) THEN
TOUTP(:,I) = TONEXT(:,J)
ELSE
DTTST = DSEC21 ( TOUTP(:,I), TONEXT(:,J) )
IF ( DTTST .LT. 0. ) TOUTP(:,I) = TONEXT(:,J)
ENDIF
END IF
!
!
GRSTAT(I) = 0
TSYNC(:,I) = TIME(:)
!
#ifdef W3_SMC
! Check GTYPE values after initialization
IF ( IMPROC .EQ. NMPERR ) WRITE(MDSE,*) "GRID IMPROC GTYPE", &
I, IMPROC, GRIDS(I)%GTYPE
#endif
!
#ifdef W3_T
WRITE (MDST,9082) GRSTAT(I), TOUTP(:,I), TSYNC(:,I)
#endif
!
END DO ! DO I=1, NRGRD

END DO !! 8.a I-NRGRD loop
!
#ifdef W3_MPI
CALL MPI_BARRIER (MPI_COMM_MWAVE,IERR_MPI)
Expand Down Expand Up @@ -5725,7 +5698,7 @@ SUBROUTINE WMINITNML ( IDSI, IDSO, IDSS, IDST, IDSE, IFNAME, &
MPI_COMM_BCT, IERR_MPI )
IF ( MPI_COMM_GRD .EQ. MPI_COMM_NULL ) &
GSU = W3GSUC( .FALSE., FLAGLL, ICLOSE, &
XGRD, YGRD)
XGRD, YGRD )
CALL MPI_BCAST ( DXDP, NX*NY, MPI_REAL, 0, &
MPI_COMM_BCT, IERR_MPI )
CALL MPI_BCAST ( DXDQ, NX*NY, MPI_REAL, 0, &
Expand Down Expand Up @@ -5854,7 +5827,8 @@ SUBROUTINE WMINITNML ( IDSI, IDSO, IDSS, IDST, IDSE, IFNAME, &
!
DO I=1, NRGRD
DO J=JFIRST, 9
IF ( INPMAP(I,J) .LT. 0 ) IDINP(I,J) = IDINP( INPMAP(I,J),J)
IF ( INPMAP(I,J).LT.0 .AND. INPMAP(I,J).NE.-999) IDINP(I,J) = IDINP( INPMAP(I,J),J)
!IF ( INPMAP(I,J) .LT. 0 ) IDINP(I,J) = IDINP( INPMAP(I,J),J)
IF ( INPMAP(I,J) .GT. 0 ) IDINP(I,J) = IDINP(-INPMAP(I,J),J)
END DO
END DO
Expand Down Expand Up @@ -5983,7 +5957,7 @@ SUBROUTINE WMINITNML ( IDSI, IDSO, IDSS, IDST, IDSE, IFNAME, &
! 8.c.3 Relation to same ranked grids
!
#ifdef W3_SMC
!! Check whether there is a SMC grid group. JGLi12Apr2021
!! Check whether there is a SMC grid group. JGLi12Apr2021
NGRPSMC = 0
DO JJ=1, NRGRP
J = 0
Expand Down Expand Up @@ -6173,7 +6147,8 @@ SUBROUTINE WMINITNML ( IDSI, IDSO, IDSS, IDST, IDSE, IFNAME, &
IF ( TSTOUT ) CALL WMUDMP ( MDST, 0 )
!
DEALLOCATE ( MDS, NTRACE, ODAT, FLGRD, FLGR2, FLGD, FLG2, INAMES,&
MNAMES )
MNAMES &
,OUTFF )
!
#ifdef W3_MPI
CALL MPI_BARRIER ( MPI_COMM_MWAVE, IERR_MPI )
Expand Down
3 changes: 3 additions & 0 deletions model/src/ww3_ounf.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1978,14 +1978,17 @@ SUBROUTINE W3EXNC ( NX, NY, IX1, IXN, IY1, IYN, NSEA, &
!
! Maximum CFL for spatial advection
ELSE IF ( IFI .EQ. 9 .AND. IFJ .EQ. 3 ) THEN
IF (NCVARTYPEI.EQ.3) NCVARTYPE=4
CALL S2GRID(CFLXYMAX, X1)
!
! Maximum CFL for direction advection
ELSE IF ( IFI .EQ. 9 .AND. IFJ .EQ. 4 ) THEN
IF (NCVARTYPEI.EQ.3) NCVARTYPE=4
CALL S2GRID(CFLTHMAX, X1)
!
! Maximum CFL for frequency advection
ELSE IF ( IFI .EQ. 9 .AND. IFJ .EQ. 5 ) THEN
IF (NCVARTYPEI.EQ.3) NCVARTYPE=4
CALL S2GRID(CFLKMAX, X1)
!
! User defined...
Expand Down
2 changes: 2 additions & 0 deletions regtests/bin/matrix.base
Original file line number Diff line number Diff line change
Expand Up @@ -2152,11 +2152,13 @@
# Global unstr case
# Domain Decomposition Explicit
fi
if [ "$ufs" = 'y' ] && [ "$pdlib" = 'y' ] && [ "$dist" = 'y' ]; then
echo "$rtst -s MPI -s PDLIB -i input_unstr -w work_unstr_a -g a -f -p $mpi -n $np $ww3 ww3_ufs1.1" >> matrix.body
# Domain Decomposition Block Explicit
echo "$rtst -s MPI -s PDLIB -i input_unstr -w work_unstr_b -g b -f -p $mpi -n $np $ww3 ww3_ufs1.1" >> matrix.body
# Domain Decomposition Implicit
echo "$rtst -s MPI -s PDLIB -i input_unstr -w work_unstr_c -g c -f -p $mpi -n $np $ww3 ww3_ufs1.1" >> matrix.body
fi

#Test of UFS applications with ww3_multi_esmf and grib2 output
if [ "$ufs" = 'y' ] && [ "$esmf" = 'y' ] && [ "$grib" = 'y' ]
Expand Down
1 change: 1 addition & 0 deletions regtests/bin/matrix_cmake_datarmor
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ main_dir="`cd $main_dir 1>/dev/null 2>&1 && pwd`"
echo " export NETCDF_CONFIG=/home/datawork-wave/NETCDF2019/${COMP}/bin/nc-config" >> matrix.head
echo " export NetCDF_ROOT=/home/datawork-wave/NETCDF2019/${COMP}" >> matrix.head
echo " export METIS_PATH=/home/datawork-wave/PARMETIS2019/${COMP}" >> matrix.head
echo " export SCOTCH_PATH=/home/datawork-wave/LIB/SCOTCH/v7.0.3/${COMP}" >> matrix.head
echo " export WW3_PARCOMPN=4" >> matrix.head
echo " export G2_LIB4=/home/datawork-wave/NCEPLIBS/${COMP}/g2-3.4.5/lib64/libg2_4.a" >> matrix.head
echo " export BACIO_LIB4=/home/datawork-wave/NCEPLIBS/${COMP}/bacio-2.4.1/lib/libbacio_4.a" >> matrix.head
Expand Down
Loading