Opened 3 weeks ago

Closed 24 hours ago

#2082 closed Bug (fixed)

agrif_create_coordinates writes incorrect u,v points to child grid file

Reported by:Michael Component: AGRIF
Version: trunk Severity: minor
Keywords: Cc:
Management
Owned by: Milestone:
Priority: low

Description (last modified by Nicolas MARTIN)

The agrif_create_coordinates program writes the wrong values for the u and v points when producing a child grid coordinates.nc file. The code assumes a regular lon,lat grid, but that is not the case for many grids, such as ORCA-based grids.

This was probably overlooked because the model doesn't make use of the u,v coordinates (when jphgr_msh=0), rather it loads scale factors from coordinates.nc, and the child-grid scale factors are correct despite the error. Also T and F grid business (bathy, etc) would be unaffected — so many simulations will not notice this bug. However, there is at least one case where it matters, which is agrif_create_restart that would be slightly affected due to interpolating velocities to the incorrect u,v points.

Christoph Renkl discovered this bug.

For a fix: in agrif_create_coordinates.f90, change

  G1%glamu = G1%glamf
  G1%glamv = G1%glamt

to

  CALL agrif_interp(G0%glamu,G1%glamu,'U')
  CALL agrif_interp(G0%glamv,G1%glamv,'V')

and also change

  G1%gphiu = G1%gphit
  G1%gphiv = G1%gphif

to

  CALL agrif_interp(G0%gphiu,G1%gphiu,'U')
  CALL agrif_interp(G0%gphiv,G1%gphiv,'V')

Commit History (1)

ChangesetAuthorTimeChangeLog
9632jchanut2018-05-25T12:23:11+02:00

Correct child velocity points lat/lon interpolation, #2082

Change History (3)

comment:1 Changed 3 weeks ago by Nicolas MARTIN

  • Description modified (diff)

comment:2 Changed 24 hours ago by Jerome Chanut

In 9632:

Correct child velocity points lat/lon interpolation, #2082

Code review status: pending

comment:3 Changed 24 hours ago by Jerome Chanut

  • Resolution set to fixed
  • Status changed from new to closed
  • Version changed from release-3.6 to trunk
Note: See TracTickets for help on using tickets.