OpenFOAM计算管道内部泊肃叶流动需要的边界条件
泊肃叶流动为层流流动,在OpenFOAM中仅需要设计p和U边界条件:
p边界条件:
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 5.x |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -2 0 0 0 0];
internalField uniform 0;
boundaryField
{
inlet
{
type zeroGradient;
}
outlet
{
type fixedValue;
value uniform 0;
}
wall
{
type zeroGradient;
}
}
// ************************************************************************* //
U边界条件:
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 5.x | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class volVectorField; location "0"; object U; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 1 -1 0 0 0 0]; internalField uniform (0 0 0); boundaryField { inlet { type codedFixedValue; value uniform (0 0 2); name parabolicVelocity; code #{ // 下面三行为标准写法,一般不用修改 const fvPatch& boundaryPatch = patch(); const vectorField& Cf = boundaryPatch.Cf(); vectorField& field = *this; // Umax为2倍的平均速度;p_ctr_x和p_ctr_y为进口中心点与坐标系原点的偏移量;R为圆管的半径 scalar Umax = 4, p_ctr_x= 0, p_ctr_y = 0, R = 0.00125; forAll(Cf, faceI) { field[faceI] = vector(0,0,Umax*(1-(pow(Cf[faceI].x()-p_ctr_x,2)+pow(Cf[faceI].y()-p_ctr_y,2))/(R*R))); } #}; } outlet { type zeroGradient; } wall { type noSlip; } } // ************************************************************************* //