cfMesh での OpenFOAM用メッシュ生成

投稿日時: 2014/07/19 S Nakagawa
cfMesh の使い方に関するメモ。
## cfMeshの利点 ##

最低限,次の2つだけを指定すれば,メッシュが生成できる。
・ surfaceFile   points to a geometry file. The path to the geometry file is relative to the path of the case directory.
・ maxCellSize   represent the default cell size used for the meshing job. It is the maximum cell size generated in the domain.

さらに領域を指定した細分化なども可能。

 メモリ使用量が少ない


## 一連の作業の流れ ##

Salomeでパッチ毎にSTLファイルを書き出す。そのSTLファイルを結合する。特徴線を抽出してcfMesh形式のファイルにする。


## 作業 ##

 cfMesh では,単一のSTLファイルを使う。

 下記の例題を見ると,STLファイル内で,面毎に名前が付いている。これによって,作成されたメッシュでのパッチ名が変わる。
   /home/user/OpenFOAM/user-2.3.x/run/cfMesh-tutorials/cartesianMesh/sawOctree

 ファイル内部構造は下記のようなもの.

solid patch000
  facet normal 0.811072 -0.468654 0.350037
    outer loop
       vertex 4.76676 10.8144 51.1671
       vertex 4.64955 10.8767 51.5221
       vertex 4.59512 10.6202 51.3048
    endloop
  endfacet
  同様・・・
endsolid patch000
solid patch001
  facet ...
endsolid patch001


パッチ毎のSTLファイルを作成.その中でsolid名を付けておく。
それらのSTLファイルを結合して,1つのSTLとする。
これで良さそう。

salome でSTLファイルを作成したところ,solid名が空だった。
その場合には,例えば,下記の様なコマンドで,各ファイルにsolid名を追加する。そのファイルを結合すればよい。
sed -i".org" -e "s/solid/solid name01/g" name01.stl
sed -i".org" -e "s/solid/solid name02/g" name02.stl
cat name01.stl name02.stl > newName.stl

元のstlファイルだけだと,エッジがつぶれることがある。
特徴線を含んだ形に変更するためには,下記のコマンドを実行する。(引数は入力ファイル名と出力ファイル名)
surfaceFeatureEdges newName.stl newNameWithFeature.stl
このsurfaceFeatureEdgesでは,出力ファイルの拡張子をfmsにすることで,cfMeshのファイル形式で出力される。
surfaceFeatureEdges newName.stl newNameWithFeature.fms