In this document we demonstrate how to use oomph-lib's
conversion routine fig2poly
(a C++-based stand-alone executable, generated from the source code fig2poly.cc to create *
.poly
files for Jonathan Shewchuk's open-source mesh generator Triangle
, based on the output from the open-source drawing program xfig.
Mesh generation with xfig, fig2poly
and Triangle
is extremely straightforward.
fig2poly
will automatically "fill in" the missing line segment. *
. fig
file. fig2poly
to convert the *
. fig
file into a *
. fig
. poly
file. For instance, some_figure
.fig
. poly
. *
. fig
. poly
file produced by fig2poly
with Triangle and use the resulting *
.poly, *
.ele and *
.node files as input to oomph-lib's
TriangleMesh
, as described in another example. fig2poly
expects the xfig output file to conform to "Fig format 3.2" and checks for the presence of the string "#FIG 3.2" in the first line of the *
. fig
file. below. fig2poly
to terminate. Here is a screen shot from an xfig session. The figure defines a quadrilateral domain with a quadrilateral hole.
Here is a plot of the resulting mesh. It was generated by converting the file hole.fig
generated by xfig, to hole.fig.poly
, using fig2poly
and processing the resulting file with
Finally, the figure below shows a plot of the computed solution of a Poisson equation with a unit source function, obtained with three-noded (red) and six-noded (green) triangular Poisson elements:
This solution was computed with the driver code mesh_from_xfig_poisson.cc.
Here is a screen shot from another xfig session. The figure defines a quadrilateral domain containing the oomph-lib logo whose letters create holes in the domain.
Here is a plot of the mesh generated with the same procedure discussed above.
Finally, the figure below shows a plot of the solution of the steady Navier-Stokes equations (velocity vectors and pressure contours) in this domain. No-slip conditions were applied on all boundaries. Zero velocities were imposed on all boundaries apart from the outer bounding box (boundary 1) where we set
The plot may therefore be interpreted as showing the flow field that is generated when the rigid quadrilateral box that surrounds the oomph-lib logo moves in the north-westerly direction while the logo itself remains stationary. This was computed with the driver code mesh_from_xfig_navier_stokes.cc which is very similar to that for the driven cavity problem, so we shall not discuss in in detail.
fig2poly
assigns boundary numbers to these, depending on the order in which the polylines are listed in the *
. fig
file. Since this is not always obvious, it is usually necessary to examine the mesh boundaries by calling Mesh::output_boundaries(...)
before assigning boundary conditions. A pdf version of this document is available.