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

RTD support for ww3_boun[dc] #10

Merged
merged 5 commits into from
Jul 28, 2020
Merged
Show file tree
Hide file tree
Changes from 2 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
21 changes: 19 additions & 2 deletions model/ftn/ww3_bounc.ftn
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
!/ | F. Ardhuin |
!/ | M. Accensi |
!/ | FORTRAN 90 |
!/ | Last update : 04-May-2020 |
!/ | Last update : 21-Jul-2020 |
!/ +-----------------------------------+
!/
!/ 24-May-2013 : Adaptation from ww3_bound.ftn ( version 4.08 )
Expand All @@ -18,6 +18,8 @@
!/ 20-Mar-2018 : Improve netcdf file reading ( version 6.02 )
!/ 15-May-2018 : Add namelist feature ( version 6.05 )
!/ 04-May-2020 : Update spectral conversion ( version 7.XX )
!/ 21-Jul-2020 : Support rotated pole grid ( version 7.XX )
!/
!/
!/ Copyright 2012-2013 National Weather Service (NWS),
!/ National Oceanic and Atmospheric Administration. All rights
Expand Down Expand Up @@ -53,6 +55,7 @@
! EXTCDE Subr. Id. Abort program as graceful as possible.
! WAVNU1 Subr. W3DISPMD Solve dispersion relation.
! W3IOGR Subr. W3IOGRMD Reading/writing model definition file.
! W3EQTOLL Subr W3SERVMD Convert coordinates from rotated pole.
! ----------------------------------------------------------------
!
! 5. Called by :
Expand All @@ -66,6 +69,9 @@
! - Can be used also to diagnose contents of nest.ww3 file
! in read mode
!
! - Input spectra are assumed to be formulated on a standard
! pole. However, the model grid can be on a rotated pole.
!
Comment on lines +72 to +74
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is an important note. A user might do mistakes if not aware of this. May be mentioned in the Manual Sect. 3.4.9 Rotated grids in a separate, short paragraph like: "If the user wants to apply boundary condition from spectral files using one of the programs ww3_bounc or ww3_bound as described in Appendix B.2, the input spectra are assumed to be formulated on a standard pole."

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for the review @CarstenHansen . I will make a small addition the to manual to ensure the user is aware that input spectra should be on a standard pole.

Copy link
Member Author

Choose a reason for hiding this comment

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

I have also added some comments in the relevant .inp and .nml files.

Copy link
Member Author

Choose a reason for hiding this comment

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

If you are happy with the manual/documentation changes, @CarstenHansen , then I will merge and close this PR. Thanks.

! 8. Structure :
!
! ----------------------------------------------------
Expand Down Expand Up @@ -106,11 +112,13 @@
GNAME, W3NMOD, W3SETG,&
NSEA, MAPSTA, XYB, GTYPE, XGRD, YGRD, X0, Y0, &
SX, SY, MAPSF, UNGTYPE, CLGTYPE, RLGTYPE, FLAGLL
!/RTD USE W3GDATMD, ONLY : POLAT, POLON
USE W3ODATMD, ONLY: NDSO, NDSE
USE W3IOBCMD, ONLY: VERBPTBC, IDSTRBC
USE W3IOGRMD, ONLY: W3IOGR
USE W3TIMEMD
USE W3SERVMD, ONLY: ITRACE, NEXTLN, EXTCDE, DIST_SPHERE
!/RTD USE W3SERVMD, ONLY: W3EQTOLL
USE W3NMLBOUNCMD
USE NETCDF
!/S USE W3SERVMD, ONLY : STRACE
Expand Down Expand Up @@ -147,6 +155,7 @@
XBPI(:), YBPI(:), RDBPI(:,:), &
XBPO(:), YBPO(:), RDBPO(:,:), &
ABPIN(:,:), ABPIN2(:,:,:)
!/RTD REAL, ALLOCATABLE :: XTMP(:), YTMP(:), ANGTMP(:)
!
REAL, ALLOCATABLE :: TMPSPCI(:,:),TMPSPCO(:,:)

Expand Down Expand Up @@ -359,6 +368,7 @@
END IF
END DO
ALLOCATE(XBPO(NBO),YBPO(NBO))
!/RTD ALLOCATE(XTMP(NBO), YTMP(NBO), ANGTMP(NBO))
ALLOCATE (IPBPO(NBO,4),RDBPO(NBO,4))
IBO=0
DO ISEA=1,NSEA
Expand All @@ -379,7 +389,14 @@
END SELECT !GTYPE
END IF
END DO

!/RTD
!/RTD ! Convert grid boundary cell locations to standard pole
!/RTD XTMP = XBPO
!/RTD YTMP = YBPO
!/RTD CALL W3EQTOLL(YTMP, XTMP, YBPO, XBPO, ANGTMP, POLAT, POLON, NBO)
!/RTD DEALLOCATE(XTMP, YTMP, ANGTMP)
!/RTD
!
OPEN(NDSB,FILE='nest.ww3',FORM='UNFORMATTED',status='unknown')
ALLOCATE(DIMID(NBO2,3),DIMLN(NBO2,3),NCID(NBO2))

Expand Down
25 changes: 23 additions & 2 deletions model/ftn/ww3_bound.ftn
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@
!/ | WAVEWATCH III NOAA/NCEP |
!/ | F. Ardhuin |
!/ | FORTRAN 90 |
!/ | Last update : 20-Oct-2016 |
!/ | Last update : 21-Jul-2020 |
!/ +-----------------------------------+
!/
!/ 28-Aug-2012 : adaptation from SHOM/Ifremer code ( version 4.08 )
!/ 01-Nov-2012 : Bug correction for NKI != NK ( version 4.08 )
!/ 20-Oct-2016 : Error statement updates ( version 5.15 )
!/ 21-Jul-2020 : Support rotated pole grid ( version 7.06 )
!/ Chris Bunney, UKMO.
!/
!/ Copyright 2012-2012 National Weather Service (NWS),
!/ National Oceanic and Atmospheric Administration. All rights
Expand Down Expand Up @@ -47,6 +49,7 @@
! EXTCDE Subr. Id. Abort program as graceful as possible.
! WAVNU1 Subr. W3DISPMD Solve dispersion relation.
! W3IOGR Subr. W3IOGRMD Reading/writing model definition file.
! W3EQTOLL Subr W3SERVMD Convert coordinates from rotated pole.
! ----------------------------------------------------------------
!
! 5. Called by :
Expand All @@ -60,6 +63,9 @@
! - Can be used also to diagnose contents of nest.ww3 file
! in read mode
!
! - Input spectra are assumed to be formulated on a standard
! pole. However, the model grid can be on a rotated pole.
!
! 8. Structure :
!
! ----------------------------------------------------
Expand Down Expand Up @@ -97,11 +103,13 @@
USE W3GDATMD, ONLY: NK, NTH, XFR, FR1, GNAME, W3NMOD, W3SETG, &
NSEA, MAPSTA, XYB, GTYPE, XGRD, YGRD, X0, Y0, &
SX, SY, MAPSF, UNGTYPE, CLGTYPE, RLGTYPE
!/RTD USE W3GDATMD, ONLY : POLAT, POLON
USE W3ODATMD, ONLY: NDSO, NDSE
USE W3IOBCMD, ONLY: VERBPTBC, IDSTRBC
USE W3IOGRMD, ONLY: W3IOGR
USE W3TIMEMD
USE W3SERVMD, ONLY: ITRACE, NEXTLN, EXTCDE
!/RTD USE W3SERVMD, ONLY: W3EQTOLL
!/S USE W3SERVMD, ONLY : STRACE
!/
IMPLICIT NONE
Expand Down Expand Up @@ -134,6 +142,7 @@
REAL, ALLOCATABLE :: XBPI(:), YBPI(:), RDBPI(:,:), &
XBPO(:), YBPO(:), RDBPO(:,:), &
ABPIN(:,:)
!/RTD REAL, ALLOCATABLE :: XTMP(:), YTMP(:), ANGTMP(:)

INTEGER, ALLOCATABLE :: IPBPI(:,:), IPBPO(:,:)

Expand Down Expand Up @@ -288,6 +297,7 @@
END IF
END DO
ALLOCATE(XBPO(NBO),YBPO(NBO))
!/RTD ALLOCATE(XTMP(NBO), YTMP(NBO), ANGTMP(NBO))
ALLOCATE (IPBPO(NBO,4),RDBPO(NBO,4))
IBO=0
DO ISEA=1,NSEA
Expand All @@ -308,7 +318,13 @@
END SELECT !GTYPE
END IF
END DO

!
!/RTD ! Convert grid boundary cell locations to standard pole
!/RTD XTMP = XBPO
!/RTD YTMP = YBPO
!/RTD CALL W3EQTOLL(YTMP, XTMP, YBPO, XBPO, ANGTMP, POLAT, POLON, NBO)
!/RTD DEALLOCATE(XTMP, YTMP, ANGTMP)
!
OPEN(NDSB,FILE='nest.ww3',FORM='UNFORMATTED',status='unknown')
ALLOCATE(LATS(NBO2),LONS(NBO2))
DO IP=1,NBO2
Expand Down Expand Up @@ -411,6 +427,11 @@
!
READ(200+IP,'(A1,A10,A1,2F7.2,F10.1,F7.2,F6.1,F7.2,F6.1)') &
space,buoyname,space,LATS(IP),LONS(IP),depth,U10,Udir,Curr,Currdir
!/RTD
!/RTD ! Rotated coordinates are scaled in range 0 - 360
!/RTD IF(LONS(IP) .LT. 0) LONS(IP) = LONS(IP) + 360.0
!/RTD IF(LONS(IP) .GT. 360) LONS(IP) = LONS(IP) - 360.0
!/RTD
READ(200+IP,*,IOSTAT=IERR) SPEC2D
IF (IFMIN2.GT.1) THEN
!
Expand Down