メッシュの細分化

2018年3月3日

使用バージョン

OpenFOAM v1712

メッシュの細分化

全体の細分化

refineMesh を使うと、メッシュの細分化を行うことができる。全体的に細かくするならば、ケースディレクトリ内で次のようにすればよい。

$ refineMesh

2 次元メッシュか 3 次元メッシュかを判断して分割してくれるらしい。

メッシュを確認して、問題なければ上書きで実行する。

$ refineMesh -overwrite

部分的な細分化

部分的に細分化したい場合は、セットを作成して system/refineMeshDict を用意する。以下の例では、"refineSet" というセットを作ってその部分を細分化している。

$ cp -r $FOAM_TUTORIALS/incompressible/icoFoam/cavity .
$ cd cavity
$ blockMesh
$ setSet
Command>cellSet refineCells new boxToCell (0.03 0.03 0) (0.07 0.07 0.01)
Command>quit

cavity/system/refineMeshDict

FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    object      refineMeshDict;
}

// Cells to refine; name of cell set
set refineCells;

// Type of coordinate system:
// - global : coordinate system same for every cell. Usually aligned with
//   x,y,z axis. Specify in globalCoeffs section below.
// - patchLocal : coordinate system different for every cell. Specify in
//   patchLocalCoeffs section below.
coordinateSystem global;

// .. and its coefficients. x,y in this case. (normal direction is calculated
// as tan1^tan2)
globalCoeffs
{
    tan1 (1 0 0);
    tan2 (0 1 0);
}

patchLocalCoeffs
{
    patch patchName; //Normal direction is facenormal of zero'th face of patch
    tan1 (1 0 0);
    tan2 (0 1 0);
}

// List of directions to refine
directions
(
    tan1
    tan2
    //tan3
);

// Whether to use hex topology. This will
// - if patchLocal: all cells on selected patch should be hex
// - split all hexes in 2x2x2 through the middle of edges.
useHexTopology  true;

// Cut purely geometric (will cut hexes through vertices) or take topology
// into account. Incompatible with useHexTopology
geometricCut    false;

// Write meshes from intermediate steps
writeMesh       false;

refineMesh の実行

$ refineMesh

メッシュを確認して、問題なければ上書きで実行する。

$ refineMesh -overwrite

上記の設定では、メッシュが 2 次元的なら 2 次元的に、3 次元的なら 3 次元的に細分化される。cavity のケースでは、2 次元メッシュなので、奥行き方向には細分化されない。必ず 3 次元的な細分化をさせたい場合は、以下のようにする。

globalCoeffs
{
    tan1 (1 0 0);
    tan2 (0 1 0);
}

directions
(
    tan1
    tan2
    tan3
);

あるいは、単純につぎのようにしてもよいらしい。

directions
(
    tan1
    tan2
    normal
);

この設定で細分化を行うと、cavity のケースでも奥行き方向に細分化される。

useHexTopology はセルが六面体の時に使うらしい (代わりに geometricCut を無効にする)。六面体でないセルを含む場合は、つぎのようにすればよいらしい (たぶん)。

useHexTopology  false;

geometricCut    true;