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

Ww3 gse2 #1143

Draft
wants to merge 13 commits into
base: develop
Choose a base branch
from
Draft
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
2 changes: 2 additions & 0 deletions model/inp/ww3_grid.inp
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,8 @@ $ JGS_LIMITER : TRUE: Use total (quasi-steady: limits
$ FALSE: default
$ JGS_LIMITER_FUNC : 1 - old limiter (default)
$ 2 - alternatnive limiter
$ JGS_LGSE : T/F - turn on/off GSE correction on unstructured grids
$ JGS_GSE_TS : Time constant of the diffusion tensor, see Manual, same as for PR2
$ 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)
Expand Down
2 changes: 2 additions & 0 deletions model/nml/namelists.nml
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,8 @@ $ JGS_DIFF_THR : implicit solver threshold for JGS_TE
$ 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
$ JGS_LGSE : T/F - turn on/off GSE correction on unstructured grids
$ JGS_GSE_TS : Time constant of the diffusion tensor, see Manual, same as for PR2
$ SETUP_APPLY_WLV : Compute wave setup (experimental)
$ SOLVERTHR_SETUP : Solver threshold for setup computations
$ CRIT_DEP_SETUP : Critical depths for setup computations
Expand Down
2 changes: 1 addition & 1 deletion model/src/PDLIB/yownodepool.F90
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ module yowNodepool

!> coordinates of the local + ghost nodes. range [1:npa]
real(rkind), public, target, allocatable :: x(:), y(:), z(:)
real(rkind), public, target, allocatable :: PDLIB_SI(:), PDLIB_TRIA(:), PDLIB_TRIA03(:), PDLIB_IEN(:,:)
real(rkind), public, target, allocatable :: PDLIB_SI(:), PDLIB_TRIA(:), PDLIB_TRIA03(:), PDLIB_IEN(:,:), PDLIB_IEND(:,:,:)
integer, public, target, allocatable :: PDLIB_CCON(:), PDLIB_IA(:), PDLIB_JA(:)
integer, public, target, allocatable :: PDLIB_IA_P(:), PDLIB_JA_P(:), PDLIB_JA_IE(:,:,:)
integer, public, target, allocatable :: PDLIB_POS_CELL(:), PDLIB_IE_CELL(:)
Expand Down
14 changes: 12 additions & 2 deletions model/src/PDLIB/yowpdlibmain.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1306,13 +1306,13 @@ subroutine ComputeTRIA_IEN_SI_CCON
use yowerr, only: parallel_abort
use yowDatapool, only: myrank
use yowNodepool, only: np_global, np, iplg, t_Node, ghostlg, ng, npa
use yowNodepool, only: x, y, z, PDLIB_SI, PDLIB_IEN, PDLIB_TRIA, PDLIB_CCON, PDLIB_TRIA03
use yowNodepool, only: x, y, z, PDLIB_SI, PDLIB_IEN, PDLIB_IEND, PDLIB_TRIA, PDLIB_CCON, PDLIB_TRIA03

integer I1, I2, I3, stat, IE, NI(3)
real :: DXP1, DXP2, DXP3, DYP1, DYP2, DYP3, DBLTMP, TRIA03
logical :: CROSSES_DATELINE

allocate(PDLIB_SI(npa), PDLIB_CCON(npa), PDLIB_IEN(6,ne), PDLIB_TRIA(ne), PDLIB_TRIA03(ne), stat=stat)
allocate(PDLIB_SI(npa), PDLIB_CCON(npa), PDLIB_IEN(6,ne), PDLIB_IEND(3,3,ne), PDLIB_TRIA(ne), PDLIB_TRIA03(ne), stat=stat)
if(stat/=0) call parallel_abort('SI allocation failure')

PDLIB_SI(:) = 0.0d0 ! Median Dual Patch Area of each Node
Expand Down Expand Up @@ -1350,6 +1350,16 @@ subroutine ComputeTRIA_IEN_SI_CCON
WRITE(*,*) 'AREA SMALLER ZERO IN PDLIB', IE, NE, PDLIB_TRIA(IE)
STOP
ENDIF
PDLIB_IEND(1,1,IE) = DOT_PRODUCT(PDLIB_IEN(1:2,IE),PDLIB_IEN(1:2,IE)) ! Tomaich. eq. 3.19 n1 * n1 etc.
PDLIB_IEND(1,2,IE) = DOT_PRODUCT(PDLIB_IEN(1:2,IE),PDLIB_IEN(3:4,IE))
PDLIB_IEND(1,3,IE) = DOT_PRODUCT(PDLIB_IEN(1:2,IE),PDLIB_IEN(5:6,IE))
PDLIB_IEND(2,1,IE) = DOT_PRODUCT(PDLIB_IEN(3:4,IE),PDLIB_IEN(1:2,IE))
PDLIB_IEND(2,2,IE) = DOT_PRODUCT(PDLIB_IEN(3:4,IE),PDLIB_IEN(3:4,IE))
PDLIB_IEND(2,3,IE) = DOT_PRODUCT(PDLIB_IEN(3:4,IE),PDLIB_IEN(5:6,IE))
PDLIB_IEND(3,1,IE) = DOT_PRODUCT(PDLIB_IEN(5:6,IE),PDLIB_IEN(1:2,IE))
PDLIB_IEND(3,2,IE) = DOT_PRODUCT(PDLIB_IEN(5:6,IE),PDLIB_IEN(3:4,IE))
PDLIB_IEND(3,3,IE) = DOT_PRODUCT(PDLIB_IEN(5:6,IE),PDLIB_IEN(5:6,IE))


PDLIB_CCON(I1) = PDLIB_CCON(I1) + 1
PDLIB_CCON(I2) = PDLIB_CCON(I2) + 1
Expand Down
15 changes: 9 additions & 6 deletions model/src/w3gdatmd.F90
Original file line number Diff line number Diff line change
Expand Up @@ -819,9 +819,7 @@ MODULE W3GDATMD
#ifdef W3_PR1
REAL :: DUMMY
#endif
#ifdef W3_PR2
REAL :: DTME, CLATMN
#endif
#ifdef W3_PR3
REAL :: WDCG, WDTH
#endif
Expand Down Expand Up @@ -1052,8 +1050,11 @@ MODULE W3GDATMD
LOGICAL :: B_JGS_LIMITER
LOGICAL :: B_JGS_USE_JACOBI
LOGICAL :: B_JGS_BLOCK_GAUSS_SEIDEL
LOGICAL :: B_JGS_LGSE
INTEGER :: B_JGS_GSE_METHOD
INTEGER :: B_JGS_MAXITER
INTEGER :: B_JGS_LIMITER_FUNC
REAL*8 :: B_JGS_GSE_TS
REAL*8 :: B_JGS_PMIN
REAL*8 :: B_JGS_DIFF_THR
REAL*8 :: B_JGS_NORM_THR
Expand Down Expand Up @@ -1252,9 +1253,7 @@ MODULE W3GDATMD
!/
!/ Data aliasses for structure PROP(S)
!/
#ifdef W3_PR2
REAL, POINTER :: DTME, CLATMN
#endif
#ifdef W3_PR3
REAL, POINTER :: WDCG, WDTH
#endif
Expand Down Expand Up @@ -1411,6 +1410,9 @@ MODULE W3GDATMD
LOGICAL, POINTER :: B_JGS_LIMITER
LOGICAL, POINTER :: B_JGS_USE_JACOBI
LOGICAL, POINTER :: B_JGS_BLOCK_GAUSS_SEIDEL
LOGICAL, POINTER :: B_JGS_LGSE
INTEGER, POINTER :: B_JGS_GSE_METHOD
REAL(8), POINTER :: B_JGS_GSE_TS
INTEGER, POINTER :: B_JGS_MAXITER
INTEGER, POINTER :: B_JGS_LIMITER_FUNC
REAL(8), POINTER :: B_JGS_PMIN
Expand Down Expand Up @@ -2551,10 +2553,8 @@ SUBROUTINE W3SETG ( IMOD, NDSE, NDST )
!
! Structure PROPS
!
#ifdef W3_PR2
DTME => MPARS(IMOD)%PROPS%DTME
CLATMN => MPARS(IMOD)%PROPS%CLATMN
#endif
#ifdef W3_PR3
WDCG => MPARS(IMOD)%PROPS%WDCG
WDTH => MPARS(IMOD)%PROPS%WDTH
Expand Down Expand Up @@ -2849,6 +2849,9 @@ SUBROUTINE W3SETG ( IMOD, NDSE, NDST )
B_JGS_LIMITER => MPARS(IMOD)%SCHMS%B_JGS_LIMITER
B_JGS_USE_JACOBI => MPARS(IMOD)%SCHMS%B_JGS_USE_JACOBI
B_JGS_BLOCK_GAUSS_SEIDEL => MPARS(IMOD)%SCHMS%B_JGS_BLOCK_GAUSS_SEIDEL
B_JGS_LGSE => MPARS(IMOD)%SCHMS%B_JGS_LGSE
B_JGS_GSE_METHOD => MPARS(IMOD)%SCHMS%B_JGS_GSE_METHOD
B_JGS_GSE_TS => MPARS(IMOD)%SCHMS%B_JGS_GSE_TS
B_JGS_MAXITER => MPARS(IMOD)%SCHMS%B_JGS_MAXITER
B_JGS_LIMITER_FUNC => MPARS(IMOD)%SCHMS%B_JGS_LIMITER_FUNC
B_JGS_PMIN => MPARS(IMOD)%SCHMS%B_JGS_PMIN
Expand Down
29 changes: 24 additions & 5 deletions model/src/w3gridmd.F90
Original file line number Diff line number Diff line change
Expand Up @@ -928,6 +928,9 @@ MODULE W3GRIDMD
LOGICAL :: IMPSOURCE
LOGICAL :: SETUP_APPLY_WLV
INTEGER :: JGS_MAXITER
LOGICAL :: JGS_LGSE
INTEGER :: JGS_GSE_METHOD
REAL(8) :: JGS_GSE_TS
INTEGER :: nbSel
INTEGER :: UNSTSCHEMES(6)
INTEGER :: UNSTSCHEME
Expand Down Expand Up @@ -1094,6 +1097,9 @@ MODULE W3GRIDMD
JGS_LIMITER, &
JGS_LIMITER_FUNC, &
JGS_USE_JACOBI, &
JGS_LGSE, &
JGS_GSE_METHOD, &
JGS_GSE_TS, &
JGS_BLOCK_GAUSS_SEIDEL, &
JGS_MAXITER, &
JGS_PMIN, &
Expand Down Expand Up @@ -2449,17 +2455,21 @@ SUBROUTINE W3GRID()
JGS_TERMINATE_NORM = .FALSE.
JGS_LIMITER = .FALSE.
JGS_LIMITER_FUNC = 1
JGS_GSE_TS = 350000
JGS_BLOCK_GAUSS_SEIDEL = .TRUE.
JGS_USE_JACOBI = .TRUE.
JGS_LGSE = .FALSE.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add descriptions of the new terms to model/inp/ww3_grid.inp in the UNST namelist section: https://github.com/NOAA-EMC/WW3/blob/develop/model/inp/ww3_grid.inp#L318

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aronroland once this is done I can try to do some tests of this feature, but will need additional information before I can do so. We'll wait to run regression tests once we have testing information included in the PR. Lastly, you checked the box for "If a new feature was added, a regression test for testing the new feature is added", but I don't see the new regression test included yet, so we'll need that as well before this can be merged. That being said, as soon as I have enough information to run a test on my end I can do that.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding updates to ww3_grid.inp !

JGS_GSE_METHOD = 1
JGS_MAXITER=100
JGS_PMIN = 1
JGS_DIFF_THR = 1.E-10
JGS_NORM_THR = 1.E-20
JGS_NLEVEL = 0
JGS_SOURCE_NONLINEAR = .FALSE.
! read data from the unstructured devoted namelist
CALL READNL ( NDSS, 'UNST', STATUS )

CALL READNL ( NDSS, 'UNST', STATUS )

B_JGS_USE_JACOBI = JGS_USE_JACOBI
B_JGS_TERMINATE_MAXITER = JGS_TERMINATE_MAXITER
B_JGS_TERMINATE_DIFFERENCE = JGS_TERMINATE_DIFFERENCE
Expand All @@ -2473,6 +2483,9 @@ SUBROUTINE W3GRID()
B_JGS_NORM_THR = JGS_NORM_THR
B_JGS_NLEVEL = JGS_NLEVEL
B_JGS_SOURCE_NONLINEAR = JGS_SOURCE_NONLINEAR
B_JGS_LGSE = JGS_LGSE
B_JGS_GSE_TS = JGS_GSE_TS
B_JGS_GSE_METHOD = JGS_GSE_METHOD

nbSel=0

Expand Down Expand Up @@ -3334,7 +3347,10 @@ SUBROUTINE W3GRID()
JGS_DIFF_THR, &
JGS_NORM_THR, &
JGS_NLEVEL, &
JGS_SOURCE_NONLINEAR
JGS_SOURCE_NONLINEAR, &
JGS_LGSE, &
JGS_GSE_METHOD, &
JGS_GSE_TS
!
WRITE (NDSO,2976) P2SF, I1P2SF, I2P2SF, &
US3D, I1US3D, I2US3D, &
Expand Down Expand Up @@ -6660,7 +6676,10 @@ SUBROUTINE W3GRID()
', JGS_DIFF_THR=', F8.3, &
', JGS_NORM_THR=', F8.3, &
', JGS_NLEVEL=', I3, &
', JGS_SOURCE_NONLINEAR=', L3 / )
', JGS_SOURCE_NONLINEAR=', L3, &
', JGS_LGSE=', L3, &
', JGS_GSE_METHOD=', I3, &
', JGS_GSE_TS=', F15.3/)
!
960 FORMAT (/' Miscellaneous ',A/ &
' --------------------------------------------------')
Expand Down Expand Up @@ -7134,7 +7153,7 @@ SUBROUTINE W3GRID()
' Number of longitudes :',I10/ &
' Number of latitudes :',I10/ &
' Number of grid points :',I10/ &
' Number of sea points :',I10,' (',F4.1,'%)'/&
' Number of sea points :',I10,' (',F15.4,'%)'/&
' Number of input b. points :',I10/ &
' Number of land points :',I10/ &
' Number of excluded points :',I10/)
Expand All @@ -7143,7 +7162,7 @@ SUBROUTINE W3GRID()
' Number of longitudes :',I10/ &
' Number of latitudes :',I10/ &
' Number of grid points :',I10/ &
' Number of sea points :',I10,' (100%)'/ &
' Number of sea points :',I10,' (test)'/ &
' Number of input b. points :',I10/ &
' Number of land points :',I10/ &
' Number of excluded points :',I10/)
Expand Down
9 changes: 6 additions & 3 deletions model/src/w3iogrmd.F90
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,8 @@ SUBROUTINE W3IOGR ( INXOUT, NDSM, IMOD, FEXT &
B_JGS_DIFF_THR, &
B_JGS_NORM_THR, &
B_JGS_NLEVEL, &
B_JGS_SOURCE_NONLINEAR
B_JGS_SOURCE_NONLINEAR, &
B_JGS_LGSE, B_JGS_GSE_TS, B_JGS_GSE_METHOD
#ifdef W3_ASCII
WRITE (NDSA,*) &
'FSN, FSPSI,FSFCT,FSNIMP,FSTOTALIMP,FSTOTALEXP, &
Expand Down Expand Up @@ -830,7 +831,8 @@ SUBROUTINE W3IOGR ( INXOUT, NDSM, IMOD, FEXT &
B_JGS_DIFF_THR, &
B_JGS_NORM_THR, &
B_JGS_NLEVEL, &
B_JGS_SOURCE_NONLINEAR
B_JGS_SOURCE_NONLINEAR, &
B_JGS_LGSE, B_JGS_GSE_TS, B_JGS_GSE_METHOD
#endif
!Init COUNTCON and IOBDP to zero, it needs to be set somewhere or
!removed
Expand Down Expand Up @@ -995,7 +997,8 @@ SUBROUTINE W3IOGR ( INXOUT, NDSM, IMOD, FEXT &
B_JGS_DIFF_THR, &
B_JGS_NORM_THR, &
B_JGS_NLEVEL, &
B_JGS_SOURCE_NONLINEAR
B_JGS_SOURCE_NONLINEAR, &
B_JGS_LGSE, B_JGS_GSE_TS, B_JGS_GSE_METHOD
IF (.NOT. GUGINIT) THEN
CALL W3DIMUG ( IGRD, NTRI, NX, COUNTOT, NNZ, NDSE, NDST )
END IF
Expand Down
16 changes: 16 additions & 0 deletions model/src/w3pro2md.F90
Original file line number Diff line number Diff line change
Expand Up @@ -967,6 +967,22 @@ SUBROUTINE W3XYP2 ( ISP, DTG, MAPSTA, MAPFS, VQ, VGX, VGY )
#endif
DNN = XWIND * DCELL + (1.-XWIND) * DNND * TFAC


CGD = 0.5 * GRAV / SIG(IK) * IOBDP_LOC(JSEA)
DSS = ( CGD * (XFR-1.))**2 * DTME / 12.
DNN = ( CGD * DTH )**2 * DTME / 12.
DCELL = CGD / 10.0 ! -> CELLP needs probably redifinition ...
KH = WN(IK,ISEA)*DW(ISEA)
XWIND = 3.3 * U10(ISEA)*WN(IK,ISEA)/SIG(IK) - 2.3
XWIND = MAX ( 0. , MIN ( 1. , XWIND ) )
TFAC = MIN ( 1. , (CLATS(ISEA)/CLATMN)**2 )
DSS = SWFAC(JSEA) * (XWIND * DCELL + (1.-XWIND) * DSS * TFAC)
DNN = SWFAC(JSEA) * (XWIND * DCELL + (1.-XWIND) * DNN * TFAC)
DIFFVEC(1,JSEA) = (DSS*ECOS(ITH)**2+DNN*ESIN(ITH)**2)
DIFFVEC(2,JSEA) = (DSS*ESIN(ITH)**2+DNN*ECOS(ITH)**2) / CLATS(ISEA)**2
DIFFVEC(3,JSEA) = ((DSS-DNN) * ESIN(ITH)*ECOS(ITH)) / CLATS(ISEA)


VDXX(IXY) = DTLOC * (DSS*ECOS(ITH)**2+DNN*ESIN(ITH)**2)
VDYY(IXY) = DTLOC * (DSS*ESIN(ITH)**2+DNN*ECOS(ITH)**2) &
/ CLATS(ISEA)**2
Expand Down
Loading