OpenFOAM

T721_233 sloshingTank3D

この記事は約11分で読めます。

OpenFoamのサンプル確認(パラメータやキーワードの覚書)です。
スロッシングの例です。
こちらはwsl2の環境で行っています。

環境:wsl2 ubuntu 22.04.2 LTS
バージョン : OpenFOAM-11

ベース

チュートリアルフォルダ:wsl2

引用元

<チュートリアルフォルダ>/incompressibleVoF/sloshingTank3D

結果図

作業

作業としては、Allrunを実行するだけです。

#!/bin/sh
cd ${0%/*} || exit 1    # Run from this directory

# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions

runApplication blockMesh -dict $FOAM_TUTORIALS/resources/blockMesh/sloshingTank3D
runApplication setFields
runApplication $(getApplication)

#------------------------------------------------------------------------------
Allrun実行

全体構造

.sloshingTank3D
├── 0
│   ├── U
│   ├── alpha.water.orig
│   └── p_rgh
├── Allrun
├── constant
│   ├── dynamicMeshDict
│   ├── g
│   ├── momentumTransport
│   ├── phaseProperties
│   ├── physicalProperties.air
│   └── physicalProperties.water
└── system
    ├── controlDict
    ├── decomposeParDict
    ├── fvSchemes
    ├── fvSolution
    └── setFieldsDict

3 directories, 15 files
アルファベット順

0

U

dimensions      [0 1 -1 0 0 0 0];

internalField   uniform (0 0 0);

boundaryField
{
    wall
    {
        type            movingWallVelocity;
        value           uniform (0 0 0);
    }
}

alpha.water

dimensions      [0 0 0 0 0 0 0];

internalField   uniform 0;

boundaryField
{
    wall
    {
        type            zeroGradient;
    }
}

p_rgh

dimensions      [1 -1 -2 0 0 0 0];

internalField   uniform 0;

boundaryField
{
    wall
    {
        type            fixedFluxPressure;
    }
}

constant

dynamicMeshDict

mover
{
    type            motionSolver;

    libs            ("libfvMeshMovers.so" "libfvMotionSolvers.so");

    motionSolver    solidBody;

    select          all;

    solidBodyMotionFunction SDA;

    CofG            (0 0 0);
    lambda           50;
    rollAmax        0.22654;
    rollAmin        0.10472;
    heaveA          3.79;
    swayA           2.34;
    Q               2;
    Tp              13.93;
    Tpn             11.93;
    dTi             0.059;
    dTp             -0.001;
}

solidBodyMotionFunction SDA; は、OpenFOAMの solidBodyMotionFunction クラスの派生クラスであり、船舶設計解析(Ship Design Analysis)に特化した3自由度の運動関数です1. この運動関数は、x軸周りの回転(ロール)、z方向への移動(ヒーブ)、y方向への移動(スウェイ)を含む正弦波状の運動を提供し、振幅と位相が変化します.

g

dimensions      [0 1 -2 0 0 0 0];
value           (0 0 -9.81);

momentumTransport

simulationType  laminar;

phaseProperties

phases          (water air);

sigma           0;

phaseProperties は、OpenFOAMの多成分相のプロパティを管理するためのヘルパークラスです。sigma は、phaseProperties クラスで定義された、多成分相の表面張力を表すスカラー値です。

physicalProperties.air

viscosityModel  constant;

nu              1.48e-05;

rho             1;

physicalProperties.water

viscosityModel  constant;

nu              1e-06;

rho             998.2;

system

メッシュはコマンドで別処理 
blockMesh -dict $FOAM_TUTORIALS/resources/blockMesh/sloshingTank3D

controlDict

application     foamRun;

solver          incompressibleVoF;

startFrom       startTime;

startTime       0;

stopAt          endTime;

endTime         40;

deltaT          0.05;

writeControl    adjustableRunTime;

writeInterval   0.05;

purgeWrite      0;

writeFormat     binary;

writePrecision  6;

writeCompression off;

timeFormat      general;

timePrecision   6;

runTimeModifiable yes;

adjustTimeStep  yes;

maxCo           0.5;
maxAlphaCo      0.5;
maxDeltaT       1;

functions
{
    probes
    {
        type            probes;
        libs            ("libsampling.so");
        writeControl   timeStep;
        writeInterval  1;
        probeLocations
        (
            (0 9.95 19.77)
            (0 -9.95 19.77)
        );
        fixedLocations  false;
        fields
        (
            p
        );
    }
}

decomposeParDict

numberOfSubdomains 16;

method          hierarchical;

simpleCoeffs
{
    n               (2 2 1);
}

hierarchicalCoeffs
{
    n               (4 2 2);
    order           xyz;
}

manualCoeffs
{
    dataFile        "";
}

distributed     no;

roots           ( );

decomposeParDict は、OpenFOAMの並列計算において、計算領域を複数のサブドメインに分割するための設定ファイルです。decomposeParDict ファイルには、分割方法や分割数などのパラメータが記述されています。decomposeParDict ファイルを使用して、decomposePar ユーティリティを実行することで、計算領域を複数のサブドメインに分割することができます。

fvSchemes

ddtSchemes
{
    default         Euler;
}

gradSchemes
{
    default         Gauss linear;
}

divSchemes
{
    div(rhoPhi,U)  Gauss vanLeerV;
    div(phi,alpha)  Gauss interfaceCompression vanLeer 1;

    div(((rho*nuEff)*dev2(T(grad(U))))) Gauss linear;
}

laplacianSchemes
{
    default         Gauss linear corrected;
}

interpolationSchemes
{
    default         linear;
}

snGradSchemes
{
    default         corrected;
}

fvSolution

solvers
{
    alpha.water
    {
        nAlphaCorr      1;
        nAlphaSubCycles 3;
    }

    "pcorr.*"
    {
        solver          PCG;
        preconditioner
        {
            preconditioner  GAMG;
            tolerance       1e-05;
            relTol          0;
            smoother        DICGaussSeidel;
            cacheAgglomeration no;
        }

        tolerance       1e-05;
        relTol          0;
        maxIter         100;
    }

    p_rgh
    {
        solver          GAMG;
        tolerance       1e-08;
        relTol          0.01;
        smoother        DIC;
    }

    p_rghFinal
    {
        solver          PCG;
        preconditioner
        {
            preconditioner  GAMG;
            tolerance       2e-09;
            relTol          0;
            nVcycles        2;
            smoother        DICGaussSeidel;
            nPreSweeps      2;
        }

        tolerance       2e-09;
        relTol          0;
        maxIter         20;
    }

    U
    {
        solver          smoothSolver;
        smoother        GaussSeidel;
        tolerance       1e-06;
        relTol          0;
        nSweeps         1;
    }
}

PIMPLE
{
    momentumPredictor no;
    nCorrectors     2;
    nNonOrthogonalCorrectors 0;
    correctPhi      no;

    pRefPoint       (0 0 0.15);
    pRefValue       1e5;
}

relaxationFactors
{
    equations
    {
        ".*"            1;
    }
}

setFieldsDict

defaultFieldValues
(
    volScalarFieldValue alpha.water 0
);

regions
(
    boxToCell
    {
        box (-100 -100 -100) (100 100 0);
        fieldValues
        (
            volScalarFieldValue alpha.water 1
        );
    }
);

コメント

Translate »
タイトルとURLをコピーしました