Skip to content

Commit

Permalink
Merge branch 'NOAA-EMC:develop' into feature/pointbinary2nc
Browse files Browse the repository at this point in the history
  • Loading branch information
JessicaMeixner-NOAA authored Mar 11, 2024
2 parents 24c9e9f + 156a46d commit 7a1dca3
Show file tree
Hide file tree
Showing 8 changed files with 398 additions and 263 deletions.
555 changes: 318 additions & 237 deletions model/nml/namelists.nml

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions model/src/cmake/src_list.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -92,5 +92,3 @@ set(scripnc_src
${CMAKE_CURRENT_SOURCE_DIR}/SCRIP/scrip_remap_write.f
${CMAKE_CURRENT_SOURCE_DIR}/SCRIP/scrip_remap_read.f
)


26 changes: 21 additions & 5 deletions model/src/w3fld1md.F90
Original file line number Diff line number Diff line change
Expand Up @@ -550,9 +550,13 @@ SUBROUTINE W3FLD1( ASPC, FPI, WNDX,WNDY, ZWND, &
TAUDIR=atan2(TAUY, TAUX)
! Note: add another criterion (stress direction) for iteration.
CRIT1=(ABS(USTAR-USTRB)*100.0)/((USTAR+USTRB)*0.5) .GT. 0.1
CRIT2=(ABS(TAUDIR-TAUDIRB)*100.0/(TAUDIR+TAUDIRB)*0.5) .GT. 0.1
IF ((TAUDIR+TAUDIRB).NE.0.) THEN
CRIT2=(ABS(TAUDIR-TAUDIRB)*100.0/(TAUDIR+TAUDIRB)*0.5) .GT. 0.1
ELSE
CRIT2=.TRUE.
ENDIF
IF (CRIT1 .OR. CRIT2) THEN
! IF ((ABS(USTAR-USTRB)*100.0)/((USTAR+USTRB)*0.5) .GT. 0.1) THEN
! IF ((ABS(USTAR-USTRB)*100.0)/((USTAR+USTRB)*0.5) .GT. 0.1) THEN
USTRB=USTAR
TAUDIRB=TAUDIR
CTR=CTR+1
Expand Down Expand Up @@ -1116,7 +1120,11 @@ SUBROUTINE APPENDTAIL(INSPC, WN2, NKT, KA1, KA2, KA3, WNDDIR,SAT)
DO K=KA1, KA2-1
AVG=SUM(INSPC(K,:))/MAX(REAL(NTH),1.)
DO T=1,NTH
INSPC(K,T)=BT(K)*INSPC(K,T)/TPI/(WN2(K)**3.0)/AVG
if (avg /= 0.0) then
INSPC(K,T)=BT(K)*INSPC(K,T)/TPI/(WN2(K)**3.0)/AVG
else
inspc(k,t) = 0.0
end if
ENDDO
ENDDO
!-----------------------------------------------------------
Expand All @@ -1134,7 +1142,11 @@ SUBROUTINE APPENDTAIL(INSPC, WN2, NKT, KA1, KA2, KA3, WNDDIR,SAT)
ENDDO
AVG=SUM(NORMSPC)/MAX(REAL(NTH),1.)
DO T=1, NTH
INSPC(K,T) = SAT * NORMSPC(T)/TPI/(WN2(K)**3.0)/AVG
if (avg /= 0.0) then
INSPC(K,T) = SAT * NORMSPC(T)/TPI/(WN2(K)**3.0)/AVG
else
inspc(k,t) = 0.0
end if
ENDDO
ENDDO
DO T=1, NTH
Expand All @@ -1148,7 +1160,11 @@ SUBROUTINE APPENDTAIL(INSPC, WN2, NKT, KA1, KA2, KA3, WNDDIR,SAT)
AVG=SUM(NORMSPC)/MAX(REAL(NTH),1.)!1./4.
DO K=KA3+1, NKT
DO T=1, NTH
INSPC(K,T)=NORMSPC(T)*(SAT)/TPI/(WN2(K)**3.0)/AVG
if (avg /= 0.0) then
INSPC(K,T)=NORMSPC(T)*(SAT)/TPI/(WN2(K)**3.0)/AVG
else
inspc(k,t) = 0.0
end if
ENDDO
ENDDO
DEALLOCATE(ANGLE1)
Expand Down
26 changes: 18 additions & 8 deletions model/src/w3gridmd.F90
Original file line number Diff line number Diff line change
Expand Up @@ -678,6 +678,7 @@ MODULE W3GRIDMD
#endif
!
#ifdef W3_SMC
REAL :: DVSMC
REAL :: TRNMX, TRNMY
INTEGER, ALLOCATABLE :: NLvCelsk(:), NLvUFcsk(:), NLvVFcsk(:)
INTEGER, ALLOCATABLE :: IJKCelin(:,:),IJKUFcin(:,:),IJKVFcin(:,:)
Expand Down Expand Up @@ -3944,6 +3945,12 @@ SUBROUTINE W3GRID()
IF (IDFM.EQ.2) WRITE (NDSO,973) TRIM(RFORM)
IF (FROM.EQ.'NAME' .AND. NDSG.NE.NDSI) &
WRITE (NDSO,974) TRIM(FNAME)

#ifdef W3_SMC
!Li Save the depth conversion factor for SMC grid use. JGLi03Nov2023
DVSMC = VSC
#endif

!
! 7.e Read bottom depths
!
Expand Down Expand Up @@ -5065,14 +5072,17 @@ SUBROUTINE W3GRID()
CALL EXTCDE(65)
END IF

!Li Minimum DMIN depth is used as well for SMC.
ZB(ISEA)= - MAX( DMIN, FLOAT( IJKDep(ISEA) ) )
MAPFS(IY:IY+JS-1,IX:IX+IK-1) = ISEA
MAPSTA(IY:IY+JS-1,IX:IX+IK-1) = 1
MAPST2(IY:IY+JS-1,IX:IX+IK-1) = 0
MAPSF(ISEA,1) = IX
MAPSF(ISEA,2) = IY
MAPSF(ISEA,3) = IY + (IX -1)*NY
!Li Allow land cell to be defined by ZLIM value and only reset
!Li MAPST* land values for sea points. JGLi03Nov2023
ZB(ISEA) = DVSMC * FLOAT(IJKDep(ISEA))
IF( ZB(ISEA) .LT. ZLIM ) THEN
MAPSTA(IY:IY+JS-1,IX:IX+IK-1) = 1
MAPST2(IY:IY+JS-1,IX:IX+IK-1) = 0
ENDIF
MAPFS(IY:IY+JS-1,IX:IX+IK-1) = ISEA
MAPSF(ISEA,1) = IX
MAPSF(ISEA,2) = IY
MAPSF(ISEA,3) = IY + (IX-1) * NY

!Li New variable CLATS to hold cosine latitude at cell centre.
!Li Also added CLATIS and CTHG0S for version 4.08.
Expand Down
13 changes: 13 additions & 0 deletions model/src/ww3_multi.F90
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ PROGRAM W3MLTI
!/
USE WMMDATMD, ONLY: MDSI, MDSO, MDSS, MDST, MDSE, &
NMPROC, IMPROC, NMPSCR, NRGRD, ETIME
#ifdef W3_OMPG
USE OMP_LIB
#endif
!/
IMPLICIT NONE
!
Expand Down Expand Up @@ -144,6 +147,12 @@ PROGRAM W3MLTI
#ifdef W3_OMPH
IF ( IMPROC .EQ. NMPSCR ) WRITE (*,905) &
MPI_THREAD_FUNNELED, THRLEV
#endif
!
#ifdef W3_OMPG
IF( IMPROC .EQ. NMPSCR ) THEN
WRITE(*,906) omp_get_max_threads()
ENDIF
#endif
!
!/ ------------------------------------------------------------------- /
Expand Down Expand Up @@ -210,6 +219,10 @@ PROGRAM W3MLTI
905 FORMAT ( ' Hybrid MPI/OMP thread support level:'/ &
' Requested: ', I2/ &
' Provided: ', I2/ )
#endif
!
#ifdef W3_OMPG
906 FORMAT ( ' OMP threading enabled. Number of threads: ', I3 / )
#endif
!
999 FORMAT(//' End of program '/ &
Expand Down
7 changes: 5 additions & 2 deletions model/src/ww3_prnc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1059,15 +1059,15 @@ PROGRAM W3PRNC
! Manages the simple closure of the grid
!
IF (ICLO.EQ.ICLOSE_NONE) THEN
IF (IX21(IX,1).LT.1.OR.IX21(IX,1).GT.NXI-1) WRITE(NDSO,1042) IX, IY, X, Y
IF (IX21(IX,1).LT.1.OR.IX21(IX,1).GT.NXI-1) WRITE(NDSO,1041) IX, X, Y
IX21(IX,1) = MAX ( 1 , MIN(IX21(IX,1),NXI-1) )
IX22(IX,1) = IX21(IX,1) + 1
ELSE
IX21(IX,1) = MAX ( 1 , MIN(IX21(IX,1),NXI) )
IX22(IX,1) = MOD(IX21(IX,1),NXI)+1
END IF
IY21(IX,1) = 1 + INT((Y-Y0I)/SYI)
IF (IY21(IX,1).LT.1.OR.IY21(IX,1).GT.NYI-1) WRITE(NDSO,1042) IX, IY, X, Y
IF (IY21(IX,1).LT.1.OR.IY21(IX,1).GT.NYI-1) WRITE(NDSO,1041) IX, X, Y
IY21(IX,1) = MAX ( 1 , MIN(IY21(IX,1),NYI-1) )
IY22(IX,1) = IY21(IX,1) + 1
!
Expand Down Expand Up @@ -2438,6 +2438,9 @@ PROGRAM W3PRNC
' 2MS2 2MN2 2NK2 MNS2 MSN2 2SM2 3MSN2 ' &
' M4 MS4 MN4 M6 2MS6 2MN6'/)
!
1041 FORMAT (/' *** WAVEWATCH-III WARNING W3PRNC : '/ &
' GRID POINT ',I6,2F7.2,/ &
' NOT COVERED BY INPUT GRID.'/)
1042 FORMAT (/' *** WAVEWATCH-III WARNING W3PRNC : '/ &
' GRID POINT ',2I6,2F7.2,/ &
' NOT COVERED BY INPUT GRID.'/)
Expand Down
14 changes: 14 additions & 0 deletions model/src/ww3_shel.F90
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,10 @@ PROGRAM W3SHEL
#endif
!
USE W3NMLSHELMD

#ifdef W3_OMPG
USE OMP_LIB
#endif
IMPLICIT NONE
!
#ifdef W3_MPI
Expand Down Expand Up @@ -481,6 +485,7 @@ PROGRAM W3SHEL
#ifdef W3_OMPH
ENDIF
#endif

#ifdef W3_MPI
MPI_COMM = MPI_COMM_WORLD
#endif
Expand Down Expand Up @@ -583,6 +588,11 @@ PROGRAM W3SHEL
MPI_THREAD_FUNNELED, THRLEV
#endif
!
#ifdef W3_OMPG
IF(IAPROC .EQ. NAPOUT) THEN
WRITE(NDSO, 906) omp_get_max_threads()
ENDIF
#endif

!
! 1.b For WAVEWATCH III (See W3INIT)
Expand Down Expand Up @@ -2737,6 +2747,10 @@ PROGRAM W3SHEL
905 FORMAT ( ' Hybrid MPI/OMP thread support level:'/ &
' Requested: ', I2/ &
' Provided: ', I2/ )
#endif
!
#ifdef W3_OMPG
906 FORMAT ( ' OMP threading enabled. Number of threads: ', I3 / )
#endif
920 FORMAT (/' Input fields : '/ &
' --------------------------------------------------')
Expand Down
18 changes: 9 additions & 9 deletions regtests/bin/run_cmake_test
Original file line number Diff line number Diff line change
Expand Up @@ -435,21 +435,21 @@ then

echo "Switch file is $path_build/switch with switches:" >> $ofile
cat $path_build/switch >> $ofile
cmake $path_cmake ${CMAKE_OPTIONS} -DSWITCH=$path_build/switch -DCMAKE_INSTALL_PREFIX=install > $ofile 2>&1
cmake $path_cmake ${CMAKE_OPTIONS} -DSWITCH=$path_build/switch -DCMAKE_INSTALL_PREFIX=install >> $ofile 2>&1
rc=$?
if [[ $rc -ne 0 ]] ; then
echo "Fatal error in cmake."
echo "The build log is in $ofile"
exit
fi
make -j 8 > $ofile 2>&1
make -j 8 VERBOSE=1 >> $ofile 2>&1
rc=$?
if [[ $rc -ne 0 ]] ; then
echo "Fatal error in make."
echo "The build log is in $ofile"
exit
fi
make install > $ofile 2>&1
make install >> $ofile 2>&1
if [[ $rc -ne 0 ]] ; then
echo "Fatal error in make install."
echo "The build log is in $ofile"
Expand All @@ -468,20 +468,20 @@ then
\cp -f $file_c $path_build/switch
echo "Switch file is $path_build/switch with switches:" >> $ofile
cat $path_build/switch >> $ofile
cmake $path_cmake ${CMAKE_OPTIONS} -DSWITCH=$path_build/switch -DCMAKE_INSTALL_PREFIX=install > $ofile 2>&1
cmake $path_cmake ${CMAKE_OPTIONS} -DSWITCH=$path_build/switch -DCMAKE_INSTALL_PREFIX=install >> $ofile 2>&1
rc=$?
if [[ $rc -ne 0 ]] ; then
echo "Fatal error in cmake."
echo "The build log is in $ofile"
exit
fi
make -j 8 > $ofile 2>&1
make -j 8 VERBOSE=1 >> $ofile 2>&1
if [[ $rc -ne 0 ]] ; then
echo "Fatal error in make."
echo "The build log is in $ofile"
exit
fi
make install > $ofile 2>&1
make install >> $ofile 2>&1
if [[ $rc -ne 0 ]] ; then
echo "Fatal error in make install."
echo "The build log is in $ofile"
Expand All @@ -507,20 +507,20 @@ else
fi
echo "Switch file is $path_build/switch with switches:" >> $ofile
cat $path_build/switch >> $ofile
cmake $path_cmake ${CMAKE_OPTIONS} -DSWITCH=$path_build/switch -DCMAKE_INSTALL_PREFIX=install > $ofile 2>&1
cmake $path_cmake ${CMAKE_OPTIONS} -DSWITCH=$path_build/switch -DCMAKE_INSTALL_PREFIX=install >> $ofile 2>&1
rc=$?
if [[ $rc -ne 0 ]] ; then
echo "Fatal error in cmake."
echo "The build log is in $ofile"
exit
fi
make -j 8 > $ofile 2>&1
make -j 8 VERBOSE=1 >> $ofile 2>&1
if [[ $rc -ne 0 ]] ; then
echo "Fatal error in make."
echo "The build log is in $ofile"
exit
fi
make install > $ofile 2>&1
make install >> $ofile 2>&1
if [[ $rc -ne 0 ]] ; then
echo "Fatal error in make install."
echo "The build log is in $ofile"
Expand Down

0 comments on commit 7a1dca3

Please sign in to comment.