Skip to content

Commit

Permalink
RTD support for ww3_boun[dc] (#10)
Browse files Browse the repository at this point in the history
* Updated ww3_bound and ww3_bounc to handle model grids formulated on a rotated pole.
* Manual and nml/inp files to updated clarify that ww3_bound/ww3_bounc only accept input spectra formulated on a standard pole grid.
  • Loading branch information
ukmo-ccbunney authored Jul 28, 2020
1 parent 71b9ba9 commit 6c42d17
Show file tree
Hide file tree
Showing 8 changed files with 76 additions and 5 deletions.
7 changes: 6 additions & 1 deletion manual/num/rotagrid.tex
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,12 @@ \subsubsection{~Rotated grids} \label{sub:num_space_rotagrid}
has been used. Gridded netCDF files generated by {\bf ww3\_ounf} also include
\emph{standard\_latitude} and \emph{standard\_longitude} two-dimensional arrays
that describe location of the rotated model cell centres in the standard lat-lon
reference frame.
reference frame.

If the user wishes to generate boundary conditions for a rotated pole grid using
the {\bf ww3\_bound} or {\bf ww3\_bounc} boundary processing programs, then it
should be noted that the input spectra for these programs are always expected
to be formulated on a \emph{standard pole}.

Six subroutines are provided in module {\bf w3servmd.ftn} for rotated grid
conversion:
Expand Down
3 changes: 3 additions & 0 deletions manual/run/ww3_bounc.tex
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,7 @@ \subsubsection{The NetCDF boundary conditions program} \label{sub:ww3bounc}
\proddeff{Output}{standard out}{Formatted output of program.}{6}
\proddefa{nest.ww3}{Boundary conditions file.}{33}

\vspace{\baselineskip} \noindent
Note: When using this program to produce boundary inputs for a model formulated on rotated pole grid, the input spectra are always assumed to be formulated on a standard pole.

\pb
3 changes: 3 additions & 0 deletions manual/run/ww3_bound.tex
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,7 @@ \subsubsection{The boundary conditions program} \label{sub:ww3bound}
\proddeff{Output}{standard out}{Formatted output of program.}{6}
\proddefa{nest.ww3}{Boundary conditions file.}{33}

\vspace{\baselineskip} \noindent
Note: When using this program to produce boundary inputs for a model formulated on rotated pole grid, the input spectra are always assumed to be formulated on a standard pole.

\pb
27 changes: 25 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.
!
! 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,8 @@
XBPI(:), YBPI(:), RDBPI(:,:), &
XBPO(:), YBPO(:), RDBPO(:,:), &
ABPIN(:,:), ABPIN2(:,:,:)
!/RTD REAL, ALLOCATABLE :: XTMP(:), YTMP(:), ANGTMP(:)
!/RTD LOGICAL :: ISRTD
!
REAL, ALLOCATABLE :: TMPSPCI(:,:),TMPSPCO(:,:)

Expand Down Expand Up @@ -204,6 +214,9 @@
!
CALL W3IOGR ( 'READ', NDSM )
WRITE (NDSO,920) GNAME
!/RTD!
!/RTD ISRTD = POLAT .LT. 90.0
!/RTD!
!
!--- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
! 3. Read requests from input file.
Expand Down Expand Up @@ -359,6 +372,7 @@
END IF
END DO
ALLOCATE(XBPO(NBO),YBPO(NBO))
!/RTD IF (ISRTD) ALLOCATE(XTMP(NBO), YTMP(NBO), ANGTMP(NBO))
ALLOCATE (IPBPO(NBO,4),RDBPO(NBO,4))
IBO=0
DO ISEA=1,NSEA
Expand All @@ -379,7 +393,16 @@
END SELECT !GTYPE
END IF
END DO

!/RTD!
!/RTD IF (ISRTD) THEN
!/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 ENDIF
!/RTD!
!
OPEN(NDSB,FILE='nest.ww3',FORM='UNFORMATTED',status='unknown')
ALLOCATE(DIMID(NBO2,3),DIMLN(NBO2,3),NCID(NBO2))

Expand Down
33 changes: 31 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,8 @@
REAL, ALLOCATABLE :: XBPI(:), YBPI(:), RDBPI(:,:), &
XBPO(:), YBPO(:), RDBPO(:,:), &
ABPIN(:,:)
!/RTD REAL, ALLOCATABLE :: XTMP(:), YTMP(:), ANGTMP(:)
!/RTD LOGICAL :: ISRTD

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

Expand Down Expand Up @@ -174,6 +184,9 @@
!
CALL W3IOGR ( 'READ', NDSM )
WRITE (NDSO,920) GNAME
!/RTD!
!/RTD ISRTD = POLAT .LT. 90.0
!/RTD!
!
! 3. Read input file
!
Expand Down Expand Up @@ -288,6 +301,7 @@
END IF
END DO
ALLOCATE(XBPO(NBO),YBPO(NBO))
!/RTD IF (ISRTD) ALLOCATE(XTMP(NBO), YTMP(NBO), ANGTMP(NBO))
ALLOCATE (IPBPO(NBO,4),RDBPO(NBO,4))
IBO=0
DO ISEA=1,NSEA
Expand All @@ -308,7 +322,15 @@
END SELECT !GTYPE
END IF
END DO

!/RTD!
!/RTD ! Convert grid boundary cell locations to standard pole
!/RTD IF( ISRTD ) THEN
!/RTD XTMP = XBPO
!/RTD YTMP = YBPO
!/RTD CALL W3EQTOLL(YTMP, XTMP, YBPO, XBPO, ANGTMP, POLAT, POLON, NBO)
!/RTD DEALLOCATE(XTMP, YTMP, ANGTMP)
!/RTD ENDIF
!/RTD!
OPEN(NDSB,FILE='nest.ww3',FORM='UNFORMATTED',status='unknown')
ALLOCATE(LATS(NBO2),LONS(NBO2))
DO IP=1,NBO2
Expand Down Expand Up @@ -411,6 +433,13 @@
!
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 IF (ISRTD) THEN
!/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 ENDIF
!/RTD!
READ(200+IP,*,IOSTAT=IERR) SPEC2D
IF (IFMIN2.GT.1) THEN
!
Expand Down
3 changes: 3 additions & 0 deletions model/inp/ww3_bounc.inp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ $ List of spectra files. These NetCDF files use the WAVEWATCH III
$ format as described in the ww3_ounp.inp file. The files are
$ defined relative to the directory in which the program is run.
$
$ Note: When using a rotated pole WW3 grid, these input spectra are
$ always assumed to be formulated on a standard pole.
$
SPECTRA_NC/ww3.62163_spec.nc
SPECTRA_NC/ww3.62069_spec.nc
'STOPSTRING'
Expand Down
3 changes: 3 additions & 0 deletions model/inp/ww3_bound.inp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ $
$ If data is used other than from previous WAVEWATCH III runs, then
$ this data will need to be converted to the WAVEWATCH III format.
$
$ Note: When using a rotated pole WW3 grid, these input spectra are
$ always assumed to be formulated on a standard pole.
$
$ In the case of NetCDF files see ww3_bounc.inp
$
SPECTRI/mww3.W004N476.spec
Expand Down
2 changes: 2 additions & 0 deletions model/nml/ww3_bounc.nml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

! -------------------------------------------------------------------- !
! Define the input boundaries to preprocess via BOUND_NML namelist
! Note: When using a rotated pole WW3 grid, the input spectra are
! always assumed to be formulated on a standard pole.
!
! * namelist must be terminated with /
! * definitions & defaults:
Expand Down

0 comments on commit 6c42d17

Please sign in to comment.