いわて駐在研究日誌

OpenCAE、電子工作、R/C等、徒然なるままに

cfMesh v1.0.1 my tutorial

いろいろメモ(cartesian2DMesh関係)

  • fms形式のジオメトリデータをstlに変換

FMSToSurface geom.fms geom.stl

  • stlデータをfms形式に変換(同じファイル名)

surfaceToFMS geom.stl

 

  • 境界条件用に、パッチ毎のstl solidエンティティとする(1つのstlファイル中に記述)

solid left
  facet normal 0 -1 0
    outer loop
       vertex -1 0 0
       vertex 1 0 0
       vertex 1 0 0.1
    endloop
  endfacet
  facet normal 0 -1 0
    outer loop
       vertex -1 0 0
       vertex 1 0 0.1
       vertex -1 0 0.1
    endloop
  endfacet
endsolid left
solid bottom
  facet normal 1 0 0
    outer loop
       vertex 1 0 0
       vertex 1 1 0


       vertex 1 1 0.1
    endloop
  endfacet
  facet normal 1 0 0
    outer loop
       vertex 1 0 0
       vertex 1 1 0.1
       vertex 1 0 0.1
    endloop
  endfacet
endsolid bottom

  •  2次元メッシュ(cartesian2DMesh)を作る場合は、x-y平面上(z軸方向に押し出すことを想定して)に、リボン状にSTLをつくること
  • リボンの幅=押し出し厚さ
  • emptyとなるべきパッチは、"bottomEmptyFaces" "topEmptyFaces"と自動的に名前がつくので、boundaryファイルは後から要修正

    f:id:waku2005:20150604131930p:plain

複数STLはmeshDictで指定できる?

→(まだ?)出来ないので、単一STLファイルにsolidエンティティを複数記述する。それぞれのsolidエンティティはpatchとして認識される。

→ facetの法線ベクトルは調整しなくても下記のようにちゃんと認識できる。

→マルチドメインの場合は、今のところ対応してなさそうなので、個別に作ってmergeMeshが良さそう。

f:id:waku2005:20150604141055p:plain

fms形式のほうが形状再現性がよい?

→ surfaceToFMS コマンドを使っただけのstl→fms変換では、あまり差はなさそう。もう少し工夫が必要。

形状再現性を上げるには?

surfaceFeatureEdges all.stl all.fms -angle 0などとしてfmsファイルを作って指定すると、かなり改善(angleは見切り角の閾値)。

f:id:waku2005:20150604145057p:plain

             ↓

f:id:waku2005:20150604150558p:plain

→meshDictを書き換えてみる。

before:

[snip]

maxCellSize    0.01;

//surfaceFile    "axis.stl"  "AMIr.stl" "wing0.stl" "wing1.stl" "wing2.stl";  N/A
//surfaceFile "all.stl";
surfaceFile "all.fms";

boundaryLayers
{
    nLayers         6;
    thicknessRatio  1.2;
}

[snip]

after: とりあえず全部入り

 maxCellSize     0.01;
//boundaryCellSize 0.005;
//boundaryCellSizeRefinementThickness 0.005;
//minCellSize      0.001;

//surfaceFile    "axis.stl"  "AMIr.stl" "wing0.stl" "wing1.stl" "wing2.stl";  N/A
//surfaceFile "all.stl";
surfaceFile "all.fms";

boundaryLayers
{

    // for All patches
    //maxFirstLayerThickness 0.005;
    //nLayers         10;
    //thicknessRatio  1.15;

    /// for each patch
    patchBoundaryLayers
    {
      "wing.*"
      {
        maxFirstLayerThickness 0.01;
        nLayers         10;
        thicknessRatio  1.15;
        allowDiscontinuity  0;
      }
      "axis"
      {
        maxFirstLayerThickness 0.01;
        nLayers         5;
        thicknessRatio  1.15;
        allowDiscontinuity  0;
      }
    }
}

localRefinement
{
     "wing.*"
     {
        cellSize 0.005;
        additionalRefinementLevels 3;
        refinementThickness 0.005;
     }
     "axis"
     {
        cellSize 0.005;
        additionalRefinementLevels 3;
        refinementThickness 0.005;
     }
}

objectRefinements
{
/*
    objectName1    // conical object
    {  
        cellSize 3.75;  
        type cone;  
        p0   (-100 1873 -320);  
        radius0  200;  
        p1   (-560 1400 0);  
        radius1   200;  
    }  
    objectName2    // box object
    {  
        cellSize 3.75;  
        type box;  
        centre  (500 500 150);  
        lengthX  100;  
        lengthY  150;  
        lengthZ  200;  
    }  
    objectName3    // sphere object
    {  
        cellSize 3.75;  
        type sphere;  
        centre  (0 700 0);  
        radius  50;  
    }  
    objectName4    // line object
    {  
        cellSize 3.75;  
        type line;  
        p0      (-750 1000 450);  
        p1      (-750 1500 450);  
    }      
*/  
}

surfaceMeshRefinement
{
/*
    surfaceFile "axis.stl";
        additionalRefinemntLevels 3;
    refinementThickness 0.005;
*/
}

keepCellsIntersectingBoundary   0;

keepCellsIntersectingPatches
{
/*
    "wing.*"
        {
        keepCells 1;
        }
*/
}  

//removeGluedMesh 0;
checkForGluedMesh 0;


removeCellsIntersectingPatches
{
/*
        "wing.*"
        {
            keepCells 0;
        }   
*/
}  

renameBoundary
{

  defaultName frontAndBack;
  defaultType empty;    

    newPatchNames
    {
          "AMIr"
       {
           newName AMIr;
           type patch;
           }
           "wing0"
       {
           newName wing0;
           type wall;
           }
           "wing1"
       {
           newName wing1;
           type wall;
           }
           "wing2"
       {
           newName wing2;
           type wall;
           }
           "axis"
       {
           newName axis;
           type wall;
           }
           ".*EmptyFaces"
       {
         newName frontAndBack;
             type empty;
       }      
}

enforceGeometryConstraints 1;

※ maxCellSizeとminCellSize  を両方指定するとabortしてしまうのは何故だろう?仕様??ケース依存???

f:id:waku2005:20150604210639p:plain

(参考)

  1. https://openfoamwiki.net/index.php/Sig_Numerical_Optimization_/_Tips_%26_Tricks
  2. http://www.dicat.unige.it/guerrero/of2015a/3_6meshing_cfMesh.pdf