データのサンプリング2015年1月18日 | |
はじめに計算結果から線上や面上のデータを取得する。 使用バージョンOpenFOAM 2.3.0 データの用意データとして、icoFoam のチュートリアルケース cavity を使う。 $ cp -r $FOAM_TUTORIALS/incompressible/icoFoam/cavity . $ cd cavity $ blockMesh $ icoFoam sampleDict の用意データのサンプリングには sample コマンドを使う。そのために system/sampleDict を用意する。 system/sampleDict
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object sampleDict;
}
setFormat raw;
surfaceFormat raw;
interpolationScheme cellPoint;
fields ( U p );
sets
(
data
{
type uniform;
axis x;
start ( 0 0.05 0.005 );
end ( 0.1 0.05 0.005 );
nPoints 20;
}
);
surfaces
(
data
{
type patch;
patches ( movingWall );
}
);
fileds で、取得するデータの種類を指定する。ここでは速度ベクトルと圧力を指定している。 sets で直線上からデータを取る設定を行う。"data" はデータの名前 (任意)、axis は出力する位置情報の種類、start, end は直線の始点と終点、nPoints は始点と終点を結ぶ直線上の点の数である。つまり、直線上に点を発生させて、その点のデータを取得する。上記の例では、cavity モデルの真中の高さを横切る直線を指定している。 axis には以下のものを指定できる。
surfaces でサーフェイス上からデータを取る設定を行う。type で "patch" を指定してパッチからデータを取るようにし、patchName でデータを取るパッチの名前を指定している。 surafces の type には、"patch" 以外に、領域内を横切る面のデータを取得する "cuttingPlane" もある。
surfaces
(
data
{
type cuttingPlane;
planeType pointAndNormal;
pointAndNormalDict
{
basePoint (0 0.05 0);
normalVector (0 1 0);
}
}
);
setFormat には以下のものを指定できる。
surfaceFormat には以下のものを指定できる。
interpolationScheme には以下のものを指定できる。
sample コマンドの実行sample コマンドを実行する。 $ sample -latestTime オプションの -latestTime で、最後の結果だけ取得する。ここでは 0.5 のデータを取得することになる。データは "postProcessing/sets/0.5/data_U.xy" のように書き出される。gnuplot でデータを確認できる。 $ gnuplot ... gnuplot> plot 'postProcessing/sets/0.5/data_U.xy' using 1:3 title 'uy' with lines | |
| PENGUINITIS | |