A MATLAB-based GUI for gridgen

Discussion about analysis, visualization, and collaboration tools and techniques

Moderators: arango, robertson

Post Reply
Message
Author
hbzong
Posts: 36
Joined: Thu Oct 04, 2007 4:14 am
Location: Fathom Science/NCSU

A MATLAB-based GUI for gridgen

#1 Unread post by hbzong »

In order to use gridgen conveniently, I wrote a MATLAB-based GUI tool for creating input file for gridgen, reading output file of gridgen and displaying grid. It is easy to create a polygon for gridgen by using it.

See http://www.coastal.udel.edu/~hbzong

Image

RubenDiez-Lazaro

#2 Unread post by RubenDiez-Lazaro »

First of all, thanks a lot for your great job...

I'm attempt to use the Pavel Sakov's gridgen package for grid generation for ROMS usage...

I'm now playing with your application generating some grids. Nevertheless I found a problem when I try to generate a simple orthogonal four points grid. I define four points, then I mark it as (positive) vertexes and "Calculate Grid". But when I press the button "To ROMS" and before ask for a batimetry file , I get the message:

Code: Select all

??? qhull precision error: initial facet 1 is coplanar with the interior point

ERRONEOUS FACET:

While executing:  | qhull d Qt Qbb Qc

Options selected for Qhull 2003.1 2003/12/30:
  delaunay  Qtriangulate  Qbbound-last  Qcoplanar-keep  _pre-merge
  _zero-centrum  Pgood  Qinterior-keep  _max-width 49  Error-roundoff 6.9e-14
  _one-merge 4.9e-13  Visible-distance 1.4e-13  U-coplanar-distance 1.4e-13
  Width-outside 2.8e-13  _wide-facet 8.3e-13

The input to qhull appears to be less than 3 dimensional, or a
computation has overflowed.

Qhull could not construct a clearly convex simplex from points:

The center point is coplanar with a facet, or a vertex is coplanar
with a neighboring facet.  The maximum round off error for
computing distances is 6.9e-14.  The center point, facets and distances
to the center point are as follows:

facet
 p49
 p2450
 p0
 distance=    0

facet
 p2499
 p2450
 p0
 distance= -3.6e-15

facet
 p2499
 p49
 p0
 distance= -3.6e-15

facet
 p2499
 p49
 p2450
 distance=    0

These points either have a maximum or minimum x-coordinate, or
they maximize the determinant for k coordinates.  Trial points
are first selected from points that maximize a coordinate.

The min and max coordinates for each dimension are:

  0:         1        50  difference=   49

  1:         1        50  difference=   49

  2:         0        49  difference=   49

If the input should be full dimensional, you have several options that
may determine an initial simplex:
  - use 'QJ'  to joggle the input and make it full dimensional
  - use 'QbB' to scale the points to the unit cube
  - use 'QR0' to randomly rotate the input for different maximum points
  - use 'Qs'  to search all points for the initial simplex
  - use 'En'  to specify a maximum roundoff error less than 6.9e-14.
  - trace execution with 'T3' to see the determinant for each point.

If the input is lower dimensional:
  - use 'QJ' to joggle the input and make it full dimensional
  - use 'Qbk:0Bk:0' to delete coordinate k from the input.  You should
    pick the coordinate with the least range.  The hull will have the
    correct topology.
  - determine the flat containing the points, rotate the points
    into a coordinate plane, and delete the other coordinates.
  - add one or more points to make the input full dimensional.

This is a Delaunay triangulation and the input is co-circular or co-spherical:
  - use 'Qz' to add a point "at infinity" (i.e., above the paraboloid)
  - or use 'QJ' to joggle the input and avoid co-circular data
..............
This is a screen capture of the grid:
[img]
http://web.usc.es/~rdlazaro/gui_gridgen_capture.png
[/img]

Nevertheless, when i, for example, put 6 point and define it as 5 positive vertexes and 1 negative vertex, it works right....

Am I committing a mistake? What is the problem for make a simple orthogonal grid with only 4 points??

Thanks a lot.

hbzong
Posts: 36
Joined: Thu Oct 04, 2007 4:14 am
Location: Fathom Science/NCSU

#3 Unread post by hbzong »

t seems that the error occurred when extrapolating the values to the empty grid points. I also did a four points case, but i didn't find the same error. You could comment the following lines when you do four points case:
% [x,y] = size(GRD_LON);
% nn = 1;
% for m = 1:x
% for n = 1:y
% if ~isnan(GRD_LON(m,n))
% lontmpx(nn) = m;
% lontmpy(nn) = n;
% lontmpz(nn) = GRD_LON(m,n);
% lattmpx(nn) = m;
% lattmpy(nn) = n;
% lattmpz(nn) = GRD_LAT(m,n);
% nn = nn + 1;
% end
% end
% end
% [xi,yi] = meshgrid(1:x,1:y);
% grd_lon = griddata(lontmpx,lontmpy,lontmpz,xi,yi);
% grd_lat = griddata(lattmpx,lattmpy,lattmpz,xi,yi);

And add:
grd_lon = GRD_LON;
grd_lat = GRD_LAT;

I also find a mistake during reading gridgen output in calculate_grid.m.
The line 78 and 79 should be modified to:
grd_x = flipud(grd_x') * mean_xy;
grd_y = flipud(grd_y') * mean_xy;

Post Reply