Describing the mesh programmatically
Describing the mesh inside the FreeFem++ program is very handy. Once
this is done, changing the shape of the mesh or the size of
elements is reduced to changing a parameter value. It can be done
in 2D and 3D, but it only works easily in 2D. In the FreeFem++
documentation, everything is described in
chapter Mesh Generation.
External CAD tools
In 3D, meshes can be still be defined and generated in the FreeFem++
program, but taking care of all the details (especially when
intersections of surfaces are involved) becomes a nightmare. So it
is advised to use an external CAD tool like
Gmsh. Here is how (thank you to PP for trying
this out) :
- Draw geometry and build the mesh in Gmsh. Then export it to the
Medit format.
- Find the numeric labels of the boundaries which will need a
boundary condition (e.g. by loading the mesh in Medit and
displaying the material properties of hand-picked points on the
boundaries).
- Load the mesh into the FreeFem++ program with readmesh3().
For learning purposes it may be sufficient to build meshes out of
basic geometrical shapes like cubes and spheres. Please check
the list of
FreeFem++ 3D examples in case one of them suits your
needs.