We use the CurveLoop to define a surface
Notice there is difference between the CurveLoop defining the boundary
of the surface and the actually surface PlaneSurface. This difference becomes clearer in the next example with a hole. The direction of the lines is important.
New we are ready to define the geometry which described by an instance of Design class:
Here we use the two dimensional domain with a local element size in the finite element mesh of
.
We then add the surface s to the geometry
This will automatically import all items used to construct s into the Design d.
Now we are ready to construct a esys.finley FEM mesh and then write it to the file quad.fly:
In some cases it is useful to access the script used to generate the geometry. You can specify a specific name
for the script file. In our case we use
It is also useful to check error messages generated during the mesh generation process. Gmsh[19] writes
messages to the .gmsh-errors in your home directory.
If we put everything together we get the script
This example is included with the software in
quad.py in the example directory.
There are three extra statements which we have not discussed yet: By default the mesh used to subdivide the boundary are not written into the mesh file mainly to reduce the size of the data file. One need to explicitly add the lines to the Design which should be present in the mesh data. Here we additionally labeled the lines on the top and the bottom with the name ``top_and_bottom`` and the lines on the left and right hand side with the name ``sides`` using PropertySet objects. The labeling is convenient when using tagging , see Chapter 3.
If you have Gmsh[19] installed you can run the example and view the geometry and mesh with:
You can access error messages from Gmsh[19] in the .gmsh-errors in your home directory.
See Figure 5.1 for a result.
In most cases it is best practice to generate the mesh and to solve the mathematical
model in to different scripts. In our example you can read the esys.finley mesh into your simulation
code
using
Note that the underlying mesh generation software will not accept all
the geometries you can create with esys.pycad. For example, esys.pycad
will happily allow you to create a 2-D Design that is a
closed loop with some additional points or lines lying outside of the
enclosed area, but Gmsh[19] will fail to create a mesh for it.