2
1

More than 5 years have passed since last update.

OpenFOAMで入力できる項目の調べ方

Last updated at Posted at 2017-11-30

OpenFOAMインプット

OpenFOAMは様々機能を標準で搭載しているが、たびたび入力項目がっわからなくて困ることがある。

その時はネットで調べるのもいいが、すぐに入力方法を知る方法がある。

なんか適当な文字を入力して実行してみる。

OpenFOAMはインプットに適当な文字を入れると入力可能な文字列の一覧を返してくれる。これを利用することで複数ある入力項目の候補を簡単に調べることができる。

次のテキストは乱流モデルを指定するturbulencePropertiesのRASModelに適当な文字を突っ込んだ例。

constant/turbulenceProperties
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  plus                                  |
|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    "constant";
    object      turbulenceProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

simulationType RAS;

RAS
{
    RASModel        hogehoge;

    turbulence      on;

    printCoeffs     on;
}

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

この状態で計算を実行すると以下のエラーメッセージが表示される。

log
...

--> FOAM FATAL ERROR:
Unknown RASModel type hogehoge

Valid RASModel types:

18
(
LRR
LamBremhorstKE
LaunderSharmaKE
LienCubicKE
LienLeschziner
RNGkEpsilon
SSG
ShihQuadraticKE
SpalartAllmaras
kEpsilon
kOmega
kOmegaSST
kOmegaSSTLM
kOmegaSSTSAS
kkLOmega
qZeta
realizableKE
v2f
)

...

このメッセージからRASModelで使用できる項目は18個あり、この中から選ぶことができるとわかる。

境界条件も同じ

0/U
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  plus                                  |
|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       volVectorField;
    object      U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

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

internalField   uniform (25.75 3.62 0);

boundaryField
{
    inlet
    {
        type            freestream;
        freestreamValue uniform (25.75 3.62 0);
    }

    outlet
    {
        type            freestream;
        freestreamValue uniform (25.75 3.62 0);
    }

    walls
    {
        type            hogehoge;
    }

    frontAndBack
    {
        type            empty;
    }
}

// ************************************************************************* //
log
...

80
(
SRFFreestreamVelocity
SRFVelocity
SRFWallVelocity
activeBaffleVelocity
activePressureForceBaffleVelocity
advective
atmBoundaryLayerInletVelocity
calculated
codedFixedValue
codedMixed
cyclic
cyclicACMI
cyclicAMI
cyclicSlip
cylindricalInletVelocity
directionMixed
empty
extrapolatedCalculated
fixedGradient
fixedInternalValue
fixedJump
fixedJumpAMI
fixedMean
fixedNormalInletOutletVelocity
fixedNormalSlip
fixedProfile
fixedShearStress
fixedValue
flowRateInletVelocity
fluxCorrectedVelocity
freestream
inletOutlet
interstitialInletVelocity
kqRWallFunction
mapped
mappedField
mappedFixedInternalValue
mappedFixedPushedInternalValue
mappedFlowRate
mappedVelocityFlux
mixed
movingWallVelocity
noSlip
nonuniformTransformCyclic
outletInlet
outletMappedUniformInlet
outletPhaseMeanVelocity
partialSlip
pressureDirectedInletOutletVelocity
pressureDirectedInletVelocity
pressureInletOutletParSlipVelocity
pressureInletOutletVelocity
pressureInletUniformVelocity
pressureInletVelocity
pressureNormalInletOutletVelocity
pressurePIDControlInletVelocity
processor
processorCyclic
rotatingPressureInletOutletVelocity
rotatingWallVelocity
sliced
slip
supersonicFreestream
surfaceNormalFixedValue
swirlFlowRateInletVelocity
symmetry
symmetryPlane
timeVaryingMappedFixedValue
translatingWallVelocity
turbulentDFSEMInlet
turbulentInlet
uniformFixedGradient
uniformFixedValue
uniformInletOutlet
uniformJump
uniformJumpAMI
variableHeightFlowRateInletVelocity
waveTransmissive
wedge
zeroGradient
)

...

選択できる境界条件(80個)が表示される。

スカラーかベクトルかも表示される。

OpenFOAMでは境界条件の指定でスカラー値かベクトル値かその境界条件のタイプに合わせて入力する必要があるが間違えて入れた場合はそれも表示される。
次のエッセー時はベクトルのフィールドにスカラー値を入れた時のエラーメッセージ。

log
...

--> FOAM FATAL IO ERROR:
Expected a '(' while reading VectorSpace<Form, Cmpt, Ncmpts>, found on line 32 the doubleScalar 10

...

まとめ

OpenFOAMで入力項目が分からなくなったときはとりあえず何かを入れるとメッセージにヒントが表示されるので、それをもとに入力してみる。

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