Sig Numerical Optimization / Tips & Tricks

From OpenFOAMWiki

1 Geometry generation with cfMesh

For geometry creation to mesh with cfMesh the easiest way is to use .stl file type because it is supported in most CAD software. Key is to export each patch as separated .stl file (in ASCII type. NOT BINARY!!!) and then combine those files in one .stl file with added names of patches. The procedure is thoroughly explained in thread: Salome and cfMesh parametrization. Bash script to combine created .stl files can be found in tutorials page, in tutorial: Parametric Ahmed body.

To get good meshes it is recommended to follow these tips which are little different for each mesher.

1.1 cartesian2DMesh

Cartesian2DMesh proves to be a very good mesh generator to be included in the optimization routine, because of its easy to understand input file and fast speed in generating the required mesh. In addition, it is able to generate boundary layers with ease, compared to other open-source mesh generators.

While working with this tool, the following guidelines have to be followed in order to avoid mistakes and unproper meshing:

  • in 2D, the geometry should be drawn in the x-y plane (the default plane in the 2D draw of Salome). A geometry placed in the x-z or y-z plane will cause errors.
  • the geometry should only be made of external patches. These patches can be easily selected and named using Salome (New entity -> Group -> Create group -> Surfaces (3rd bottom on the top-right). Front and back patches should not be included, as cartesian2DMesh will generate these patches itself (naming it topEmptyFaces and bottomEmptyFaces).
  • For boundary layer generation, it is important to have connected patch surfaces. This means your patch needs to be made of connected surfaces in open or closed way. For example:
    • in the turbine example, surfaces of each blade should form patch for it self.
    • in case with multiple seperated inlets, each inlet surface needs to be patch for it self.
  • Input files .fms or .ftr are also recommended in cartesian2DMesh. It is possible to convert an .stl to .ftr using the command surfaceConvert geometry.stl geometry.ftr


1.2 cartesianMesh

1.3 tetMesh