Using the triangle libraries

Triangular grids can be created from a simple planar straight line
graph (pslg) which is specified as the `pslg`

file in `suntans.dat`

.
The format of this file is similar to the format of the planar straight
line graph file for use in triangle. The planar straight line graph
file is a listing of points and edges that make up a closed contour.
These edges will comprise the boundaries of the triangulation that are
created by the triangle libraries. The simplest PSLG file is one which
specifies a box with sides of length 1. This requires four points and
four edges, as shown in the following file `box.dat`

:

# Number of points 4 # List of points (x,y,marker) 0.0 0.0 0 0.0 1.0 1 1.0 1.0 2 1.0 0.0 3 # Number of segments 4 # List of segments and boundary markers (point #, point #, marker) 0 1 1 1 2 1 2 3 1 3 0 1 # Number of holes 0 # Minimum area .005The minimum area causes the triangle program to continue to add triangles until the minimum area of one of the triangles satisfies this area. Setting the

`pslg`

variable to `box.dat`

in `suntans.dat`

and running SUNTANS with
mpirun sun -t -g --datadir=./dataThis creates a triangulation composed of 256 right triangles within a square with sides of length 1. The three columns after the number of points specification correspond to the x-y coordinates of each point, along with a marker for each point. Following the number of segments specification, the first two columns specify the indices of the points that make up the end points of each segment in C-style numbering, such that the indices go from 0 to one less than the number of points. The third column in the segment list specifies the marker for each segment. This is how the boundary conditions are specified, and is discussed in more detail in Section 4.2. The number of holes is currently not used.

Degenerate triangulations may arise when neighboring triangles are close to having
right angles. In this case the distance between the Voronoi points may be close
to zero and hence may severely limit the time step. This is remedied by setting
the `CorrectVoronoi`

variable to 1 in `suntans.dat`

. If this
parameter is set, then the Voronoi points are corrected when the distance
between Voronoi points is less than `VoronoiRatio`

times the distance between
the cell centroids. For example, for two neighboring right triangles, the Voronoi
points will be coincident and hence the distance between the Voronoi points of these
neighboring triangles will be zero. If `VoronoiRatio`

is set to `0.5`

,
then the Voronoi points are adjusted so that the distance between them is half the
distance between the cell centroids. If `VoronoiRatio`

is set to `1`

,
then the Voronoi points correspond to the cell centroids.

A useful m-file `checkgrid.m`

is provided in the suntans/mfiles directory that
determines the shortest distance between Voronoi points on a grid as well as a histogram
of the Voronoi distances on the entire grid. It is important to remember that most
grid generation packages, including triangle, are meant for finite-element calculations
in which calculations are usually node-based (i.e. everything is stored at the Delaunay points).
Because SUNTANS is Voronoi-based, this places a strong constraint on the distance between
the Voronoi points and as a result it can be quite difficult to generate good grids in
highly complex domains. We have found a great deal of success with the grid generation
package GAMBIT from Fluent, Inc. and use it for most of our production-scale SUNTANS runs.