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.
fig2polywill automatically "fill in" the missing line segment.
fig2polyto convert the
figfile into a
polyfile. For instance,
polyfile produced by
fig2polywith Triangle and use the resulting
*.node files as input to
TriangleMesh, as described in another example.
fig2polyexpects 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
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
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.
fig2polyassigns boundary numbers to these, depending on the order in which the polylines are listed in the
figfile. 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.