首页/文章/ 详情

OpenFOAM|算例 04 airFoil2D

精品
作者优秀平台推荐
详细信息
文章亮点
作者优秀
优秀教师/意见领袖/博士学历/特邀专家
平台推荐
内容稀缺
3年前浏览4589

本文利用OpenFOAM中的simpleFoam求解器计算2D翼型。

1 基本操作

  • 进入终端,执行以下命令将文件拷贝到当前路径
cd $FOAM_RUN
cp -r $FOAM_TUTORIALS/incompressible/simpleFoam/airFoil2D/ .  
cd airFoil2D
  • 执行命令查看计算网格
paraFoam

本案例的计算网格是在外部网格生成工具中直接生成,如下图所示。

图片

翼型局部计算网格如下图所示。

图片

采用2D计算区域,包含边界:inlet、outlet、walls以及frontAndBack。可以通过查阅constant/polyMesh/boundary文件检查边界名称及边界类型。

通过以下命令运行case及后处理:

simpleFoam
paraFoam

1.1 文件组织结构

本案例的文件组织如下所示,在0/nuTilda及0/nut文件中指定边界湍流参数,需要在constant/transportProperties及constant/turbulenceProperties文件中指定物性参数及湍流模型。

├── 0
│   ├── U    
│   ├── nuTilda
│   ├── nut  
│   └── p        
├── constant
│   ├── polyMesh
│   │   ├── boundary
│   │   ├── cells
│   │   ├── faces
│   │   ├── neighbour
│   │   ├── owner
│   │   └── points
│   ├── transportProperties
│   └── turbulenceProperties
└── system
   ├── controlDict
   ├── fvSchemes
   └── fvSolution

1.2 物性参数

在constant/transportProperties文件中指定介质的物性参数。

FoamFile
{
   version     2.0;
   format      ascii;
   class       dictionary;
   location    "constant";
   object      transportProperties;
}
// * * * * * * * * * * * * * * ** * * * * * * * * * * //
transportModel  Newtonian;
rho             [1 -3 0 0 0 0 0] 1;
nu              [0 2 -1 0 0 0 0] 1e-05;

这里指定了密度为1 kg/m3,运动粘度为1e-5 m2/s。

1.3 湍流模型

在constant/turbulenceProperties文件中指定湍流模型。文件内容如下。

FoamFile
{
   version     2.0;
   format      ascii;
   class       dictionary;
   location    "constant";
   object      turbulenceProperties;
}
// * * * * * * * * * * * * * * * //
simulationType RAS;
RAS
{
   RASModel        SpalartAllmaras;
   turbulence      on;
   printCoeffs     on;
}

这里选择使用SpalartAllmaras湍流模型。

湍流模型的选择决定了在0文件夹中需要指定的湍流参数,SA模型需要额外指定nut及nuTilda。

这里的nuTilda()为SA模型的待求变量。SA模型输运方程形式为:

这里的nut为湍流粘度(Turbulent Viscosity),其计算方式为:

其中,,且有。

关于SA模型,可参阅源代码(路径$FOAM_SRC/TurbulenceModels\turbulenceModels/RAS/SpalartAllmaras中的SpalartAllmaras.H及SpalartAllmaras.c)。

1.4 边界条件p

修改p文件定义边界压力。

FoamFile
{
   version     2.0;
   format      ascii;
   class       volScalarField;
   object      p;
}
// * * * * * * * * * * * * * * * * * //
//注意压力的量纲为m2/s2,是Pa除以kg/m3后的量纲
//不可压缩求解器都需要这样处理
dimensions      [0 2 -2 0 0 0 0];
internalField   uniform 0;
boundaryField
{
   inlet
   {
       type            freestreamPressure;
       freestreamValue $internalField;
   }
   outlet
   {
       type            freestreamPressure;
       freestreamValue $internalField;
   }
   walls
   {
       type            zeroGradient;
   }
   frontAndBack
   {
       type            empty;
   }
}

这里指定了边界inlet与outlet的压力类型为freestreamPressure,并指定压力值为0。

freestreamPressure边界条件当流体流入边界时为zero gradient,当流体流出边界时为恒定压力值。

关于freestreamPressure边界类型更多的信息,可查阅$FOAM_RUN/finiteVolume/fields/fvPatchFields/derived/freestreamPressure文件夹下的文件。

1.5 边界条件U

修改U文件定义边界速度。

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            freestreamVelocity;
       freestreamValue $internalField;
   }
   outlet
   {
       type            freestreamVelocity;
       freestreamValue $internalField;
   }
   walls
   {
       type            noSlip;
   }
   frontAndBack
   {
       type            empty;
   }
}

这里指定了一个8°的攻角,来流速度为26 m/s。

freestreamVelocity边界类型也是一个in-outlet边界,当流体流入边界时采用指定的速度,当流体流出边界时为zero gradient。

1.6 nut文件

nut文件中指定边界的湍流粘度信息。

FoamFile
{
   version     2.0;
   format      ascii;
   class       volScalarField;
   object      nut;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions      [0 2 -1 0 0 0 0];
internalField   uniform 0.14;
boundaryField
{
   inlet
   {
       type            freestream;
       freestreamValue uniform 0.14;
   }
   outlet
   {
       type            freestream;
       freestreamValue uniform 0.14;
   }
   walls
   {
       type            nutUSpaldingWallFunction;
       value           uniform 0;
   }
   frontAndBack
   {
       type            empty;
   }
}

1.7 nuTilda文件

nuTilda文件中指定边界的信息。

FoamFile
{
   version     2.0;
   format      ascii;
   class       volScalarField;
   object      nuTilda;
}
// * * * * * * * * * * * * * * * * * * //
dimensions      [0 2 -1 0 0 0 0];
internalField   uniform 0.14;
boundaryField
{
   inlet
   {
       type            freestream;
       freestreamValue uniform 0.14;
   }
   outlet
   {
       type            freestream;
       freestreamValue uniform 0.14;
   }
   walls
   {
       type            fixedValue;
       value           uniform 0;
   }
   frontAndBack
   {
       type            empty;
   }
}

1.8 指定ControlDict信息

该文件指定计算控制参数。

FoamFile
{
   version     2.0;
   format      ascii;
   class       dictionary;
   location    "system";
   object      controlDict;
}
// * * * * * * * * * * * * //
application     simpleFoam;
startFrom       startTime;
startTime       0;
stopAt          endTime;
endTime         500;
deltaT          1;
writeControl    timeStep;
writeInterval   50;
purgeWrite      0;
writeFormat     ascii;
writePrecision  6;
writeCompression off;
timeFormat      general;
timePrecision   6;
runTimeModifiable true;

文件中指定采用求解器simpleFoam,迭代次数为500次。

1.9 fvSchemes文件

此文件指定求解算法。

FoamFile
{
   version     2.0;
   format      ascii;
   class       dictionary;
   location    "system";
   object      fvSchemes;
}
// * * * * * * * * * * * * * //
ddtSchemes
{
   default         steadyState;
}
gradSchemes
{
   default         Gauss linear;
}
divSchemes
{
   default         none;
   div(phi,U)      bounded Gauss linearUpwind grad(U);
   div(phi,nuTilda) bounded Gauss linearUpwind grad(nuTilda);
   div((nuEff*dev2(T(grad(U))))) Gauss linear;
}
laplacianSchemes
{
   default         Gauss linear corrected;
}
interpolationSchemes
{
   default         linear;
}
snGradSchemes
{
   default         corrected;
}
wallDist
{
   method meshWave;
}

1.10 fvSolution文件

此文件指定方程求解控制参数。

FoamFile
{
   version     2.0;
   format      ascii;
   class       dictionary;
   location    "system";
   object      fvSolution;
}
// * * * * * * * * * * * //
solvers
{
   p
   {
       solver          GAMG;
       tolerance       1e-06;
       relTol          0.1;
       smoother        GaussSeidel;
   }
   U
   {
       solver          smoothSolver;
       smoother        GaussSeidel;
       nSweeps         2;
       tolerance       1e-08;
       relTol          0.1;
   }
   nuTilda
   {
       solver          smoothSolver;
       smoother        GaussSeidel;
       nSweeps         2;
       tolerance       1e-08;
       relTol          0.1;
   }
}
SIMPLE
{
   nNonOrthogonalCorrectors 0;
   residualControl
   {
       p               1e-5;
       U               1e-5;
       nuTilda         1e-5;
   }
}
relaxationFactors
{
   fields
   {
       p               0.3;
   }
   equations
   {
       U               0.7;
       nuTilda         0.7;
   }
}

1.11 计算结果

  • 压力分布

图片

  • 速度分布

图片

---------------------------------------------------------------------------------------------

版权声明:

原创文章,来源CFD之道,本文已经授权,欢迎分享,如需转载请联系作者。

求解技术网格处理仿真体系科普航天航空OpenFOAM
著作权归作者所有,欢迎分享,未经许可,不得转载
首次发布时间:2020-12-23
最近编辑:3年前
CFD之道
博士 | 教师 探讨CFD职场生活,闲谈CFD里外
获赞 2443粉丝 10439文章 651课程 27
点赞
收藏

作者推荐

未登录
1条评论
1年前
这个翼型是NACA0012吗,openfoam官网上有一个是0012的,https://www.openfoam.com/documentation/guides/latest/doc/verification-validation-naca0012-airfoil-2d.html但是他的网格是C型的
回复 1条回复

课程
培训
服务
行家

VIP会员 学习 福利任务 兑换礼品
下载APP
联系我们
帮助与反馈