CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Native Meshers: blockMesh

keep getting errors from blockMesh saying: "negative volume"

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   November 9, 2014, 08:34
Default keep getting errors from blockMesh saying: "negative volume"
  #1
Member
 
Join Date: Nov 2014
Posts: 87
Rep Power: 3
hwsv07 is on a distinguished road
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!
hwsv07 is offline   Reply With Quote

Old   November 9, 2014, 08:52
Default
  #2
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 9,651
Blog Entries: 39
Rep Power: 99
wyldckat is just really nicewyldckat is just really nicewyldckat is just really nicewyldckat is just really nicewyldckat is just really nice
Greetings hwsv07 and welcome to the forum!

Quote:
Originally Posted by hwsv07 View Post
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 View Post
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
__________________
wyldckat is offline   Reply With Quote

Old   November 9, 2014, 13:22
Default
  #3
Member
 
Join Date: Nov 2014
Posts: 87
Rep Power: 3
hwsv07 is on a distinguished road
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) */
);

// ************************************************************************* //
hwsv07 is offline   Reply With Quote

Old   November 9, 2014, 13:27
Default
  #4
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 9,651
Blog Entries: 39
Rep Power: 99
wyldckat is just really nicewyldckat is just really nicewyldckat is just really nicewyldckat is just really nicewyldckat is just really nice
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.
wyldckat is offline   Reply With Quote

Old   November 9, 2014, 14:40
Default
  #5
Member
 
Join Date: Nov 2014
Posts: 87
Rep Power: 3
hwsv07 is on a distinguished road
Quote:
Originally Posted by wyldckat View Post
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.
hwsv07 is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[ICEM] Negative volume error in hybrid mesh siw ANSYS Meshing & Geometry 4 September 3, 2014 05:25
InterFoam negative alpha karasa03 OpenFOAM 7 December 12, 2013 04:41
same geometry,structured and unstructured mesh,different behaviour. sharonyue OpenFOAM Running, Solving & CFD 13 January 2, 2013 23:40
fluent add additional zones for the mesh file SSL FLUENT 2 January 26, 2008 12:55
Could anybody help me see this error and give help liugx212 OpenFOAM Running, Solving & CFD 3 January 4, 2006 19:07


All times are GMT -4. The time now is 19:31.