Difference between revisions of "Sig Numerical Optimization / Tips & Tricks"

From OpenFOAMWiki
(Geometry generation with cfMesh)
(Basic procedure of mesh generation with cfMesh)
 
(9 intermediate revisions by 2 users not shown)
Line 1: Line 1:
==   Geometry generation with cfMesh ==  
+
== Basic procedure of mesh 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.
 
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: [http://openfoamwiki.net/index.php/Thread:Talk:Sig_Numerical_Optimization/Salome_and_cfMesh_parametrization#Preparation_of_created_boundary_.stl_files_for_cfMesh Salome and cfMesh parametrization].
+
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: [http://openfoamwiki.net/index.php/Thread:Talk:Sig_Numerical_Optimization/Salome_and_cfMesh_parametrization#Preparation_of_created_boundary_.stl_files_for_cfMesh Salome and cfMesh parametrization].
 +
 
 +
[[File:Turbine_example.png|thumbnail|135x135px|Turbine example for creation of boundery layers on all patches]]
 +
[[File:Multiple_inlet_example.png|thumbnail|135x135px|Multiple inlet example example for creation of boundery layers on all patches]]
 +
 
 
Bash script to combine created ''.stl'' files can be found in tutorials page, in tutorial: [http://openfoamwiki.net/index.php/Sig_Numerical_Optimization_/_Tutorials#Parametric_Ahmed_body_geometry.2C_mesh_and_case_preparation_with_Salome_and_cfMesh Parametric Ahmed body].
 
Bash script to combine created ''.stl'' files can be found in tutorials page, in tutorial: [http://openfoamwiki.net/index.php/Sig_Numerical_Optimization_/_Tutorials#Parametric_Ahmed_body_geometry.2C_mesh_and_case_preparation_with_Salome_and_cfMesh Parametric Ahmed body].
 +
General tip to use cfMesh can be seen in thread: [http://openfoamwiki.net/index.php/Thread:Talk:Sig_Numerical_Optimization/Salome_and_cfMesh_parametrization#Tips cfMesh tip]
  
To get good meshes it is recommended to follow these tips which are little different for each mesher.
+
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, as cfMesh captures feature edges at the border between the two patches or where it finds a feature edge defined by the user. 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.
 +
 
 +
To get good meshes it is recommended to follow these extra guidelines for the following specific mesh generators.
  
 
===  cartesian2DMesh ===
 
===  cartesian2DMesh ===
Line 13: Line 23:
 
* 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.
 
* 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).
+
* 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''
 
* 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''
 
+
With .ftr geometries, it is possible to specify patch types which are transferred onto the resulting mesh in the meshing process. This is an advantage which simplifies the process of setting up a simulation.
  
 
===  cartesianMesh ===
 
===  cartesianMesh ===
 
+
For cartesianMesh it is enough to follow basic cfMesh procedure described above.
  
  
 
===  tetMesh ===
 
===  tetMesh ===

Latest revision as of 08:45, 13 October 2014

1 Basic procedure of mesh 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.

Turbine example for creation of boundery layers on all patches
Multiple inlet example example for creation of boundery layers on all patches

Bash script to combine created .stl files can be found in tutorials page, in tutorial: Parametric Ahmed body. General tip to use cfMesh can be seen in thread: cfMesh tip

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, as cfMesh captures feature edges at the border between the two patches or where it finds a feature edge defined by the user. 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.

To get good meshes it is recommended to follow these extra guidelines for the following specific mesh generators.

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).
  • 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

With .ftr geometries, it is possible to specify patch types which are transferred onto the resulting mesh in the meshing process. This is an advantage which simplifies the process of setting up a simulation.

1.2 cartesianMesh

For cartesianMesh it is enough to follow basic cfMesh procedure described above.


1.3 tetMesh