欢迎光临散文网 会员登陆 & 注册

openFoam旋转机械propeller案例教程

2023-08-21 21:28 作者:左邻右舍都盼隔壁老王  | 我要投稿

1 简介

以of10版本下官方算例propeller作为介绍,从模型、网格、计算和后处理进行详细描述。关于ESI版本(如openfoam2206)可参考最后第6部分

位于tutorials/incompressible/pimpleFoam/RAS/propeller

2 模型

 

模型


propeller算例由4个模型组成,其作用分别为:

(1)propeller:几何模型

(2)propeller-innerCylinder:用于创建rotationZone

(3)propeller-middleCylinder:用于网格加密

(4)propeller-outerCylinder:螺旋桨的流体域

3 网格划分

propeller算例采用snappyHexMesh对网格进行划分,其步骤及结果如下:

(1)blockMesh生产背景网格

 

生成背景网格


(2)surfaceFeatures提取面和几何特征

surfaceFeatures指令需要提前在surfaceFeaturesDict文件中定义需要提取的几何文件,如下所示:

surfaces

(

    "propeller-innerCylinder.obj"

    "propeller-outerCylinder.obj"

    "propeller.obj"

);

includedAngle   150;

trimFeatures

{

    minElem         10;

}

surfaceFeaturesDict中定义了提取inner、outerCylinder和propeller三个文件的几何特征。运行surfaceFeatures指令后,会在算例文件canstant/extendedFeatureEdgeMesh下生成三个几何文件的extendedFeatureEdgeMesh文件。

(3)decomposePar -noFields分块计算

decomposePar指令会将模型根据decomposeParDict字典文件中的分块策略对模型进行分块,用于分块网格划分和计算,Dict文件如下:

numberOfSubdomains 8;  //将模型分成8块

method          hierarchical;  //分块方法

hierarchicalCoeffs

{

    n               (2 2 2); //xyz方向各2块

    order           xyz;

}

默认运行decomposePar指令是将网格和场同时进行分块,算例执行的指令是decomposePar -noFields,-noFields意思是仅仅对几何进行分块,其目的是用于后续snappyHexMesh。

(4)mpirun -np 8 snappyHexMesh -parallel

网格划分这里就不再赘述,这里需要注意一点:算例的进出口边界条件,即进口inlet patch和出口outlet patch定义在propeller-outerCylinder.obj几何文件中,通过定义在snappyHexMeshDict文件中字典,实现patch的命名:

outerCylinder

        {

            level       (0 0);

            regions

            {

                inlet

                {

                    level       (0 0);

                    patchInfo

                    {

                        type        patch;

                    }

                }

                outlet

                {

                    level       (0 0);

                    patchInfo

                    {

                        type        patch;

                    }

                }

            }

        }

(5)mpirun -np 8 createBaffles -overwrite -parallel

网格划分好之后就可以对网格和交界面以及边界面进行处理,由于该算例的几何文件中并没有创建螺旋状旋转交界面,因此需要使用createBaffles指令来生成动静交界面,createBaffles指令需要定义Dict文件,如下所示。

internalFacesOnly true;

baffles

{

    nonCouple

    {

        type        faceZone;  //创建baffles的方法为通过面域生成

        zoneName    innerCylinder;  //面域为inner几何体

 

        patches  //baffles对应的patch名字

        {

            owner

            {

                name        nonCouple1;

                type        patch;

            }

 

            neighbour

            {

                name        nonCouple2;

                type        patch;

            }

        }

    }

}

结果如下图所示:

动静交界面

 

(6)mpirun -np 8 splitBaffles -overwrite -parallel

事实上createBaffles只是创建了一个Baffles即动静交界面,还需要执行split命令使其网格独立出来,这里不需要Dict文件。

(7)mpirun -np 8 createNonConformalCouples -overwrite nonCouple1 nonCouple2 -parallel

创建动静交界面。

(8)decomposePar -fields -copyZero

-fields :仅利用现有几何拆分文件和转换场;

-copyZero:复制0文件到每个块内而不是分解场。

(9)网格划分结果

 

网格截面

注意:如不进行并行计算,snappyHexMesh后可以执行reconstructParMesh -constant。

4 模型初始化及边界条件定义

(1)边界条件设置

边界条件设置比较简单,重点介绍一下其中一个边界条件设置:

movingWallVelocity:该类型通常用于moving网格中的movingWal,根据网格的移动会自动修正通量值,这样保障了网格移动以后通过壁面的总通量为0。将movingWall设置成期望的速度,这里用$internalField,即0;

(2)动网格设置dynamicMeshDict

螺旋桨的转动在dynamicMeshDict字典中定义。

mover

{

    type            motionSolver;

    libs            ("libfvMeshMovers.so" "libfvMotionSolvers.so");

    motionSolver    solidBody;

    cellZone        innerCylinder;

    solidBodyMotionFunction  rotatingMotion;

    origin      (0 0 0);

    axis        (0 1 0);

    omega       158; // rad/s

(3)fvSchemes数值离散设置

fvSchemes文件用来设置离散格式,凡是求解器里面出现的方程,都需要在这里面设置离散格式。一般默认即可。

(4)fvSolution方程求解器、残差、算法控制

默认即可。

(5)controlDict全局控制

application     pimpleFoam;

startFrom       startTime;//还有firstTime和lastestTime

startTime       0;

stopAt          endTime;

endTime         0.005;

deltaT          1e-5;  //时间步长

writeControl    adjustableRunTime;  //输出设置

writeInterval   0.001;  //每0.001s输出1个文件

////- For testing with moveMesh

//deltaT          0.01;

//writeControl    timeStep;

//writeInterval   1;

purgeWrite      0;  //循环写入数据方式

writeFormat     binary;  //输出二进制文件

writePrecision  6;

writeCompression off;  //数据压缩

timeFormat      general; //文件时间步命名

timePrecision   6;

runTimeModifiable true;

adjustTimeStep  yes;  //是否开启可调节时间步长

maxCo           2;  //最大库郎数

functions      //需要添加的函数

{

    #includeFunc Q   //计算Q值

    #include "surfaces"

    #include "forces"

}

5 后处理

对于水泵、水轮机、风机的性能计算(以及在许多其他情况下),通常需要关于压降、流量和功率的数据。如果计算空化问题,还需要获得压力的最大值和最小值,同时最大值和最小值速度也可以说明收敛或数值问题。所有这些值最好在运行时计算,因此最好如下所示定义controlDict.functionObjects:

1)转矩

forces

{

    type          forces;

    libs          ("libforces.so");

    writeControl  timeStep;

    timeInterval  1;

    log           yes;

    patches       ("propeller.*");

    rho           rhoInf;     // Indicates incompressible

    log           true;

    rhoInf        998;          // Redundant for incompressible

    CofR          (0 0 0);    // Rotation around centre line of propeller

    pitchAxis     (0 1 0);

}

6 关于ESI版本的openfoam(如openfoam2206)

对于ESI版本的propeller算例,原理都是一样的,如openfoam2206官方算例的做法是,通过topoSet的方式生成cyclicAMI、inlet和outlet的faceset,然后用createPatchDict将这些faceset定义为patch。

实际上,在openfoam2206中也能采用上面of10的方法,先通过snappyHexMesh生成网格,利用propeller-innerCylinder.obj生成facezone,然后输入以下指令:

(1)createBaffles//生成cyclicAMI

(2)mergeOrSplitBaffles -split -overwrite//生成动静交界面

(3)renumberMesh -overwrite


openFoam旋转机械propeller案例教程的评论 (共 条)

分享到微博请遵守国家法律