Opened 10 years ago

Closed 10 years ago

#617 closed defect (Fixed)

VERY IMPORTANT: Corrected Matlab scripts for refinement

Reported by: arango Owned by: arango
Priority: major Milestone: Release ROMS/TOMS 3.7
Component: Nonlinear Version: 3.7
Keywords: Cc:

Description

Several of the Matlab scripts for grid nesting were updated. In particular, the contact points for refinement are computed in a more robust way:

  • contact.m: The native Matlab function inpolygon is used to determine the contact points inside, at the boundary, and outside of the nested grids. In complex applications with rotated grids, this determination is subject to round-off. Some points can be missing or the incorrect donor cell is selected yielding negative interpolation weights. This is not good... I have to rethink the approach to determine the contact points for refined grid configurations. The computation is now done in (XI, ETA) coordinates instead of (Lon,Lat). This fixed the problem and made the computation more robust. Now, all the interpolation weights are positive and add exactly to one. Several new plots are added to local function refinement in contact.m. The first three plots (figures 1:3) show the finer grid points with a red plus sign. All the donor grid points are marked with cyan circles. The blue circles show the donor grid cell needed to interpolate the contact points for the receiver (finer) grid from the donor (coarser) grid. There is a figure for RHO-, U-, and V-points. The next three plots (figures 4:6), illustrate the finer grid cells that need to be averaged to replace the coarser grid field values in two-way nesting. For debugging purposes, three new text files (Rweights.txt, Uweights.txt, and Vweights.txt) are written to provide detailed information about the interpolation weights used to compute the receiver grid contact points from the donor grid. I highly recommend to inspect these files before proceeding with a nesting application. This has to be done as part of the grid set-up.
  • grid_extract.m: Coastline data is now written into the extracted grid, if available. Recall that this function is used to extract a sub-grid from a larger finer grid.
  • fine2coarse.f: The logic on how to extract a coarse grid from a finer grid was revisited. In addition, coastline data is now written into the extracted grid, if available. The grid metrics (pm, pn, dndx, dmde) are re-computed at the coarser resolution using function grid_metrics. We cannot extract their values because grid spacing is larger by factor of Gfactor. The computation of metrics from discrete points is subject to round-off. There is not much that we can do here. The round-off is small and of the order 1.0E-16 (eps value).
  • grid_perimeter: Added the perimeters in (XI, ETA) coordinates for PSI-, RHO-, U-, and V-points to the grid sub-structure. In addition, the UV-perimeter is also computed to avoid round-off problems in inpolygon.

The refinement contact points for the DOGBONE refinement test case were recomputed. This NetCDF file is in the test repository. Users need to update the test repository. Instructions on how to download the Test Cases repository are given in WikiROMS.

The nesting algorithms seem to be working nicely in realistic refinement application for the South China Sea (rotated grids) and Gulf of Mexico (non rotated grids). This application run well when ONE_WAY is activated. The two-way nesting works well in the DOGBONE test case. Two-way realistic applications requires more fine tuning. I am working on an iterative algorithm to correct the finer grid bathymetry at the contact points to impose the same water column volume as the coarser grid. Perhaps, this is also required for the interior points. The finer grid volume sum must be equal to that of the coarse grid in rest conditions (zeta=0).

I am very pleased with the strategy of computing all the nesting information outside of ROMS. It will be very difficult to compute the contact points information inside ROMS for complex configurations. The parallelism will complicate matters. It is more robust to provide a NetCDF file with all the nesting information.

WARNING, WARNING, WARNING: In order for ROMS to work with nesting, you must update the Matlab nesting scripts in this repository and recompute the contact points NetCDF file. Otherwise, your nesting application will not work because incorrect nesting contact points indices...

Change History (1)

comment:1 by arango, 10 years ago

Resolution: Fixed
Status: newclosed
Note: See TracTickets for help on using tickets.