OpenFOAM中的周期性边界条件

发布于 2024-07-08  506 次阅读


Please refresh the page if equations are not rendered correctly.
---------------------------------------------------------------

在使用单胞模型计算渗透率时,需要用到周期性边界条件。在OpenFOAM中为cyclic边界条件,其定义见OpenFOAM: User Guide: Cyclic.

假设模型如下:

其中back面($y_{min})为压力入口,front面为压力出口。其余面为周期性边界,相匹配的面为对应面。经过测试,需要在场文件中进行如下设置:

./0/p文件

/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  8
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      binary;
    class       volScalarField;
    location    "0";
    object      p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

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

internalField   uniform 0;

boundaryField
{
    back
    {
        type            fixedValue;
        value           uniform 1;
    }
    front
    {
        type            fixedValue;
        value           uniform 0;
    }
    bottom
    {
        type            cyclic;
    }
    top
    {
        type            cyclic;
    }
    left
    {
        type            cyclic;
    }
    right
    {
        type            cyclic;
    }
}


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

./0/U文件

/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  8
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      binary;
    class       volVectorField;
    location    "0";
    object      U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

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

internalField   uniform ( 0 0 0 );

boundaryField
{
    left
    {
        type            cyclic;
    }
    right
    {
        type            cyclic;
    }
    bottom
    {
        type            cyclic;
    }
    top
    {
        type            cyclic;
    }
    front
    {
        type            inletOutlet;
        value           uniform (0 0 0);
        inletValue      uniform (0 0 0);
    }
    back
    {
        type            zeroGradient;
    }
}


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

./0/F文件

/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  8
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      binary;
    class       volTensorField;
    location    "0";
    object      F;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

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

internalField   uniform ( 0 0 0 0 0 0 0 0 0 );

boundaryField
{
    left
    {
        type            cyclic;
    }
    right
    {
        type            cyclic;
    }
    back
    {
        type            fixedValue;
        value           uniform ( 0 0 0 0 0 0 0 0 0 );
    }
    front
    {
        type            fixedValue;
        value           uniform ( 0 0 0 0 0 0 0 0 0 );
    }
    bottom
    {
        type            cyclic;
    }
    top
    {
        type            cyclic;
    }
}


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

./0/D文件

./0/D文件的边界条件部分设置如下:

boundaryField
{
    top
    {
        type            cyclic;
    }

    bottom
    {
        type            cyclic;
    }

    left
    {
        type            cyclic;
    }

    right
    {
        type            cyclic;
    }

    back
    {
        type            zeroGradient;
    }

    front
    {
        type            zeroGradient;
    }
}

网格文件中的边界类型设置

/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \    /   O peration     | Website:  https://openfoam.org
    \  /    A nd           | Version:  8
     \/     M anipulation  |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       polyBoundaryMesh;
    location    "constant/polyMesh";
    object      boundary;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

6
(
    left
    {
        type cyclic;
        nFaces 48906;
        startFace 23793593;
        neighbourPatch  right;
    }
    right
    {
        type cyclic;
        nFaces 48906;
        startFace 23842499;
        neighbourPatch  left;
    }
    back
    {
        type patch;
        nFaces 32274;
        startFace 23891405;
    }
    front
    {
        type patch;
        nFaces 32274;
        startFace 23923679;
    }
    bottom
    {
        type cyclic;
        nFaces 40261;
        startFace 23955953;
        neighbourPatch  top;
    }
    top
    {
        type cyclic;
        nFaces 40261;
        startFace 23996214;
        neighbourPatch  bottom;
    }
    )

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

参考资料

  1. 关于循环壁面的一些问题
Everything not saved will be lost.
最后更新于 2024-07-08