LoginSignup
0

More than 3 years have passed since last update.

"potentialFoam" + "applyBoundaryLayer"を使った初期条件の作成

Last updated at Posted at 2021-01-07

はじめに

数値解析においては、初期条件、境界条件を適切に設定することが重要です。OpenFOAMでは、特にこの条件が計算安定性に及ぼす影響は大きいです。
OpenFOAMでは初期条件を作成する方法として、potentialFoam(完全流体流れ)を使用する方法が主流ですが、デメリットとして、(当然ではありますが)境界層がない、流束を過大評価する、があります。

本記事では、OpenFOAM ver.8環境下でpotentialFoam + applyBoundaryLayerを組み合わせた初期条件の設定方法をまとめます。

Step 1: potentialFoam

  • Tutorial pimpleFoam/pitzDailyを作業ディレクトリにコピーします。
  • このままでは potentialFoam が実行できないのでfvSolutionを編集します。
system/fvSolution
solvers
{
    Phi 
    {   
        solver          GAMG;
        smoother        DIC;

        tolerance       1e-06;
        relTol          0.01;
    }  
}
potentialFlow
{
    nNonOrthogonalCorrectors 2;
}
  • Step 2: potentialFoamを実行

下図のような境界層が無い流れ場が0ディレクトリに得られます。

Screen Shot 2021-01-06 at 23.50.28.png

applyBoundaryLayer

applyBoundaryLayerは速度場データを元に壁面境界を計算するソルバーになります。
以下はソースの抜粋になります。

applyBoundaryLayer.C
     // Modify velocity by applying a 1/7th power law boundary-layer
     // u/U0 = (y/ybl)^(1/7)
     // assumes U0 is the same as the current cell velocity

     Info<< "Setting boundary layer velocity" << nl << endl;
     scalar yblv = ybl.value();
     forAll(U, celli)
     {
         if (y[celli] <= yblv)
         {
             mask[celli] = 1;
             U[celli] *= ::pow(y[celli]/yblv, (1.0/7.0));
         }
     }
     mask.correctBoundaryConditions();

     Info<< "Writing U\n" << endl;
     U.write();

ここに記載している通り境界層を「$1/7$乗則」で計算します。

使用方法ですが、以下のようにオプションをつけて実行するのみです。

applyBoundaryLayer <option>
  • options
    • -Cbl scalar
    • -ybl scalar

前者は壁面からの平均距離(第1層のメッシュ厚さ)にオプションで指定した値を乗じたものを境界層厚さとします。後者は境界層厚さをそのまま指定することになります。

その他、詳細はここを参考にしていただければと思います。

あとは、fvSchemesにwallDistの設定を追記すれば良いです。

system/fvSchemes
wallDist
{
    method meshWave;

    // Optional entry enabling the calculation
    // of the normal-to-wall field
    nRequired false;
}

Screen Shot 2021-01-06 at 23.48.16.png

上図がapplyBoundaryLayerによって得られた速度場の初期条件になります。先のpotentialFoamの結果と比べて、よりリーズナブルな速度場(境界層があり、かつ、速度の過大評価が是正されている)が得られていることがわかります。

なお、対象が乱流のcaseであれば、乱流パラメーターも計算してくれます。

さいごに

解析が発散するような場合は、離散化や線形ソルバーの見直しも必要ですが、このような初期条件の見直しも有効だと思います。

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
0