Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into syncdev2ufs_2023jun27
Browse files Browse the repository at this point in the history
* origin/develop:
  handle NaN air-sea temperatures from nearest land points (NOAA-EMC#869)
  Increase valid_max for f in ounp (NOAA-EMC#1014)
  Bugfix deallocation of invalid memory in ww3_prnc (NOAA-EMC#1016)
  Update to orion intel module path and two typo corrections. (NOAA-EMC#1011)
  Bugfix to out of bounds array write in w3profsmd_pdlib.f90 (NOAA-EMC#1013)
  Simple logic fix for time interpolation of boundary nodes at the end of W3XYPFSNIMP. (NOAA-EMC#1005)
  in w3iors use NSEA instead of NSEAL in serial write/read of VA (NOAA-EMC#954)
  Update documentation for UNST namelist (NOAA-EMC#986)
  In certain coupled configurations, the piece of code testing the coupling frequency to check if 'receive' coupling exchanges need to take place fail, resulting in an infinite loop causing the integration between time zero and the first time step to repeat indefinitely. This check needs to be rewritten, which fixes also issue NOAA-EMC#816 in a simpler way.  (NOAA-EMC#999)
  • Loading branch information
MatthewMasarik-NOAA committed Jun 27, 2023
2 parents c4b1168 + 3eb8161 commit 0c26878
Show file tree
Hide file tree
Showing 11 changed files with 103 additions and 112 deletions.
61 changes: 36 additions & 25 deletions model/inp/ww3_grid.inp
Original file line number Diff line number Diff line change
Expand Up @@ -305,33 +305,44 @@ $ limitation and the GSE alleviation.
$
$ Unstructured grids ------------------------------------------------ $
$ UNST parameters : Namelist UNST
$ UGOBCAUTO : TRUE: OBC points are taken from type 15 elements
$ FALSE: OBC points must be listed in ww3_grid.inp
$ UGOBCDEPTH : Threshold ( < 0) depth for OBC points if UGOBCAUTO is TRUE
$ UGOBCFILE : Reading boundary files from a file
$ EXPFSN : Activation of N scheme (only one of the below 4, True - Active, False - not active)
$ UGBCCFL : Turns on/off (TRUE/FALSE) the computation of the CFL number on the physical domain boundary.
$ If FALSE the explicit scheme can be much faster though stability is not guaranteed
$ (default TRUE)
$ UGOBCAUTO : TRUE: OBC points are taken from type 15 elements (default)
$ FALSE: OBC points must be listed in ww3_grid.inp
$ UGOBCDEPTH : Threshold ( < 0) depth (default -10) for OBC points if UGOBCAUTO is TRUE
$ UGOBCFILE : File name of file for reading boudary (default 'unset')
$
$ The following are TRUE/FALSE variables and only one can be TRUE.
$ By default, EXPFSN is TRUE and must be set to false to activate another option
$ EXPFSN : Activation of N scheme (default option)
$ EXPFSPSI : Activation of PSI scheme
$ EXPFSFCT : Activation of FCT scheme
$ IMPFSN : Activation of N implicit scheme
$ EXPTOTAL : Activation of the Block explicit N scheme solver
$ IMPTOTAL : Activation of fully implicit scheme | Non splitting
$ IMPREFRACTION : Turn on implicit freq. shift (only with imptotal)
$ IMPFREQSHIFT : Turn on implicit freq. shift terms (only with imptotal)
$ IMPSOURCE : Turn on implicit source terms (only with imptotal)
$ JGS_TERMINATE_MAXITER : max. Number of iterations
$ JGS_TERMINATE_DIFFERENCE : Terminate based on the total change of the unweightet sum of wave action
$ JGS_TERMINATE_NORM : Terminate based on the norm of the solution
$ JGS_USE_JACOBI : Use Jacobi solver family
$ JGS_BLOCK_GAUSS_SEIDEL : Use Block Gauss Seidel method for imptotal instead of the conservative jacobi iterator.
$ JGS_MAXITER : max. Number of solver iterations
$ JGS_PMIN : % of grid points that do not need to converge during solver iteration.
$ JGS_DIFF_THR : implicit solver threshold for JGS_TERMINATE_DIFFERENCE
$ JGS_NORM_THR : terminate based on the norm of the solution
$ JGS_LIMITER : use total (quasi-steady: limits whole equation) instead of local limiter (un-steady: limits only source terms)
$ JGS_LIMITER_FUNC : 1 - old limiter; 2 - alternatnive limiter
$ SETUP_APPLY_WLV : Compute wave setup (experimental)
$ SOLVERTHR_SETUP : Solver threshold for setup computations
$ CRIT_DEP_SETUP : Critical depths for setup computations
$ IMPFSN : Activation of N implicit scheme
$ EXPTOTAL : Activation of Block explicit N scheme solver
$ IMPTOTAL : Activation of fully implicit scheme, non splitting
$
$ The following TRUE/FALSE variables are only for IMPTOTAL=TRUE
$ IMPREFRACTION : Turn on implicit freq. shift (default FALSE)
$ IMPFREQSHIFT : Turn on implicit freq. shift terms (default FALSE)
$ IMPSOURCE : Turn on implicit source terms (default FALSE)
$
$ JGS_TERMINATE_MAXITER : Terminate based on max number of iterations (TRUE/FALSE, default TRUE)
$ JGS_TERMINATE_DIFFERENCE : Terminate based on the total change of the unweightet sum of wave action (TRUE/FALSE, default TRUE)
$ JGS_TERMINATE_NORM : Terminate based on the norm of the solution (TRUE/FALSE, default FALSE)
$ JGS_USE_JACOBI : Use Jacobi solver family (TRUE/FALSE, default TRUE)
$ JGS_BLOCK_GAUSS_SEIDEL : Use Block Gauss Seidel method for imptotal instead of the conservative jacobi iterator. (TRUE/FALSE, default TRUE)
$ JGS_MAXITER : Max. Number of solver iterations for JGS_TERMINATE_MAXITER (integer, default 100)
$ JGS_PMIN : % of grid points that do not need to converge during solver iteration (real, default 1)
$ JGS_DIFF_THR : Implicit solver threshold for JGS_TERMINATE_DIFFERENCE (real, default 1.0e-10)
$ JGS_NORM_THR : Norm of the solution for JGS_TERMINATE_NORM (real, default 1.0e-20)
$ JGS_LIMITER : TRUE: Use total (quasi-steady: limits whole equation) instead of local limiter (un-steady: limits only source terms)
$ FALSE: default
$ JGS_LIMITER_FUNC : 1 - old limiter (default)
$ 2 - alternatnive limiter
$ SETUP_APPLY_WLV : Compute wave setup (TRUE/FALSE, default TRUE)
$ SOLVERTHR_SETUP : Solver threshold for setup computations (default 1E-6)
$ CRIT_DEP_SETUP : Critical depth for setup computations (default 0.1)

$
$ SMC grid propagation : Namelist PSMC and default values
Expand Down
13 changes: 12 additions & 1 deletion model/src/w3iorsmd.F90
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,7 @@ SUBROUTINE W3IORS ( INXOUT, NDSR, DUMFPI, IMOD, FLRSTRT )
! Original non-server version writing of spectra
!
IF ( .NOT.IOSFLG .OR. (NAPROC.EQ.1.AND.NAPRST.EQ.1) ) THEN
#ifdef W3_MPI
DO JSEA=1, NSEAL
CALL INIT_GET_ISEA(ISEA, JSEA)
NREC = ISEA + 2
Expand All @@ -694,6 +695,16 @@ SUBROUTINE W3IORS ( INXOUT, NDSR, DUMFPI, IMOD, FLRSTRT )
WRITEBUFF(1:NSPEC) = VA(1:NSPEC,JSEA)
WRITE (NDSR,POS=RPOS,ERR=803,IOSTAT=IERR) WRITEBUFF
END DO
#else
DO JSEA=1, NSEA
ISEA = JSEA
NREC = ISEA + 2
RPOS = 1_8 + LRECL*(NREC-1_8)
WRITEBUFF(:) = 0.
WRITEBUFF(1:NSPEC) = VA(1:NSPEC,JSEA)
WRITE (NDSR,POS=RPOS,ERR=803,IOSTAT=IERR) WRITEBUFF
END DO
#endif
!
! I/O server version writing of spectra ( !/MPI )
!
Expand Down Expand Up @@ -843,7 +854,7 @@ SUBROUTINE W3IORS ( INXOUT, NDSR, DUMFPI, IMOD, FLRSTRT )
ELSE
#endif
VA = 0.
DO JSEA=1, NSEAL
DO JSEA=1, NSEA
CALL INIT_GET_ISEA(ISEA, JSEA)
NREC = ISEA + 2
RPOS = 1_8 + LRECL*(NREC-1_8)
Expand Down
4 changes: 2 additions & 2 deletions model/src/w3ounfmetamd.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2638,8 +2638,8 @@ SUBROUTINE DEFAULT_META()
!META(1)%VARNS='air_sea_temperature_difference'
META(1)%VARNS=''
META(1)%VARNG='air_sea_temperature_difference'
META(1)%VMIN = 0
META(1)%VMAX = 400
META(1)%VMIN = -200.0
META(1)%VMAX = 200.0
! IFI=1, IFJ=5, WLV
META => GROUP(1)%FIELD(5)%META
META(1)%FSC = 0.01
Expand Down
4 changes: 2 additions & 2 deletions model/src/w3profsmd.F90
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,7 @@ SUBROUTINE W3XYPFSN2 ( ISP, C, LCALC, RD10, RD20, DT, AC)
IF (REFPARS(3).LT.0.5.AND.IOBPD(ITH,IP).EQ.0.AND.IOBPA(IP).EQ.0) THEN
U(IP) = AC(IP) ! restores reflected boundary values
ENDIF
#endif^
#endif
END DO
! update spectrum
AC = U
Expand Down Expand Up @@ -1266,7 +1266,7 @@ SUBROUTINE W3XYPFSNIMP ( ISP, C, LCALC, RD10, RD20, DT, AC)
DO IBI=1, NBI
IP = MAPSF(ISBPI(IBI),1)
AC(IP) = ( RD1*BBPI0(ISP,IBI) + RD2*BBPIN(ISP,IBI) ) &
*IOBPA(IP)*(1-IOBPD(ITH,IP)) / CG(IK,ISBPI(IBI)) * CLATS(ISBPI(IBI))
*IOBPA(IP)*IOBPD(ITH,IP) / CG(IK,ISBPI(IBI)) * CLATS(ISBPI(IBI))
END DO
END IF

Expand Down
4 changes: 2 additions & 2 deletions model/src/w3profsmd_pdlib.F90
Original file line number Diff line number Diff line change
Expand Up @@ -3642,8 +3642,8 @@ SUBROUTINE calcARRAY_JACOBI_VEC(DTG,FACX,FACY,VGX,VGY)
DTK = 0
TMP3 = 0

CCOSA = FACX * ECOS
CSINA = FACX * ESIN
CCOSA = FACX * ECOS(1:NTH)
CSINA = FACX * ESIN(1:NTH)
call print_memcheck(memunit, 'memcheck_____:'//' WW3_JACOBI SECTION 0')

DO ISP = 1, NSPEC
Expand Down
31 changes: 30 additions & 1 deletion model/src/w3src4md.F90
Original file line number Diff line number Diff line change
Expand Up @@ -666,8 +666,16 @@ SUBROUTINE W3SIN4 (A, CG, K, U, USTAR, DRAT, AS, USDIR, Z0, CD, &
! I got it from, maybe just made up from drag law ...
!
#ifdef W3_STAB3
Usigma=MAX(0.,-0.025*AS)
IF ( ISNAN(AS) ) THEN
! AS is typically NaN on land and can propagate into the domain by interpolation
Usigma = 0.
ELSE
Usigma = MAX(0.,-0.025*AS)
END IF
USTARsigma=(1.0+U/(10.+U))*Usigma
#endif
#ifdef W3_T
WRITE (NDST,9003) AS, Usigma, USTARsigma, U
#endif
UST=USTAR
ISTAB=3
Expand All @@ -678,6 +686,9 @@ SUBROUTINE W3SIN4 (A, CG, K, U, USTAR, DRAT, AS, USDIR, Z0, CD, &
#endif
TAUX = UST**2* COS(USDIR)
TAUY = UST**2* SIN(USDIR)
#ifdef W3_T
WRITE (NDST,9001) ISTAB, TAUX, TAUY, UST
#endif
!
! Loop over the resolved part of the spectrum
!
Expand Down Expand Up @@ -788,6 +799,9 @@ SUBROUTINE W3SIN4 (A, CG, K, U, USTAR, DRAT, AS, USDIR, Z0, CD, &
YSTRESS=0.5*(STRESSSTAB(1,2)+STRESSSTAB(2,2))
TAUWNX=0.5*(STRESSSTABN(1,1)+STRESSSTABN(2,1))
TAUWNY=0.5*(STRESSSTABN(1,2)+STRESSSTABN(2,2))
#endif
#ifdef W3_T
WRITE (NDST,9002) SUM(D), SUM(A), XSTRESS, YSTRESS, TAUWNX, TAUWNY
#endif
S = D * A
!
Expand Down Expand Up @@ -868,6 +882,21 @@ SUBROUTINE W3SIN4 (A, CG, K, U, USTAR, DRAT, AS, USDIR, Z0, CD, &
!
#ifdef W3_T
9000 FORMAT (' TEST W3SIN4 : COMMON FACT.: ',3E10.3)
9001 FORMAT (' TEST W3SIN4 : ISTAB :',I2/ &
' TAUX :',E12.3/ &
' TAUY :',E12.3/ &
' UST :',E12.3)
9002 FORMAT (' TEST W3SIN4 : SUM(D) :',E12.3/ &
' SUM(A) :',E12.3/ &
' STRESSX :',E12.3/ &
' STRESSY :',E12.3/ &
' TAUWNX :',E12.3/ &
' TAUWNY :',E12.3)
9003 FORMAT (' TEST W3SIN4 : AS :',F8.4/ &
' Usigma :',E12.3/ &
' USTARsigma :',E12.3/ &
' U :',E12.3)

#endif
!/
!/ End of W3SIN4 ----------------------------------------------------- /
Expand Down
15 changes: 8 additions & 7 deletions model/src/w3srcemd.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1424,7 +1424,7 @@ SUBROUTINE W3SRCE ( srce_call, IT, ISEA, JSEA, IX, IY, IMOD, &
#ifdef W3_PDLIB
IF (B_JGS_LIMITER_FUNC == 2) THEN
DO IK=1, NK
JAC = CG1(IK)/CLATSL
JAC = CG1(IK)/CLATSL
JAC2 = 1./TPI/SIG(IK)
FRLOCAL = SIG(IK)*TPIINV
#ifdef W3_ST6
Expand All @@ -1449,7 +1449,7 @@ SUBROUTINE W3SRCE ( srce_call, IT, ISEA, JSEA, IX, IY, IMOD, &
#ifdef W3_ST6
VS(IS) = VS(IS) + VSWL(IS)
#endif
#ifndef W3_PDLIB
#ifndef W3_PDLIB
#ifdef W3_TR1
VS(IS) = VS(IS) + VSTR(IS)
#endif
Expand Down Expand Up @@ -1491,8 +1491,8 @@ SUBROUTINE W3SRCE ( srce_call, IT, ISEA, JSEA, IX, IY, IMOD, &
#endif
END DO ! end of loop on IS

!VD = 0
!VS = 0
!VD = 0
!VS = 0
!
DT = MAX ( 0.5, DT ) ! The hardcoded min. dt is a problem for certain cases e.g. laborotary scale problems.
!
Expand Down Expand Up @@ -1702,7 +1702,8 @@ SUBROUTINE W3SRCE ( srce_call, IT, ISEA, JSEA, IX, IY, IMOD, &
RETURN ! return everything is done for the implicit ...

END IF ! srce_imp_pre
#endif !W3_PDLIB
!W3_PDLIB
#endif
!
#ifdef W3_T
WRITE (NDST,9040) DTRAW, DT, SHAVE
Expand Down Expand Up @@ -1736,7 +1737,7 @@ SUBROUTINE W3SRCE ( srce_call, IT, ISEA, JSEA, IX, IY, IMOD, &
eInc1 = VDTR(IS) * DT / MAX ( 1. , (1.-HDT*VDTR(IS)))
SPEC(IS) = MAX ( 0. , SPEC(IS)+eInc1 )
END DO
#endif
#endif

#ifdef W3_DEBUGSRC
IF (IX == DEBUG_NODE) WRITE(44,'(1EN15.4)') SUM(VSIN)
Expand Down Expand Up @@ -2257,7 +2258,7 @@ SUBROUTINE W3SRCE ( srce_call, IT, ISEA, JSEA, IX, IY, IMOD, &
IF (IX .eq. DEBUG_NODE) THEN
WRITE(740+IAPROC,*) '5 : sum(SPEC)=', sum(SPEC)
END IF
#endif
#endif

#ifdef W3_REF1
IF (REFLEC(1).GT.0.OR.REFLEC(2).GT.0.OR.(REFLEC(4).GT.0.AND.BERG.GT.0)) THEN
Expand Down
2 changes: 1 addition & 1 deletion model/src/ww3_ounp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -3356,7 +3356,7 @@ SUBROUTINE W3CRNC (ITYPE, OTYPE, NCTYPE, NCFILE, NCID, DIMID, DIMLN, VARID, ONE,
IRET=NF90_PUT_ATT(NCID,VARID(12),'scale_factor',1.)
IRET=NF90_PUT_ATT(NCID,VARID(12),'add_offset',0.)
IRET=NF90_PUT_ATT(NCID,VARID(12),'valid_min',0.)
IRET=NF90_PUT_ATT(NCID,VARID(12),'valid_max',100.)
IRET=NF90_PUT_ATT(NCID,VARID(12),'valid_max',1000.)
IRET=NF90_PUT_ATT(NCID,VARID(12),'_FillValue',NF90_FILL_FLOAT)
IRET=NF90_PUT_ATT(NCID,VARID(12),'content','TXY')
IRET=NF90_PUT_ATT(NCID,VARID(12),'associates','time station frequency')
Expand Down
13 changes: 8 additions & 5 deletions model/src/ww3_prnc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,8 @@ PROGRAM W3PRNC
REAL, ALLOCATABLE :: XC(:,:), YC(:,:), AC(:,:), &
DATA(:,:), XTEMP(:,:)
!
REAL, POINTER :: ALA(:,:), ALO(:,:)
REAL, ALLOCATABLE, TARGET :: ALA(:,:), ALO(:,:)
REAL, POINTER :: PTR_ALA(:,:), PTR_ALO(:,:)
!
DOUBLE PRECISION :: REFJULDAY, CURJULDAY, STARTJULDAY, STPJULDAY
!
Expand Down Expand Up @@ -1007,7 +1008,9 @@ PROGRAM W3PRNC
!
! ... create grid search utility
!
GSI = W3GSUC( .TRUE., FLAGLL, ICLO, ALO, ALA )
PTR_ALA => ALA
PTR_ALO => ALO
GSI = W3GSUC( .TRUE., FLAGLL, ICLO, PTR_ALO, PTR_ALA )
!
! ... construct Interpolation data
!
Expand Down Expand Up @@ -1210,9 +1213,9 @@ PROGRAM W3PRNC
!
! ... read lat-lon data
!
IF ( ASSOCIATED(ALA) ) THEN
IF ( ALLOCATED(ALA) ) THEN
DEALLOCATE ( ALA, ALO )
NULLIFY ( ALA, ALO )
NULLIFY ( PTR_ALA, PTR_ALO )
END IF
ALLOCATE ( ALA(NXJ(J),NYJ(J)), ALO(NXJ(J),NYJ(J)) )
CALL INA2R (ALA, NXJ(J), NYJ(J), 1, NXJ(J), 1, NYJ(J),&
Expand Down Expand Up @@ -2221,7 +2224,7 @@ PROGRAM W3PRNC
END DO ! NTI
!
DEALLOCATE(XC,YC,AC,XTEMP)
IF (ASSOCIATED(ALA)) DEALLOCATE(ALA,ALO)
IF (ALLOCATED(ALA)) DEALLOCATE(ALA,ALO)
!
! End loop over input fields
!--- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Expand Down
Loading

0 comments on commit 0c26878

Please sign in to comment.