いわて駐在研究日誌

OpenCAE、電子工作、R/C等、徒然なるままに

動的なsolidBodyMotionFvMeshのライブラリ作成

OF、あるいは、動的メッシュ機能をもつたいていのCFDソフトは、メッシュの移動・回転速度を指定して計算するのが一般的だろう。

 

風車の研究をしているので、ブレードトルク→回転の運動方程式→角速度→回転角のような動的なメッシュ移動ができないか試行錯誤しているが、自分のC++の知識ではOFのC++の高レベルの利用に追いついていけず、遅々として進んでいない(一応それらしい動きができるようにしてみたが、回転の運動方程式をfunctionObject機能を利用して外部で解いているので、次のステップとして、できれば全部OFの中でクローズしたいと考えている)。

 

もっと時間をかけてC++勉強しないとだめだなぁと思いつつ、いろいろ調べてたらそのようなライブラリを使用している論文を発見(Goong Chen et al, "OpenFOAM computation of interacting wind turbine flows and control(I): free rotating case", WPのpreprint?)。2014年かということで、自分がアイデア考えだしたころに論文になってたということになる。ちょっと残念。Chen先生は結構OF関連では、論文を出してるみたいだ。

 

彼らの論文によると、OF-extendを利用して(???明確な記述なし)、solidBodyMotionFvMeshからforceDrivenFvMeshというライブラリを作成し、その中で、forceDrivenMotionFunction( FDRotatingMoton, codedFDRotatingMotion)の回転計算functionを定義して利用しているようである。

 

ライブラリ自体のあまり詳しい情報は小論文にのっておらず、ネットでも検索でヒットしないので、情報を得るには直接コンタクトするか、CFDonlineに聞くしかないようだ。もう少し調査しつつ、正規版4.xでも作れないか作業してみたい。

 

 

 

SL6にdevtoolを入れる

SL6やCentOS6系はコンパイラのバージョンが古いため、OF4.xのビルドなどのためには、いろいろ支障が出てきている。そこで、devtoolと呼ばれるコンパイラ関係の更新パッケージをいれてみる(SL6.8)。

 

linux.web.cern.ch

devtoolは現在4まであるみたいだが、あまり新しいコンパイラだとハマる可能性もあるため、devtool-2をいれてみた(gcc4.8.2)。

$ su

# cd /etc/yum.repo.d/

# wget http://linuxsoft.cern.ch/cern/devtoolset/slc6-devtoolset.repo

# yum install devtoolset-2

# exit

$ source /opt/rh/devtoolset-2/enable 

$ gcc --version
gcc (GCC) 4.8.2 20140120 (Red Hat 4.8.2-15)
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

 

SLは、次のバージョンからCentOSベースになるらしいけど、それならCentOSでいいのかな。

chtMulitRegionFoam + DynamicMesh(fluidRegion) + interFoam + Evapolation/Condensation on OF3.0.x (その1)

というのをやりたいので、以下の順番に進める。

OF4.0が出たばっかりだが、ちょっとヘッダファイルが変わったようなので、とりあえず3.0.xで進める。

①chtMulitRegionFoam + DynamicMesh(fluidRegion) = chtMultiReginDyMFoam

 

 

 

 

Immersed boundary method on foam-extend 3.2

(注意) foam-extend 3..2はgcc 4.9.2以上が必要なようです。

OpenFOAMのforkしたバージョンであるfoam-extend 3.2が昨年9月にリリースされ、前から気になっていたImmersed boundary methodが正式にリリースされていたので、知らべてみた。現在は、nextReleaseとして4.0の作業を進めているらしいです。

 

ライブラリ:src/immersedBoundary

ソルバー:applications/solvers/immersedBoundary/ (六つ)

    icoIbFoam    porousSimpleIbFoam  simpleIbFoam
    icoDyMIbFoam     interIbFoam  potentialIbFoam

チュートリアル:tutorials/immersedBoundary/*

 

テスト1(Tutorial・・・cylinderInChannelIcoIbFoam)

2次元チャネル内に、2次元stlファイルでIB(Immersed boundary)が静止している計算。ここで設定として

  • IBはstlないしftrで指定(ベースメッシュで考慮は不要)する。ファイル名がboundary名になる。stlファイルはsurfaceConvertコマンドでftr形式にも変換して、同じフォルダにおいておく。
  • IBのconstant/boundaryには、以下のように記述する。nFacesは0で、それ以外のfaceIDに合わせて適宜startFaceを指定する。

   ibCylinder
    {
        type            immersedBoundary;
        nFaces          0;
        startFace       3650;
        internalFlow    no;
    }

  •  0/U,pファイルは、以下のように記述する。

0/U

    ibCylinder
    {
        type immersedBoundary;
        refValue uniform (0 0 0);
        refGradient  uniform (0 0 0);
        fixesValue yes;

        setDeadCellValue   yes;
        deadCellValue      (0 0 0);
    }

 0/p

    ibCylinder
    {
        type immersedBoundary;
        refValue uniform 0;
        refGradient  uniform 0;
        fixesValue no;

        setDeadCellValue   yes;
        deadCellValue      0;

        value uniform 0;
    }

 

f:id:waku2005:20160627133934p:plain

f:id:waku2005:20160627133939p:plain

f:id:waku2005:20160627133943p:plain

スト2(Tutorial・・・cylinderInChannelIcoIbFoam)

2次元チャネル内に、2次元stlファイルでIB(Immersed boundary)が変動している計算。ソルバーはicoDyMIbFoamになる。

下記のとおり、dynamicMeshDictの中で、往復するsolidBodyMotionを定義している。

- constant/dynamicMeshDict

dynamicFvMesh   immersedBoundarySolidBodyMotionFvMesh;

immersedBoundarySolidBodyMotionFvMeshCoeffs
{
    motionFunctions
    (
        ibCylinder
        {
//             solidBodyMotionFunction     translation;
//             translationCoeffs
//             {
//                 velocity (0.1 0 0);
//             }

            solidBodyMotionFunction     linearOscillation;
            linearOscillationCoeffs
            {
                amplitude    (0.5 0 0);
                period       2.5;
            }
        }
    );
}

 

f:id:waku2005:20160627140854p:plain

f:id:waku2005:20160627140901p:plain

Adaptive Mesh Refinement(AMR) on OpenFOAM 3.0.x

AMRはDyMソルバーで利用可能。3Dメッシュのみ+Parallel計算可能。

interDyMFoamのチュートリアルに含まれているconstant/dynamicMeshDictでは以下の通りに記述されている。

dynamicFvMesh   dynamicRefineFvMesh;

dynamicRefineFvMeshCoeffs
{
    // How often to refine     refineの頻度(time step)
    refineInterval  1;
    // Field to be refinement on   refineの基準変数(volScalarしかできない?)
    field           alpha.water;
    // Refine field inbetween lower..upper  基準変数のrefine下限値/上限値(この範囲がrefineされる)
    lowerRefineLevel 0.001;
    upperRefineLevel 0.999;
    // If value < unrefineLevel unrefine  unrefine最大の値(通常は大きな値としておくと、自動的にunrefineも行われることになる)
    unrefineLevel   10;
    // Have slower than 2:1 refinement    refineのバッファー
    nBufferLayers   1;
    // Refine cells only up to maxRefinement levels   refineの最大追加レベル
    maxRefinement   2;
    // Stop refinement if maxCells reached  リファイン停止条件の最大セル
    maxCells        200000;

    // Flux field and corresponding velocity field. Fluxes on changed
    // faces get recalculated by interpolating the velocity. Use 'none'
    // on surfaceScalarFields that do not need to be reinterpolated.
    correctFluxes
    (
        (phi none)
        (nHatf none)
        (rhoPhi none)
        (ghf none)
    );
    // Write the refinement level as a volScalarField
    dumpLevel       true;
}

 

助成金申請

なかなか科研費があたらないので、助成金のほうで頑張って稼ごうと足掻いています。

本日2件提出しました。来月も2件提出予定です。

現状、

・企業さんの申請に協力する形で2件(@30弱)

・某M社、E社の助成金(@100, @65)

を提出して結果待ちで、来月〆切のものは、

・某S社、I社の助成金(@100、@200)

とちょっと額が大きいので頑張って書くべし。