How to create a curvilinear grid in OpenFlows FLOOD

Product(s): OpenFlows FLOOD


This article will detail how to create a curvilinear computational grid in OpenFlows FLOOD. To learn about regular computational grid generation please read the article: How to create a computational grid


To create a curvilinear grid in OpenFlows FLOOD a polygon covering the area where the grid will be constructed is necessary. You can load the polygon file onto the Map or you can create one using the “Toolbox -> Geometry Layers -> Create Polygons Layer”. Keep in mind that if for example you’re trying to create a curvilinear grid for the river, it is recommended that the polygon covers the river area but also the margins, as shown in the image below.


Once you have the polygon layer loaded on the Map, you can create the curvilinear grid by using the “Toolbox -> Grid -> Create Curvilinear Grid".


The tool window appears docked on the right side of the main window.

There are six steps in this tool.

  • Selection of the polygon that defines the grid's boundary.
  • Definition of the grid's corners.
  • Selection of the grid coordinate system.
  • Selection of the grid generation parameters.
  • Generation of the grid.
  • Saving the grid to a file.


The first step is select the polygon layer mentioned above as shown below (in this example the polygon layer is called “GridPolygon”).  

Second, the user must define the grid polygon corners/bends. This is a very important feature as it will determine how the grid is constructed, especially when the area of simulation includes channels, bays, sharp bends, etc. In the “Define Polygon Corners” tool, you’ll have to manually set in the Map window, where the corners are and set their direction (right or left bend). For right bends, select the blue marker and click on the map over the polygon vertex that is located at a sharp right bend, as shown below (in this case we assume the polygon orientation is clockwise, but a counterclockwise orientation can also be used, as long as the right and left bends are identified consistently).

Then do the same for the left turns using the red marker as shown below:

If the polygon corners are not correctly defined, the grid will be highly distorted and might not have a matching boundary with the polygon. In some cases, careful consideration must be given when choosing the corners, and different corner definitions might generate valid, but different, grids. The methodology here is to try different approaches and select the best one.

The third step is to select the grid coordinate system in "Output Coordinate System". This is similar to the when constructing a regular grid. Three types of coordinates are available:

  • Geographic coordinates (WGS84), where distances are in given in degrees.
  • UTM WGS84 (an UTM zone number must be defined), where distances are in meters.
  • Grid coordinates (for schematic cases or other projected coordinates - defined by map projection - where distances are in meters.

The grid parameters are set in "Grid Options". There are two ways of choosing the grid's refinement:

  • Specifying the number of columns and the number of rows.
  • Selecting a variable spaced grid - the curvilinear grid will copy the refinement of the variable spaced grid while ignoring its location and dimensions. With this method, it is possible to locally refine the grid as desired.

Independently of how the grid's refinement was chosen, the grid will also be more refined in thinner regions and less refined in wider regions if there are no corners defined between them.

If "Eliminate thin triangles" is checked, the program will pre-process the polygon and remove points that are too close to each other, which will avoid the generation of cells that are too small. 

If "Check polygon" is checked, the program will test if the selected polygon is simple (none of its lines intersect each other and so the polygon is a valid boundary).

All the other parameters affect precision and computation time during the generation of the grid. Insufficient precision might affect the grid's orthogonality which in turn affects the validity of the results after a simulation. If unsure, these parameters can be safely left with their default values.

“Precision” sets the program’s precision during iterative methods, defining when convergence is considered to be reached. A lower precision value increases grid computation time.

“NPPE” - Number of points per internal edge of the triangulation. Lower values decrease precision and computation time. It can be switched off by setting it to 0. In this case, coarser images of quadrilaterals will be used that are formed by straight lines connecting the quadrilateral vertex images.

“Nodes” - Number of nodes in the Gauss-Jacobi quadrature when solving integrals. If defined based on precision, it will be set to -log10(<precision>). Lower values decrease precision and computation time.

“Gauss-Newton solver with Broyden update” - If checked, the program will use Gauss-Newton solver with Broyden update for solving a non-linear least squares problem. Otherwise, simple iterations are used. Checking this parameter off will increase precision and computation time.

After all the above steps, the grid can be generated in pressing the "Generate Curvilinear Grid" button.

The curvilinear grid will appear on the Map window as shown below.


Finally, when a suitable grid is generated, it can be saved into a file by clicking "Save Grid".