CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Meshing & Mesh Conversion (https://www.cfd-online.com/Forums/openfoam-meshing/)
-   -   [blockMesh] Unable to change mesh density in blocks (https://www.cfd-online.com/Forums/openfoam-meshing/219164-unable-change-mesh-density-blocks.html)

jtipton2 July 17, 2019 23:07

Unable to change mesh density in blocks
 
I'm attaching a simplified mesh code that utilizes 5 block regions. Each block starts with a very simple mesh density of (1 1 1).

My goal is to change the x-direction mesh density. Let's take the middle block "BLOCK III". I can change the mesh density to (10 1 1) and the the blockMesh command works without a problem.

Now let's say I want to change the mesh density in both "BLOCK 0" and "BLOCK IV" to (20 1 1). Now I get an error message that says:

Code:

--> FOAM FATAL ERROR:
Inconsistent number of faces between block pair 0 and 4

    From function void Foam::blockMesh::calcMergeInfo()
    in file blockMesh/blockMeshMerge.C at line 221.

I don't understand why this is a problem since the blocks have the exact same x-dimensions. Can anyone help explain the problem? My code is below.

Many thanks,

~ Joseph



Code:

FoamFile
{
    version    2.0;
    format    ascii;
    class      dictionary;
    object    blockMeshDict;
}

scale  0.001;

vertices
(
    (0 0 0)
    (100 0 0)
    (100 5 0)
    (105 5 0)
    (105 0 0)
    (205 0 0)
    (205 5 0)
    (205 50 0)
    (105 50 0)
    (100 50 0)
    (0 50 0)
    (0 5 0)

    (0 0 7)
    (100 0 7)
    (100 5 7)
    (105 5 7)
    (105 0 7)
    (205 0 7)
    (205 5 7)
    (205 50 7)
    (105 50 7)
    (100 50 7)
    (0 50 7)
    (0 5 7)
);

blocks
(
    // BLOCK 0
    hex (0 1 2 11 12 13 14 23)
    (1 1 1)
    simpleGrading (1 1 1)

    // BLOCK 1
    hex (3 4 5 6 15 16 17 18)
    (1 1 1)
    simpleGrading (1 1 1)

    // BLOCK 2
    hex (3 6 7 8 15 18 19 20)
    (1 1 1)
    simpleGrading (1 1 1)

    // BLOCK 3
    hex (2 3 8 9 14 15 20 21)
    (1 1 1)
    simpleGrading (1 1 1)

    // BLOCK 4
    hex (2 9 10 11 14 21 22 23)
    (1 1 1)
    simpleGrading (1 1 1)

);

edges
(
);

boundary
(
    inlet
    {
        type patch;
        faces
        (
            (10 11 23 22)
            (11 0 12 23)
        );
    }

    outlet
    {
        type patch;
        faces
        (
            (6 7 19 18)
            (5 6 18 17)
        );
    }

    upperWall
    {
        type wall;
        faces
        (
            (7 8 20 19)
            (8 9 21 20)
            (9 10 22 21)
        );
    }

    lowerWall
    {
        type wall;
        faces
        (
            (0 1 13 12)
            (1 2 14 13)
            (2 3 15 14)
            (3 4 16 15)
            (4 5 17 16)
        );
    }

    front
    {
        type empty;
        faces
        (
            (13 14 23 12)
            (14 21 22 23)
            (14 15 20 21)
            (15 18 19 20)
            (15 16 17 18)
        );
    }

    back
    {
        type empty;
        faces
        (
            (11 2 1 0)
            (3 6 5 4)
            (8 7 6 3)
            (9 8 3 2)
            (10 9 2 11)
        );
    }

);

mergePatchPairs
(

);


asfdasdf

GerhardHolzinger July 18, 2019 04:25

1 Attachment(s)
You can not mesh two connected blocks with different mesh density.

In the image attached, you see two blocks, with a green and a red mesh. The face the two blocks are connected, the grid lines don't match. This is why OpenFOAM aborts with an error.

You have two options
  • Use matching mesh densities
  • Don't connect the blocks; create the mesh; connect the meshes using AMI

jtipton2 July 18, 2019 09:58

Gerhard,

Thanks so much for the reply. The thumbnail you showed does not match what I am trying to do. I am not changing the y-direction mesh density. BLOCK 0 and BLOCK IV are on the left of my domain and on top of each other.

Code:

|--------------|---|----------------|
|  Block IV  |III|    Block II  |
|              |  |                |
|--------------|---|----------------|
|  Block 0    |  |    Block I    |
|--------------|  |----------------|


I am just trying to change the x-direction mesh density, e.g.

Code:

    // BLOCK 0
    hex (0 1 2 11 12 13 14 23)
    (10 1 1)
    simpleGrading (1 1 1) 

    // BLOCK 4
    hex (2 9 10 11 14 21 22 23)
    (10 1 1)
    simpleGrading (1 1 1)


I feel like this is too simple of a problem to be a bug in the software but I cannot understand why this is not possible.

Thanks so much for your help! ~ Joseph

GerhardHolzinger July 19, 2019 05:17

1 Attachment(s)
Your local coordinates are messed up.

Code:

blocks
(
    // BLOCK 0
    hex (0 1 2 11 12 13 14 23)
    (1 1 1)
    simpleGrading (1 1 1)

    // BLOCK 4
    hex (2 9 10 11 14 21 22 23)
    (1 1 1)
    simpleGrading (1 1 1)
);

While the local x-direction of block 0 coincides with the global x-direction, the local x-direction of block 4 doesn't.

jtipton2 July 19, 2019 09:28

Gerhard,

Thanks so much for helping me isolate my error. I knew that blocks had to be defined in a CCW manner but did not realize the first vertex sets the origin.

Best,

~ Joseph


All times are GMT -4. The time now is 08:04.