LoginSignup
2
2

More than 1 year has passed since last update.

OpenFOAM Postprocessingによるデータ抽出方法(probes/internalProbes)

Last updated at Posted at 2020-12-14

はじめに

OpenFOAMでは様々なポスト処理が用意されています。
ここでは、指定のセル(点)における、指定の変数の抽出方法、probes、__internalProbes__について言及します。
なお、本記事では OpenFOAM ver.8 / ver.10 (Foundation版) について解説していきます。

probe / internalProbes の概略

probing dataのページに概略が述べられています:

  • probes identify the nearest cells to the probe locations and write out the cell values; data is written into a single file in a time-value format, suitable for plotting a graph.
  • boundaryProbes and internalProbes interpolate field data to the probe locations, with the locations being snapped onto boundaries for boundaryProbes; data sets are written to separate files at scheduled write times (like fields). data.

probes は指定座標に近いセルの__時系列__データを抽出するのに対し、 internalProbes は指定座標のデータを補間して抽出します。

また、Fundation版で実装されているscript、foamInfoを叩くと所望の関数、ソルバーの情報を得ることができます。

probes
File
    /opt/openfoam8/src/sampling/probes/probes.H

Description
    Set of locations to sample.

    Call write() to sample and write files.

Examples using "probes"
    *** Listing 10 out of 11; run with "-a" option to list all ***
    /opt/openfoam8/tutorials/compressible/rhoPimpleFoam/laminar/helmholtzResonance
    /opt/openfoam8/tutorials/incompressible/pimpleFoam/RAS/TJunction
    /opt/openfoam8/tutorials/incompressible/pimpleFoam/RAS/TJunctionFan
    /opt/openfoam8/tutorials/incompressible/pisoFoam/LES/pitzDaily
    /opt/openfoam8/tutorials/incompressible/pisoFoam/LES/pitzDailyMapped
    ...
internalProbes
File
    /opt/openfoam8/etc/caseDicts/postProcessing/probes/internalProbes

Description
    Writes out values of fields interpolated to a specified list of points.

以降ではそれぞれの使い方を、incompressible/pimpleFoam/pitzDailyを使って説明していきます。

probes

ver.8

pitzDailyにおいて、

foamGet probes

を実行することにより、system/probesファイルを自前のcaseDirに用意することができます。

system/probes
/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  8
     \\/     M anipulation  |
-------------------------------------------------------------------------------
Description
    Writes out values of fields from cells nearest to specified locations.

\*---------------------------------------------------------------------------*/

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

fields (p U);
probeLocations
(
   (0 0 0)
);

fieldsに所望の変数を、probeLocationsに座標を入力します。設定は基本これだけになります。

なお、その他の設定については、caseDicts/postProcessing/probes/probes.cfgというファイルで行われています。

system/probes.cfg
/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  8
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/

type            probes;
libs            ("libsampling.so");

writeControl    timeStep;
writeInterval   1;

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

ProbesのLibraryの読み込み、データ書き出し設定を行っています。デフォルトでは毎時間ステップにデータ出力することになっています。出力間隔を変更したい場合は、probes.cfgfoamGetで持ってきて、編集する必要があります。

pimpleFoamを実行後にデータ抽出を行う際は、

postProcessing -func probes

を実行すると、postProcessingディレクトリ下に指定座標における、指定変数の時系列データが出力されます。

また、pimpleFoam実行時に同時に出力を行う場合は、system/controlDict

controlDict
functions
{
   #includeFunc probes
}

を追記します。

ver.10

ver.10 では少し設定ファイルの記述が変更されています。
そのため,ver.8の設定ファイルをもってきても動きません・・・(Foundation版のあるあるですね)。

/opt/openfoam9/etc/caseDicts/postProcessing/probes/probes
/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  10
     \\/     M anipulation  |
-------------------------------------------------------------------------------
Description
    Writes out values of fields from cells nearest to specified locations.

\*---------------------------------------------------------------------------*/

points  (<points>);

fields  (<fieldNames>);

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

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

internalProbes

指定の座標のデータを、補間しつつ、抽出してくれます。ただ、probesで行ったようなfoamGetで設定ファイルを持ってくるだけでは動かすことができません。以下のような操作が必要になります。

  1. internalProbes、internalProbes.cfgの2つのファイルをfoamGetで持ってきます。
  2. internalProbesに補間方法(internalProbes)、データ・フォーマット(setFormat)の設定の記述を追記します。
internalProbes
fields (p U);
points
(
         (0.0254 0.0253 0)
);

interpolationScheme     cellPoint;
setFormat       raw;
  1. internalProbes.cfgにorderedを追記します。
internalProbes.cfg
type            sets;
libs            ("libsampling.so");

executeControl  writeTime;
writeControl    writeTime;

sets
(
    points
    {
        type    points;
        axis    xyz;
        points  $points;
        ordered 1;
    }
);

以上で設定は終了です。実行はprobesと同様にpostProcessingを実行する、もしくは、controlDictにpostProcessingを追記します。

まとめ

本記事では、probes、__internalProbes__について、特にそれぞれの使用方法についてまとめました。
情報不足、誤り等ございましたら、ご指摘いただければ幸いです。

2
2
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
2
2