BOSS International


GFGEN (Geometry File GENeration) is a pre-processor for RMA2, creating a binary finite element mesh geometry file from the ASCII finite element mesh geometry file that are generated by SMS. GFGEN also performs routine mesh diagnostics and element reordering.

» Overview

Types of Elements

GFGEN is capable of handling many different types of elements within the same computational finite element mesh. The types of elements fit into three basic categories:

  • Two dimensional elements (2D)
  • One dimensional elements (1D)
  • Special elements (transitions, junctions, and control structure elements).

Elements may have either straight or curved edges.

Although it is no longer necessary to describe curved external boundaries to prevent leaking (which occurred with RMA2 prior to version 4.2), curved elements may be used to achieve aesthetics. Curving is particularly useful for one dimensional elements to achieve the meandering or snaking river effect. (Leaking refers to the inability of a mesh to properly hold water. Some modelers refer to a "leak test" as a means to check out a mesh. Leaks, or "oozes", are a result of poor element shapes, large boundary break angles, and/or erroneous boundary condition specifications. RMA2 no longer has a problem with leaks.)

Two Dimensional Elements

Two dimensional elements may be three sided with six nodes or four sided with eight nodes. Figure 1 illustrates the basic triangle and quadrilateral shapes for two dimensional elements. There are three/four corner nodes at the vertices and three/four mid-side nodes on the sides. If the element is straight, the mid-side node is exactly halfway between the two corners. However, if an edge of the element is curved, the mid-side node of that edge needs to fall within the middle third of the distance between the two corners to meet the criterion of well formed.

Figure 1: Well Formed Two Dimensional Elements

One Dimensional Elements

The basic one dimensional element is composed of two corners and one mid-side node. Figure 2 illustrates a basic straight and curved one dimensional element.

Figure 2: Well Formed One Dimensional Elements

As depicted in Figure 3, the numerical model’s governing equations for 1D elements are based on a trapezoidal cross-section with side slopes and off-channel storage. The user may assign the width (W), channel side slopes (SL and SR), and off-channel storage (Ws) for the cross-section.

Figure 3: A Well Formed One Dimensional Element

Transitional Elements

A transitional element is a special 1D element that is required for connecting a 2D element with a 1D element. Figure 4 illustrates a 1D element transition to a 2D element. The transition element has 5 nodes and is shaped like the letter T.

The first three nodes must be from the 1D side of the transition, the last nodes of the transition element are the corner nodes of the adjacent 2D element. Note that the transition node 3 requires coordinates and bottom elevation though it will look like a mid-side node to the adjoining 2D element. The angles between the transition side of the 2D element and the adjacent 2D element sides should be close to 90 degrees, otherwise leakage will occur along those sides. In addition, the bottom elevations of nodes 3, 4, and 5 of the transition element must be identical to conform to the trapezoidal channel assumption.

Figure 4: Transition Element

Junction Element

A junction element is a special 1D element that is used to describe the proper characteristics where three or more 1D elements intersect. GFGEN is capable of handling from three to eight branching channels within a junction. A junction element is composed of collocated corner nodes at the junction end of all 1D elements that connect into the junction. Figure 5 illustrates a junction formed by nodes 3, 4 and 7.

Figure 5: Junction Element

Control Structure Element

A control structure element is a special 1D element that is used to simulate weirs, gates, etc. The control structure has two collocated corner nodes connecting two 1D elements. Figure 6 illustrates a control structure element.

Figure 6: Control Structure Element

Problem Elements

There are several categories of issues which lead to problem elements.

Causes of Problem Elements

  • Poor aspect ratio
  • Erroneous element connections
  • Mid-side nodes violating the middle third rule
  • Slope rule error
  • Needle-like corners
  • Element edge overlap

The following figures illustrate some of the problems which may occur with straight elements and curved elements. Figure 7:

Problem Straight Elements

Needle-like corner elements are those elements that have an interior angle of less than approximately 6 degrees. An element of this shape will likely cause stability problems in RMA2.

Figure 8: Problem Curved Elements

A slope rule error occurs when the slopes given at two adjacent corner nodes cause the boundary to reverse directions between the nodes, as shown in the previous figure. If a user is tempted to use exotic slopes in an attempt to define complex shoreline boundaries, be warned that experience has proven that greater resolution (higher numbers of elements) is a better strategy.

Middle third rule states that when using a curved element side, the point at which the smallest radius of the curved side is located must lie between the middle third of the distance between the two corner nodes of the element side. Middle third rule violations that are close to a fraction of either 0.333 or 0.666 can usually be tolerated by the models. Fractions less than 0.2 or more than 0.8 usually lead to model inaccuracy and even instability.

The shape described by a curved element side is that of a second order curve. It can contain only one inflection point between two corner nodes. If a boundary is curved very sharply, as shown in the above figure, then the mid-side node will fall quite close to one of the adjacent corner nodes. Hence the mid-side node falls outside of the middle third of the curved arc length, producing what GFGEN will designate as a "middle third rule" violation and GFGEN will print the fraction of the arc length at which the mid-side falls.


The simultaneous equation solver used by the models (i.e., RMA2, RMA4, SED2D) runs more efficiently (and thus, considerably more economically) if the solution sequence is optimized by reordering the mesh. Reordering does not change any element or node numbers; it changes the sequence in which the elemental equations are assembled.

SMS will allow the user to attempt various reordering node strings, and will then present the matrix characteristics (bandwidth, band sum, and front width) for each reordering attempt. The cost savings associated with reordering are large enough that it is strongly recommended that the user spend some time carefully generating the optimum reordering scheme. Once the reordering is complete, only the best reordering node string should be used so that computation costs are minimized.

In general, choose a reordering node string that make up a continuous line along one end of the mesh. Try node strings on different edges of the mesh and of varying length. Be warned that a very short node strings (less than five nodes) may cause the front width (number of equations assembled simultaneously) to become too large for program dimensions. When the node string leading to the smallest front width is found, try multiple versions of that node string, including slightly shorter and slightly longer node strings. Try reversing the order of the node string (the order that the nodes are listed, such as left to right instead of right to left, etc.).