CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Pre-Processing

Directions exchange in number of cells input area

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 23, 2020, 12:46
Default Directions exchange in number of cells input area
  #1
Member
 
Chris Harding
Join Date: Dec 2016
Posts: 76
Rep Power: 10
HappyS5 is on a distinguished road
To me, this is odd and likely a bug.

I used pointField.H to build my full cylinder points. I got the following error:

'FOAM FATAL ERROR : Inconsistent number of faces between block pair 0 and 10'

Seemed my meshing wasn't matching up. With that said, I was confident I was correctly specifying the right number of cells for (x y z).

I found that the top half of my geometry hex blocks were normal:

hex (0 1 2 3 4 5 6 7) (x y z) simpleGrading (1 1 1).

I found that my bottom half of geometry was abnormal:

hex (0 1 2 3 4 5 6 7) (y x z) simpleGrading (1 1 1).

Notice, the number of cells exchanged.

Here is a video that walks through the error: https://youtu.be/bCU2XqcAmgs

To Reproduce:

Download case files and run:

>foamCleanTutorials
>foamCleanPolyMesh
>blockMesh

Code:
/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  7
     \\/     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(-35, 0, 0);
        points[1]  = point(9, 0, 0);
        points[2]  = point(10, 0, 0);
        points[3]  = point(12, 0, 0);
        points[4]  = point(13, 0, 0);
        points[5]  = point(115, 0, 0);
        points[6]  = point(-35, 1.4142136, 0);
        points[7]  = point(9.5857864, 1.4142136, 0);
        points[8]  = point(11, 2, 0);
        points[9]  = point(12.4142136, 1.4142136, 0);
        points[10] = point(115, 1.4142136, 0);
        points[11] = point(-35, 50, 0);
        points[12] = point(9.5857864, 50, 0);
        points[13] = point(11, 50, 0);
        points[14] = point(12.4142136, 50, 0);
        points[15] = point(115, 50, 0);
        points[16] = point(10.292893, 0.707107, 0);
        points[17] = point(11, 1, 0);
        points[18] = point(11.707107, 0.707107, 0);

        // 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()+2);
        }
        
        //Mirror above geometry in the -y direction
        
        label my = points.size(); 
        points.setSize(2*my);
        for (label i = 6; i < my; i++)
        {
            
            if (i < 19)
            {
                const point& pt = points[i];
                points[i+(my-6)] = point(pt.x(), -pt.y(), pt.z());
            
            }
            
            
            if (i > 24 && i < 38)
            {
            
                const point& pt = points[i];
                points[i+26] = point(pt.x(), -pt.y(), pt.z());
            
            }
        }
        
        
        
        
        //Print points
        for ( label k = 0; k < 2*my-12; k++)
        {
            Info << "This is point:" << k << points[k] << endl;             
            
        }
            

        os  << points;
    #};
};


blocks
(
    //Normal cell numbering of (x y z): 
    hex (0 1 7 6 19 20 26 25) (10 25 1) simpleGrading (1 1 1)//1
    hex (1 2 16 7 20 21 35 26) (10 25 1) simpleGrading (1 1 1)//2
    hex (7 16 17 8 26 35 36 27) (10 25 1) simpleGrading (1 1 1)//3
    hex (8 17 18 9 27 36 37 28) (10 25 1) simpleGrading (1 1 1)//4
    hex (3 4 9 18 22 23 28 37) (10 25 1) simpleGrading (1 1 1)//5
    hex (4 5 10 9 23 24 29 28) (10 25 1) simpleGrading (1 1 1)//6
    hex (6 7 12 11 25 26 31 30) (10 10 1) simpleGrading (1 1 1)//7
    hex (7 8 13 12 26 27 32 31) (25 10 1) simpleGrading (1 1 1)//8
    hex (8 9 14 13 27 28 33 32) (25 10 1) simpleGrading (1 1 1)//9
    hex (9 10 15 14 28 29 34 33) (10 10 1) simpleGrading (1 1 1)//10
    
    //Abnormal cell numbering of (y x z) :
    hex (0 38 39 1 19 51 52 20) (25 10 1) simpleGrading (1 1 1)//11
    hex (1 39 48 2 20 52 61 21) (25 10 1) simpleGrading (1 1 1)//12
    hex (39 40 49 48 52 53 62 61) (25 10 1) simpleGrading (1 1 1)//13
    hex (40 41 50 49 53 54 63 62) (25 10 1) simpleGrading (1 1 1)//14
    hex (3 50 41 4 22 63 54 23) (25 10 1) simpleGrading (1 1 1)//15
    hex (4 41 42 5 23 54 55 24) (25 10 1) simpleGrading (1 1 1)//16
    hex (38 43 44 39 51 56 57 52) (10 10 1) simpleGrading (1 1 1)//17
    hex (39 44 45 40 52 57 58 53) (10 25 1) simpleGrading (1 1 1)//18
    hex (40 45 46 41 53 58 59 54) (10 25 1) simpleGrading (1 1 1)//19
    hex (41 46 47 42 54 59 60 55) (10 10 1) simpleGrading (1 1 1)//20
);    

edges
(
    arc 1 7 (9.1522409 0.76536686 0)//1
    arc 7 8 (10.234633 1.8477591 0)//2
    arc 8 9 (11.765367 1.8477591 0)//3
    arc 9 4 (12.847759 0.76536686 0)//4
    arc 2 16 (10.076120 0.38268343 0)//5
    arc 16 17 (10.617317 0.92387953 0)//6
    arc 17 18 (11.382683 0.92387953 0)//7
    arc 18 3 (11.923880 0.38268343 0)//8
    
    arc 20 26 (9.1522409 0.76536686 2)//9
    arc 26 27 (10.234633 1.8477591 2)//10
    arc 27 28 (11.765367 1.8477591 2)//11
    arc 28 23 (12.847759 0.76536686 2)//12
    arc 21 35 (10.076120 0.38268343 2)//13
    arc 35 36 (10.617317 0.92387953 2)//14
    arc 36 37 (11.382683 0.92387953 2)//15
    arc 37 22 (11.923880 0.38268343 2)//16 
    
    //bottom geometry
    arc 1 39 (9.1522409 -0.76536686 0)//17
    arc 39 40 (10.234633 -1.8477591 0)//18
    arc 40 41 (11.765367 -1.8477591 0)//19
    arc 41 4 (12.847759 -0.76536686 0)//20
    arc 2 48 (10.076120 -0.38268343 0)//21
    arc 48 49 (10.617317 -0.92387953 0)//22
    arc 49 50 (11.382683 -0.92387953 0)//23
    arc 50 3 (11.923880 -0.38268343 0)//24
    
    arc 20 52 (9.1522409 -0.76536686 2)//25
    arc 52 53 (10.234633 -1.8477591 2)//26
    arc 53 54 (11.765367 -1.8477591 2)//27
    arc 54 23 (12.847759 -0.76536686 2)//28
    arc 21 61 (10.076120 -0.38268343 2)//29
    arc 61 62 (10.617317 -0.92387953 2)//30
    arc 62 63 (11.382683 -0.92387953 2)//31
    arc 63 22 (11.923880 -0.38268343 2)//32 
    
);

boundary
(
    bottomWall
    {
        type symmetry;
        faces
        (
           (43 44 57 56)
           (44 45 58 57)
           (45 46 59 58)
           (46 47 60 59)
        );
    }
    outlet
    {
        type patch;
        faces
        (
            (10 15 34 29)
            (5 10 29 24)
            (5 24 55 42)
            (42 55 60 47)
            
        );
    }
    topWall
    {
        type symmetry;
        faces
        (
            (11 30 31 12)
            (12 31 32 13)
            (13 32 33 14)
            (14 33 34 15)
        );
    }
    inlet
    {
        type patch;
        faces
        (
            (6 25 30 11)
            (0 19 25 6)
            (0 38 51 19)
            (38 43 56 51)
        );
    }
    cylinder
    {
        type wall;
        faces
        (
            (2 16 35 21)
            (16 17 36 35)
            (17 18 37 36)
            (3 22 37 18)
            (2 21 61 48)
            (48 61 62 49)
            (49 62 63 50)
            (3 50 63 22)
        );
    }
    frontandBack
    {
        type empty;
        faces
        (
            //back
            (0 6 7 1)
            (1 7 16 2)
            (7 8 17 16)
            (8 9 18 17)
            (3 18 9 4)
            (4 9 10 5)
            (6 11 12 7)
            (7 12 13 8)
            (8 13 14 9)
            (9 14 15 10)
            //(1 2 48 39)
            
            //front
            (19 20 26 25)
            (20 21 35 26)
            (26 35 36 27)
            (27 36 37 28)
            (22 23 28 37)
            (23 24 29 28)
            (25 26 31 30)
            (26 27 32 31)
            (27 28 33 32)
            (28 29 34 33)
                
        
        );
        
        
    }
    
);

mergePatchPairs
(
);

// ************************************************************************* //
Attached Images
File Type: jpg fullCylinderPointMap.jpg (79.8 KB, 3 views)
Attached Files
File Type: gz ErrorFullCylinder.tar.gz (3.9 KB, 0 views)

Last edited by HappyS5; October 25, 2020 at 17:44. Reason: Add point Map
HappyS5 is offline   Reply With Quote

Old   October 24, 2020, 16:15
Default Hrvoje Jasak Answer
  #2
Member
 
Chris Harding
Join Date: Dec 2016
Posts: 76
Rep Power: 10
HappyS5 is on a distinguished road
"Not a bug. Definition of a block defines its internal coordinate system. You ordered the block the wrong way round. I know: I personally wrote this code in 1994 and use it regularly."- https://www.linkedin.com/feed/update...02959824898%29

Basically, I have sloppy code. I will work on that. If I figure out where I got confused, I will return and explain what I did to resolve the issue.

Last edited by HappyS5; October 24, 2020 at 19:03. Reason: To reassure
HappyS5 is offline   Reply With Quote

Old   October 26, 2020, 15:35
Default Appropriately ordered blocks
  #3
Member
 
Chris Harding
Join Date: Dec 2016
Posts: 76
Rep Power: 10
HappyS5 is on a distinguished road
In truth, I missed the "local coordinate" information when I read: https://cfd.direct/openfoam/user-guide/v8-blockMesh/

I had numbered the hex block wrong. Vertex 0 --> vertex 1 specifies x1.

Here is the new blockMeshDict:

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

convertToMeters 0.01;

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

    code
    #{
        pointField points(19);
        points[0]  = point(-35, 0, 0);
        points[1]  = point(9, 0, 0);
        points[2]  = point(10, 0, 0);
        points[3]  = point(12, 0, 0);
        points[4]  = point(13, 0, 0);
        points[5]  = point(115, 0, 0);
        points[6]  = point(-35, 1.4142136, 0);
        points[7]  = point(9.5857864, 1.4142136, 0);
        points[8]  = point(11, 2, 0);
        points[9]  = point(12.4142136, 1.4142136, 0);
        points[10] = point(115, 1.4142136, 0);
        points[11] = point(-35, 50, 0);
        points[12] = point(9.5857864, 50, 0);
        points[13] = point(11, 50, 0);
        points[14] = point(12.4142136, 50, 0);
        points[15] = point(115, 50, 0);
        points[16] = point(10.292893, 0.707107, 0);
        points[17] = point(11, 1, 0);
        points[18] = point(11.707107, 0.707107, 0);

        // 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()+2);
        }
        
        //Mirror above geometry in the -y direction
        
        label my = points.size(); 
        points.setSize(2*my);
        for (label i = 6; i < my; i++)
        {
            
            if (i < 19)
            {
                const point& pt = points[i];
                points[i+(my-6)] = point(pt.x(), -pt.y(), pt.z());
            
            }
            
            
            if (i > 24 && i < 38)
            {
            
                const point& pt = points[i];
                points[i+26] = point(pt.x(), -pt.y(), pt.z());
            
            }
        }
        
        
        
        
        //Print points
        for ( label k = 0; k < 2*my-12; k++)
        {
            Info << "This is point:" << k << points[k] << endl;             
            
        }
            

        os  << points;
    #};
};


blocks
(
    //Normal cell numbering of (x1 x2 x3): 
    hex (0 1 7 6 19 20 26 25) (10 25 1) simpleGrading (1 1 1)//1
    hex (1 2 16 7 20 21 35 26) (10 25 1) simpleGrading (1 1 1)//2
    hex (7 16 17 8 26 35 36 27) (10 25 1) simpleGrading (1 1 1)//3
    hex (8 17 18 9 27 36 37 28) (10 25 1) simpleGrading (1 1 1)//4
    hex (3 4 9 18 22 23 28 37) (10 25 1) simpleGrading (1 1 1)//5
    hex (4 5 10 9 23 24 29 28) (10 25 1) simpleGrading (1 1 1)//6
    hex (6 7 12 11 25 26 31 30) (10 10 1) simpleGrading (1 1 1)//7
    hex (7 8 13 12 26 27 32 31) (25 10 1) simpleGrading (1 1 1)//8
    hex (8 9 14 13 27 28 33 32) (25 10 1) simpleGrading (1 1 1)//9
    hex (9 10 15 14 28 29 34 33) (10 10 1) simpleGrading (1 1 1)//10
    
    //Fixed and matching cell numbering of (x1 x2 x3) :
    hex (38 39 1 0 51 52 20 19) (10 25 1) simpleGrading (1 1 1)//11
    hex (39 48 2 1 52 61 21 20) (10 25 1) simpleGrading (1 1 1)//12
    hex (40 49 48 39 53 62 61 52) (10 25 1) simpleGrading (1 1 1)//13
    hex (41 50 49 40  54 63 62 53) (10 25 1) simpleGrading (1 1 1)//14
    hex (50 41 4 3 63 54 23 22) (10 25 1) simpleGrading (1 1 1)//15
    hex (41 42 5 4 54 55 24 23) (10 25 1) simpleGrading (1 1 1)//16
    hex (43 44 39 38 56 57 52 51) (10 10 1) simpleGrading (1 1 1)//17
    hex (44 45 40 39 57 58 53 52) (25 10 1) simpleGrading (1 1 1)//18
    hex (45 46 41 40 58 59 54 53) (25 10 1) simpleGrading (1 1 1)//19
    hex (46 47 42 41 59 60 55 54) (10 10 1) simpleGrading (1 1 1)//20
);    

edges
(
    arc 1 7 (9.1522409 0.76536686 0)//1
    arc 7 8 (10.234633 1.8477591 0)//2
    arc 8 9 (11.765367 1.8477591 0)//3
    arc 9 4 (12.847759 0.76536686 0)//4
    arc 2 16 (10.076120 0.38268343 0)//5
    arc 16 17 (10.617317 0.92387953 0)//6
    arc 17 18 (11.382683 0.92387953 0)//7
    arc 18 3 (11.923880 0.38268343 0)//8
    
    arc 20 26 (9.1522409 0.76536686 2)//9
    arc 26 27 (10.234633 1.8477591 2)//10
    arc 27 28 (11.765367 1.8477591 2)//11
    arc 28 23 (12.847759 0.76536686 2)//12
    arc 21 35 (10.076120 0.38268343 2)//13
    arc 35 36 (10.617317 0.92387953 2)//14
    arc 36 37 (11.382683 0.92387953 2)//15
    arc 37 22 (11.923880 0.38268343 2)//16 
    
    //bottom geometry
    arc 1 39 (9.1522409 -0.76536686 0)//17
    arc 39 40 (10.234633 -1.8477591 0)//18
    arc 40 41 (11.765367 -1.8477591 0)//19
    arc 41 4 (12.847759 -0.76536686 0)//20
    arc 2 48 (10.076120 -0.38268343 0)//21
    arc 48 49 (10.617317 -0.92387953 0)//22
    arc 49 50 (11.382683 -0.92387953 0)//23
    arc 50 3 (11.923880 -0.38268343 0)//24
    
    arc 20 52 (9.1522409 -0.76536686 2)//25
    arc 52 53 (10.234633 -1.8477591 2)//26
    arc 53 54 (11.765367 -1.8477591 2)//27
    arc 54 23 (12.847759 -0.76536686 2)//28
    arc 21 61 (10.076120 -0.38268343 2)//29
    arc 61 62 (10.617317 -0.92387953 2)//30
    arc 62 63 (11.382683 -0.92387953 2)//31
    arc 63 22 (11.923880 -0.38268343 2)//32 
    
);

boundary
(
    bottomWall
    {
        type symmetry;
        faces
        (
           (43 44 57 56)
           (44 45 58 57)
           (45 46 59 58)
           (46 47 60 59)
        );
    }
    outlet
    {
        type patch;
        faces
        (
            (10 15 34 29)
            (5 10 29 24)
            (5 24 55 42)
            (42 55 60 47)
            
        );
    }
    topWall
    {
        type symmetry;
        faces
        (
            (11 30 31 12)
            (12 31 32 13)
            (13 32 33 14)
            (14 33 34 15)
        );
    }
    inlet
    {
        type patch;
        faces
        (
            (6 25 30 11)
            (0 19 25 6)
            (0 38 51 19)
            (38 43 56 51)
        );
    }
    cylinder
    {
        type wall;
        faces
        (
            (2 16 35 21)
            (16 17 36 35)
            (17 18 37 36)
            (3 22 37 18)
            (2 21 61 48)
            (48 61 62 49)
            (49 62 63 50)
            (3 50 63 22)
        );
    }
    frontandBack
    {
        type empty;
        faces
        (
            //back
            (0 6 7 1)
            (1 7 16 2)
            (7 8 17 16)
            (8 9 18 17)
            (3 18 9 4)
            (4 9 10 5)
            (6 11 12 7)
            (7 12 13 8)
            (8 13 14 9)
            (9 14 15 10)
            //(1 2 48 39)
            
            //front
            (19 20 26 25)
            (20 21 35 26)
            (26 35 36 27)
            (27 36 37 28)
            (22 23 28 37)
            (23 24 29 28)
            (25 26 31 30)
            (26 27 32 31)
            (27 28 33 32)
            (28 29 34 33)
                
        
        );
        
        
    }
    
);

mergePatchPairs
(
);

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

Last edited by HappyS5; October 26, 2020 at 18:03.
HappyS5 is offline   Reply With Quote

Reply

Tags
blockmeshdict block mesh


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
GenerateVolumeMesh Error - Surface Wrapper Self Interacting (?) AndreP STAR-CCM+ 10 August 2, 2018 08:48
[snappyHexMesh] sHM layer process keeps getting killed MBttR OpenFOAM Meshing & Mesh Conversion 4 August 15, 2016 04:21
Cluster ID's not contiguous in compute-nodes domain. ??? Shogan FLUENT 1 May 28, 2014 16:03
[Netgen] Import netgen mesh to OpenFOAM hsieh OpenFOAM Meshing & Mesh Conversion 32 September 13, 2011 06:50
CFX Solver Memory Error mike CFX 1 March 19, 2008 08:22


All times are GMT -4. The time now is 13:58.