Skip to content

Bugfix rotbd#1

Open
Carsten-Hansen wants to merge 2 commits into
FCOO:fb_xsmffrom
Carsten-Hansen:bf_rotbd
Open

Bugfix rotbd#1
Carsten-Hansen wants to merge 2 commits into
FCOO:fb_xsmffrom
Carsten-Hansen:bf_rotbd

Conversation

@Carsten-Hansen
Copy link
Copy Markdown

@Carsten-Hansen Carsten-Hansen commented Apr 24, 2026

Pull Request Summary

This bugfix corrects the erroneous advection across multi-grid boundaries when using rotated grids (switch RTD) with ww3_multi

This bug fix is intended to be pulled by @MadsBruunPoulsen into the FCOO/WW3 branch fb_xsmf.

It is a tentative solution to the issue NOAA-EMC#1579 by @CarstenHansen, following the suggestion given there.

Description

The bug is described in detail in NOAA-EMC#1579. The solution provides the expected correct grid boundary transfer under ww3_multi, e.g. as illustrated in Fig. 2.

A flag is declared global in w3_iobcmd.F90 where it is set to 'TRUE' only when reading boundary conditions from file (nest.ww3), and used in w3updtmd.F90 to indicate when rotation must be done (as suggested in NOAA-EMC#1579 (comment)). Setting this flag is not a property of the individual grid, but distinguish if if boundary conditions are either read from file or transferred by the ww3_multi mechanism.

Issue(s) addressed

Fixes NOAA-EMC#1579 (comment)

Commit Message

Correct the erroneous advection across multi-grid boundaries when using rotated grids (switch RTD) with ww3_multi.
Co-author: @MadsBrunPoulsen.

Check list

Testing

  • How were these changes tested? A suggested new regression test is included as rotated grid set (grdset_r), an extension to the existing advection regtest mww3_test02.
  • Are the changes covered by regression tests? (If not, why? Do new tests need to be added?) I suggest adding grdset_r to mww3_test02. Suggested additions to the info file is provided in info_rtd. The program ‎regtests/bin/run_cmake_test is modified to be able to create the initial files for the rotated grids.
  • Have the matrix regression tests been run (if yes, please note HPC and compiler)? NO
  • Please indicate the expected changes in the regression test output, (Note the list of known non-identical tests.)
  • Please provide the summary output of matrix.comp (matrix.Diff.txt, matrixCompFull.txt and matrixCompSummary.txt):

@Carsten-Hansen Carsten-Hansen changed the base branch from develop to fb_xsmf April 28, 2026 09:29
Comment thread model/src/w3iobcmd.F90
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.

Let me check if I understand the logic of the implementation:

  1. BCTURN is set to FALSE by default (so no turning of spectra)
  2. Only if W3IOBC is called, which reads and writes actual boundary condition files (nestX.ww3), is BCTURN set to TRUE.
  3. W3UBPT reads BCTURN from w3iobcmd. If BCTURN=FALSE it means that we are not in a state where the model reads/writes to boundary condiiton file, hence spectra are not to be rotated standard lon-lat. If BCTURN=TRUE it means that W3IOBC was called and the model reads/writes to a nest.ww3 file where spectra must be rotated to standard lon-lat. BCTURN is set to FALSE when rotation to standard lon-lat has completed.

Is the correct?

I would like for us to go through W3WAVE to see how W3IOBC and W3UBPT are called.

Comment thread model/src/w3updtmd.F90
!! 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 from W3IOBC,
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.

W3IOBC is not calling W3UBPT, as far as I can tell? Isn't it W3WAVE?

Comment thread model/src/w3iobcmd.F90
IDSTRBC = 'WAVEWATCH III BOUNDARY DATA FILE'
!/
#ifdef W3_RTD
! Logical to tell subroutine W3UBPT if inbound boundary conditions are to be roteted
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Spelling mistake: "roteted" --> "rotated"

Comment thread model/src/w3updtmd.F90
USE W3SERVMD, ONLY: W3ACTURN
!! BCTURN==.TRUE. only when calling W3UBPT from W3IOBC,
!! 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Under switch RTD, the two-way nesting is corrupted when running ww3_multi

3 participants