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] keep getting errors from blockMesh saying: "negative volume" (https://www.cfd-online.com/Forums/openfoam-meshing/144106-keep-getting-errors-blockmesh-saying-negative-volume.html)

hwsv07 November 9, 2014 07:34

keep getting errors from blockMesh saying: "negative volume"
 
Hi everyone,

I am very new to OpenFOAM and after much pain and struggle, I finally installed OF 2.3.0 on VMware player with Ubuntu 14.04 32bit.

Eventually, I want to implement an actuator disc model and do some flow analysis. I tried googling and got some info but it is just overwhelming for me - going no where. This is a noob question - but is there any CAD software that can automatically generate this blockMeshDict file?

So, right now, I am learning how to use blockMesh and create some simple mesh according to this tutorial I found online : http://www.fm.energy.lth.se/fileadmi...rExercise1.pdf

My blockMeshDict code
Code:

/*--------------------------------*- 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)
    (3 0 0)
    (3 1 0)
    (0 1 0)
        (4 2 0)
    (5 2 0)
    (4 5 0)
    (5 5 0)
        (0 0 0.1)
    (3 0 0.1)
    (3 1 0.1)
    (0 1 0.1)
    (4 2 0.1)
    (5 2 0.1)
    (4 5 0.1)
    (5 5 0.1)       
);

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

edges
(
arc 3 4 (1.2 3.6 0.0) // arc through vertices 3 and 4, through a point
arc 1 5 (4.0 0.2679 0.0) // arc through vertices 1 and 5, through a point
arc 11 12 (1.2 3.6 0.1) // arc through vertices 11 and 12, through a point
arc 9 13 (4.0 0.2679 0.1) // arc through vertices 9 and 13, through a point
);

boundary  // any boundary patch omitted is assigned a type empty
(
    inlet // given name of patch (i.e. region)
    {
        type patch;
        faces
        (
            (8 10 2 0) // vertices that define the patch, clockwise from inside block
        );
    }
    outlet
    {
        type patch;
        faces
        (
            (6 14 15 7)
        );
    }       
        blockzerooutlet
        {
        type patch;
        faces
        (
            (1 3 11 9)
        );
    }       
        blockoneinlet
        {
        type patch;
        faces
        (
            (9 11 3 1)
        );
    }
        blockoneoutlet
        {
        type patch;
        faces
        (
            (4 12 13 5)
        );
    }               
        blocktwoinlet
        {
        type patch;
        faces
        (
            (5 13 12 4)
        );
    }       
    frontAndBack // 2D problem x-y
    {
        type empty;
        faces
        (
            (0 2 3 1)
            (3 4 5 1)
            (4 6 7 5)
                        (9 11 10 8)
            (13 12 11 9)
            (13 15 14 12)
        );
    }
    topAndbottomWalls
    {
        type wall;
        faces
        (
            (2 10 11 3)
            (1 9 8 0)
                        (3 11 12 4)
                        (5 13 9 1)
                        (4 12 14 6)
                        (7 15 13 5)
        );
    }
);

mergePatchPairs
(
        (blockzerooutlet blockoneinlet)
        (blockoneoulet blocktwoinlet)
);

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

I keep getting errors from blockMesh saying I have negative volume. I wanna debug it, but I can't correspond the errors to my blockMeshDict file.

Any help is really very much appreciated! Thank you!

wyldckat November 9, 2014 07:52

Greetings hwsv07 and welcome to the forum!

Quote:

Originally Posted by hwsv07 (Post 518137)
This is a noob question - but is there any CAD software that can automatically generate this blockMeshDict file?

On this sub-forum for blockMesh: OpenFOAM Native Meshers: blockMesh - there is a sticky thread entitled "Sticky: About blockMesh".
If you visit that thread, it will point you to a wiki page, in which you'll find a section entitled "Graphical User Interfaces for visualizing and designing blockMeshDict": http://openfoamwiki.net/index.php/Bl..._blockMeshDict :)

Quote:

Originally Posted by hwsv07 (Post 518137)
I keep getting errors from blockMesh saying I have negative volume. I wanna debug it, but I can't correspond the errors to my blockMeshDict file.

When it comes to everything related to OpenFOAM, there are essentially two rules:
  1. Every single detail is more important than you might want or expect.
  2. If it's not working as intended, you should always divide and conquer the problem ;)
    • Better yet, you should never jump directly to the final problem you're trying to solve, you should first simplify the problem to the simplest simulation case scenario and then gradually increase the level of detail, after each test.
This to say that the best way to debug this, even if you do not have any GUI to assist in debugging each block, you can comment out parts within the dictionary file "blockMeshDict" and then gradually add back each block and feature, to try and isolate where the problem is coming from :).

Best regards,
Bruno

hwsv07 November 9, 2014 12:22

Hi wyldckat,

I took your advice and broke up my mesh into separate blocks and found out my problem. I mis-read how I should number my vertices. so now I have to managed to generate my 3 blocks.

However, I still have a problem. I have specified a curve edge, but when I previewed my mesh in paraview, it does not show me the curve edge. Is there something I did wrong?

How I did to preview mesh was as follows:
Code:

blockMesh -blockTopology
which creates 2 files - blockCentres.obj blockTopology.obj

I then opened paraview.

blockCentres.obj does not show me anything, but blockTopology.obj only shows me the outline, but I cannot see the mesh though (I selected Wireframe under Properties - I tried some tutorials, and I know using WireFrame allows me to see the mesh grids). Am I doing something wrong here?

I also tried to preview mesh by just running
Code:

blockMesh
paraFoam

one after another, but it didn't work out as it always crashed with the following message.

Code:

user@ubuntu:~/Desktop/Link to MySimulation/pipe$ paraFoam
created temporary 'pipe.OpenFOAM'
fileName::stripInvalid() called for invalid fileName /home/user/Desktop/LinktoMySimulation/pipe/pipe.OpenFOAM
    For debug level (= 2) > 1 this is considered fatal
Aborted (core dumped)

Any help is really appreciated.

Below is my blockMeshDict.

Code:

/*--------------------------------*- 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) // block 0 (0 to 7)
    (3 0 0)
    (3 1 0)
    (0 1 0)
    (0 0 1)
    (3 0 1)
    (3 1 1)
    (0 1 1)
       
    (4 2 0) // block 2 (8 to 15)
    (5 2 0)
    (5 5 0)
    (4 5 0)
    (4 2 1)
    (5 2 1)
    (5 5 1)       
    (4 5 1)
       
        (3 0 0) // block 1 (16 to 23)
        (5 2 0)
        (4 2 0)
        (3 1 0)
        (3 0 1)
        (5 2 1)
        (4 2 1)
        (3 1 1)
);

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

edges
(
/* arc 19 18 (3.6 8 0)
arc 16 17 (4.0 0.2679 0)
arc 23 22 (3.6 1.2 1)
arc 20 21 (4.0 0.2679 1) */
arc 2 8 (3.6 8 0)
arc 1 9 (4.0 0.2679 0)
arc 6 12 (3.6 1.2 1)
arc 5 13 (4.0 0.2679 1)
);

boundary  // any boundary patch omitted is assigned a type empty
(
    inlet // given name of patch (i.e. region)
    {
        type patch;
        faces
        (
            (4 7 3 0) // vertices that define the patch, clockwise from inside block
        );
    }
    outlet
    {
        type patch;
        faces
        (
            (11 15 14 10)       
        );
    }       
/*        block0outlet
        {
        type patch;
        faces
        (
            (2 6 5 1)
        );
    }       
        block1inlet
        {
        type patch;
        faces
        (
            (16 20 23 19)
        );
    }
        block1outlet
        {
        type patch;
        faces
        (
            // (18 22 21 17)
                        (8 12 13 9)
        );
    }               
        block2inlet
        {
        type patch;
        faces
        (
            (9 13 12 8)
        );
    }        */
    topAndbottomWalls
    {
        type wall;
        faces
        (
                        (3 7 6 2)    // block 0
                        (1 5 4 0)
                        (8 12 15 11)  // block 2
                        (10 14 13 9)
                        // (19 23 22 18) // block 1
                        // (17 21 20 16)
                        (6 12 8 2) // block 1
                        (1 9 13 5)
        );
    }
);

mergePatchPairs
(
/*        (block0outlet block1inlet)
        (block1outlet block2inlet) */
);

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


wyldckat November 9, 2014 12:27

Quick answer:
  1. Do not use spaces in names on files and folders, such as you have: "Link to MySimulation" - OpenFOAM is allergic to them ;).
  2. Curves are harder to be displayed in the topology mechanisms available so far. The bullet-proof way is to do check/test 1 curve at a time and use blockMesh to create the actual mesh. To make it quicker, don't use much refinement... 5-10 cells in each direction is usually more than enough for debugging curves.

hwsv07 November 9, 2014 13:40

Quote:

Originally Posted by wyldckat (Post 518158)
Quick answer:
  1. Do not use spaces in names on files and folders, such as you have: "Link to MySimulation" - OpenFOAM is allergic to them ;).
  2. Curves are harder to be displayed in the topology mechanisms available so far. The bullet-proof way is to do check/test 1 curve at a time and use blockMesh to create the actual mesh. To make it quicker, don't use much refinement... 5-10 cells in each direction is usually more than enough for debugging curves.

yes wyldckat, I have also finally found out that the spaces were causing all the problems. thanks for the reply though and it is great that someone is helping out here. hope I will get better with OF as I progress to more complex stuff.


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