Skip to content

Commit

Permalink
ww3_repart: add repartioning namelist parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
aronroland committed Feb 12, 2024
1 parent 9a718fc commit 29a1084
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 16 deletions.
6 changes: 1 addition & 5 deletions model/src/PDLIB/yowpdlibmain.F90
Original file line number Diff line number Diff line change
Expand Up @@ -495,10 +495,9 @@ subroutine runParmetis(MNP)
ncon = 1
! wgtflag: 0: none (vwgt and adjwgt are NULL); 1: edges (vwgt is NULL); 2: vertices (adjwgt is NULL); 3: both vertices & edges;

#ifdef WEIGHTS
wgtflag = 2
INQUIRE ( FILE='weights.ww3', EXIST = lexist )
IF (lexist) THEN
wgtflag = 2
OPEN(100001,FILE='weights.ww3',FORM='FORMATTED',status='unknown')
allocate(iweights(np_global)); iweights = 0
do i = 1, np_global
Expand All @@ -508,9 +507,6 @@ subroutine runParmetis(MNP)
ELSE
wgtflag = 0
ENDIF
#else
wgtflag = 0
#endif

! Create weights
allocate(vwgt(np*ncon), stat=stat)
Expand Down
3 changes: 3 additions & 0 deletions model/src/w3gdatmd.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1046,6 +1046,7 @@ MODULE W3GDATMD
LOGICAL :: DO_CHANGE_WLV
REAL(8) :: SOLVERTHR_STP
REAL(8) :: CRIT_DEP_STP
LOGICAL :: LWEIGHTS
LOGICAL :: B_JGS_TERMINATE_MAXITER
LOGICAL :: B_JGS_TERMINATE_DIFFERENCE
LOGICAL :: B_JGS_TERMINATE_NORM
Expand Down Expand Up @@ -1405,6 +1406,7 @@ MODULE W3GDATMD
LOGICAL, POINTER :: DO_CHANGE_WLV
REAL(8), POINTER :: SOLVERTHR_STP
REAL(8), POINTER :: CRIT_DEP_STP
LOGICAL, POINTER :: LWEIGHTS
LOGICAL, POINTER :: B_JGS_TERMINATE_MAXITER
LOGICAL, POINTER :: B_JGS_TERMINATE_DIFFERENCE
LOGICAL, POINTER :: B_JGS_TERMINATE_NORM
Expand Down Expand Up @@ -2843,6 +2845,7 @@ SUBROUTINE W3SETG ( IMOD, NDSE, NDST )
DO_CHANGE_WLV => MPARS(IMOD)%SCHMS%DO_CHANGE_WLV
SOLVERTHR_STP => MPARS(IMOD)%SCHMS%SOLVERTHR_STP
CRIT_DEP_STP => MPARS(IMOD)%SCHMS%CRIT_DEP_STP
LWEIGHTS => MPARS(IMOD)%SCHMS%LWEIGHTS
B_JGS_TERMINATE_MAXITER => MPARS(IMOD)%SCHMS%B_JGS_TERMINATE_MAXITER
B_JGS_TERMINATE_DIFFERENCE => MPARS(IMOD)%SCHMS%B_JGS_TERMINATE_DIFFERENCE
B_JGS_TERMINATE_NORM => MPARS(IMOD)%SCHMS%B_JGS_TERMINATE_NORM
Expand Down
7 changes: 6 additions & 1 deletion model/src/w3gridmd.F90
Original file line number Diff line number Diff line change
Expand Up @@ -907,6 +907,7 @@ MODULE W3GRIDMD
#ifdef W3_PR3
REAL :: WDTHCG, WDTHTH
#endif
LOGICAL :: LUSEWEIGHTS
LOGICAL :: JGS_TERMINATE_MAXITER
LOGICAL :: JGS_TERMINATE_DIFFERENCE
LOGICAL :: JGS_TERMINATE_NORM
Expand Down Expand Up @@ -1088,6 +1089,7 @@ MODULE W3GRIDMD
IMPFSN, IMPTOTAL, EXPTOTAL, &
IMPREFRACTION, IMPFREQSHIFT, &
IMPSOURCE, &
LUSEWEIGHTS, &
JGS_TERMINATE_MAXITER, &
JGS_TERMINATE_DIFFERENCE, &
JGS_TERMINATE_NORM, &
Expand Down Expand Up @@ -2444,6 +2446,7 @@ SUBROUTINE W3GRID()
SETUP_APPLY_WLV = .TRUE.
SOLVERTHR_SETUP=1E-6
CRIT_DEP_SETUP=0.1
LUSEWEIGHTS = .FALSE.
JGS_TERMINATE_MAXITER = .TRUE.
JGS_TERMINATE_DIFFERENCE = .TRUE.
JGS_TERMINATE_NORM = .FALSE.
Expand All @@ -2460,6 +2463,7 @@ SUBROUTINE W3GRID()
! read data from the unstructured devoted namelist
CALL READNL ( NDSS, 'UNST', STATUS )

LWEIGHTS = LUSEWEIGHTS
B_JGS_USE_JACOBI = JGS_USE_JACOBI
B_JGS_TERMINATE_MAXITER = JGS_TERMINATE_MAXITER
B_JGS_TERMINATE_DIFFERENCE = JGS_TERMINATE_DIFFERENCE
Expand Down Expand Up @@ -3321,7 +3325,7 @@ SUBROUTINE W3GRID()
WRITE (NDSO,2956) UGBCCFL, UGOBCAUTO, UGOBCDEPTH,TRIM(UGOBCFILE), &
EXPFSN, EXPFSPSI, EXPFSFCT, IMPFSN, EXPTOTAL,&
IMPTOTAL, IMPREFRACTION, IMPFREQSHIFT, &
IMPSOURCE, SETUP_APPLY_WLV, &
IMPSOURCE, SETUP_APPLY_WLV, LUSEWEIGHTS, &
JGS_TERMINATE_MAXITER, &
JGS_TERMINATE_DIFFERENCE, &
JGS_TERMINATE_NORM, &
Expand Down Expand Up @@ -6648,6 +6652,7 @@ SUBROUTINE W3GRID()
', IMPTOTAL=',L3,',IMPREFRACTION=', L3, &
', IMPFREQSHIFT=', L3,', IMPSOURCE=', L3, &
', SETUP_APPLY_WLV=', L3, &
', LUSEWEIGHTS=', L3 &
', JGS_TERMINATE_MAXITER=', L3, &
', JGS_TERMINATE_DIFFERENCE=', L3, &
', JGS_TERMINATE_NORM=', L3, &
Expand Down
4 changes: 4 additions & 0 deletions model/src/w3iogrmd.F90
Original file line number Diff line number Diff line change
Expand Up @@ -785,6 +785,7 @@ SUBROUTINE W3IOGR ( INXOUT, NDSM, IMOD, FEXT &
FSBCCFL, FSREFRACTION, FSFREQSHIFT, FSSOURCE, &
DO_CHANGE_WLV, SOLVERTHR_STP, CRIT_DEP_STP, &
NTRI,COUNTOT, COUNTRI, NNZ, &
LWEIGHTS, &
B_JGS_TERMINATE_MAXITER, &
B_JGS_TERMINATE_DIFFERENCE, &
B_JGS_TERMINATE_NORM, &
Expand All @@ -803,6 +804,7 @@ SUBROUTINE W3IOGR ( INXOUT, NDSM, IMOD, FEXT &
FSBCCFL, FSREFRACTION, FSFREQSHIFT, FSSOURCE, &
DO_CHANGE_WLV, SOLVERTHR_STP, CRIT_DEP_STP, &
NTRI,COUNTOT, COUNTRI, NNZ, &
LWEIGHTS, &
B_JGS_TERMINATE_MAXITER, &
B_JGS_TERMINATE_DIFFERENCE, &
B_JGS_TERMINATE_NORM, &
Expand All @@ -819,6 +821,7 @@ SUBROUTINE W3IOGR ( INXOUT, NDSM, IMOD, FEXT &
FSBCCFL, FSREFRACTION, FSFREQSHIFT, FSSOURCE, &
DO_CHANGE_WLV, SOLVERTHR_STP, CRIT_DEP_STP, &
NTRI,COUNTOT, COUNTRI, NNZ, &
LWEIGHTS, &
B_JGS_TERMINATE_MAXITER, &
B_JGS_TERMINATE_DIFFERENCE, &
B_JGS_TERMINATE_NORM, &
Expand Down Expand Up @@ -984,6 +987,7 @@ SUBROUTINE W3IOGR ( INXOUT, NDSM, IMOD, FEXT &
FSBCCFL, FSREFRACTION, FSFREQSHIFT, FSSOURCE, &
DO_CHANGE_WLV, SOLVERTHR_STP, CRIT_DEP_STP, &
NTRI,COUNTOT, COUNTRI, NNZ, &
LWEIGHTS, &
B_JGS_TERMINATE_MAXITER, &
B_JGS_TERMINATE_DIFFERENCE, &
B_JGS_TERMINATE_NORM, &
Expand Down
14 changes: 4 additions & 10 deletions model/src/w3profsmd_pdlib.F90
Original file line number Diff line number Diff line change
Expand Up @@ -5568,9 +5568,7 @@ SUBROUTINE PDLIB_JACOBI_GAUSS_SEIDEL_BLOCK(IMOD, FACX, FACY, DTG, VGX, VGY, LCAL
REAL*8 :: eVA, eVO, CG2, NEWDAC, NEWAC, OLDAC, MAXDAC
REAL :: CG1(0:NK+1), WN1(0:NK+1)
LOGICAL :: LCONVERGED(NSEAL), lexist, LLWS(NSPEC)
#ifdef WEIGHTS
INTEGER :: ipiter(nseal), ipitergl(np_global), ipiterout(np_global)
#endif
#ifdef W3_DEBUGSRC
REAL :: IntDiff, eVA_w3srce, eVAsolve, SumACout
REAL :: SumVAin, SumVAout, SumVAw3srce, SumVS, SumVD, VS_w3srce
Expand Down Expand Up @@ -5744,7 +5742,7 @@ SUBROUTINE PDLIB_JACOBI_GAUSS_SEIDEL_BLOCK(IMOD, FACX, FACY, DTG, VGX, VGY, LCAL
nbIter=0
do ip = 1, np
Lconverged(ip) = .false.
#ifdef WEIGHTS
#ifdef W3_WEIGHTS
ipiter(ip) = 0
#endif
enddo
Expand Down Expand Up @@ -5780,9 +5778,7 @@ SUBROUTINE PDLIB_JACOBI_GAUSS_SEIDEL_BLOCK(IMOD, FACX, FACY, DTG, VGX, VGY, LCAL
ACLOC = VA(:,JSEA)

IF (.NOT. LCONVERGED(IP)) THEN
#ifdef WEIGHTS
ipiter(ip) = ipiter(ip) + 1
#endif
#ifdef W3_DEBUGFREQSHIFT
WRITE(740+IAPROC,*) 'Begin loop'
WRITE(740+IAPROC,*) 'IP/IP_glob/ISEA/JSEA=', IP, IP_glob, ISEA, JSEA
Expand Down Expand Up @@ -6292,7 +6288,6 @@ SUBROUTINE PDLIB_JACOBI_GAUSS_SEIDEL_BLOCK(IMOD, FACX, FACY, DTG, VGX, VGY, LCAL
ENDIF ! FLSOU
END DO ! JSEA

#ifdef WEIGHTS
INQUIRE ( FILE='weights.ww3', EXIST = lexist )
if (.not. lexist) then
ipitergl = 0
Expand All @@ -6302,14 +6297,13 @@ SUBROUTINE PDLIB_JACOBI_GAUSS_SEIDEL_BLOCK(IMOD, FACX, FACY, DTG, VGX, VGY, LCAL
END DO
call mpi_reduce(ipitergl,ipiterout,NP_GLOBAL,MPI_INT,MPI_SUM,0,MPI_COMM_WCMP,ierr)
if (myrank == 0) tHEN
OPEN(100001,FILE='weights.ww3',FORM='FORMATTED',STATUS='unknown')
OPEN(10001,FILE='weights.ww3',FORM='FORMATTED',STATUS='unknown')
do ip = 1, np_global
write(100001,*) ipiterout(ip)
write(10001,*) ipiterout(ip)
enddo
CLOSE(100001)
CLOSE(10001)
endif
endif
#endif
!
call print_memcheck(memunit, 'memcheck_____:'//' WW3_PROP SECTION LOOP 7')
!
Expand Down

0 comments on commit 29a1084

Please sign in to comment.