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

blockMesh flips x & y on adding to cylinder?

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 26, 2020, 01:01
Default blockMesh flips x & y on adding to cylinder?
  #1
New Member
 
Jnana Bhaskar Rao
Join Date: Mar 2020
Posts: 1
Rep Power: 0
jnanabrao is on a distinguished road
I'm trying to create a cylindrical domain with a inner cylinder and an outer shell (like insulation) with blockMesh in openfoam-6. I've defined all the vertices, curved edges and blocks required and I'm trying to get the domain;s cells along r and theta directions as per my requirement. I'm disabling parts of the code to get just the inner core initially. Later I'm trying to add a quarter of the outer shell. It appears that blockMesh switches the r and theta between the case with just the core vs the case with core+quarter shell. Initially i used curved edges to make the core with 4 blocks as follows:

vertices
(
(1 -1 0) //0
(-1 -1 0) //1
(-1 1 0) //2
(1 1 0) //3
(2 -2 0) //4
(-2 -2 0) //5
(-2 2 0) //6
(2 2 0) //7

(1 -1 4) //8
(-1 -1 4) //9
(-1 1 4) //10
(1 1 4) //11
(2 -2 4) //12
(-2 -2 4) //13
(-2 2 4) //14
(2 2 4) //15

(0 0 0) //16
(0 0 4) //17
);

edges
(
//curved boundaries inlet
//arc 4 5 (0 -2.828427125 0) //back
/*arc 5 6 (-2.828427125 0 0) //bottom
arc 6 7 (0 2.828427125 0) //front
arc 7 4 (2.828427125 0 0) //top*/

//curved boundaries outlet
//arc 12 13 (0 -2.828427125 4) //back
/*arc 13 14 (-2.828427125 0 4) //bottom
arc 14 15 (0 2.828427125 4) //front
arc 15 12 (2.828427125 0 4) //top*/

//curved boundaries inlet core
arc 0 1 (0 -1.414213562 0) //back
arc 1 2 (-1.414213562 0 0) //bottom
arc 2 3 (0 1.414213562 0) //front
arc 3 0 (1.414213562 0 0) //top

//curved boundaries outlet core
arc 8 9 (0 -1.414213562 4) //back
arc 9 10 (-1.414213562 0 4) //bottom
arc 10 11 (0 1.414213562 4) //front
arc 11 8 (1.414213562 0 4) //top
);

r 2; y 5; z 5;
R 2; Y 5; Z 5;
pr1 0.9;nr1 0.7;sr1 0.5;sr1a 2; pr2 0.1;nr2 0.3;sr2 0.25;sr2a 4;
blocks
(
hex (16 3 2 16 17 11 10 17) ($r $y $z) simpleGrading (1/*(($pr1 $nr1 $sr1)($pr2 $nr2 $sr2))*/ 1 1)
hex (16 2 1 16 17 10 9 17) ($r $y $z) simpleGrading (1/*(($pr1 $nr1 $sr1)($pr2 $nr2 $sr2))*/1 1)
hex (16 1 0 16 17 9 8 17) ($r $y $z) simpleGrading (1/*(($pr1 $nr1 $sr1)($pr2 $nr2 $sr2))*/ 1 1)
hex (16 0 3 16 17 8 11 17) ($r $y $z) simpleGrading (1/*(($pr1 $nr1 $sr1)($pr2 $nr2 $sr2))*/ 1 1)
//hex (5 4 0 1 13 12 8 9) ($R $Y $Z) simpleGrading (1/*(($pr2 $nr2 $sr2a)($pr1 $nr1 $sr1a)) */1 1)
// hex (6 5 1 2 14 13 9 10) ($R $Y $Z) simpleGrading (1/*(($pr2 $nr2 $sr2a)($pr1 $nr1 $sr1a))*/ 1 1)
// hex (7 6 2 3 15 14 10 11) ($R $Y $Z) simpleGrading (1/*(($pr2 $nr2 $sr2a)($pr1 $nr1 $sr1a)) */1 1)
// hex (4 7 3 0 12 15 11 8) ($R $Y $Z) simpleGrading (1/*(($pr2 $nr2 $sr2a)($pr1 $nr1 $sr1a))*/ 1 1)
);

boundary
(
inlet
{
type patch;
faces
(
(16 3 2 16)
(16 2 1 16)
(16 1 0 16)
(16 0 3 16)
//(5 4 0 1)
/*(6 5 1 2)
(7 6 2 3)
(4 7 3 0)*/
);
}

outlet
{
type patch;
faces
(
(17 11 10 17)
(17 10 9 17)
(17 9 8 17)
(17 8 11 17)
//(13 12 8 9)
/*(14 13 9 10)
(15 14 10 11)
(12 15 11 8)*/
);
}

wall
{
type wall;
faces
(
//(5 4 12 13)(0 4 12 8)(5 13 9 1)
/*(6 5 13 14)(1 5 13 9)(6 14 10 2)*/
/*(7 6 14 15)
(4 7 15 12)*/

);
}
);

The result is a uniform cylinder with x representing radial direction and y representing theta direction. See attachment initial.png

On adding a quarter shell block to the cylinder, and varying the number of cells in each direction, i get an inconsistent number of faces error unless i flip x to represent theta direction and y to represent radial direction as follows:

vertices
(
(1 -1 0) //0
(-1 -1 0) //1
(-1 1 0) //2
(1 1 0) //3
(2 -2 0) //4
(-2 -2 0) //5
(-2 2 0) //6
(2 2 0) //7

(1 -1 4) //8
(-1 -1 4) //9
(-1 1 4) //10
(1 1 4) //11
(2 -2 4) //12
(-2 -2 4) //13
(-2 2 4) //14
(2 2 4) //15

(0 0 0) //16
(0 0 4) //17
);

edges
(
//curved boundaries inlet
arc 4 5 (0 -2.828427125 0) //back
/*arc 5 6 (-2.828427125 0 0) //bottom
arc 6 7 (0 2.828427125 0) //front
arc 7 4 (2.828427125 0 0) //top*/

//curved boundaries outlet
arc 12 13 (0 -2.828427125 4) //back
/*arc 13 14 (-2.828427125 0 4) //bottom
arc 14 15 (0 2.828427125 4) //front
arc 15 12 (2.828427125 0 4) //top*/

//curved boundaries inlet core
arc 0 1 (0 -1.414213562 0) //back
arc 1 2 (-1.414213562 0 0) //bottom
arc 2 3 (0 1.414213562 0) //front
arc 3 0 (1.414213562 0 0) //top

//curved boundaries outlet core
arc 8 9 (0 -1.414213562 4) //back
arc 9 10 (-1.414213562 0 4) //bottom
arc 10 11 (0 1.414213562 4) //front
arc 11 8 (1.414213562 0 4) //top
);

r 5; y 5; z 5;
R 5; Y 8; Z 5;
pr1 0.9;nr1 0.7;sr1 0.5;sr1a 2; pr2 0.1;nr2 0.3;sr2 0.25;sr2a 4;
blocks
(
hex (16 3 2 16 17 11 10 17) ($r $y $z) simpleGrading (1/*(($pr1 $nr1 $sr1)($pr2 $nr2 $sr2))*/ 1 1)
hex (16 2 1 16 17 10 9 17) ($r $y $z) simpleGrading (1/*(($pr1 $nr1 $sr1)($pr2 $nr2 $sr2))*/1 1)
hex (16 1 0 16 17 9 8 17) ($r $y $z) simpleGrading (1/*(($pr1 $nr1 $sr1)($pr2 $nr2 $sr2))*/ 1 1)
hex (16 0 3 16 17 8 11 17) ($r $y $z) simpleGrading (1/*(($pr1 $nr1 $sr1)($pr2 $nr2 $sr2))*/ 1 1)
hex (5 4 0 1 13 12 8 9) ($R $Y $Z) simpleGrading (1/*(($pr2 $nr2 $sr2a)($pr1 $nr1 $sr1a)) */1 1)
// hex (6 5 1 2 14 13 9 10) ($R $Y $Z) simpleGrading (1/*(($pr2 $nr2 $sr2a)($pr1 $nr1 $sr1a))*/ 1 1)
// hex (7 6 2 3 15 14 10 11) ($R $Y $Z) simpleGrading (1/*(($pr2 $nr2 $sr2a)($pr1 $nr1 $sr1a)) */1 1)
// hex (4 7 3 0 12 15 11 8) ($R $Y $Z) simpleGrading (1/*(($pr2 $nr2 $sr2a)($pr1 $nr1 $sr1a))*/ 1 1)
);

boundary
(
inlet
{
type patch;
faces
(
(16 3 2 16)
(16 2 1 16)
(16 1 0 16)
(16 0 3 16)
//(5 4 0 1)
/*(6 5 1 2)
(7 6 2 3)
(4 7 3 0)*/
);
}

outlet
{
type patch;
faces
(
(17 11 10 17)
(17 10 9 17)
(17 9 8 17)
(17 8 11 17)
(13 12 8 9)
/*(14 13 9 10)
(15 14 10 11)
(12 15 11 8)*/
);
}

wall
{
type wall;
faces
(
(5 4 12 13)(0 4 12 8)(5 13 9 1)
/*(6 5 13 14)(1 5 13 9)(6 14 10 2)*/
/*(7 6 14 15)
(4 7 15 12)*/

);
}
);
The result is in the attachment final.png. Is this a limitation of blockMesh? I'm unable to modulate the number of cells along r and theta as per my requirement. I basically require the inner core to have a different number of cells along r and theta but am getting an inconsistent number of faces error between the core block and adjoining shell block.
Initial.png

final.png
jnanabrao is offline   Reply With Quote

Old   March 26, 2020, 03:49
Default
  #2
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,922
Rep Power: 34
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Hi,

Yes, it is a limitation of blockMesh (or to be more precise, of the way, you are building the mesh).

If you need two regions with different mesh densities in theta direction, you create them separately (i.e. points of the inner mesh differ from the points of outer shell). Then, if you need single-region mesh, you can use either mergePatchPairs, or stitchMesh to merge inner-outer and outer-inner patches.

Alternatively you can try to use two-region mesh with AMI patches.
alexeym is offline   Reply With Quote

Reply

Tags
blockmesh boundary layers, blockmesh cylinder

Thread Tools Search this Thread
Search this Thread:

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
[blockMesh] Hole in a cylinder / T-junction of two cylinders using blockMesh anuragm OpenFOAM Meshing & Mesh Conversion 4 March 2, 2018 08:36
[blockMesh] How to create a T-junction cylinder with blockMesh Blanca OpenFOAM Meshing & Mesh Conversion 1 February 24, 2018 06:24
chtMultiRegionSimpleFoam: crash on parallel run student666 OpenFOAM Running, Solving & CFD 3 April 20, 2017 11:05
Forces Acting on a Rotating Cylinder (Moving Mesh) dreamchaser CFX 5 April 25, 2015 06:01
[blockMesh] how to create a circular cylinder with blockMesh? jishnu25 OpenFOAM Meshing & Mesh Conversion 1 November 12, 2014 16:40


All times are GMT -4. The time now is 01:03.