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] Can't find my mistake blockMeshDict (https://www.cfd-online.com/Forums/openfoam-meshing/113402-cant-find-my-mistake-blockmeshdict.html)

jelzinga February 19, 2013 06:29

Can't find my mistake blockMeshDict
 
I'm trying to get started with OpenFOAM and using BlockMesh as a "first" mesher to get started.

My basic simulation would be 2 squares (cubicles) stacked on top of eachother, with the top face of the small cubicle being an air inlet and the bottom face of the big cubicle being an outlet.

I've defined the 16 vertices and the 2 hex blocks. Furthermore, I've tried to define the patches necessary (including a "mergePatchPairs") but the generated OpenFOAM mesh-files do not contain boundary-zones for the inlet and outlet (the top and bottom faces).

Ive copied/pasted my blockMeshDict to this post in the hopes someone can explain me what I'm doing wrong ...

Code:

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

convertToMeters 0.001;

vertices       
(
    (3 3 -3) //0
    (-3 3 -3) //1
    (-3 -3 -3) //2
    (3 -3 -3) //3
    (3 3 0) //4
    (-3 3 0) //5
    (-3 -3 0) //6
    (3 -3 0) //7
    (1 1 0) //8
    (-1 1 0) //9
    (-1 -1 0) //10
    (1 -1 0) //11
    (1 1 1) //12
    (-1 1 1) //13
    (-1 -1 1) //14
    (1 -1 1) //15
   
);

blocks         
(
    hex (0 1 2 3 4 5 6 7) (19 19 19) simpleGrading (1 1 1)
    hex (8 9 10 11 12 13 14 15) (23 23 23) simpleGrading (1 1 1)
 
);

edges
(
);

patches
(
 patch vlak1
  (
    ( 4 5 6 7)
  )

 patch vlak2
  (
    (8 9 10 11)
  )

);


boundary
(
 
inlet
  {
  type patch;
  faces
    (
      (12 13 14 15)
    );
  }

 outlet
  {
  type patch;
  faces
    (
      (0 1 2 3)
    );
  }

 defaultFaces
  {
  type patch;
  faces
    (
      (0 4 7 3)
      (3 7 6 2)
      (1 5 6 2)
      (1 0 4 5)
      (8 12 15 11)
      (10 11 15 14)
      (10 9 13 14)
      (9 8 12 13)
      (4 5 6 7)
    );
  }

 
);




mergePatchPairs
(
(vlak2 vlak1) //merge1
);


);

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

thanks in forward ;)

startingWithCFD February 19, 2013 07:10

-You can either have "patches" or "boundary", not both. "boundary" was ignored and therefore no inlet or outlet appeared.
-Be careful that the number of cells must be the same in neighbouring blocks. I corrected that for you.
-There was also an extra ); at the end.

Code:

convertToMeters 0.001;

vertices
(
    (3 3 -3) //0
    (-3 3 -3) //1
    (-3 -3 -3) //2
    (3 -3 -3) //3
    (3 3 0) //4
    (-3 3 0) //5
    (-3 -3 0) //6
    (3 -3 0) //7
    (1 1 0) //8
    (-1 1 0) //9
    (-1 -1 0) //10
    (1 -1 0) //11
    (1 1 1) //12
    (-1 1 1) //13
    (-1 -1 1) //14
    (1 -1 1) //15

);

blocks
(
    hex (0 1 2 3 4 5 6 7) (24 24 12) simpleGrading (1 1 1)
    hex (8 9 10 11 12 13 14 15) (8 8 4) simpleGrading (1 1 1)

);

edges
(
);



boundary
(
    inlet
    {
        type patch;
        faces
        (
            (12 13 14 15)
        );
    }

    vlak1
    {
        type patch;
        faces
        (
            ( 4 5 6 7)
        );
    }

    vlak2
    {
        type patch;
        faces
        (
            (8 9 10 11)
        );
    }

    outlet
    {
        type patch;
        faces
        (
            (0 1 2 3)
        );

);


mergePatchPairs
(
    (vlak2 vlak1) //merge1
);


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


jelzinga February 19, 2013 07:30

Thanks for the quick help. I was not aware you could not have both, so learned already something ;)

When I copied your code over my file (after making a backup) I get the following error when I run blockMesh in the case directory:

Code:

--> FOAM FATAL IO ERROR:
ill defined primitiveEntry starting at keyword 'boundary' on line 52 and ending at line 101

file: /home/openfoam/Jos2013/GS_proposal/constant/polyMesh/blockMeshDict at line 101.

    From function primitiveEntry::readEntry(const dictionary&, Istream&)
    in file db/dictionary/primitiveEntry/primitiveEntryIO.C at line 214.

FOAM exiting

I must admit I run OpenFOAM 1.7.0 because that was bundled with the OpenCAE Linux version I downloaded, does that matter? Did the syntax change compared to the newer version and perhaps I should consider upgrading ?

startingWithCFD February 19, 2013 09:12

Sorry, I missed a } at the end of outlet during the copy-paste stage.
I wanted to attach the file itself but the forum rules did not allow that.
It must be working like this, right?

jelzinga February 19, 2013 09:22

Thanks for the heads-up. In the meantime I took the effort to install OpenFOAM 2.1 to exclude this as a possible problem-point later on.

I've edited the file accordingly and this seems to indeed add the boundaries required, thanks!

I'm pretty sure I run into a new problem later on, but thanks alot for now !

diananilminikumari March 18, 2015 05:48

ill defined primitiveEntry starting at keyword 'blocks'
 
I was trying to define cylinder mesh,and When run the blockMesh I have get the error ,

--> FOAM FATAL IO ERROR:
"ill defined primitiveEntry starting at keyword 'blocks' on line 53 and ending at line 149"

file: /home/diana/OpenFOAM/diana-2.3.0/run/tutorials/heatTransfer/buoyantSimpleFoam/hotcylinder/constant/polyMesh/blockMeshDict at line 149.

From function primitiveEntry::readEntry(const dictionary&, Istream&)
in file lnInclude/IOerror.C at line 132.

Here is my blockMesh file .Please kind to help me to find the error
/*--------------------------------*- 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
(
(0 0 0)//0
(0.02 0 0)//1
(0 0.02 0)//2
(0 0 0.5)//3
(0.02 0 0.5)//4
(0 0.02 0.5)//5
(0 0 1)//6
(0.02 0 1)//7
(0 0.02 1)//8

(-0.02 0 0)
(-0.02 0 0.5)
(-0.02 0 1)
(0 -0.02 0)
(0 -0.02 0.5)
(0 -0.02 1)

(0.05 0 0)
(0 0.05 0)
(0.05 0 0.5)
(0 0.05 0.5)
(0.05 0 1)
(0 0.05 1)
(-0.05 0 0)
(-0.05 0 0.5)
(-0.05 0 1)
(0 -0.05 0)
(0 -0.05 0.5)
(0 -0.05 1)
);

blocks
(
hex(0 0 1 2 3 3 4 5) (2 2 10) simpleGrading (1 1 1)
hex(3 3 5 4 6 6 7 8) (2 2 10) simpleGrading (1 1 1)
hex(0 0 2 9 3 3 5 10) (2 2 10) simpleGrading (1 1 1)
hex(3 3 5 10 6 6 8 11) (2 2 10) simpleGrading (1 1 1)
hex(0 0 9 12 3 3 10 13) (2 2 10) simpleGrading (1 1 1)
hex(3 3 10 13 6 6 11 14) (2 2 10) simpleGrading (1 1 1)
hex(0 0 12 1 3 3 13 4) (2 2 10) simpleGrading (1 1 1)
hex(3 3 13 4 6 6 14 7) (2 2 10) simpleGrading (1 1 1)
hex(1 15 16 2 4 17 18 5) (3 3 10) simpleGrading (1 1 1)
hex(4 17 18 5 7 19 20 8) (3 3 10) simpleGrading (1 1 1)
hex(2 16 21 9 5 18 22 10) (3 3 10) simpleGrading (1 1 1)
hex(5 18 22 10 8 20 23 11) (3 3 10) simpleGrading (1 1 1)
hex(9 21 24 12 10 22 25 13) (3 3 10) simpleGrading (1 1 1)
hex(10 22 25 13 11 23 26 14) (3 3 10) simpleGrading (1 1 1)
hex(12 24 15 1 13 25 17 4) (3 3 10) simpleGrading (1 1 1)
hex(13 25 17 4 14 26 19 7) (3 3 10) simpleGrading (1 1 1)

);
edges
(
arc 1 2 (0.01 0.0173205080756888 0)
arc 4 5 (0.01 0.0173205080756888 0.5)
arc 7 8 (0.01 0.0173205080756888 1)
arc 2 9 (-0.01 0.0173205080756888 0)
arc 5 10 (-0.01 0.0173205080756888 0.5)
arc 8 11 (-0.01 0.0173205080756888 1)
arc 9 12 (-0.0173205080756888 -0.01 0)
arc 10 13 (-0.0173205080756888 -0.01 0.5)
arc 11 14 (-0.0173205080756888 -0.01 1)
arc 10 1 (0.03 0.04 0)
arc 13 4 (0.03 0.04 0.5)
arc 14 7 (0.03 0.04 1)
);
boundary
(
uppipewall
{
type wall;
faces
(
(15 16 18 17)
(17 18 20 19)
(16 21 22 18)
(18 22 23 20)
)
}
downpipewall
{
type wall;
faces
(
(24 15 25 17)
(17 25 26 19)
(24 21 22 25)
(25 22 23 26)
)
}
inflow
{
type patch;
faces
(
(0 2 1 0)
(1 2 16 15)
(0 9 2 0)
(9 21 16 2)
(0 12 9 0)
(12 24 21 9)
(0 1 12 0)
(1 15 24 12)
)
}
outflow
{
type patch;
faces
(
(6 8 7 6)
(8 20 19 7)
(6 11 8 6)
(11 23 20 8)
(6 14 11 6)
(14 26 23 11)
(6 7 14 6)
(7 19 26 14)
)
}
);

mergePatchPairs
(
);

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

alexeym March 18, 2015 06:07

Hi,

1. There should be space between hex and vertices vector
2. There should be semicolon in the end of faces vector of vector in patch definition

Though after these two minor corrections you will encounter problems with hex vertices numbering:

Code:

Creating block mesh topology
--> FOAM Warning :
    From function cellModel::mag(const labelList&, const pointField&)
    in file meshes/meshShapes/cellModel/cellModel.C at line 128
    zero or negative pyramid volume: -1.66667e-05 for face 4

and

Code:

--> FOAM FATAL ERROR:
face 0 in patch 1 does not have neighbour cell face: 4(24 15 25 17)

Next time when posting blockMeshDict (or any other dictionary) on the forum, please, use CODE tag or just attach compressed file.

Linse March 18, 2015 06:13

Just a short note: Try to put a space between the "hex" and the brackets... Should help for part of the problem already...

diananilminikumari March 19, 2015 01:08

Thank you very much for your information. :)
I have got the mesh


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