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] could anyone post a simple cylinder mesh (https://www.cfd-online.com/Forums/openfoam-meshing/61796-could-anyone-post-simple-cylinder-mesh.html)

guilherme October 19, 2006 14:18

could anyone post a simple cylinder mesh
 
hi, how do I do a cylinder with blockmesh? Is it necessary do a quarter of a cylinder and stablish simmetry plane in the lateral faces of it or exists a mean of make a entire cylinder? My cylinder is totally wrong I think.

Could anyone posts a simple mesh to I see?

gschaider October 19, 2006 15:04

Hi! I don't have a blockMes
 
Hi!

I don't have a blockMesh Handy, but it's actualy quite easy once you have the general idea: you've got to compose the cylinder of _five_ blocks: one at the center and 4 blocks "bolted" to that (let's call them N,E,S and W according to the side of the center block they're glued to) For instance the N block shares his S-side with the centre-block, E-side with block E, W-side with block W and the N-side is part of the outer boundary of the cylinder

hemph October 20, 2006 03:52

Hi Guilherme, I have a cylind
 
Hi Guilherme,
I have a cylinder-script file you could try. It does just what Bernhard suggests, and is easy to adapt to new number of cells/dimensions. To get a blockMeshDict file from it, do

m4 cylinderMesh.m4 > blockMeshDict

from a terminal window. If it doesn't work, you will need to install the m4-preprocessor.
//Rasmus
http://www.cfd-online.com/OpenFOAM_D...hment_icon.gif cylinderMesh.m4

guilherme October 23, 2006 09:00

Thanks Rasmus The mesh work
 
Thanks Rasmus

The mesh works fine.

Bye.

francois March 23, 2007 10:57

Hi all, I'm starting a new
 
Hi all,

I'm starting a new project which deals with a Large Eddy Simulation of an axisymmetric jet on a rotating and heated plate. The sketch of the computational domain is shown on the present figure.

http://www.cfd-online.com/OpenFOAM_D...ges/1/4061.png

The jet nozzle is circular and the jet is impinging on an heated rotor (in red on the attached picture).

I have read some posts on cylinder mesh and was wondering about the best strategy for my configuration:

- use the cylinderMesh.m4 script-file to decompose the cylinder with a square like on this picture:

http://www.cfd-online.com/OpenFOAM_D...ges/1/4062.png

- use a wedge type meshing strategy like on this picture:

http://www.cfd-online.com/OpenFOAM_D...ges/1/4060.jpg

For the later case, I was not able to find some useful info to make a 3D mesh with wedge type cells with blockmesh.

Is it possible in OpenFOAM1.3 or this feature is only available for pseudo 3D domain (one cell in the third direction) ?

Thanks for your help or suggestions.
Francois

francois March 26, 2007 10:04

Thanks Ville, As you sugges
 
Thanks Ville,

As you suggested I will start with the with a 9 blocks mesh and play a bit with the cylinderMesh.m4 preprocessor script.

But I don't realy understand why I'll loose in the resolution with wedge blocks.

Anyway thanks a lot for your suggestions.
I will post my blockMeshDict file when I'm done with it ...

Have a nice day.
Francois

aderliner April 2, 2007 22:04

Hi, everyone I am also inte
 
Hi, everyone

I am also interested in the wedge blocks,because when I use multiblock to simulate the spray process, it seems like the drops are allways spray from the corner of the "centre block". But, after I've read the userguider, I find that it seems like it's impossible to get the wedge blocks like the picture before using blockmesh?

Could anyone can help me ? Thank you ~~~!

Bobby

guido_adriaensen May 3, 2007 06:32

Hello Cedric Sorry to say,
 
Hello Cedric

Sorry to say, but that is not your only mistake... I have taken a look at your file and there is a lot wrong with it. Blocks are intersecting and not defined using a right-hand rule, you're arcs are also ill defined.
Could you give an example (picture) of what you're geometry should look like?

I've modified your file into the following, but I don't think this is the geometry you're looking for...

/*-----------------------------------------------------*\
| ========= | |
| \ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \ / O peration | Version: 1.3 |
| \ / A nd | Web: http://www.openfoam.org |
| \/ M anipulation | |
\*-----------------------------------------------------*/

FoamFile
{
version 2.0;
format ascii;

root "";
case "";
instance "";
local "";

class dictionary;
object blockMeshDict;
}

// * * * * * * * * * * * * * * * * * * * * * * * * * *//
//meshGenApp blockMesh;
convertToMeters 0.001;
vertices
(
( 3.0 -3.0 0.0)
( 1.0 -1.0 0.0)
( 1.0 1.0 0.0)
( 3.0 3.0 0.0)

( -3.0 3.0 0.0)
( -1.0 1.0 0.0)
( -1.0 -1.0 0.0)
( -3.0 -3.0 0.0)

( 6.0 -6.0 0.0)
( 6.0 6.0 0.0)
( -6.0 6.0 0.0) //10
( -6.0 -6.0 0.0)

( 6.0 -6.0 10.0)
( 3.0 -3.0 10.0)
( 3.0 3.0 10.0)
( 6.0 6.0 10.0)

( -6.0 6.0 10.0)
( -3.0 3.0 10.0)
( -3.0 -3.0 10.0)
( -6.0 -6.0 10.0)

);
blocks
(
hex (1 2 5 6 13 14 17 18) (6 6 10) simpleGrading (1 1 1)
hex (2 3 4 5 14 15 16 17) (2 6 10) simpleGrading (1 1 1)
hex (5 4 7 6 17 16 19 18) (2 6 10) simpleGrading (1 1 1)
hex (0 1 6 7 12 13 18 19) (2 6 10) simpleGrading (1 1 1)
hex (0 3 2 1 12 15 14 13) (6 2 10) simpleGrading (1 1 1)
);
edges
(
arc 5 2 (0.0 1.414214 0.0)
arc 6 5 (-1.414214 0.0 0.0)
arc 1 6 (0.0 -1.414214 0.0)
arc 2 1 (1.414214 0.0 0.0)
arc 17 14 (0.0 4.242641 10.0)
arc 18 17 (-4.242641 0.0 10.0)
arc 13 18 (0.0 -4.242641 10.0)
arc 14 13 (4.242641 0.0 10.0)
);

patches
(
patch inlet
(
(1 6 5 2)
(3 2 5 4)
(4 5 6 7)
(7 6 1 0)
(0 1 2 3)
)
patch outlet
(
(13 14 17 18)
(14 15 16 17)
(17 16 19 18)
(12 13 18 19)
(12 15 14 13)
)
wall walls
(
(3 4 16 15)
(4 7 19 16)
(7 0 12 19)
(0 3 15 12)
)

);
mergePatchPairs
(
);

cedric_duprat May 4, 2007 04:29

Hi Guido, Thank you for your
 
Hi Guido,
Thank you for your reply. I hope it hadn't disturbed you too long ;o)
this is my final geometry:
http://www.cfd-online.com/OpenFOAM_D...ges/1/4361.jpg
I made the left part (the diffuser) and it works correctly, but when I add the large dump downstream of the diffuser section, some mistake are coming.
so what I gave you yesterday is only the dump with the outlet section of the diffuser.
I also would like to use a buterfly mesh (see Francois Beaubert message upper)
I give all also a piece of fortran code to do that easily where I can modifie all my parameters :
http://www.cfd-online.com/OpenFOAM_D...s/mime_txt.gif CreateGridFoam_clausen.f.txt
Cedric
Thank you again for helping

guido_adriaensen May 4, 2007 06:53

Hello Cedric, I didn't take
 
Hello Cedric,

I didn't take me too long :-). Following your example, I have created a small diffuser with a dump, maybe this can point you in the right direction. I have made 7 blocks, 2 for the diffuser and 5 for the dump area. The dump area has been constructed as O-grid (You referred to it as a butterfly mesh, I think it is the same)
The blocks should be created with the right-hand-rule. The arcs are created by the two corner points and a point on the line in between (in this case in the middle). The patches should be numbered in such order that the normal points outward.

If you have anymore questions, let me know. :-)


Guido

/*-----------------------------------------------------*\
| ========= | |
| \ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \ / O peration | Version: 1.3 |
| \ / A nd | Web: http://www.openfoam.org |
| \/ M anipulation | |
\*-----------------------------------------------------*/

FoamFile
{
version 2.0;
format ascii;

root "";
case "";
instance "";
local "";

class dictionary;
object blockMeshDict;
}

// * * * * * * * * * * * * * * * * * * * * * * * * * *//
//meshGenApp blockMesh;
convertToMeters 0.001;
vertices
(
( 1.0 -1.0 -5.0) //0
( 1.0 1.0 -5.0)
( -1.0 1.0 -5.0)
( -1.0 -1.0 -5.0)

( 1.0 -1.0 -2.0) //4
( 1.0 1.0 -2.0)
( -1.0 1.0 -2.0)
( -1.0 -1.0 -2.0)

( 3.0 -3.0 0.0) //8
( 3.0 3.0 0.0)
( -3.0 3.0 0.0)
( -3.0 -3.0 0.0)

( 6.0 -6.0 0.0) //12
( 6.0 6.0 0.0)
( -6.0 6.0 0.0)
( -6.0 -6.0 0.0)

( 3.0 -3.0 10.0) //16
( 3.0 3.0 10.0)
( -3.0 3.0 10.0)
( -3.0 -3.0 10.0)

( 6.0 -6.0 10.0) //20
( 6.0 6.0 10.0)
( -6.0 6.0 10.0)
( -6.0 -6.0 10.0)

);
blocks
(
hex (0 1 2 3 4 5 6 7) (4 4 3) simpleGrading (1 1 1)
hex (4 5 6 7 8 9 10 11) (4 4 2) simpleGrading (1 1 1)
hex (8 9 10 11 16 17 18 19) (4 4 10) simpleGrading (1 1 1)
hex (14 10 9 13 22 18 17 21) (6 4 10) simpleGrading (3 1 1)
hex (15 11 10 14 23 19 18 22) (6 4 10) simpleGrading (3 1 1)
hex (12 8 11 15 20 16 19 23) (6 4 10) simpleGrading (3 1 1)
hex (13 9 8 12 21 17 16 20) (6 4 10) simpleGrading (3 1 1)
);
edges
(
arc 2 1 (0.0 1.414214 -5.0)
arc 1 0 (1.414214 0.0 -5.0)
arc 0 3 (0.0 -1.414214 -5.0)
arc 3 2 (-1.414214 0.0 -5.0)
arc 6 5 (0.0 1.414214 -2.0)
arc 5 4 (1.414214 0.0 -2.0)
arc 4 7 (0.0 -1.414214 -2.0)
arc 7 6 (-1.414214 0.0 -2.0)
arc 10 9 (0.0 4.242641 0.0)
arc 9 8 (4.242641 0.0 0.0)
arc 8 11 (0.0 -4.242641 0.0)
arc 11 10 (-4.242641 0.0 0.0)
arc 14 13 (0.0 8.485281 0.0)
arc 13 12 (8.485281 0.0 0.0)
arc 12 15 (0.0 -8.485281 0.0)
arc 15 14 (-8.485281 0.0 0.0)
arc 18 17 (0.0 4.242641 10.0)
arc 17 16 (4.242641 0.0 10.0)
arc 16 19 (0.0 -4.242641 10.0)
arc 19 18 (-4.242641 0.0 10.0)
arc 22 21 (0.0 8.485281 10.0)
arc 21 20 (8.485281 0.0 10.0)
arc 20 23 (0.0 -8.485281 10.0)
arc 23 22 (-8.485281 0.0 10.0)
);

patches
(
patch inlet
(
(0 3 2 1)
)
patch outlet
(
(16 17 18 19)
(17 21 22 18)
(18 22 23 19)
(20 16 19 23)
(20 21 17 16)
)
);
mergePatchPairs
(
);

cedric_duprat May 4, 2007 11:14

Hello Guido, Thank you very m
 
Hello Guido,
Thank you very much, it seems to work.
I'm trying now to improve the mesh.
If I have a problem, I won't hesitate to disturb you :-)
Cedric

jaswi May 4, 2007 23:03

Hello OpenFOAM users I am n
 
Hello OpenFOAM users

I am new to OpenFOAM. With the help of forum knowledgebase I have been able to install and create meshes for some simple geometries.

My interest is to simulate flow in a pipe with bend. Is it possible to generate geometry + mesh using the blockMesh tool.

Looking forward to suggestions
Kind Regards Jaswi

lillberg January 21, 2008 02:25

You're misspelling fixedValue
 
You're misspelling fixedValue , capital V.

good luck

nikhilmadduri June 17, 2008 04:19

Hello Rasmus or anyone else,
 
Hello Rasmus or anyone else,

I have tried to use the script provided by Rasmus.
When I executed it, it worked fine.

But to visualize it in paraFoam, when I tried, paraFoam window got open but on clicking "accept" in it, the window closed automatically showing the following FATAL ERROR message.


[nikhil@localhost ~]$ paraFoam /home/nikhil/OpenFOAM/nikhil-1.4.1/run/tutorials/icoFoam cavityGrade


--> FOAM FATAL IO ERROR : size 400 is not equal to the given value of 450

file: /home/nikhil/OpenFOAM/nikhil-1.4.1/run/tutorials/icoFoam/cavityGrade/0.8/p from line 25 to line 445.

From function Field<type>::Field(const word& keyword, const dictionary& dict, const label s)
in file lnInclude/Field.C at line 224.

FOAM exiting


I am pasting down the steps below. Somebody please tell me why I am not able to visualise in paraFoam and how I can make the necessary changes if required.

Thank you,
nikhil

bhuve June 17, 2008 04:43

HI!!....perhaves you can visul
 
HI!!....perhaves you can visulize mesh by first clik on "constant" in paraFoam window and than "accept"..may be this error is because of differnt parameters.
regards
Bhuvnesh Verma

ngj June 17, 2008 05:37

Hi Nikhil The reason for yo
 
Hi Nikhil

The reason for your problems is seen in the following error:

-> FOAM FATAL IO ERROR : size 400 is not equal to the given value of 450

It means that the number of elements in your data files, in this case in specific the pressure at t=0.8, does not correspond to the number of elements in your mesh.

Best regards,

Niels

nikhilmadduri June 17, 2008 05:47

thanq bhuvanesh. ur suggestion
 
thanq bhuvanesh. ur suggestion really works.

thanq Niels.

but i dint understand why itz not working when we click say "0.8" instead of "constant" in paraFoam.
i mean, which parameters will change if we change the above options(constant and 0.8)?

regards,
nikhil

ngj June 17, 2008 06:03

The reason is, that in the 'co
 
The reason is, that in the 'constant' directory, the physical variables, i.e. pressure, velocity, etc is (probably) not loaded, thus a mismatch in the number of computational cells and the number of variables in the physical fields is not checked, thus you are allowed to see your mesh.

/ Niels

bhuve June 17, 2008 06:09

HI!...reason is as Niels menti
 
HI!...reason is as Niels mentioned !..so for that you may try..'move to case->constant->..there you delet all neigh..,owne..ets previous stuff expect 'blockmeshdict'.than again form these stuff by blockmesh ./case.,than solve ur case. i think it must work now for anytime .

regards
Bhuvnesh Verma

nikhilmadduri June 17, 2008 22:17

thanq Niels n Bhuvanesh. u
 
thanq Niels n Bhuvanesh.

u both were true.
itz working when i deleted the old files, the problem was coz of new stuff not getting loaded in the presence of old files.

regards,
nikhil

mo.houssami February 16, 2012 19:00

hi all,

I took your examples and try to adapt it to my case, where i only have to make a simple cylinder that i need to mesh inside as regularly as possible.

the first solution proposed doesn't work on my version of openFOAM, but the others do but its a bit tricky, since i'm still learning.

If someone has an example of what i need, please post it.

Anyway thank you very much, i learned a lot from this discussion. :D

mo.houssami February 20, 2012 16:34

it's ok, i did it ! :cool:

libia87 April 23, 2012 03:21

Quote:

Originally Posted by mo.houssami (Post 344849)
hi all,

I took your examples and try to adapt it to my case, where i only have to make a simple cylinder that i need to mesh inside as regularly as possible.

the first solution proposed doesn't work on my version of openFOAM, but the others do but its a bit tricky, since i'm still learning.

If someone has an example of what i need, please post it.

Anyway thank you very much, i learned a lot from this discussion. :D


I have the same problem!
Did you earned the mesh?? I'm new with the OPenFOAM and for me it's difficult to understand how it works the mesh generation.
Thanks!

kid April 23, 2012 06:43

@libia87

OpenFOAM mesh how does it work?

This is a broad question, and really depends on the problem you are solving. So, Plz discribe your problem.

Note:
OpenFOAM mesh making module has two major blocks.
1. blockMesh // this generate basic structured mesh for domain to be considered.
2. snappyHexMesh // This generates fine mesh for boundary ex a CAR or Cylinder.

Also consider a cylinder placed in regular domain. If you want to mesh inside the cylnder domain Use following Patch in snappyHexMeshDict::castellatedMeshControls

refinementSurfaces
{
myCylinder // user defined cylinder
{
level (2 2);
faceZone cylinder;
cellZone cylinder;
zoneInside true; // inside or ZoneOutside for outer mesh
}
}

.
Also it is best you state your model. It will be much easier for us.

regards
CFDkid

elvis April 24, 2012 09:05

Hi,

blockmesh and snappyhexmesh are the two meshing programs that are included into OpemFoam. If you install Engrid you have another opensource mesher. With pyFoamDisplayBlockMesh.py an external program (you could visualize your blockmesh) => http://openfoamwiki.net/index.php/Co...m#Installation

There are commercial mesher that can export directly as OF (ANSA, Hypermesh, Pointwise, CastNet)

PrzemekPL July 24, 2012 09:55

Hi,
has anyone tried to run script provided by Rasmus with the OF 2.0.1?

I get an error when I try to run the blockMesh on blockMeshDict created after execution of the m4 script.

blockMeshDict can be seen below. This is what I get after executing Rasmus's script:

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


convertToMeters 0.001;

//5 mm column diameter
//10 cm length



//Width of middle square section




//how many cells in the square section
//how many cells from square section to perimeter
// how many cells from top to bottom

vertices
(
( 1.25 0.0 1.25) // Vertex fiveoclocksqb = 0
(-1.25 0.0 1.25) // Vertex sevenoclocksqb = 1
(-1.25 0.0 -1.25) // Vertex elevenoclocksqb = 2
( 1.25 0.0 -1.25) // Vertex oneoclocksqb = 3

( 1.76776695455285 0.0 1.76776695137989) // Vertex fiveoclockcb = 4
(-1.76776695455285 0.0 1.76776695137989) // Vertex sevenoclockcb = 5
(-1.76776695455285 0.0 -1.76776695137989) // Vertex elevenoclockcb = 6
( 1.76776695455285 0.0 -1.76776695137989) // Vertex oneoclockcb = 7

( 1.25 100 1.25) // Vertex fiveoclocksqt = 8
(-1.25 100 1.25) // Vertex sevenoclocksqt = 9
(-1.25 100 -1.25) // Vertex elevenoclocksqt = 10
( 1.25 100 -1.25) // Vertex oneoclocksqt = 11

( 1.76776695455285 100 1.76776695137989) // Vertex fiveoclockct = 12
(-1.76776695455285 100 1.76776695137989) // Vertex sevenoclockct = 13
(-1.76776695455285 100 -1.76776695137989) // Vertex elevenoclockct = 14
( 1.76776695455285 100 -1.76776695137989) // Vertex oneoclockct = 15
);

blocks
(
//square block
hex (
1 0 3 2
9 8 11 10
)
(3 3 10)
simpleGrading (1 1 1)

//slice1
hex (
5 4 0 1
13 12 8 9
)
(3 3 10)
simpleGrading (1 1 1)

//slice2
hex (
1 2 6 5
9 10 14 13
)
(3 3 10)
simpleGrading (1 1 1)

//slice3
hex (
2 3 7 6
10 11 15 14
)
(3 3 10)
simpleGrading (1 1 1)

//slice4
hex (
3 0 4 7
11 8 12 15
)
(3 3 10)
simpleGrading (1 1 1)

);


//create the quarter circles
edges
(
arc 4 5 (0.0 0.0 2.5)
arc 5 6 (-2.5 0.0 0.0)
arc 6 7 (0.0 0.0 -2.5)
arc 7 4 (2.5 0.0 0.0)

arc 12 13 (0.0 100 2.5)
arc 13 14 (-2.5 100 0.0)
arc 14 15 (0.0 100 -2.5)
arc 15 12 (2.5 100 0.0)

);

patches
(
patch outlet
(
(2 4(0 3 2 1))
(2 4(0 4 7 3))
(2 4(4 0 1 5))
(2 4(1 2 6 5))
(2 4(3 7 6 2))
)

patch inlet
(
(2 4(8 11 10 9))
(2 4(8 12 15 11))
(2 4(12 8 9 13))
(2 4(9 10 14 13))
(2 4(11 15 14 10))
)

wall walls
(
(2 4(5 4 12 13))
(2 4(5 13 14 6))
(2 4(6 14 15 7))
(2 4(7 15 12 4))
)

);
mergePatchPairs
(
);

Smed July 28, 2012 09:55

1 Attachment(s)
PrzemekPL,

I believe it has to do with a change in the way that patches are now defined. Rename the attached version to .m4 and use the same method that hemph described:
Quote:

m4 cylinderMesh.m4 > blockMeshDict
(The attachment tool rejected the file when it was named .m4, sorry)

-Smed

PrzemekPL July 30, 2012 03:36

Smed,

you were right. There was an issue with the patches definition, i.e. :

(2 4(fiveoclocksqb oneoclocksqb elevenoclocksqb sevenoclocksqb))

Now, everything works,
thanks!

Burak_1984 December 12, 2012 10:59

1 Attachment(s)
Hello

Here is my small contrubution to the forum.I modified the cylindermesher.m4 file to have the Z direction passing through the middle.

I wanted to have arced inlet conditions for the turbinsiting tutorial so I modified the skript somebodyposted in this thread(Thanks!:)).

So maybe somebody needs this version also.Just rename the file to cylindermesher.m4 and use it(You have to have the m4 preprocessor installed).I hope this helps.

My Regards
Burak

ÁlexVieira May 7, 2013 11:17

Quote:

Originally Posted by francois (Post 179978)
Hi all,

I'm starting a new project which deals with a Large Eddy Simulation of an axisymmetric jet on a rotating and heated plate. The sketch of the computational domain is shown on the present figure.

http://www.cfd-online.com/OpenFOAM_D...ges/1/4061.png

The jet nozzle is circular and the jet is impinging on an heated rotor (in red on the attached picture).

I have read some posts on cylinder mesh and was wondering about the best strategy for my configuration:

- use the cylinderMesh.m4 script-file to decompose the cylinder with a square like on this picture:

http://www.cfd-online.com/OpenFOAM_D...ges/1/4062.png

- use a wedge type meshing strategy like on this picture:

http://www.cfd-online.com/OpenFOAM_D...ges/1/4060.jpg

For the later case, I was not able to find some useful info to make a 3D mesh with wedge type cells with blockmesh.

Is it possible in OpenFOAM1.3 or this feature is only available for pseudo 3D domain (one cell in the third direction) ?

Thanks for your help or suggestions.
Francois



I'm trying to do basically the same mesh from this problem but using openfoam 2.1.1 and all the examples posted aren't working.
Using the mesh generated from the file posted from Burak_1984 i get the blockMesh but when i try to see it on paraFoam the following error appears:



--> FOAM FATAL IO ERROR:
keyword outlet is undefined in dictionary "/home/lest/Downloads/C1/0/p::boundaryField"

file: /home/lest/Downloads/C1/0/p::boundaryField from line 25 to line 35.

From function dictionary::subDict(const word& keyword) const
in file db/dictionary/dictionary.C at line 461.

FOAM exiting




Can anyone help me?

BenjAkker September 13, 2013 04:34

1 Attachment(s)
Quote:

Originally Posted by francois (Post 179978)
(...)

- use a wedge type meshing strategy like on this picture:

http://www.cfd-online.com/OpenFOAM_D...ges/1/4060.jpg

For the later case, I was not able to find some useful info to make a 3D mesh with wedge type cells with blockmesh.

Is it possible in OpenFOAM1.3 or this feature is only available for pseudo 3D domain (one cell in the third direction) ?

Thanks for your help or suggestions.
Francois

I attached a script that creates such a mesh (needs m4 like the other scripts posted in this thread). It has generated useful results in my own simulations. However, the aspect ratio of the cells on the axis worries me. I suggest using snappyHexMesh instead, as I intend to for my own work.

Quote:

Originally Posted by ÁlexVieira (Post 425879)
Using the mesh generated from the file posted from Burak_1984 i get the blockMesh but when i try to see it on paraFoam the following error appears:

--> FOAM FATAL IO ERROR:
keyword outlet is undefined in dictionary "/home/lest/Downloads/C1/0/p::boundaryField"

file: /home/lest/Downloads/C1/0/p::boundaryField from line 25 to line 35.

From function dictionary::subDict(const word& keyword) const
in file db/dictionary/dictionary.C at line 461.

FOAM exiting

Can anyone help me?

This is probably too late to be useful to you directly, but I'll answer it for the benefit of other readers. ParaView is telling you that it can't find the boundary condition for the 'outlet' patch. The '0' folder should specify this for each field. If you don't know how to do this, I suggest that you look at a few tutorials and then design a simple study case with a self-made mesh and corresponding boundary conditions, to learn the basics.

sachinlb February 26, 2016 04:20

create cylineder mesh by collapsing one edge
 
2 Attachment(s)
Dear all,
First make block. Collapse one side. Use arc for one side in block. Preapre mesh for half cylivder. see fig halfcyl. create blockmesh. use feature mirrorMesh by keeping and editing file mirrorMeshDict in system. See cylinder made in fig. fullcyl.
Regards
Dr Sachin Borse

greenleader March 25, 2016 07:45

Quote:

Originally Posted by hemph (Post 179976)
Hi Guilherme,
I have a cylinder-script file you could try. It does just what Bernhard suggests, and is easy to adapt to new number of cells/dimensions. To get a blockMeshDict file from it, do

m4 cylinderMesh.m4 > blockMeshDict

from a terminal window. If it doesn't work, you will need to install the m4-preprocessor.
//Rasmus
http://www.cfd-online.com/OpenFOAM_D...hment_icon.gif cylinderMesh.m4

Anyone got a version of this that works with latest version of OF?
Seems that some syntax has changed...
Thanks

UHGAR October 10, 2016 22:24

Error in blockMeshDict
 
Hi Foamers,

I am very new to OpenFoam and I have modified the codes posted by the members in this thread as follows.

Code:

/*-----------------------------------------------------*\
| ========= | |
| \ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \ / O peration | Version: 1.3 |
| \ / A nd | Web: http://www.openfoam.org |
| \/ M anipulation | |
\*-----------------------------------------------------*/

FoamFile
{
version 2.0;
format ascii;

root "";
case "";
instance "";
local "";

class dictionary;
object blockMeshDict;
}

// * * * * * * * * * * * * * * * * * * * * * * * * * *//
//meshGenApp blockMesh;
convertToMeters 0.001;

r              2.2;            // Radius of Inlet
R              #calc "20*$r";  // Domain radius
Inlet_z        11;            //  Inlet from origin (-ve)
Outlet_z        110;            //  Outlet distance from origin
halfAngle      45.0;            // Fixed angle for mid-point
radHalfAngle    #calc "degToRad($halfAngle)"; 
mid_c1          #calc "$r*sin($radHalfAngle)";  // Mid-point for Inner cylinder arc
mid_c2          #calc "$R*sin($radHalfAngle)";  // Mid-point for Outer cylinder arc
                       



vertices
(

( $r          #calc"-1*$r"    #calc "-1*$Inlet_z") //0
( $r          $r            #calc "-1*$Inlet_z")
(#calc"-1*$r"  $r            #calc "-1*$Inlet_z")
(#calc"-1*$r"  #calc"-1*$r"    #calc "-1*$Inlet_z")

( $r          #calc"-1*$r"  0) //4
( $r          $r            0)
(#calc"-1*$r" $r            0)
(#calc"-1*$r" #calc"-1*$r"  0)

( $R          #calc"-1*$R" 0) //8
( $R          $R          0)
(#calc"-1*$R"  $R          0)
(#calc"-1*$R" #calc"-1*$R" 0)

( $R          #calc"-1*$R"  $Outlet_z) //12
( $R          $R            $Outlet_z)
(#calc"-1*$R"  $R            $Outlet_z)
(#calc"-1*$R"  #calc"-1*$R"  $Outlet_z)

( $r          #calc"-1*$r" $Outlet_z) //16
( $r          $r          $Outlet_z)
(#calc"-1*$r"  $r          $Outlet_z)
(#calc"-1*$r"  #calc"-1*$r" $Outlet_z)

);

blocks
(

hex (0 1 2 3 4 5 6 7) (10 10 10) simpleGrading (1 1 1)
hex (4 5 6 7 16 17 18 19) (10 10 10) simpleGrading (1 1 1)
hex (10 6 5 9 14 18 17 13) (10 10 10) simpleGrading (1 1 1)
hex (11 7 6 10 15 19 18 14) (10 10 10) simpleGrading (1 1 1)
hex (8 4 7 11 12 16 19 15) (10 10 10) simpleGrading (1 1 1)
hex (9 5 4 8 13 17 16 12) (10 10 10) simpleGrading (1 1 1)

);

edges
(
arc 2 1  (0.0 $mid_c1  #calc "-1*$Inlet_z")
arc 1 0  ($mid_c1 0.0  #calc "-1*$Inlet_z")
arc 0 3  (0.0  #calc"-1*$mid_c1"  #calc "-1*$Inlet_z")
arc 3 2  (#calc"-1*$mid_c1" 0.0  #calc "-1*$Inlet_z")
arc 6 5  (0.0 $mid_c1 0)
arc 5 4  ($mid_c1 0.0 0)
arc 4 7  (0.0 #calc"-1*$mid_c1" 0)
arc 7 6  (#calc"-1*$mid_c1" 0.0 0)
arc 10 9  (0.0 $mid_c2 0.0)
arc 9 8  ($mid_c2 0.0 0.0)
arc 8 11  (0.0 #calc"-1*$mid_c2" 0.0)
arc 11 10 (#calc"-1*$mid_c2" 0.0 0.0)
arc 18 17 (0.0 $mid_c2 $Outlet_z)
arc 17 16 ($mid_c2 0.0 $Outlet_z)
arc 16 19 (0.0 #calc"-1*$mid_c2" $Outlet_z)
arc 19 18 (#calc"-1*$mid_c2" 0.0 $Outlet_z)
arc 14 13 (0.0 $mid_c2 $Outlet_z)
arc 13 12 ($mid_c2 0.0 $Outlet_z)
arc 12 15 (0.0 #calc"-1*$mid_c2" $Outlet_z)
arc 15 14 (#calc"-1*$mid_c2" 0.0 $Outlet_z)
);

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

Outlet
    {
    type patch;
    faces
        (
    (16 17 18 19)
    (17 13 14 18)
    (18 14 15 19)
    (12 16 19 15)
    (12 13 17 16)
    );
    }

Wall

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

);

Unfortunately, I am getting the following error. Can any one help me to identify the error?

Quote:

/*---------------------------------------------------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.1.1 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
Build : 2.1.1-221db2718bbb
Exec : checkMesh
Date : Oct 10 2016
Time : 22:08:22
Host : "ulab2"
PID : 6167
Case : /media/WorkData/OE_Nov16/SourceTut_20RG/cylinder
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster
allowSystemOperations : Allowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create polyMesh for time = 0

Time = 0

Mesh stats
points: 6901
faces: 18900
internal faces: 17100
cells: 6000
boundary patches: 4
point zones: 0
face zones: 0
cell zones: 0

Overall number of cells of each type:
hexahedra: 5920
prisms: 0
wedges: 80
pyramids: 0
tet wedges: 0
tetrahedra: 0
polyhedra: 0

Checking topology...
Boundary definition OK.
***Total number of faces on empty patches is not divisible by the number of cells in the mesh. Hence this mesh is not 1D or 2D.
Cell to face addressing OK.
Point usage OK.
Upper triangular ordering OK.
Face vertices OK.
Number of regions: 1 (OK).

Checking patch topology for multiply connected surfaces ...
Patch Faces Points Surface topology
Inlet 100 121 ok (non-closed singly connected)
Outlet 500 481 ok (non-closed singly connected)
Wall 1000 1060 ok (non-closed singly connected)
defaultFaces 200 231 ok (non-closed singly connected)

Checking geometry...
Overall domain bounding box (-0.044 -0.044 -0.011) (0.044 0.044 0.11)
Mesh (non-empty, non-wedge) directions (0 0 0)
Mesh (non-empty) directions (0 0 0)
***Number of edges not aligned with or perpendicular to non-empty directions: 16960
<<Writing 6880 points on non-aligned edges to set nonAlignedEdges
Boundary openness (2.42158e-17 1.05504e-18 7.39927e-18) OK.
Max cell openness = 5.85637e-16 OK.
Max aspect ratio = 0 OK.
Minumum face area = 3.42323e-08. Maximum face area = 0.00018805. Face area magnitudes OK.
Min volume = 2e-300. Max volume = 1.87335e-06. Total volume = 0.000562066. Cell volumes OK.
#0 Foam::error::printStack(Foam::Ostream&) in "/home/vasulab/OpenFOAM/OpenFOAM-2.1.1/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#1 Foam::sigFpe::sigHandler(int) in "/home/vasulab/OpenFOAM/OpenFOAM-2.1.1/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#2 in "/lib/x86_64-linux-gnu/libc.so.6"
#3 acos in "/lib/x86_64-linux-gnu/libm.so.6"
#4 Foam::primitiveMesh::checkFaceOrthogonality(bool, Foam::HashSet<int, Foam::Hash<int> >*) const in "/home/vasulab/OpenFOAM/OpenFOAM-2.1.1/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#5
in "/home/vasulab/OpenFOAM/OpenFOAM-2.1.1/platforms/linux64GccDPOpt/bin/checkMesh"
#6
in "/home/vasulab/OpenFOAM/OpenFOAM-2.1.1/platforms/linux64GccDPOpt/bin/checkMesh"
#7 __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
#8
in "/home/vasulab/OpenFOAM/OpenFOAM-2.1.1/platforms/linux64GccDPOpt/bin/checkMesh"
Floating point exception (core dumped)



Antimony October 11, 2016 02:57

Hi,

Have you visualized your mesh? There seems to be something wrong with your mesh if your maximum aspect ratio is 0.

Check that the mesh is the type you want before proceeding further.

Cheers,
Antimony

UHGAR October 11, 2016 22:41

Hi Antimony,

Thanks for your reply,

I got it. I have corrected the script as follows.

Code:

/*-----------------------------------------------------*\
| ========= | |
| \ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \ / O peration | Version: 1.3 |
| \ / A nd | Web: http://www.openfoam.org |
| \/ M anipulation | |
\*-----------------------------------------------------*/

FoamFile
{
version 2.0;
format ascii;

root "";
case "";
instance "";
local "";

class dictionary;
object blockMeshDict;
}

// * * * * * * * * * * * * * * * * * * * * * * * * * *//
//meshGenApp blockMesh;
convertToMeters 0.001;
r              1.1;            // Radius of Inlet (mm)
R              #calc "20*$r";  // Domain radius (mm)
Inlet_z_1        80;            //  Inlet-1 from origin (-ve) (mm)
Inlet_z_2        10;            //  Inlet-2 (exit of inlet-1) from origin (-ve) (mm)
Outlet_z          110;            //  Outlet distance from origin  (mm)
halfAngle      45.0;            // Fixed angle for mid-point
radHalfAngle    #calc "degToRad($halfAngle)"; 
mid_c1          #calc "$r/sin($radHalfAngle)";  // Mid-point for Inner cylinder arc
mid_c2          #calc "$R/sin($radHalfAngle)";  // Mid-point for Outer cylinder arc
                       


vertices
(

( $r          #calc"-1*$r"    #calc "-1*$Inlet_z_1") //0
( $r          $r            #calc "-1*$Inlet_z_1")
(#calc"-1*$r"  $r            #calc "-1*$Inlet_z_1")
(#calc"-1*$r"  #calc"-1*$r"    #calc "-1*$Inlet_z_1")

( $r          #calc"-1*$r"    #calc "-1*$Inlet_z_2") //4
( $r          $r            #calc "-1*$Inlet_z_2")
(#calc"-1*$r"  $r            #calc "-1*$Inlet_z_2")
(#calc"-1*$r"  #calc"-1*$r"    #calc "-1*$Inlet_z_2")

( $r          #calc"-1*$r"  0) //8
( $r          $r            0)
(#calc"-1*$r" $r            0)
(#calc"-1*$r" #calc"-1*$r"  0)

( $R          #calc"-1*$R" 0) //12
( $R          $R          0)
(#calc"-1*$R"  $R          0)
(#calc"-1*$R" #calc"-1*$R" 0)


( $r          #calc"-1*$r" $Outlet_z) //16
( $r          $r          $Outlet_z)
(#calc"-1*$r"  $r          $Outlet_z)
(#calc"-1*$r"  #calc"-1*$r" $Outlet_z)

( $R          #calc"-1*$R"  $Outlet_z) //20
( $R          $R            $Outlet_z)
(#calc"-1*$R"  $R            $Outlet_z)
(#calc"-1*$R"  #calc"-1*$R"  $Outlet_z)

);


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

edges
(

arc 2 1 (0.0              $mid_c1            #calc "-1*$Inlet_z_1")
arc 1 0 ($mid_c1          0.0                #calc "-1*$Inlet_z_1")
arc 0 3 (0.0              #calc"-1*$mid_c1"  #calc "-1*$Inlet_z_1")
arc 3 2 (#calc"-1*$mid_c1" 0.0                #calc "-1*$Inlet_z_1")
arc 6 5 (0.0              $mid_c1            #calc "-1*$Inlet_z_2")
arc 5 4 ($mid_c1          0.0                #calc "-1*$Inlet_z_2")
arc 4 7 (0.0              #calc"-1*$mid_c1"  #calc "-1*$Inlet_z_2")
arc 7 6 (#calc"-1*$mid_c1" 0.0                #calc "-1*$Inlet_z_2")
arc 10 9 (0.0              $mid_c1            0.0                  )
arc 9 8  ($mid_c1          0.0                0.0                  )
arc 8 11 (0.0              #calc"-1*$mid_c1"  0.0                  )
arc 11 10(#calc"-1*$mid_c1" 0.0              0.0                  )         
arc 14 13(0.0              $mid_c2            0.0                  )
arc 13 12($mid_c2          0.0              0.0                  )
arc 12 15(0.0              #calc"-1*$mid_c2"  0.0                  )
arc 15 14(#calc"-1*$mid_c2" 0.0              0.0                  )
arc 18 17(0.0              $mid_c1            $Outlet_z            ) 
arc 17 16($mid_c1          0.0              $Outlet_z            )
arc 16 19(0.0              #calc"-1*$mid_c1"  $Outlet_z            )
arc 19 18(#calc"-1*$mid_c1" 0.0              $Outlet_z            )
arc 22 21(0.0              $mid_c2            $Outlet_z            )
arc 21 20($mid_c2          0.0              $Outlet_z            )
arc 20 23 (0.0            #calc"-1*$mid_c2"  $Outlet_z            )
arc 23 22 (#calc"-1*$mid_c2" 0.0              $Outlet_z            )
);

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

Outlet
    {
    type patch;
    faces
        (
    (16 17 18 19)
        (17 21 22 18)
        (18 22 23 19)
        (20 16 19 23)
        (20 21 17 16)
    );
    }

Walls

  {
    type wall;
    faces
        (
        (0 1 5 4)
    (1 2 6 5)
    (2 3 7 6)
        (3 0 4 7)
    (4 5 9 8)
        (5 6 10 9)
        (6 7 11 10)
        (7 4 8 11)
        (8 12 15 11)
        (11 15 14 10)
        (10 14 13 9)
        (9 13 12 8)
        (12 13 21 20)
        (15 12 20 23)
        (14 15 23 22)
        (13 14 22 21)
    );
  }


);

mergePatchPairs
(
);


/*
patches
(
patch inlet
(
(0 3 2 1)
)
patch outlet
(
(16 17 18 19)
(17 21 22 18)
(18 22 23 19)
(20 16 19 23)
(20 21 17 16)
)
);
mergePatchPairs
(
);


khambi305 September 29, 2017 16:51

Update for OpenFOAM V5
 
He everyone there have been some updates to OpenFOAM since this was last posted I updated the .m4 file for the the version 5.

Paste in a text file and see under extension .m4:
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 5.0 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant/polyMesh";
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
changecom(//)changequote([,])
define(calc, [esyscmd(perl -e 'printf ($1)')])
define(VCOUNT, 0)
define(vlabel, [[// ]Vertex $1 = VCOUNT define($1, VCOUNT)define([VCOUNT], incr(VCOUNT))])


meshGenApp blockMesh;
convertToMeters 0.001;

define(D, 10) //10 mm column diameter
define(L, 500) //50 cm length
define(PI, 3.14159265)

define(R, calc(D/2))
define(CW, calc(D/4)) //Width of middle square section

define(CX, calc(R*cos((PI/180)*45)))
define(CZ, calc(R*sin((PI/180)*45)))

define(NPS, 50) // how many cells in width of square section
define(NPD, 50) // how many cells from square section edge to perimeter of cylinder
define(NPY, 50) // how many cells from top to bottom

vertices
(
( CW 0.0 CW) vlabel(fiveoclocksqb)
(-CW 0.0 CW) vlabel(sevenoclocksqb)
(-CW 0.0 -CW) vlabel(elevenoclocksqb)
( CW 0.0 -CW) vlabel(oneoclocksqb)

( CX 0.0 CZ) vlabel(fiveoclockcb)
(-CX 0.0 CZ) vlabel(sevenoclockcb)
(-CX 0.0 -CZ) vlabel(elevenoclockcb)
( CX 0.0 -CZ) vlabel(oneoclockcb)

( CW L CW) vlabel(fiveoclocksqt)
(-CW L CW) vlabel(sevenoclocksqt)
(-CW L -CW) vlabel(elevenoclocksqt)
( CW L -CW) vlabel(oneoclocksqt)

( CX L CZ) vlabel(fiveoclockct)
(-CX L CZ) vlabel(sevenoclockct)
(-CX L -CZ) vlabel(elevenoclockct)
( CX L -CZ) vlabel(oneoclockct)
);

blocks
(
//square block
hex (
sevenoclocksqb fiveoclocksqb oneoclocksqb elevenoclocksqb
sevenoclocksqt fiveoclocksqt oneoclocksqt elevenoclocksqt
)
(NPS NPS NPY)
simpleGrading (1 1 1)

//slice1
hex (
sevenoclockcb fiveoclockcb fiveoclocksqb sevenoclocksqb
sevenoclockct fiveoclockct fiveoclocksqt sevenoclocksqt
)
(NPS NPD NPY)
simpleGrading (1 1 1)

//slice2
hex (
sevenoclocksqb elevenoclocksqb elevenoclockcb sevenoclockcb
sevenoclocksqt elevenoclocksqt elevenoclockct sevenoclockct
)
(NPS NPD NPY)
simpleGrading (1 1 1)

//slice3
hex (
elevenoclocksqb oneoclocksqb oneoclockcb elevenoclockcb
elevenoclocksqt oneoclocksqt oneoclockct elevenoclockct
)
(NPS NPD NPY)
simpleGrading (1 1 1)

//slice4
hex (
oneoclocksqb fiveoclocksqb fiveoclockcb oneoclockcb
oneoclocksqt fiveoclocksqt fiveoclockct oneoclockct
)
(NPS NPD NPY)
simpleGrading (1 1 1)

);


//create the quarter circles
edges
(
arc fiveoclockcb sevenoclockcb (0.0 0.0 R)
arc sevenoclockcb elevenoclockcb (-R 0.0 0.0)
arc elevenoclockcb oneoclockcb (0.0 0.0 -R)
arc oneoclockcb fiveoclockcb (R 0.0 0.0)

arc fiveoclockct sevenoclockct (0.0 L R)
arc sevenoclockct elevenoclockct (-R L 0.0)
arc elevenoclockct oneoclockct (0.0 L -R)
arc oneoclockct fiveoclockct (R L 0.0)

);

boundary
(

outlet
{
type patch;
faces
(
(fiveoclocksqb oneoclocksqb elevenoclocksqb sevenoclocksqb)
(fiveoclocksqb fiveoclockcb oneoclockcb oneoclocksqb)
(fiveoclockcb fiveoclocksqb sevenoclocksqb sevenoclockcb)
(sevenoclocksqb elevenoclocksqb elevenoclockcb sevenoclockcb)
(oneoclocksqb oneoclockcb elevenoclockcb elevenoclocksqb)
);
}

inlet
{
type patch;
faces
(
(fiveoclocksqt oneoclocksqt elevenoclocksqt sevenoclocksqt)
(fiveoclocksqt fiveoclockct oneoclockct oneoclocksqt)
(fiveoclockct fiveoclocksqt sevenoclocksqt sevenoclockct)
(sevenoclocksqt elevenoclocksqt elevenoclockct sevenoclockct)
(oneoclocksqt oneoclockct elevenoclockct elevenoclocksqt)
);
}

walls
{
type wall;
faces
(
(sevenoclockcb fiveoclockcb fiveoclockct sevenoclockct)
(sevenoclockcb sevenoclockct elevenoclockct elevenoclockcb)
(elevenoclockcb elevenoclockct oneoclockct oneoclockcb)
(oneoclockcb oneoclockct fiveoclockct fiveoclockcb)
);
}
);

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

Bloerb November 11, 2017 16:02

Here is a pipe mesh done with OpenFOAM-dev and the #calc function. As well as the new methods to adress patches via their block and face number. Also naming the points etc is used. The values 0.278 and 0.35 are chosen in such a way, that the non orthogonality and skewness of the resulting mesh is optimal for the current mesh size. It also features an additional outer region for increased resolution of the boundary layer.
Code:

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

convertToMeters 0.001;

ra1 10; // radius in mm

le1 0; // start
le2 100; // end

a1p #calc "0.35*$ra1*sin(degToRad(45.0))";
a2p #calc "0.900*$ra1*sin(degToRad(45.0))";
a3p #calc "1.000*$ra1*sin(degToRad(45.0))";
a1n #calc "-$a1p";
a2n #calc "-$a2p";
a3n #calc "-$a3p";

ap1 #calc " 0.278*$ra1";
an1 #calc "-0.278*$ra1";
ap2 #calc " 0.900*$ra1";
an2 #calc "-0.900*$ra1";
ap3 #calc " 1.000*$ra1";
an3 #calc "-1.000*$ra1";

xa 10; // mesh resolution
ya 10; // mesh resolution
za 100; // mesh resolution

vertices
(
    name a00 ($a1n $a1n $le1)
    name a01 ($a1p $a1n $le1)
    name a02 ($a1p $a1p $le1)
    name a03 ($a1n $a1p $le1)

    name a04 ($a2n $a2n $le1)
    name a05 ($a2p $a2n $le1)
    name a06 ($a2p $a2p $le1)
    name a07 ($a2n $a2p $le1)

    name a08 ($a3n $a3n $le1)
    name a09 ($a3p $a3n $le1)
    name a10 ($a3p $a3p $le1)
    name a11 ($a3n $a3p $le1)

    name b00 ($a1n $a1n $le2)
    name b01 ($a1p $a1n $le2)
    name b02 ($a1p $a1p $le2)
    name b03 ($a1n $a1p $le2)

    name b04 ($a2n $a2n $le2)
    name b05 ($a2p $a2n $le2)
    name b06 ($a2p $a2p $le2)
    name b07 ($a2n $a2p $le2)

    name b08 ($a3n $a3n $le2)
    name b09 ($a3p $a3n $le2)
    name b10 ($a3p $a3p $le2)
    name b11 ($a3n $a3p $le2)
);               

blocks
(
    hex (a00 a01 a02 a03 b00 b01 b02 b03) fluid ($ya $ya $za) simpleGrading (1 1 1)

    hex (a06 a02 a01 a05 b06 b02 b01 b05) fluid ($xa $ya $za) simpleGrading (1 1 1)
    hex (a07 a03 a02 a06 b07 b03 b02 b06) fluid ($xa $ya $za) simpleGrading (1 1 1)
    hex (a04 a00 a03 a07 b04 b00 b03 b07) fluid ($xa $ya $za) simpleGrading (1 1 1)
    hex (a05 a01 a00 a04 b05 b01 b00 b04) fluid ($xa $ya $za) simpleGrading (1 1 1)

    hex (a10 a06 a05 a09 b10 b06 b05 b09) fluid (3 $ya $za) simpleGrading (5 1 1)
    hex (a11 a07 a06 a10 b11 b07 b06 b10) fluid (3 $ya $za) simpleGrading (5 1 1)
    hex (a08 a04 a07 a11 b08 b04 b07 b11) fluid (3 $ya $za) simpleGrading (5 1 1)
    hex (a09 a05 a04 a08 b09 b05 b04 b08) fluid (3 $ya $za) simpleGrading (5 1 1)
);

edges
(
    arc a00 a01 (0    $an1 $le1)
    arc a01 a02 ($ap1 0    $le1)
    arc a02 a03 (0    $ap1 $le1)
    arc a03 a00 ($an1 0    $le1)

    arc a04 a05 (0    $an2 $le1)
    arc a05 a06 ($ap2 0    $le1)
    arc a06 a07 (0    $ap2 $le1)
    arc a07 a04 ($an2 0    $le1)

    arc a08 a09 (0    $an3 $le1)
    arc a09 a10 ($ap3 0    $le1)
    arc a10 a11 (0    $ap3 $le1)
    arc a11 a08 ($an3 0    $le1)

    arc b00 b01 (0    $an1 $le2)
    arc b01 b02 ($ap1 0    $le2)
    arc b02 b03 (0    $ap1 $le2)
    arc b03 b00 ($an1 0    $le2)

    arc b04 b05 (0    $an2 $le2)
    arc b05 b06 ($ap2 0    $le2)
    arc b06 b07 (0    $ap2 $le2)
    arc b07 b04 ($an2 0    $le2)

    arc b08 b09 (0    $an3 $le2)
    arc b09 b10 ($ap3 0    $le2)
    arc b10 b11 (0    $ap3 $le2)
    arc b11 b08 ($an3 0    $le2)
);
 
defaultPatch
{
    name walls;
    type wall;


boundary
(
    inlet
    {
        type patch;
        faces
        (
            (0 4)
            (1 4)
            (2 4)
            (3 4)
            (4 4)
            (5 4)
            (6 4)
            (7 4)
            (8 4)
        );
    }
    outlet
    {
        type patch;
        faces
        (
            (0 5)
            (1 5)
            (2 5)
            (3 5)
            (4 5)
            (5 5)
            (6 5)
            (7 5)
            (8 5)
        );
    } 
);


otaolafr December 6, 2019 03:06

1/4 of pipe with blockmesh
 
hello,
i am fairly new with OpenFOAM and well, the preprocessing is a little bit complicated, OF it is super powerfull as software but a little bit complicated to get the hand on it....

i wanted to do a 1/4 of a cylinder with blockmesh,
is it possible to do the blockmesh with polyhedral cells for the mesh?
also how can i define a simple quarter of cylinder, i found some examples in the comments of a cylinder but it was difficult to follow them.... i wanted to finish with something where i can define the R and the lenght of the hight in Z with the 5 different patches defined...

TanF May 8, 2020 11:08

3 Attachment(s)
Hello everyone!
I am currently working with OpenFoam to create a cylinder. The cylinder I need should only be discretized in the h direction (Photo). Does anyone know how I can avoid the round basement being divided into so many small cells? (I have attached a photo).
I´m quite new to OpenFoam and would be very happy if someone could help me!
Regards!


All times are GMT -4. The time now is 10:28.