网格分级问题 BlockMeshDict OpenFOAM

Problem in mesh grading BlockMeshDict OpenFOAM

提问人:Ali Marzooq 提问时间:4/12/2023 更新时间:4/12/2023 访问量:82

问:

我为圆柱体周围的流动创建了一个网格,现在我想细化圆柱壁附近的网格。我试图通过网格分级来做到这一点,但是当我运行blockMesh时,我收到以下错误:

Create time

Creating block mesh from "system/blockMeshDict"
Using #codeStream at line 43 in file "/home/amarzooq/OpenFOAM/amarzooq-v2106/run/run/twoD_simple_1/system/blockMeshDict"
Using #codeStream with "/home/amarzooq/OpenFOAM/amarzooq-v2106/run/run/twoD_simple_1/dynamicCode/platforms/linux64GccDPInt32Opt/lib/libcodeStream_3e44164af783959a8222fab0498961b521b338db.so"
Creating block edges
No non-planar block faces defined
Creating topology blocks
Creating topology patches

Creating block mesh topology

Check topology

        Basic statistics
                Number of internal faces : 28
                Number of boundary faces : 64
                Number of defined boundary faces : 64
                Number of undefined boundary faces : 0
        Checking patch -> block consistency

Creating block offsets
Creating merge list (topological search)..

--> FOAM FATAL ERROR: (openfoam-2106 patch=211215)
Point merge failure between face 2 of block 10 and face 2 of block 11
    Points: (0.69487913 -0.69487913 -0.5) (0.68265147 -0.68265147 -0.5)
    This may be due to inconsistent grading.

    From void Foam::blockMesh::calcTopologicalMerge()
    in file blockMesh/blockMeshMergeTopological.C at line 453.

FOAM exiting

这是我的代码:

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

scale   1;

// Geometric parameters
rInner  0.5;
rOuter  1;
//xmax    7.5;
xmax_n  10*$rInner; //left wall location as a function of radius
xmax_p  50*$rInner;//right wall location as a function of radius 
ymax    16*$rInner;
zmin   -0.5;  // Back/front locations
zmax    0.5;

// Divisions: Radial, quarter circumference, outer region and z-directions.
nRadial  20; //cylinder cells
nQuarter 10;//the region above, right and left to the cylinder (wake and drag region)
nxOuter  40;//x direction cells (cylinder not included)
nxOuterRight 200;//x direction cells (cylinder not included) in the right of the cylinder 
nyOuter  50;//y direction cells (cylinder not included)
nz       1;

// ----------------

// Derived quantities
rInner45    ${{ $rInner * sqrt(0.5) }};
rOuter45    ${{ $rOuter * sqrt(0.5) }};

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

    code
    #{
        pointField points
        ({
         /*0*/ { $rInner, 0, $zmin },
            /* 1*/ { $rOuter, 0, $zmin },
            /* 2*/ { $xmax_p, 0, $zmin },//right wall x positive 
            /* 3*/ { $xmax_p, $rOuter45, $zmin }, //right wall xpositive
            /* 4*/ { $rOuter45, $rOuter45, $zmin },
            /* 5*/ { $rInner45, $rInner45, $zmin },
            /* 6*/ { $xmax_p, $ymax, $zmin },//right wall x positive 
            /* 7*/ { $rOuter45, $ymax, $zmin },
            /* 8*/ { 0, $ymax, $zmin },
            /* 9*/ { 0, $rOuter, $zmin },
            /*10*/ { 0, $rInner, $zmin },
            /*11*/ { -$rInner, 0, $zmin },
            /*12*/ { -$rOuter, 0, $zmin },
            /*13*/ { -$xmax_n, 0, $zmin },
            /*14*/ { -$xmax_n, $rOuter45, $zmin },
            /*15*/ { -$rOuter45, $rOuter45, $zmin },
            /*16*/ { -$rInner45, $rInner45, $zmin }, //left wall xnegative
            /*17*/ { -$xmax_n, $ymax, $zmin },//left wall xnegative
            /*18*/ { -$rOuter45, $ymax, $zmin },//left wall xnegative


      //*19*/ {-$rInner, 0, -$zmin }, // 19 will be exactly as point 0 // deleted
      //  /* 20*/ { -$rOuter, 0, -$zmin },//20 will be exactly as point 1  //deleted
          //  /* 21*/ { -$xmax_p, 0, -$zmin },//right wall x positive // 21 will be exactly as point 2 /deleted

        /*19*/ { $xmax_p, -$rOuter45, $zmin }, //right wall xpositive
            /* 20*/ { $rOuter45, -$rOuter45, $zmin },
            /* 21*/ { $rInner45, -$rInner45, $zmin },
            /* 22*/ { $xmax_p, -$ymax, $zmin },//right wall x positive 
            /* 23*/ { $rOuter45, -$ymax, $zmin },
            /* 24*/ { 0, -$ymax, $zmin },
            /* 25*/ { 0, -$rOuter, $zmin },
            /*26*/ { 0, -$rInner, $zmin }, 

        // /*30*/ { $rInner, 0, -$zmin },// 30 will be exactly as point 11 // deleted
        //  /*31*/ { $rOuter, 0, -$zmin },//31 will be exactly as point 12 //deleted
        //   /*32*/ { $xmax_n, 0, -$zmin },//32 will be exactly as point 13 // deleted

        /*27*/ { -$xmax_n, -$rOuter45, $zmin },
            /*28*/ { -$rOuter45, -$rOuter45, $zmin },
            /*29*/ { -$rInner45, -$rInner45, $zmin }, //left wall xnegative
            /*30*/ { -$xmax_n, -$ymax, $zmin },//left wall xnegative
            /*31*/ { -$rOuter45, -$ymax, $zmin }//left wall xnegative


    });

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

        os  << points;
    #};
};

// Can remove unneeded variables
#remove ( "r(Inner|Outer).*"  "[xy](min|max)" )

blocks

(

 // +Y blocks 
 /*0*/ hex (5 4 9 10 37 36 41 42)    ($nRadial  $nQuarter $nz) grading (2 1 1)       //cylinder
 /*1*/ hex (0 1 4 5 32 33 36 37)     ($nRadial  $nQuarter $nz) grading (2 1 1)       //cylinder
 /*2*/ hex (1 2 3 4 33 34 35 36)     ($nxOuterRight  $nQuarter $nz) grading (4 1 1)  //+ right
 /*3*/ hex (4 3 6 7 36 35 38 39)     ($nxOuterRight  $nyOuter  $nz) grading (4 1 1)  //corner right
 /*4*/ hex (9 4 7 8 41 36 39 40)     ($nQuarter $nyOuter  $nz) grading (1 1 1)       //+ top right
 /*5*/ hex (15 16 10 9 47 48 42 41)  ($nRadial  $nQuarter $nz) grading (.5 1 1)       //cylinder
 /*6*/ hex (12 11 16 15 44 43 48 47) ($nRadial  $nQuarter $nz) grading (.5 1 1)       //cylinder
 /*7*/ hex (13 12 15 14 45 44 47 46) ($nxOuter  $nQuarter $nz) grading (1 1 1)       //+ left left
 /*8*/ hex (14 15 18 17 46 47 50 49) ($nxOuter  $nyOuter  $nz) grading (1 1 1)       //+corner left
 /*9*/ hex (15 9 8 18 47 41 40 50)   ($nQuarter $nyOuter  $nz) grading (1 1 1)       //+ top left

   //-Y blocks
 /*10*/ hex (20 21 26 25 52 53 58 57) ($nRadial  $nQuarter $nz) grading (2 1 1)      //cylinder
 /*11*/ hex (21 20 1 0 53 52 33 32)   ($nRadial  $nQuarter $nz) grading (2 1 1)      //cylinder 
 /*12*/ hex (20 19 2 1 52 51 34 33)   ($nxOuterRight $nQuarter $nz) grading (4 1 1)   //+ right right
 /*13*/ hex (23 22 19 20 55 54 51 52) ($nxOuterRight  $nyOuter  $nz) grading (4 1 1) //corner right
 /*14*/ hex (24 23 20 25 56 55 52 57) ($nQuarter $nyOuter  $nz) grading (1 1 1)      //+ bottom right
 /*15*/ hex (25 26 29 28 57 58 61 60) ($nRadial  $nQuarter $nz) grading (0.5 1 1)      //cylinder 
 /*16*/ hex (28 29 11 12 60 61 43 44) ($nRadial  $nQuarter $nz) grading (0.5 1 1)      //cylinder
 /*17*/ hex (27 28 12 13 59 60 44 45) ($nxOuter  $nQuarter $nz) grading (1 1 1)      //+left left
 /*18*/ hex (30 31 28 27 62 63 60 59) ($nxOuter  $nyOuter  $nz) grading (1 1 1)      //corner left
 /*19*/ hex (31 24 25 28 63 56 57 60)   ($nQuarter $nyOuter  $nz) grading (1 1 1)    //+bottom left
   
);

edges
(
 //  Inner cylinder
    arc  0  5 origin (0 0 $zmin)
    arc  5 10 origin (0 0 $zmin)
    arc  1  4 origin (0 0 $zmin)
    arc  4  9 origin (0 0 $zmin)

    arc  0  21 origin (0 0 $zmin)
    arc  21 26 origin (0 0 $zmin)
    arc  1 20 origin (0 0 $zmin)
    arc  20 25 origin (0 0 $zmin)

    arc  32 53 origin (0 0 $zmax)
    arc  53 58 origin (0 0 $zmax)
    arc  33 52 origin (0 0 $zmax)
    arc  52 57 origin (0 0 $zmax)

    arc 32 37 origin (0 0 $zmax)
    arc 37 42 origin (0 0 $zmax)
    arc 33 36 origin (0 0 $zmax)
    arc 36 41 origin (0 0 $zmax)
    
    // Intermediate cylinder
    arc 11 16 origin (0 0 $zmin)
    arc 16 10 origin (0 0 $zmin)
    arc 12 15 origin (0 0 $zmin)
    arc 15  9 origin (0 0 $zmin)

    arc 43 48 origin (0 0 $zmax)
    arc 48 42 origin (0 0 $zmax)
    arc 44 47 origin (0 0 $zmax)
    arc 47 41 origin (0 0 $zmax)

    arc 11 29 origin (0 0 $zmin)
    arc 29 26 origin (0 0 $zmin)
    arc 12 28 origin (0 0 $zmin)
    arc 28 25 origin (0 0 $zmin)

    arc 43 61 origin (0 0 $zmax)
    arc 61 58 origin (0 0 $zmax)
    arc 44 60 origin (0 0 $zmax)
    arc 60 57 origin (0 0 $zmax)

);

boundary
(
    lowerWall
    {
        type symmetryPlane;
        faces
        (
            (30 31 63 62) 
            (31 24 56 63) 
            (24 23 55 56) 
            (23 22 54 55) 
        );
    }
    outlet
    {
        type patch;
        faces
        (
         (38 6 3 35)
     (35 3 2 34)
     
     (51 19 22 54)
    (51 34 2 19) //This is the line that is producing the error
        );
    }
    upperWall
    {
        type symmetryPlane;
        faces
        (
     (17 18 50 49)
     (18 8 40 50)
     (8 7 39 40)
     (7 6 38 39)
        );
    }
    
    inlet
    {
        type patch;
        faces
        (
     (17 14 46 49)
     (14 13 45 46)
     (13 27 59 45)
     (27 30 62 59)
        );
    }

    cylinder
    {
        type wall;
        faces
        ( 
          (10 5 37 42)
          (5 0 32 37)
          (16 10 42 48)
          (11 16 48 43)

      (0 21 53 32)
      (21 26 58 53)
      (26 29 61 58)
      (29 11 43 61)      
     );
    }
    front
    {type empty;
      faces
    (
     //up
     (4 3 6 7)
     (4 7 8 9)
     (15 18 17 14)
     (12 15 14 13)
     (1 2 3 4)
     (0 1 4 5)
     (5 4 9 10)
     (10 9 15 16)
     (16 15 12 11)
     (9 8 18 15)

     //down
     (19 2 1 20)
     (22 19 20 23)
     (23 20 25 24)
     (24 25 28 31)
     (28 12 13 27)
     (28 29 11 12)
     (28 25 26 29)
     (25 20 21 26)
         (20 1 0 21)
     (30 31 28 27)
     );
    }

    back
    {type empty;
      faces
    (
     //up
     (33 34 35 36)
     (36 35 38 39)
     (36 39 40 41)
     (41 40 50 47)
     (47 50 49 46)
     (47 46 45 44)
     (44 43 48 47)
     (48 42 41 47)
     (42 37 36 41)
     (37 32 33 36)
     
     //down

     (55 54 51 52)
     (52 51 34 33)
     (56 55 52 57)
     (63 56 57 60)
     (63 60 59 62)
     (44 60 61 43)
     (59 60 44 45)
     (60 57 58 61)
     (58 57 52 53)
     (53 52 33 32)

     );
    }
);

mergePatchPairs
(
);


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

问题出在这两行代码中,我不明白为什么它是错误的,因为块 #0 和 #1 完全相同,但在 x 轴上是对称的,它们没有显示此错误。

 /*10*/ hex (20 21 26 25 52 53 58 57) ($nRadial  $nQuarter $nz) grading (2 1 1)      //cylinder
 /*11*/ hex (21 20 1 0 53 52 33 32)   ($nRadial  $nQuarter $nz) grading (2 1 1)      //cylinder 

我花了很多时间思考它,但我不明白哪里出了问题。我将不胜感激任何帮助!

状 Openfoam 流体动力学

评论


答: 暂无答案