[Introduction]  [Commands]  [Samples]  [Version history]  [To do list]  [Downloads]


Turtle is a small application to produce extruded and revolved 3D grids for flow ducts. These grids can be used in flow simulations, e.g., with the open-source CFD solver Dolfyn.

The generation of 3D grids for flow problems is usually not very easy, you have to define the geometry in a CAD or CAD-like environment, generating points (vertices), lines and curves, surfaces and volumes and then divide the volumes into a (large) number of computational cells. In this way, given time, you can create grids almost any geometry you like, but you will need to learn (and remember) how to use these complex CAD systems.

For a certain subclass of flow problems, an easier way to generate grids is possible. In the early days of the Personal Computer (remember Turbo Pascal?), there was a small graphics demo called Turtle Graphics. Apparently it was originally part of the LOGO programming language. It works with a cursor (the turtle) that looks like an arrow head. The turtle can be rotated by a given angle and it can be moved forward or backward in the direction of the arrow. In this way, simple (usually ugly) line graphics can be produced, by specifying distances and angles instead of coordinates.

The same principle can be used to generate structured grids by extruding and revolving of a plane. In this case, the number of cells in a cross section of the duct (in the X and Y direction) is constant (once chosen) and of course there can be no splitting or merging of ducts (single flow channel). However, the duct can change its size (expanding or contracting) or shape (from circular to rectangular cross-section) along the length of an extrusion. In this way, quite complex geometries can be modelled, as can be seen below.

Turtle was written as a text-only console application in Fortran95, so that it should compile without (major?, any?) modifications on different operating systems and hardware (MacOSX, Linux, Unix, Windows). Turtle was also designed to be extensible with new features and output formats. Currently, Turtle outputs grids that can be used in Dolfyn, and in de VTK format used by popular open source 3D viewers like Paraview. Using other (future) tools, more complex grids could be created by modifying the Turtle grids or by merging two or more Turtle grids into a single flow model.

Turtle is distributed as open source software, so the source code is available in the downloads section.


Turtle uses only a few commands to create the grid. Note that only the first four characters need to be entered (although you can type all if you like).

STARtStart a new duct by defining the low Z ("inlet") plane, either a rectangle or an ellipse. Here you also determine the number of cells in the cross section of the duct (nx and ny); these will be the same for each cross section. Boundary elements will be created for the low face of the duct.
EXTRudeExtrude the plane in the normal direction to create a block of cells. You can extrude to a pane with different dimensions and shape. Boundary elements will be created for the side faces of the duct.
REVOlveRevolve the plane around an axis that is perpendicular to one of the plane axes. You can just revolve the plane by any angle or revolve and expand or change shape at the same time. Boundary elements will be created for the side faces of the duct.
DELEteDelete a range of cells, creating a hole in the geometry. The boundary types for all sides of the hole gan be given.
ENDEnd the duct by creating boundary elements for the high ("outlet") face of the duct

Other commands are available, e.g., to COUNt the cells in the current grid, to UNDO or REDO commands, and to WRITe the grid (vertices, boundaries and cells) to output files. Commands are echoed to a history file (ducturtle.his) and you can copy/paste these to text files, modify the commands if you like and then execute them in one go with the LOAD command. Type HELP in Turtle for more detailed information about all commands.


The first example shows a simple duct that starts as a 1 by 1 m square, changes to a 1 m diameter circular duct in 0.5 m lenght, then bends 70 degrees to the left and ends with a straight section of 1 m. The following commands were entered to generate the grid:

STARt 10, 10, 1.0, 1.0, CIRCle

EXTRude 5, 0.5, 1.0, 1.0, RECT

REVOlve 10, X, 0.5, 70

EXTR 10, 1.0


The grid files were then used for a very simple Dolfyn calculation and the Dolfyn output (VTK) was read into a (free) postprocessor (ParaView). The resulting 3D grid is shown in the picture below (click for larger image).

A somewhat more complicated duct where a duct with a 0.5x0.5m square cross section expands in one direction, then bends and expands to 1x1 m square cross section, bends in the other direction and then contracts to an ellipsoidal cross section. This takes in total six Turtle commands.

Version history

November 14, 2005

October 1, 2008

May 13, 2009

To do list

This is only a second version, with enough functionality for now. There remains a lot to be desired of course:


Turtle is published under the GNU general public license. It has currently not been fully tested (too many possibilities...) so use at your own triumph or peril. If you find any bugs or have any comments or questions, please don't hesitate to contact me by e-mail (see below).

The source code is Fortran 95. It was tested with Digital Visual Fortran 6.5 as well as G95, the open source Fortran 95 compiler (recommended!). Currently there is only a Windows binary, but I may post Unix and MacOSX binaries later if I find the time and/or on request.

Turtle sourceF90 sourceMay 13, 200924 Kbhere
Turtle exeWindows binaryMay 13, 2009160 Kbhere

Bouke Tuinstra