1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

OpenFOAM postProcess (ESI) によるデータ抽出方法

1
Last updated at Posted at 2025-11-20

はじめに

OpenFOAM の計算中に、任意の座標点での 圧力 p や速度 U などの時間変化を取り出したいときに便利なのが probes functionObject です。ポスト処理で点サンプリングするよりも、計算と同時にログが残るので、収束状況や脈動の確認などに特に便利です。(OpenFOAM Documentation)

以前にも類似のポストをしているところですが、年数が経っているのと、ESI版を最近はつかっているため、改めてまとめてみました。


controlDict での設定方法

ESI版では system/controlDictfunctionsprobes 設定を include するだけでOKです。

system/controlDict の末尾付近に以下を追記します。

functions
{
    #include "probes"
}
  • これで system/probes に書いた内容が読み込まれます。
  • functions { ... } の中に直接 probes 設定を書いても良いですが、別ファイル化しておくと使い回しが楽です。

probes ファイルの用意

system ディレクトリ直下に probes というファイルを作成します(拡張子なし)。

例:

system/probes

type                probes;
// functionObjectLibs  ("libsampling.so");   // ESI版ならこれでOK(省略可)
enabled             true;

writeControl        timeStep;             // 例: outputTime でも可
writeInterval       1;

fields              (p U);
interpolationScheme cellPoint;

probeLocations
(
    (-0.0226387 -0.0701701 -0.696085)  // 参照したい座標
);

各項目の説明(最低限)

  • type probes;
    probes の宣言です。

  • functionObjectLibs ("libsampling.so");
    sampling 系のライブラリ指定。ESI版ではほぼ不要で、省略しても動くことが多いです(環境により必要なら復活)。

  • writeControl / writeInterval
    出力タイミングを決めます。

    • writeControl timeStep; → n ステップごと
    • writeControl outputTime;controlDict の writeInterval と同期
      詳細は user guide の sampling/functionObject の考え方に準拠。
  • fields (p U);
    取り出したい変数を列挙します。スカラー/ベクトルどちらもOK。

  • interpolationScheme cellPoint;
    セル値と頂点値からの補間。点がセル中心にない場合の標準的な選択です。

  • probeLocations ( ... );
    取り出したい座標を並べます。複数点も可。

例:3点に増やす場合

probeLocations
(
    (0.0 0.0 0.0)
    (0.01 0.0 0.0)
    (0.02 0.0 0.0)
);

出力されるファイル

計算を実行すると、自動的に

postProcessing/probes/<time>/

の下に probes 結果が出力されます。
典型的には pU のファイルができ、1列目が「時間」、以降が各 probe 点の値として並びます。

また、計算実行後のデータについてデータ抽出したい場合は、

postProcess -func probes

とすると上記のフォルダ、データが生成されます。


ちょい便利Tips

1) includeEtc を使ってさらに短く書く

ESI版の標準テンプレを読む形にすると、最小限の差分だけ書けます。

system/probes をこう書いてもOK:

#includeEtc "caseDicts/postProcessing/probes/probes.cfg"

fields (p U);

probeLocations
(
    (-0.0226387 -0.0701701 -0.696085)
);

interpolationScheme cellPoint;

テンプレ側に type probes; libs ("libsampling.so"); writeControl timeStep; writeInterval 1; などが含まれています。


2) 並列計算でも普通に使える

decomposeParmpirun の並列計算でも、probes は各領域でサンプリングされ、最終的に同じ postProcessing/probes/ にまとまります(点が属するプロセッサで評価)。


3) 「点がメッシュ外」にあるとエラー/NaN

座標が流体領域外・壁内部だと値が取れません。
ParaView で座標位置を確認するか、checkMesh と合わせて位置を見直すと安全です。


まとめ

  • OpenFOAM ESI版では、functions { #include "probes" } として別ファイル化するのが便利。
  • system/probesfieldsprobeLocations を書けば、計算中に指定点の値が出力される。
  • 出力は postProcessing/probes/ に保存され、時系列解析にすぐ使える。

probes は「ちょっとした確認」に強力なので、ぜひケーステンプレに入れておくと作業がかなり楽になります。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?