いわて駐在研究日誌

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

blockMesh/sHM/extrudeMeshで2Dメッシュ生成

最適化計算のため、形状パラメータ>blockMeshDict生成>blockMesh、の手順のみではなかなか品質の良い計算メッシュが作られないので、標記のコマンドの組み合わせて2Dメッシュ(例えばz方向にメッシュ1)を作成する手順をまとめてみる。

 

1.blockMeshによるベースメッシュ作成

sHMを使う準備と同じようにblockMeshDictを用意する(立方体の領域生成、ただし例えばz方向にメッシュ1としておく)

frontとbackのemptyパッチを別名にしておく以外はとくにパッチ指定なし(defaultFacesになる)でOK

 

2.sHMの実行

surfaceFeatureExtract

snappyHexMesh -overwrite

とし、これもsHMと同様に進める。

この時、ベースメッシュを横切る断面のSTLファイルを2つ用意しておく(例えば翼面、外部境界:要はベースメッシュをこれらのSTLファイルで型抜きのように切り抜く)。

sHMは、castellatedMesh、snap、addLayersの間にメッシュを追加してしまうので、上記のblockMeshでz方向にメッシュ1としておいても、結局z方向にはメッシュが増えてしまう。

3.extrudeMeshの実行

system/extrudeMeshDict(下記)を用意し、extrudeMeshを実行する。

実行結果は、constant/polyMesh/を上書きすするので、sHMで-overwriteオプションをつけずに1 2 3と時刻フォルダへ出力させていると混乱するので注意しよう。

あと、念のためflattenMesh、checkMeshは実行しておく。

/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2.3.0                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    object      extrudeMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

// What to extrude:
//      patch   : from patch of another case ('sourceCase')
//      mesh    : as above but with original case included
//      surface : from externally read surface

//constructFrom mesh;
constructFrom patch;
//constructFrom surface;

// If construct from patch/mesh:
sourceCase ".";       現在のケースフォルダに出力
sourcePatches ( FrontEmpty );   どのパッチを押し出すか
// If construct from patch: patch to use for back (can be same as sourcePatch)
exposedPatchName FrontEmpty; 押し出し後のパッチ名(ソースパッチを同じにしておくと、同じ名前がつけられる)
// If construct from surface:
//surface "movingWall.stl";

// Flip surface normals before usage. Valid only for extrude from surface or
// patch.
flipNormals false;

//- Linear extrusion in point-normal direction
extrudeModel        linearNormal; 上記の指定のパッチのnormal方向に押し出す
//- Linear extrusion in specified direction
//extrudeModel        linearDirection; 押し出し方向も指定可能
//- Wedge extrusion. If nLayers is 1 assumes symmetry around plane.
//extrudeModel        wedge;
//- Extrudes into sphere around (0 0 0)
//extrudeModel        linearRadial;
//- Extrudes into sphere around (0 0 0) with specified radii
//extrudeModel        radial;
//- Extrudes into sphere with grading according to pressure (atmospherics)
//extrudeModel        sigmaRadial;

nLayers             1;  押し出しの層数を指定
expansionRatio      1.0;    //0.9; 複数の場合は拡大率を指定

wedgeCoeffs
{
    axisPt      (0 0.1 -0.05);
    axis        (-1 0 0);
    angle       360;  // For nLayers=1 assume symmetry so angle/2 on each side
}

linearNormalCoeffs
{
    thickness       1;  押し出しの層厚を指定
}

linearDirectionCoeffs
{
    direction       (0 0 1);
    thickness       0.1;
}

linearRadialCoeffs
{
    R               0.1;
    // Optional inner radius
    Rsurface        0.01;
}

radialCoeffs
{
    // Radii specified through interpolation table
    R               table *1;
}


sigmaRadialCoeffs
{
    RTbyg           1;
    pRef            1;
    pStrat          1;
}

// Do front and back need to be merged? Usually only makes sense for 360
// degree wedges.
mergeFaces false;   //true;

// Merge small edges. Fraction of bounding box.
mergeTol 0;

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

 

*1:0 0.01)(3 0.03)(10 0.1