OpenFOAM2.3.x 圆柱体网格 blockMeshDict

一、使用更高版本的blockMeshDict

1. 设置bashrc

alias of7='source /opt/OpenFOAM-7/OpenFOAM-7/etc/bashrc '
alias of2='export FOAM_INST_DIR=/opt/OpenFOAM
foamDotFile=$FOAM_INST_DIR/OpenFOAM-2.3.x/etc/bashrc
[ -f $foamDotFile ] && . $foamDotFile
export LD_LIBRARY_PATH=$FOAM_INST_DIR/OpenFOAM-2.3.x/platforms/linux64GccDPOpt/lib:$LD_LIBRARY_PATH
source ${foamDotFile}
 '

2. 切换高版本生成网格

of7
blockMesh

3. 切换低版本检查网格

of2
checkMesh

在这里插入图片描述
在这里插入图片描述

4. blockMeshDict

参考链接:https://www.cnblogs.com/Xiwang-Sun/p/17463243.html

/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  5                                     |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    object      blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 1;

radius      0.5;//圆柱半径
radiusNeg  -0.5;
box         0.18;//box和boxNeg定义中间长方体block的范围
boxNeg     -0.18;
zMax        1;//zMax和zMin定义圆柱体的长度
zMin        0.0;

nR          10;//扇形block半径上的节点数
nBox        10;//矩形block正方形边上的节点数
nZ          12;//轴向方向上的节点数

verbose no;

geometry
{
    cylinder
    {
        type      searchableCylinder;
        point1    (0 0 -10);//由point1和point2构成的区域要大于zMax和zMin构成的区域
        point2    (0 0  10);
        radius    $radius;
    }
}

scale 1;


vertices
(
    // Inner
    ($boxNeg $boxNeg $zMin)//0
    ($box    $boxNeg $zMin)//1
    ($boxNeg $box    $zMin)//2
    ($box    $box    $zMin)//3

    // Outer block points
    project ($radiusNeg $radiusNeg $zMin) (cylinder)//4
    project ($radius    $radiusNeg $zMin) (cylinder)//5
    project ($radiusNeg $radius    $zMin) (cylinder)//6
    project ($radius    $radius    $zMin) (cylinder)//7

    // Inner
    ($boxNeg $boxNeg $zMax)//8
    ($box    $boxNeg $zMax)//9
    ($boxNeg $box    $zMax)//10
    ($box    $box    $zMax)//11

    // Outer block points
    project ($radiusNeg $radiusNeg $zMax) (cylinder)//12
    project ($radius    $radiusNeg $zMax) (cylinder)//13
    project ($radiusNeg $radius    $zMax) (cylinder)//14
    project ($radius    $radius    $zMax) (cylinder)//15
);

blocks
(
    hex ( 4  5  1  0 12 13  9  8) ($nBox $nR   $nZ) simpleGrading (1 1 1)
    hex ( 4  0  2  6 12  8 10 14) ($nR   $nBox $nZ) simpleGrading (1 1 1)
    hex ( 1  5  7  3  9 13 15 11) ($nR   $nBox $nZ) simpleGrading (1 1 1)
    hex ( 2  3  7  6 10 11 15 14) ($nBox $nR   $nZ) simpleGrading (1 1 1)
    hex ( 0  1  3  2  8  9 11 10) ($nBox $nBox $nZ) simpleGrading (1 1 1)
);

edges
(
    project  4  5 (cylinder)
    project  7  5 (cylinder)
    project  6  7 (cylinder)
    project  4  6 (cylinder)
    project 12 13 (cylinder)
    project 13 15 (cylinder)
    project 12 14 (cylinder)
    project 14 15 (cylinder)
);

//boundary
patches
(
    patch inlet
    (
     (0 1 3 2)
     (0 2 6 4)
     (0 1 5 4)
     (1 5 7 3)
     (2 3 7 6)
    )

    patch outlet
    (
     (8   9  11  10)
     (8  10  14  12)
     (8   9  13  12)
     (9  13  15  11)
     (10 11  15  14)
    )

    wall wall
    (
     (4  12  14  6)
     (4   5  13 12)
     (5  13  15  7)
     (6   7  15 14)
    )
);

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

二、标准算例的cylinder

路径

$FOAM_TUTORIALS/basic/potentialFoam/cylinder/constant/polyMesh/blockMeshDict:

/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2.3.0                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    object      blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

convertToMeters 1;

vertices #codeStream
{
    codeInclude
    #{
        #include "pointField.H"
    #};

    code
    #{
        pointField points(19);
        points[0]  = point(0.5, 0, -0.5);
        points[1]  = point(1, 0, -0.5);
        points[2]  = point(2, 0, -0.5);
        points[3]  = point(2, 0.707107, -0.5);
        points[4]  = point(0.707107, 0.707107, -0.5);
        points[5]  = point(0.353553, 0.353553, -0.5);
        points[6]  = point(2, 2, -0.5);
        points[7]  = point(0.707107, 2, -0.5);
        points[8]  = point(0, 2, -0.5);
        points[9]  = point(0, 1, -0.5);
        points[10] = point(0, 0.5, -0.5);
        points[11] = point(-0.5, 0, -0.5);
        points[12] = point(-1, 0, -0.5);
        points[13] = point(-2, 0, -0.5);
        points[14] = point(-2, 0.707107, -0.5);
        points[15] = point(-0.707107, 0.707107, -0.5);
        points[16] = point(-0.353553, 0.353553, -0.5);
        points[17] = point(-2, 2, -0.5);
        points[18] = point(-0.707107, 2, -0.5);

        // Duplicate z points
        label sz = points.size();
        points.setSize(2*sz);
        for (label i = 0; i < sz; i++)
        {
            const point& pt = points[i];
            points[i+sz] = point(pt.x(), pt.y(), -pt.z());
        }

        os  << points;
    #};
};


blocks
(
    hex (5 4 9 10 24 23 28 29) (10 10 1) simpleGrading (1 1 1)
    hex (0 1 4 5 19 20 23 24) (10 10 1) simpleGrading (1 1 1)
    hex (1 2 3 4 20 21 22 23) (20 10 1) simpleGrading (1 1 1)
    hex (4 3 6 7 23 22 25 26) (20 20 1) simpleGrading (1 1 1)
    hex (9 4 7 8 28 23 26 27) (10 20 1) simpleGrading (1 1 1)
    hex (15 16 10 9 34 35 29 28) (10 10 1) simpleGrading (1 1 1)
    hex (12 11 16 15 31 30 35 34) (10 10 1) simpleGrading (1 1 1)
    hex (13 12 15 14 32 31 34 33) (20 10 1) simpleGrading (1 1 1)
    hex (14 15 18 17 33 34 37 36) (20 20 1) simpleGrading (1 1 1)
    hex (15 9 8 18 34 28 27 37) (10 20 1) simpleGrading (1 1 1)
);

edges
(
    arc 0 5 (0.469846 0.17101 -0.5)
    arc 5 10 (0.17101 0.469846 -0.5)
    arc 1 4 (0.939693 0.34202 -0.5)
    arc 4 9 (0.34202 0.939693 -0.5)
    arc 19 24 (0.469846 0.17101 0.5)
    arc 24 29 (0.17101 0.469846 0.5)
    arc 20 23 (0.939693 0.34202 0.5)
    arc 23 28 (0.34202 0.939693 0.5)
    arc 11 16 (-0.469846 0.17101 -0.5)
    arc 16 10 (-0.17101 0.469846 -0.5)
    arc 12 15 (-0.939693 0.34202 -0.5)
    arc 15 9 (-0.34202 0.939693 -0.5)
    arc 30 35 (-0.469846 0.17101 0.5)
    arc 35 29 (-0.17101 0.469846 0.5)
    arc 31 34 (-0.939693 0.34202 0.5)
    arc 34 28 (-0.34202 0.939693 0.5)
);

boundary
(
    down
    {
        type symmetryPlane;
        faces
        (
            (0 1 20 19)
            (1 2 21 20)
            (12 11 30 31)
            (13 12 31 32)
        );
    }
    right
    {
        type patch;
        faces
        (
            (2 3 22 21)
            (3 6 25 22)
        );
    }
    up
    {
        type symmetryPlane;
        faces
        (
            (7 8 27 26)
            (6 7 26 25)
            (8 18 37 27)
            (18 17 36 37)
        );
    }
    left
    {
        type patch;
        faces
        (
            (14 13 32 33)
            (17 14 33 36)
        );
    }
    cylinder
    {
        type symmetry;
        faces
        (
            (10 5 24 29)
            (5 0 19 24)
            (16 10 29 35)
            (11 16 35 30)
        );
    }
);

mergePatchPairs
(
);

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值