CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Meshing & Mesh Conversion

[blockMesh] Mesing a polar cylinder in x-direction

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 4, 2024, 15:39
Default Mesing a polar cylinder in x-direction
  #1
Member
 
Marķa Rosales
Join Date: Mar 2023
Location: Spain
Posts: 48
Rep Power: 3
MMRC is on a distinguished road
Good day community,

Please, can you give me a hand in the block definition. I want to elaborate a cylindrical geometry, radial directions in y & z, and length along x-axis. The grid that I want is polar so I wanted to reproduce 4 times a quarter of cylinder but I got stucked in the block definition:

Code:
scale               1;

cx 0.0;
cy 0.0;
cz 80.0;

height 3;

r 45;

h #calc "$height+$cx";

vz #calc "$cz+$r";
nvz #calc "$cz-$r";

vy #calc "$cy+$r";
nvy #calc "$cy-$r";

c1 #calc "$cz + ($r*cos(45.0))"; // cosine in first quadrant
s1 #calc "$cy + ($r*sin(45.0))"; // sine

c2 #calc "$cz + ($r*cos(135.0))"; // cosine in first quadrant
s2 #calc "$cy + ($r*sin(135.0))"; // sine

c3 #calc "$cz + ($r*cos(225.0))"; // cosine in first quadrant
s3 #calc "$cy + ($r*sin(225.0))"; // sine

c4 #calc "$cz + ($r*cos(315.0))"; // cosine in first quadrant
s4 #calc "$cy + ($r*sin(315.0))"; // sine

vertices
(

($cx $cy $nvz) //0
($h $cy $nvz) //1
($h $vy $cz) //2
($cx $vy $cz) //3
($cx $nvy $cz) //4
($h $nvy $cz) //5
($h $cy $vz) //6
($cz $cy $vz) //7

($cx $cy $cz) //8
($h $cy $cz) //9

);

blocks
(
    hex (8 4 0 8 9 5 1 9) (1 15 15) simpleGrading (1 1 1)
    hex (8 0 3 8 9 1 2 9) (1 15 15) simpleGrading (1 1 1)
    hex (8 3 7 8 9 2 6 9) (1 15 15) simpleGrading (1 1 1)
    hex (8 7 4 8 9 6 5 9) (1 15 15) simpleGrading (1 1 1)
);

edges
(

    arc 0 1 ($cx $s1 $c1)
    arc 1 2 ($cx $s2 $c2)
    arc 2 3 ($cx $s3 $c3)
    arc 3 0 ($cx $s4 $c4)
    
    arc 4 5 ($h $s1 $c1)
    arc 5 6 ($h $s2 $c2)
    arc 6 7 ($h $s3 $c3)
    arc 7 4 ($h $s4 $c4)
    
);
The error in terminal is:

Code:
Creating block edges
No non-planar block faces defined
Creating topology blocks
--> FOAM Warning : 
    From Foam::vector Foam::cellModel::centre(const labelList&, const Foam::UList<Foam::Vector<double> >&) const
    in file meshes/meshShapes/cellModel/cellModel.C at line 63
    zero or negative pyramid volume: -12487.5 for face 1
--> FOAM Warning : 
    From Foam::vector Foam::cellModel::centre(const labelList&, const Foam::UList<Foam::Vector<double> >&) const
    in file meshes/meshShapes/cellModel/cellModel.C at line 63
    zero or negative pyramid volume: -6243.75 for face 3
--> FOAM Warning : 
    From Foam::vector Foam::cellModel::centre(const labelList&, const Foam::UList<Foam::Vector<double> >&) const
    in file meshes/meshShapes/cellModel/cellModel.C at line 63
    zero or negative pyramid volume: -2868.75 for face 4
--> FOAM Warning : 
    From Foam::vector Foam::cellModel::centre(const labelList&, const Foam::UList<Foam::Vector<double> >&) const
    in file meshes/meshShapes/cellModel/cellModel.C at line 63
    zero or negative pyramid volume: -2868.75 for face 5


--> FOAM FATAL IO ERROR: (openfoam-2306)
Block hex (8 3 7 8 9 2 6 9) (1 15 15) grading (1(1) 1(1) 1(1)) has inward-pointing faces
    4(3 7 6 2) 4(8 9 6 7) 4(8 8 7 3) 4(9 2 6 9) 

file: system/blockMeshDict.blocks at line 68.

    From void Foam::blockDescriptor::check(const Foam::Istream&)
    in file blockDescriptor/blockDescriptor.C at line 147.

FOAM exiting
Any comments are welcome
MMRC is offline   Reply With Quote

Old   April 5, 2024, 07:46
Default
  #2
New Member
 
Matthias Renaud
Join Date: Jan 2023
Posts: 2
Rep Power: 0
MatthiasR is on a distinguished road
Hola Maria,


I see a few errors in your blockMeshDict file.


First I assume the cos and sin function to take angle in rad as inputs, you could also used sqrt(2) just as I did.


Second your vertex 7 in not defined correctly, it should be ($cx $cy $vz)
you wrote $cz instead.


And last all your edges are wrong, there should be no arc between vertices 0 and 1, 6 and 7, 4 and 5, 2 and 3. Below is my version of the blockMeshDict (it works):



Code:
scale 1;

cx 0.0;
cy 0.0;
cz 80.0;

height 3;

r 45;

h #calc "$height+$cx";

vz #calc "$cz+$r";
nvz #calc "$cz-$r";

vy #calc "$cy+$r";
nvy #calc "$cy-$r";

c1 #calc "$cz + ($r / sqrt(2.0))"; // cosine in first quadrant
s1 #calc "$cy + ($r / sqrt(2.0))"; // sine

c2 #calc "$cz - ($r / sqrt(2.0))"; // cosine in first quadrant
s2 #calc "$cy + ($r / sqrt(2.0))"; // sine

c3 #calc "$cz - ($r / sqrt(2.0))"; // cosine in first quadrant
s3 #calc "$cy - ($r / sqrt(2.0))"; // sine

c4 #calc "$cz + ($r / sqrt(2.0))"; // cosine in first quadrant
s4 #calc "$cy - ($r / sqrt(2.0))"; // sine

vertices
(
    ($cx $cy $nvz) //0
    ($h $cy $nvz) //1
    ($h $vy $cz) //2
    ($cx $vy $cz) //3
    ($cx $nvy $cz) //4
    ($h $nvy $cz) //5
    ($h $cy $vz) //6
    ($cx $cy $vz) //7

    ($cx $cy $cz) //8
    ($h $cy $cz) //9

);

blocks
(
    hex (8 4 0 8 9 5 1 9) (15 15 15) simpleGrading (1 1 1)
    hex (8 0 3 8 9 1 2 9) (15 15 15) simpleGrading (1 1 1)
    hex (8 3 7 8 9 2 6 9) (15 15 15) simpleGrading (1 1 1)
    hex (8 7 4 8 9 6 5 9) (15 15 15) simpleGrading (1 1 1)
);

edges
(

    arc 7 3 ($cx $s1 $c1)
    arc 6 2 ($h $s1 $c1)
    
    arc 3 0 ($cx $s2 $c2)
    arc 2 1 ($h $s2 $c2)
    
    arc 0 4 ($cx $s3 $c3) 
    arc 1 5 ($h $s3 $c3)
    
    arc 4 7 ($cx $s4 $c4)
    arc 5 6 ($h $s4 $c4)
    
);

Have a nice day,
Matthias
MatthiasR is offline   Reply With Quote

Old   April 5, 2024, 11:38
Default
  #3
Member
 
Marķa Rosales
Join Date: Mar 2023
Location: Spain
Posts: 48
Rep Power: 3
MMRC is on a distinguished road
MUCHAS GRACIAS Matthias,

The cylinder worked with your solution!

Here I share how the blockMesh would look like:
Code:


scale 1;

cx 0.0;
cy 0.0;
cz 80.0;

height 3;

r 45;

h #calc "$height+$cx";

vz #calc "$cz+$r";
nvz #calc "$cz-$r";

vy #calc "$cy+$r";
nvy #calc "$cy-$r";

c1 #calc "$cz + ($r / sqrt(2.0))"; // cosine in first quadrant
s1 #calc "$cy + ($r / sqrt(2.0))"; // sine

c2 #calc "$cz - ($r / sqrt(2.0))"; // cosine in first quadrant
s2 #calc "$cy + ($r / sqrt(2.0))"; // sine

c3 #calc "$cz - ($r / sqrt(2.0))"; // cosine in first quadrant
s3 #calc "$cy - ($r / sqrt(2.0))"; // sine

c4 #calc "$cz + ($r / sqrt(2.0))"; // cosine in first quadrant
s4 #calc "$cy - ($r / sqrt(2.0))"; // sine

vertices
(
    ($cx $cy $nvz) //0
    ($h $cy $nvz) //1
    ($h $vy $cz) //2
    ($cx $vy $cz) //3
    ($cx $nvy $cz) //4
    ($h $nvy $cz) //5
    ($h $cy $vz) //6
    ($cx $cy $vz) //7

    ($cx $cy $cz) //8
    ($h $cy $cz) //9

);

blocks
(
    hex (8 4 0 8 9 5 1 9) (15 15 1) simpleGrading (1 1 1)
    hex (8 0 3 8 9 1 2 9) (15 15 1) simpleGrading (1 1 1)
    hex (8 3 7 8 9 2 6 9) (15 15 1) simpleGrading (1 1 1)
    hex (8 7 4 8 9 6 5 9) (15 15 1) simpleGrading (1 1 1)
);

edges
(

    arc 7 3 ($cx $s1 $c1)
    arc 6 2 ($h $s1 $c1)

    arc 3 0 ($cx $s2 $c2)
    arc 2 1 ($h $s2 $c2)

    arc 0 4 ($cx $s3 $c3)
    arc 1 5 ($h $s3 $c3)

    arc 4 7 ($cx $s4 $c4)
    arc 5 6 ($h $s4 $c4)

);

boundary
(
    upwind
    {
        type patch;
        faces
        (
    (8 0 4 8)
    (8 3 0 8)
    (8 7 3 8)
    (8 4 7 8)
            
        );
    }
    sides
    {
        type patch;
        faces
        (
    (0 4 5 1)
    (7 6 2 3)
    (5 6 7 4)
    (3 2 1 0)
        );
    }
    leeward
    {
        type patch;
        faces
        (
    (9 6 5 9)
    (9 5 1 9)
    (9 1 2 9)
    (9 2 6 9)
        );
    }
    
);

mergePatchPairs
(
);
MMRC is offline   Reply With Quote

Reply

Tags
blockmesh, blockmesh cylinder, mesh


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with verification of transverse freely moving cylinder aakie OpenFOAM Running, Solving & CFD 4 August 3, 2019 10:01
[blockMesh] Cylinder mesh using blockMesh with m4 macro Lewis Liang OpenFOAM Meshing & Mesh Conversion 2 November 21, 2017 03:28
[ANSYS Meshing] uniform mesh, cylinder with a cut Matiasi ANSYS Meshing & Geometry 5 June 8, 2015 16:08
I need help about velocity vectors direction in cylinder modeling!!! aminepoxnet FLUENT 0 March 17, 2013 18:41
Drag on non-infinite cylinder between parallel walls deltaquattro Main CFD Forum 0 September 10, 2009 14:01


All times are GMT -4. The time now is 06:45.