天天看點

openfoam v8 波浪算例學習日記: 5.邊界條件及初始條件

邊界條件及初始條件

此波浪算例所需的初始條件有

alpha.water p_rgh U

1、

alpha.water.orig

檔案

$ cat 0/alpha.water.orig
...
FoamFile
{
    version     2.0;
    format      ascii;
    class       volScalarField;
    location    "0";
    object      alpha.water;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions      [0 0 0 0 0 0 0];

internalField   uniform 0;

boundaryField
{
    #includeEtc "caseDicts/setConstraintTypes"

    "(right|bottom)"
    {
        type            zeroGradient;
    }
    left
    {
        type            waveAlpha; //造波邊界,與waves2Foam類似,均為waveAlpha,不過所需的參數不同。
        U               U;
        inletOutlet     true;//猜測此項表示此邊界可以允許流體進出
    }
    top
    {
        type            inletOutlet;
        inletValue      uniform 0;
        value           uniform 0;
    }
}


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

其中

waveAlpha

類型中的

inletOutlet

參數不太了解,于是檢視了該邊界條件的定義檔案。

通過以下指令:

$ grep -rn waveAlpha $FOAM_SRC
...
/opt/openfoam8/src/waves/derivedFvPatchFields/waveAlpha/waveAlphaFvPatchScalarField.H:28:    This boundary condition provides a waveAlpha condition. This sets the phase
...
           

找到源代碼路徑,然後打開檢視檔案頭,其中會有該邊界條件的描述。此處引用過來

Description

This boundary condition provides a waveAlpha condition. This sets the phase

fraction to that specified by a superposition of wave models. All the

wave modelling parameters are obtained from a centrally registered

waveSuperposition class.

Flow reversal will occur in the event that the amplitude of the velocity
oscillation is greater than the mean flow. This triggers special handling,
the form of which depends on the inletOutlet flag and whether a wave
pressure condition is being used.

If a wave pressure condition is not being used, the inletOutlet switches
between a fixedValue and an inletOutlet condition, with the value given by
the wave model. If fixedValue, the result may be more accurate, but it
might also be unstable.

If a wave pressure condition is being used, then the normal phase fraction
condition becomes fixedGradient on outlet faces. This gradient is
calculated numerically by evaluating the wave model on both the patch face
and the adjacent cell.
           

沒太了解。

2、

p_rgh

檔案

$ cat 0/p_rgh
...
FoamFile
{
    format      ascii;
    class       volScalarField;
    location    "0";
    object      p_rgh;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

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

internalField   uniform 0;

boundaryField
{
    #includeEtc "caseDicts/setConstraintTypes"

    "(left|right|bottom)"
    {
        type            fixedFluxPressure;
        value           uniform 0;
    }
    top
    {
        type            totalPressure;
        p0              uniform 0;
    }
}

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

都是些正常的邊界條件。

3、

U.org

檔案

$ cat 0/U.org
...
FoamFile
{
    format      ascii;
    class       volVectorField;
    location    "0";
    object      U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

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

internalField   uniform (2 0 0);

boundaryField
{
    #includeEtc "caseDicts/setConstraintTypes"

    left
    {
        type            waveVelocity; //波浪速度
    }
    right
    {
        type            outletPhaseMeanVelocity;
        UnMean          2; //流速
        alpha           alpha.water; //指定水,而不是空氣
    }
    top
    {
        type            pressureInletOutletVelocity;
        value           uniform (0 0 0);
    }
    bottom
    {
        type            noSlip;
    }
}


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

檔案夾下初始條件在

setWave

指令作用下,生成計算中使用的初始條件。

繼續閱讀