Skip to content
Open
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
9 changes: 9 additions & 0 deletions model/src/w3iobcmd.F90
Comment thread
MadsBruunPoulsen marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ MODULE W3IOBCMD
CHARACTER(LEN=32), PARAMETER :: &
IDSTRBC = 'WAVEWATCH III BOUNDARY DATA FILE'
!/
#ifdef W3_RTD
! Logical to tell subroutine W3UBPT if inbound boundary conditions are to be rotated
LOGICAL :: BCTURN = .FALSE.
#endif
!/
CONTAINS
!/ ------------------------------------------------------------------- /
!>
Expand Down Expand Up @@ -562,10 +567,14 @@ SUBROUTINE W3IOBC ( INXOUT, NDSB, TIME1, TIME2, IOTST, IMOD )
!
! End FCOO local
#ifdef W3_RTD
! After read from file nestN.ww3, W3WAVE calls W3UBPT which rotates the spectra
! only if the parameter BCTURN .eq. .TRUE.
!
! All boundary conditions position arrays XBPI, YBPI are defined
! in standard lat/lon coordinates. If Polat = 90. (and Polon = -180.),
! the b.c. positions don't need to be remapped
IF ( Polat < 90. ) THEN
BCTURN = .true. ! To turn spectra in later call W3UBPT
!! Convert standard into rotated lat/lon. JGLi12Jun2012
ALLOCATE ( Anglbdy(NBI), ELatbdy(NBI), ELonbdy(NBI) )

Expand Down
17 changes: 13 additions & 4 deletions model/src/w3updtmd.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1399,6 +1399,9 @@ SUBROUTINE W3UBPT
!! Use rotation angle and action conversion sub. JGLi12Jun2012
USE W3GDATMD, ONLY: NK, NTH, NSPEC, AnglD, PoLat
USE W3SERVMD, ONLY: W3ACTURN
!! BCTURN==.TRUE. only when calling W3UBPT upon reading data from nest.ww3,
!! This is in order *not* to turn 2-way nested bdy data under ww3_multi
USE W3IOBCMD, ONLY: BCTURN
Copy link
Copy Markdown

@MadsBruunPoulsen MadsBruunPoulsen May 15, 2026

Choose a reason for hiding this comment

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

Would it make more sense to control this behavior from W3WAVE instead of loading this variable from W3IOBCMD? I guess that W3WAVE only calls W3IOBC if it needs to write a nest.ww3 file, so one could also introduce the logical in W3WAVE instead of W3IOBCMD. This logical could then work as an input when calling W3UBPT in W3WAVE and then you would not have to reset BCTURN=FALSE at the bottom. With my limited insights into WW3 architechure I would think that this is a more readable edit.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

This sounds reasonable. Let us check the logic of such change when we discuss the code.

Copy link
Copy Markdown

@MadsBruunPoulsen MadsBruunPoulsen May 19, 2026

Choose a reason for hiding this comment

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

CHA to understand where w3iobc is called in w3wave and determine how straightforward it is to modify to control behavior from there. Note that if controlled from w3wave it is not necessary to keep modifications to w3iobcmd.F90 (assumption).

#endif
#ifdef W3_T0
USE W3GDATMD, ONLY: DDEN
Expand Down Expand Up @@ -1475,18 +1478,24 @@ SUBROUTINE W3UBPT
!
#ifdef W3_RTD
!! Rotate the spectra if model is on rotated grid. JGLi12Jun2012
!! PoLat == 90. if the grid is standard lat/lon (C. Hansen 20190613)
IF ( PoLat < 90. ) THEN
!! PoLat == 90. if the grid is standard lat/lon
!! If PoLat < 90. we have set a logical BCTURN == .true. to turn the spectra.
!! Note, for to-way nesting under ww3_multi, spectra are *not* turned.
!! Spectra are turned/deturned only when read/write from/to file (W3IOBC).
IF ( BCTURN ) THEN
Spectr = BBPIN(:,IBI)
AnglBP = AnglD(ISEA)
CALL W3ACTURN( NTH, NK, AnglBP, Spectr )
BBPIN(:,IBI) = Spectr
END IF

#endif
!
END DO

#ifdef W3_RTD
!! Return to default *not* turning the spectra
BCTURN = .false.
#endif
!
! 3. Wave height test output ---------------------------------------- *
!
#ifdef W3_T0
Expand Down
17 changes: 13 additions & 4 deletions regtests/bin/run_cmake_test
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ Options:
-f : force pre- and post-processing programs to be compiled
: non-MPI (i.e., with SHRD switch); default is all programs
: compiled with unmodified switch settings
-g grid_string : use ww3_grid_<grid_string>.inp
-g grid_string : use <prog>_<grid_string>.inp when <prog> is one of ww3_grid,
: ww3_strt, ww3_gint
-h : print usage and exit
-i inpdir : use inputs in test_name/<inpdir> (default test_name/input)
-m grid_set : execute multi-model test
Expand Down Expand Up @@ -731,12 +732,20 @@ prog=ww3_strt
if [ $exec_p = $prog -o $exec_p = "none" ]
then

# config filename - gridset option
if [ $grdstr ]
then
fileconf="${prog}_${grdstr}${gu}"
else
fileconf="${prog}${gu}"
fi
Comment on lines +736 to +741
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

In some cases this does not exist: ww3_strt_${grdstr}${gu} while the version without ${grdset} does exist. Please consider.


# select inp/nml files
if [ $nml_input ] && [ ! -z "`ls ${path_i}/${prog}.nml 2>/dev/null`" ]
if [ $nml_input ] && [ ! -z "`ls ${path_i}/${fileconf}.nml 2>/dev/null`" ]
then
ifile="`ls ${path_i}/${prog}.nml 2>/dev/null`"
ifile="`ls ${path_i}/${fileconf}.nml 2>/dev/null`"
else
ifile="`ls $path_i/$prog.inp 2>/dev/null`"
ifile="`ls $path_i/$fileconf.inp 2>/dev/null`"
fi

if [ $? = 0 ]
Expand Down
38 changes: 38 additions & 0 deletions regtests/mww3_test_02/info_rtd
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

You wrote a regtest that checks that behavior is as expected for ww3_multi with switch RTD. Are we missing any checks, e.g. that a ww3_multi model run with a regular pole is able to output boundary conditions to a destination grid that is rotated?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

If ww3_multi writes boundary files not identical to the output with ww3_shel, that would be a separate issue.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

CHA: Missing to test that if outer domain has incoming boundary conditions (nest.ww3 defined) it is correctly rotated to rank 1 grid and that BCTURN is correctly set to false afterwards when nesting between outer and fine grid. That would test both cases of BCTURN.

Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#############################################################################
# #
# Case switch RTD #
# #
# mww3_test_02 : Test for static nesting (propagation only) #
# Single nest basic test. #
# #
# The test case here is for spherical (longitude,latitude) grids with a #
# (common) rotated pole #
# The test case is adopted from mww3_test_02 with inputs marked 'rtd' #
# The grid set grdset_r is a spherical approximation to Cartesian grdset_b #
# The script run_cmake_test is run with option -g rtd #
# #
# * ww3_grid_rtd_outer.inp : (only outer grid) #
# + Spatial grid: 43 x 43 rectilinear spherical grid #
# - dx = 0.225 deg, dy = 0.225 deg #
# - Xrange = -5.625:3.825 deg, Yrange = -5.625:3.825 deg #
# - Grid north pole at lon, lat = -90., 0. #
# + Spectral grid: ntheta = 24, nf = 25, f1 = 0.04177, fgamma = 1.1 #
# #
# * ww3_grid_rtd_fine.inp : (double resolution inner grid) #
# + Spatial grid: 25 x 25 rectilinear spherical grid #
# - dx = 0.1125 deg, dy = 0.1125 deg #
# - Xrange = 0:2.7 deg, Yrange = 0:2.7 deg #
# - Grid north pole at lon, lat = -90., 0. #
# + Spectral grid: ntheta = 24, nf = 25, f1 = 0.04177, fgamma = 1.1 #
# #
# * Grid set : #
# + grdset_r: outer + fine #
# #
# * Switch: #
# + switch_PR3_UQ_MPI_RTD #
# #
# Example run_test command: #
# ./bin/run_cmake_test -N -g rtd -m grdset_r -n 3 -p mpirun \ #
# -s PR3_UQ_MPI_RTD -w work_bp_PR3_MPI_RTD ../model mww3_test_02 #
Comment on lines +35 to +36
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I am able to run the regtest but not with the -N (use .mnl files) flag. It works with .inp files. The output looks strange, however, and not as presented in your issue post on NOAAs GitHub account. Are you able to run the regtest with .nml files successfully?

# #

3 changes: 3 additions & 0 deletions regtests/mww3_test_02/input/grdset_r
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
MODEL: outer fine
INPUT:
POINT: outer fine
5 changes: 5 additions & 0 deletions regtests/mww3_test_02/input/namelists_rtd_fine.nml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
&OUTS E3D=1, TH1MF=1, STH1MF=1, TH2MF=1, STH2MF=1 /
&PRO2 DTIME = 0. /
&PRO3 WDTHCG = 0., WDTHTH = 0. /
Copy link
Copy Markdown

@MadsBruunPoulsen MadsBruunPoulsen May 18, 2026

Choose a reason for hiding this comment

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

Are settings for both PRO2 and PRO3 mentioned as the regtest can be run with different switches that both involve PRO2 and PRO3? The info_fcoo only mentions switch_PR3_UQ_MPI_RTD.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

This may be a reason, but I just copied the contents of namelisis_fine.nml without thinking about it.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Consider to outcomment

&ROTD PLAT = 0.0 PLON = -90.0, UNROT = .FALSE. /
END OF NAMELISTS
5 changes: 5 additions & 0 deletions regtests/mww3_test_02/input/namelists_rtd_outer.nml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
&OUTS E3D=1, TH1MF=1, STH1MF=1, TH2MF=1, STH2MF=1 /
&PRO2 DTIME = 0. /
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Here as well

&PRO3 WDTHCG = 0., WDTHTH = 0. /
&ROTD PLAT = 0.0 PLON = -90.0, UNROT = .FALSE. /
END OF NAMELISTS
1 change: 1 addition & 0 deletions regtests/mww3_test_02/input/points_rtd.list
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.35 1.35 'point_A'
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Please remind me; point output coordinates are defined in the rotated grid, correct? So this coordinate is within the fine grid?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I actually forgot the answer to this. I think the answer is given in the User manual, or check the points specified for the FCOO GRL9 grid.

1 change: 1 addition & 0 deletions regtests/mww3_test_02/input/switch_PR3_UQ_MPI_RTD
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
NOGRB RTD DIST MPI PR3 UQ FLX2 LN0 ST0 NL0 BT0 DB0 TR0 BS0 IC0 IS0 REF0 WNT1 WNX1 CRT1 CRX1 O0 O1 O2 O3 O4 O5 O6 O7 O10 O11
38 changes: 38 additions & 0 deletions regtests/mww3_test_02/input/ww3_grid_rtd_fine.inp
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
$ WAVEWATCH III Grid preprocessor input file
$ ------------------------------------------
'Fine (12.5km) inner nest '
$
1.1 0.04177 25 24 0.
$
F T T F F F
450. 450. 450. 15.
$
&OUTS E3D=1, TH1MF=1, STH1MF=1, TH2MF=1, STH2MF=1 /
&PRO2 DTIME = 0. /
$ &PRO2 DTIME = 21600. /
Comment thread
MadsBruunPoulsen marked this conversation as resolved.
&PRO3 WDTHCG = 0., WDTHTH = 0. /
&ROTD PLAT = 0.0 PLON = -90.0, UNROT = .FALSE. /
Comment thread
MadsBruunPoulsen marked this conversation as resolved.
END OF NAMELISTS
Comment thread
MadsBruunPoulsen marked this conversation as resolved.
$
'RECT' T 'NONE'
25 25
0.1125 0.1125 1.
0.0 0.0 1.
$
-0.1 0.25 10 -1000. 4 1 '(....)' 'UNIT' 'input'
$
625*1
$
10 1 1 '(....)' 'PART' 'mapsta.inp'
$
1 1 T
1 25 T
25 25 T
25 1 T
1 1 T
0 0 F
$
0 0 F
0 0
$
0. 0. 0. 0. 0
85 changes: 85 additions & 0 deletions regtests/mww3_test_02/input/ww3_grid_rtd_fine.nml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
! -------------------------------------------------------------------- !
! WAVEWATCH III - ww3_grid.nml - Grid pre-processing !
! -------------------------------------------------------------------- !

! -------------------------------------------------------------------- !
! Define the spectrum parameterization via SPECTRUM_NML namelist
! -------------------------------------------------------------------- !
&SPECTRUM_NML
SPECTRUM%XFR = 1.1
SPECTRUM%FREQ1 = 0.04177
SPECTRUM%NK = 25
SPECTRUM%NTH = 24
/

! -------------------------------------------------------------------- !
! Define the run parameterization via RUN_NML namelist
! -------------------------------------------------------------------- !
&RUN_NML
RUN%FLCX = T
RUN%FLCY = T
/

! -------------------------------------------------------------------- !
! Define the timesteps parameterization via TIMESTEPS_NML namelist
! -------------------------------------------------------------------- !
&TIMESTEPS_NML
TIMESTEPS%DTMAX = 450.
TIMESTEPS%DTXY = 450.
TIMESTEPS%DTKTH = 450.
TIMESTEPS%DTMIN = 15.
/

! -------------------------------------------------------------------- !
! Define the grid to preprocess via GRID_NML namelist
! -------------------------------------------------------------------- !
&GRID_NML
GRID%NAME = 'Fine (12.5km) inner nest'
GRID%NML = '../input/namelists_rtd_fine.nml'
GRID%TYPE = 'RECT'
GRID%COORD = 'SPHE'
GRID%CLOS = 'NONE'
GRID%ZLIM = -0.1
GRID%DMIN = 0.25
/

! -------------------------------------------------------------------- !
! Define the rectilinear grid type via RECT_NML namelist
! -------------------------------------------------------------------- !
&RECT_NML
RECT%NX = 25
RECT%NY = 25
RECT%SX = 0.1125 ! from SX_cart=12.5E3 m to SX_cart/111111.111 deg
RECT%SY = 0.1125
RECT%X0 = 0.0 ! from 600.0E3
RECT%Y0 = 0.0 ! from 600.0E3
/

! -------------------------------------------------------------------- !
! Define the depth to preprocess via DEPTH_NML namelist
! -------------------------------------------------------------------- !
&DEPTH_NML
DEPTH%SF = -1000.
DEPTH%FILENAME = '../input/fine.depth'
DEPTH%IDLA = 4
/

! -------------------------------------------------------------------- !
! Define the input boundary points via INBND_COUNT_NML and
! INBND_POINT_NML namelist
! -------------------------------------------------------------------- !
&INBND_COUNT_NML
INBND_COUNT%N_POINT = 5
/

&INBND_POINT_NML
INBND_POINT(1) = 1 1 T
INBND_POINT(2) = 1 25 T
INBND_POINT(3) = 25 25 T
INBND_POINT(4) = 25 1 T
INBND_POINT(5) = 1 1 T
/

! -------------------------------------------------------------------- !
! WAVEWATCH III - end of namelist !
! -------------------------------------------------------------------- !
32 changes: 32 additions & 0 deletions regtests/mww3_test_02/input/ww3_grid_rtd_outer.inp
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
$ WAVEWATCH III Grid preprocessor input file
$ ------------------------------------------
'The outer grid @ 0.225 deg '
$
1.1 0.04177 25 24 0.
$
F T T F F F
900. 900. 900. 15.
$
&OUTS E3D=1, TH1MF=1, STH1MF=1, TH2MF=1, STH2MF=1 /
&PRO2 DTIME = 0. /
$ &PRO2 DTIME = 21600. /
&PRO3 WDTHCG = 0., WDTHTH = 0. /
&ROTD PLAT = 0.0 PLON = -90.0, UNROT = .FALSE. /
Comment thread
MadsBruunPoulsen marked this conversation as resolved.
END OF NAMELISTS
$
'RECT' T 'NONE'
43 43
0.225 0.225 1.
-5.625 -5.625 1.
$
-0.1 0.25 10 -1000. 4 1 '(....)' 'UNIT' 'input'
$
1849*1
$
10 1 1 '(....)' 'PART' 'mapsta.inp'
$
0 0 F
0 0 F
0 0
$
0. 0. 0. 0. 0
69 changes: 69 additions & 0 deletions regtests/mww3_test_02/input/ww3_grid_rtd_outer.nml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
! -------------------------------------------------------------------- !
! WAVEWATCH III - ww3_grid.nml - Grid pre-processing !
! -------------------------------------------------------------------- !

! -------------------------------------------------------------------- !
! Define the spectrum parameterization via SPECTRUM_NML namelist
! -------------------------------------------------------------------- !
&SPECTRUM_NML
SPECTRUM%XFR = 1.1
SPECTRUM%FREQ1 = 0.04177
SPECTRUM%NK = 25
SPECTRUM%NTH = 24
/

! -------------------------------------------------------------------- !
! Define the run parameterization via RUN_NML namelist
! -------------------------------------------------------------------- !
&RUN_NML
RUN%FLCX = T
RUN%FLCY = T
/

! -------------------------------------------------------------------- !
! Define the timesteps parameterization via TIMESTEPS_NML namelist
! -------------------------------------------------------------------- !
&TIMESTEPS_NML
TIMESTEPS%DTMAX = 900.
TIMESTEPS%DTXY = 900.
TIMESTEPS%DTKTH = 900.
TIMESTEPS%DTMIN = 15.
/

! -------------------------------------------------------------------- !
! Define the grid to preprocess via GRID_NML namelist
! -------------------------------------------------------------------- !
&GRID_NML
GRID%NAME = 'The outer grid @ 25 km'
GRID%NML = '../input/namelists_rtd_outer.nml'
GRID%TYPE = 'RECT'
GRID%COORD = 'SPHE'
GRID%CLOS = 'NONE'
GRID%ZLIM = -0.1
GRID%DMIN = 0.25
/

! -------------------------------------------------------------------- !
! Define the rectilinear grid type via RECT_NML namelist
! -------------------------------------------------------------------- !
&RECT_NML
RECT%NX = 43
RECT%NY = 43
RECT%SX = 0.225 ! from SX_cart=25.E3 m to SX_cart/111111.111 deg
RECT%SY = 0.225
RECT%X0 = -5.625 ! from -25.E3 or -1.*SX to -25*SX
RECT%Y0 = -5.625
/

! -------------------------------------------------------------------- !
! Define the depth to preprocess via DEPTH_NML namelist
! -------------------------------------------------------------------- !
&DEPTH_NML
DEPTH%SF = -1000.
DEPTH%FILENAME = '../input/outer.depth'
DEPTH%IDLA = 4
/

! -------------------------------------------------------------------- !
! WAVEWATCH III - end of namelist !
! -------------------------------------------------------------------- !
Loading