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

[blockMesh] Another cylinder question

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 5, 2015, 10:25
Default Another cylinder question
  #1
Member
 
Jeremy Dudley
Join Date: Jul 2010
Posts: 45
Rep Power: 16
bendel_boy is on a distinguished road
This time it is a cylinder in a cylinder.

The aim is to have the inner cylinder represent an inlet, discharging flow near the floor of the tank, across 1/8 of the tank diameter. The opposite 1/8 of the tank, at the surface, is where the flow discharges.

I have created vertices for three concentric circles (inlet radius, intermediate radius - to allow definition of a cleaning outlet - and outer wall) and at four depths (floor; top of inlet diffuser; base of outlet weir; tank surface)

When I run blockMesh I get a message to check the topology.

I have tried commenting out all the blocks but the first, and changing the vertex order from anti-clockwise to clockwise - but that has made no difference to the message.

The vertices for each circle are created as

(x y z)
(-x y z)
(-x -y z)
(x -y z)

where x = radius x cos(3 PI / 8), y = radius x sin(3 PI / 8), so that I get four points to define my intended inlet/outlet regions occupying 1/8 of the tank.
bendel_boy is offline   Reply With Quote

Old   January 5, 2015, 10:26
Default
  #2
Member
 
Jeremy Dudley
Join Date: Jul 2010
Posts: 45
Rep Power: 16
bendel_boy is on a distinguished road
Here is my full blockMeshDict. Fixed errors in my vertex/arc order, which meant that the hex blocks were not connected the way I had thought that they should be - but still has not resolved the error.

FoamFile
{version 2.0;
format ascii;
class dictionary;
object blockMeshDict;}
convertToMeters 1.0;
vertices (
( 0.382683429610802 0.92387953365215 0.0) // 0
(-0.382683429610802 0.92387953365215 0.0) // 1
(-0.382683429610802 -0.92387953365215 0.0) // 2
( 0.382683429610802 -0.92387953365215 0.0) // 3
( 0.574025144416202 1.38581930047823 0.0) // 4
(-0.574025144416202 1.38581930047823 0.0) // 5
(-0.574025144416202 -1.38581930047823 0.0) // 6
( 0.574025144416202 -1.38581930047823 0.0) // 7
( 2.52571059893575 6.09760483399617 0.0) // 8
(-2.52571059893575 6.09760483399617 0.0) // 9
(-2.52571059893575 -6.09760483399617 0.0) // 10
( 2.52571059893575 -6.09760483399617 0.0) // 11
( 0.382683429610802 0.92387953365215 1 ) // 12
(-0.382683429610802 0.92387953365215 1 ) // 13
(-0.382683429610802 -0.92387953365215 1 ) // 14
( 0.382683429610802 -0.92387953365215 1 ) // 15
( 0.574025144416202 1.38581930047823 1 ) // 16
(-0.574025144416202 1.38581930047823 1 ) // 17
(-0.574025144416202 -1.38581930047823 1 ) // 18
( 0.574025144416202 -1.38581930047823 1 ) // 19
( 2.52571059893575 6.09760483399617 1 ) // 20
(-2.52571059893575 6.09760483399617 1 ) // 21
(-2.52571059893575 -6.09760483399617 1 ) // 22
( 2.52571059893575 -6.09760483399617 1 ) // 23
( 0.382683429610802 0.92387953365215 2.5 ) // 24
(-0.382683429610802 0.92387953365215 2.5 ) // 25
(-0.382683429610802 -0.92387953365215 2.5 ) // 26
( 0.382683429610802 -0.92387953365215 2.5 ) // 27
( 0.574025144416202 1.38581930047823 2.5 ) // 28
(-0.574025144416202 1.38581930047823 2.5 ) // 29
(-0.574025144416202 -1.38581930047823 2.5 ) // 30
( 0.574025144416202 -1.38581930047823 2.5 ) // 31
( 2.52571059893575 6.09760483399617 2.5 ) // 32
(-2.52571059893575 6.09760483399617 2.5 ) // 33
(-2.52571059893575 -6.09760483399617 2.5 ) // 34
( 2.52571059893575 -6.09760483399617 2.5 ) // 35
( 0.382683429610802 0.92387953365215 3 ) // 36
(-0.382683429610802 0.92387953365215 3 ) // 37
(-0.382683429610802 -0.92387953365215 3 ) // 38
( 0.382683429610802 -0.92387953365215 3 ) // 39
( 0.574025144416202 1.38581930047823 3 ) // 40
(-0.574025144416202 1.38581930047823 3 ) // 41
(-0.574025144416202 -1.38581930047823 3 ) // 42
( 0.574025144416202 -1.38581930047823 3 ) // 43
( 2.52571059893575 6.09760483399617 3 ) // 44
(-2.52571059893575 6.09760483399617 3 ) // 45
(-2.52571059893575 -6.09760483399617 3 ) // 46
( 2.52571059893575 -6.09760483399617 3 ) // 47
);
blocks (
hex (1 0 4 5 13 12 16 17) ( 4 4 4 ) simpleGrading (1 1 1)
hex (6 2 1 5 18 14 13 17) ( 4 4 4 ) simpleGrading (1 1 1)
hex (2 3 7 6 14 15 19 18) ( 4 4 4 ) simpleGrading (1 1 1)
hex (7 3 0 4 19 15 12 16) ( 4 4 4 ) simpleGrading (1 1 1)
hex (5 4 8 9 17 16 20 21) ( 8 8 4 ) simpleGrading (1 1 1)
hex (10 6 5 9 22 18 17 21) ( 8 8 4 ) simpleGrading (1 1 1)
hex (6 7 11 10 18 19 23 22) ( 8 8 4 ) simpleGrading (1 1 1)
hex (11 7 4 8 23 19 16 20) ( 8 8 4 ) simpleGrading (1 1 1)
hex (13 12 16 17 25 24 28 29) ( 4 4 4 ) simpleGrading (1 1 1)
hex (18 14 13 17 30 26 25 29) ( 4 4 4 ) simpleGrading (1 1 1)
hex (14 15 19 18 26 27 31 30) ( 4 4 4 ) simpleGrading (1 1 1)
hex (19 15 12 16 31 27 24 28) ( 4 4 4 ) simpleGrading (1 1 1)
hex (17 16 20 21 29 28 32 33) ( 8 8 8 ) simpleGrading (1 1 1)
hex (22 18 17 21 34 30 29 33) ( 8 8 8 ) simpleGrading (1 1 1)
hex (18 19 23 22 30 31 35 34) ( 8 8 8 ) simpleGrading (1 1 1)
hex (23 19 16 20 35 31 28 32) ( 8 8 8 ) simpleGrading (1 1 1)
hex (25 24 28 29 37 36 40 41) ( 4 4 4 ) simpleGrading (1 1 1)
hex (30 26 25 29 42 38 37 41) ( 4 4 4 ) simpleGrading (1 1 1)
hex (26 27 31 30 38 39 43 42) ( 4 4 4 ) simpleGrading (1 1 1)
hex (31 27 24 28 43 39 36 40) ( 4 4 4 ) simpleGrading (1 1 1)
hex (29 28 32 33 41 40 44 45) ( 8 8 8 ) simpleGrading (1 1 1)
hex (34 30 29 33 46 42 41 45) ( 8 8 8 ) simpleGrading (1 1 1)
hex (30 31 35 34 42 43 47 46) ( 8 8 8 ) simpleGrading (1 1 1)
hex (35 31 28 32 47 43 40 44) ( 8 8 8 ) simpleGrading (1 1 1)
);
edges (
arc 0 1 ( 0 1 0.0)
arc 1 2 (-1 0.0 0.0)
arc 2 3 ( 0 -1 0.0)
arc 3 0 ( 1 0.0 0.0)
arc 4 5 ( 0 1.5 0 )
arc 5 6 (-1.5 0.0 0 )
arc 6 7 ( 0 -1.5 0 )
arc 7 4 ( 1.5 0.0 0 )
arc 8 9 ( 0 6.6 0 )
arc 9 10 (-6.6 0.0 0 )
arc 10 11 ( 0 -6.6 0 )
arc 11 8 ( 6.6 0.0 0 )
arc 12 13 ( 0 1 1 )
arc 13 14 (-1 0.0 1 )
arc 14 15 ( 0 -1 1 )
arc 15 12 ( 1 0.0 1 )
arc 16 17 ( 0 1.5 1 )
arc 17 18 (-1.5 0.0 1 )
arc 18 19 ( 0 -1.5 1 )
arc 19 16 ( 1.5 0.0 1 )
arc 20 21 ( 0 6.6 1 )
arc 21 22 (-6.6 0.0 1 )
arc 22 23 ( 0 -6.6 1 )
arc 23 20 ( 6.6 0.0 1 )
arc 24 25 ( 0 1 2.5 )
arc 25 26 (-1 0.0 2.5 )
arc 26 27 ( 0 -1 2.5 )
arc 27 24 ( 1 0.0 2.5 )
arc 28 29 ( 0 1.5 2.5 )
arc 29 30 (-1.5 0.0 2.5 )
arc 30 31 ( 0 -1.5 2.5 )
arc 31 28 ( 1.5 0.0 2.5 )
arc 32 33 ( 0 6.6 2.5 )
arc 33 34 (-6.6 0.0 2.5 )
arc 34 35 ( 0 -6.6 2.5 )
arc 35 32 ( 6.6 0.0 2.5 )
arc 36 37 ( 0 1 3 )
arc 37 38 (-1 0.0 3 )
arc 38 39 ( 0 -1 3 )
arc 39 36 ( 1 0.0 3 )
arc 40 41 ( 0 1.5 3 )
arc 41 42 (-1.5 0.0 3 )
arc 42 43 ( 0 -1.5 3 )
arc 43 40 ( 1.5 0.0 3 )
arc 44 45 ( 0 6.6 3 )
arc 45 46 (-6.6 0.0 3 )
arc 46 47 ( 0 -6.6 3 )
arc 47 44 ( 6.6 0.0 3 )
);
walls (
);
mergePatchPairs ();

Last edited by bendel_boy; January 5, 2015 at 13:10.
bendel_boy is offline   Reply With Quote

Old   January 5, 2015, 10:29
Default
  #3
Member
 
Jeremy Dudley
Join Date: Jul 2010
Posts: 45
Rep Power: 16
bendel_boy is on a distinguished road
And here are the diagnostics

Creating curved edges
Creating topology blocks
Creating topology patches

Check topology

Backtrace:
ZN10StackTraceC1Ev module: libstack_trace.dll
ZN4Foam9blockMesh13verboseOutputE module:\libblockMesh.dll
bendel_boy is offline   Reply With Quote

Old   January 5, 2015, 22:56
Default
  #4
Member
 
Jeremy Dudley
Join Date: Jul 2010
Posts: 45
Rep Power: 16
bendel_boy is on a distinguished road
If I add patches (); to my file the topology diagnostic clears.

But now I can do with help orienting my blocks as I move around the cylinder. I get the following messages:

Creating block mesh topology
--> FOAM Warning :
From function cellModel::mag(const labelList&, const pointField&)
in file meshes/meshShapes/cellModel/cellModel.C at line 128
zero or negative pyramid volume: -0.073657 for face 0
--> FOAM Warning :
From function cellModel::mag(const labelList&, const pointField&)
in file meshes/meshShapes/cellModel/cellModel.C at line 128
zero or negative pyramid volume: -0.073657 for face 1
--> FOAM Warning :
From function cellModel::mag(const labelList&, const pointField&)
in file meshes/meshShapes/cellModel/cellModel.C at line 128
zero or negative pyramid volume: -0.0883883 for face 2
--> FOAM Warning :
From function cellModel::mag(const labelList&, const pointField&)
in file meshes/meshShapes/cellModel/cellModel.C at line 128
zero or negative pyramid volume: -0.0589256 for face 3
--> FOAM Warning :
From function cellModel::mag(const labelList&, const pointField&)
in file meshes/meshShapes/cellModel/cellModel.C at line 128
zero or negative pyramid volume: -0.073657 for face 4
--> FOAM Warning :
From function cellModel::mag(const labelList&, const pointField&)
in file meshes/meshShapes/cellModel/cellModel.C at line 128
zero or negative pyramid volume: -0.073657 for face 5
--> FOAM Warning :
From function blockMesh::createTopology(IOdictionary&)
in file blockMesh/blockMeshTopology.C at line 255
negative volume block : 0, probably defined inside-out
--> FOAM Warning :
From function cellModel::mag(const labelList&, const pointField&)
in file meshes/meshShapes/cellModel/cellModel.C at line 128
zero or negative pyramid volume: -0.073657 for face 0
--> FOAM Warning :
From function cellModel::mag(const labelList&, const pointField&)
in file meshes/meshShapes/cellModel/cellModel.C at line 128
zero or negative pyramid volume: -0.073657 for face 1
--> FOAM Warning :
From function cellModel::mag(const labelList&, const pointField&)
in file meshes/meshShapes/cellModel/cellModel.C at line 128
zero or negative pyramid volume: -0.0589256 for face 2
--> FOAM Warning :
From function cellModel::mag(const labelList&, const pointField&)
in file meshes/meshShapes/cellModel/cellModel.C at line 128
zero or negative pyramid volume: -0.0883883 for face 3
--> FOAM Warning :
From function cellModel::mag(const labelList&, const pointField&)
in file meshes/meshShapes/cellModel/cellModel.C at line 128
zero or negative pyramid volume: -0.073657 for face 4
--> FOAM Warning :
From function cellModel::mag(const labelList&, const pointField&)
in file meshes/meshShapes/cellModel/cellModel.C at line 128
zero or negative pyramid volume: -0.073657 for face 5
--> FOAM Warning :
From function blockMesh::createTopology(IOdictionary&)
in file blockMesh/blockMeshTopology.C at line 255
negative volume block : 1, probably defined inside-out

Reading physicalType from existing boundary file

Default patch type set to empty
--> FOAM Warning :
From function polyMesh:olyMesh(... construct from shapes...)
in file meshes/polyMesh/polyMeshFromShapeMesh.C at line 888
Found 10 undefined faces in mesh; adding to default patch.

Check topology

Basic statistics
Number of internal faces : 1
Number of boundary faces : 10
Number of defined boundary faces : 10
Number of undefined boundary faces : 0
Checking patch -> block consistency

Creating block offsets
Creating merge list .

Creating polyMesh from blockMesh
Creating patches
Creating cells
Creating points with scale 1

Writing polyMesh
----------------
Mesh Information
----------------
boundingBox: (-1.5 -1.38582 0) (0.574025 1.5 1)
nPoints: 225
nCells: 128
nFaces: 464
nInternalFaces: 304
----------------
Patches
----------------
patch 0 (start: 304 size: 160) name: defaultFaces

End
bendel_boy is offline   Reply With Quote

Old   January 6, 2015, 06:06
Default
  #5
Member
 
Jeremy Dudley
Join Date: Jul 2010
Posts: 45
Rep Power: 16
bendel_boy is on a distinguished road
This file resolves my problem - I was stepping across the 'X' axis I was keeping my point ordering the same as for the +Y direction, rather than reflecting to start from the more 'negative Y' value

FoamFile
{version 2.0;
format ascii;
class dictionary;
object blockMeshDict;}
convertToMeters 1.0;
vertices (
( 0.382683429610802 0.92387953365215 0.0) // 0
(-0.382683429610802 0.92387953365215 0.0) // 1
(-0.382683429610802 -0.92387953365215 0.0) // 2
( 0.382683429610802 -0.92387953365215 0.0) // 3
( 0.574025144416202 1.38581930047823 0.0) // 4
(-0.574025144416202 1.38581930047823 0.0) // 5
(-0.574025144416202 -1.38581930047823 0.0) // 6
( 0.574025144416202 -1.38581930047823 0.0) // 7
( 2.52571059893575 6.09760483399617 0.0) // 8
(-2.52571059893575 6.09760483399617 0.0) // 9
(-2.52571059893575 -6.09760483399617 0.0) // 10
( 2.52571059893575 -6.09760483399617 0.0) // 11
( 0.382683429610802 0.92387953365215 1 ) // 12
(-0.382683429610802 0.92387953365215 1 ) // 13
(-0.382683429610802 -0.92387953365215 1 ) // 14
( 0.382683429610802 -0.92387953365215 1 ) // 15
( 0.574025144416202 1.38581930047823 1 ) // 16
(-0.574025144416202 1.38581930047823 1 ) // 17
(-0.574025144416202 -1.38581930047823 1 ) // 18
( 0.574025144416202 -1.38581930047823 1 ) // 19
( 2.52571059893575 6.09760483399617 1 ) // 20
(-2.52571059893575 6.09760483399617 1 ) // 21
(-2.52571059893575 -6.09760483399617 1 ) // 22
( 2.52571059893575 -6.09760483399617 1 ) // 23
( 0.382683429610802 0.92387953365215 2.5 ) // 24
(-0.382683429610802 0.92387953365215 2.5 ) // 25
(-0.382683429610802 -0.92387953365215 2.5 ) // 26
( 0.382683429610802 -0.92387953365215 2.5 ) // 27
( 0.574025144416202 1.38581930047823 2.5 ) // 28
(-0.574025144416202 1.38581930047823 2.5 ) // 29
(-0.574025144416202 -1.38581930047823 2.5 ) // 30
( 0.574025144416202 -1.38581930047823 2.5 ) // 31
( 2.52571059893575 6.09760483399617 2.5 ) // 32
(-2.52571059893575 6.09760483399617 2.5 ) // 33
(-2.52571059893575 -6.09760483399617 2.5 ) // 34
( 2.52571059893575 -6.09760483399617 2.5 ) // 35
( 0.382683429610802 0.92387953365215 3 ) // 36
(-0.382683429610802 0.92387953365215 3 ) // 37
(-0.382683429610802 -0.92387953365215 3 ) // 38
( 0.382683429610802 -0.92387953365215 3 ) // 39
( 0.574025144416202 1.38581930047823 3 ) // 40
(-0.574025144416202 1.38581930047823 3 ) // 41
(-0.574025144416202 -1.38581930047823 3 ) // 42
( 0.574025144416202 -1.38581930047823 3 ) // 43
( 2.52571059893575 6.09760483399617 3 ) // 44
(-2.52571059893575 6.09760483399617 3 ) // 45
(-2.52571059893575 -6.09760483399617 3 ) // 46
( 2.52571059893575 -6.09760483399617 3 ) // 47
);
blocks (
hex (1 0 4 5 13 12 16 17) ( 4 4 4 ) simpleGrading (1 1 1)
hex (6 2 1 5 18 14 13 17) ( 4 4 4 ) simpleGrading (1 1 1)
hex (6 7 3 2 18 19 15 14) ( 4 4 4 ) simpleGrading (1 1 1)
hex (7 4 0 3 19 16 12 15) ( 4 4 4 ) simpleGrading (1 1 1)
hex (5 4 8 9 17 16 20 21) ( 4 4 4 ) simpleGrading (1 1 1)
hex (10 6 5 9 22 18 17 21) ( 4 4 4 ) simpleGrading (1 1 1)
hex (10 11 7 6 22 23 19 18) ( 4 4 4 ) simpleGrading (1 1 1)
hex (11 8 4 7 23 20 16 19) ( 4 4 4 ) simpleGrading (1 1 1)
hex (13 12 16 17 25 24 28 29) ( 4 4 4 ) simpleGrading (1 1 1)
hex (18 14 13 17 30 26 25 29) ( 4 4 4 ) simpleGrading (1 1 1)
hex (18 19 15 14 30 31 27 26) ( 4 4 4 ) simpleGrading (1 1 1)
hex (19 16 12 15 31 28 24 27) ( 4 4 4 ) simpleGrading (1 1 1)
hex (17 16 20 21 29 28 32 33) ( 4 4 4 ) simpleGrading (1 1 1)
hex (22 18 17 21 34 30 29 33) ( 4 4 4 ) simpleGrading (1 1 1)
hex (22 23 19 18 34 35 31 30) ( 4 4 4 ) simpleGrading (1 1 1)
hex (23 20 16 19 35 32 28 31) ( 4 4 4 ) simpleGrading (1 1 1)
hex (25 24 28 29 37 36 40 41) ( 4 4 4 ) simpleGrading (1 1 1)
hex (30 26 25 29 42 38 37 41) ( 4 4 4 ) simpleGrading (1 1 1)
hex (30 31 27 26 42 43 39 38) ( 4 4 4 ) simpleGrading (1 1 1)
hex (31 28 24 27 43 40 36 39) ( 4 4 4 ) simpleGrading (1 1 1)
hex (29 28 32 33 41 40 44 45) ( 4 4 4 ) simpleGrading (1 1 1)
hex (34 30 29 33 46 42 41 45) ( 4 4 4 ) simpleGrading (1 1 1)
hex (34 35 31 30 46 47 43 42) ( 4 4 4 ) simpleGrading (1 1 1)
hex (35 32 28 31 47 44 40 43) ( 4 4 4 ) simpleGrading (1 1 1)
);
edges (
arc 0 1 ( 0 1 0.0)
arc 1 2 (-1 0.0 0.0)
arc 2 3 ( 0 -1 0.0)
arc 3 0 ( 1 0.0 0.0)
arc 4 5 ( 0 1.5 0 )
arc 5 6 (-1.5 0.0 0 )
arc 6 7 ( 0 -1.5 0 )
arc 7 4 ( 1.5 0.0 0 )
arc 8 9 ( 0 6.6 0 )
arc 9 10 (-6.6 0.0 0 )
arc 10 11 ( 0 -6.6 0 )
arc 11 8 ( 6.6 0.0 0 )
arc 12 13 ( 0 1 1 )
arc 13 14 (-1 0.0 1 )
arc 14 15 ( 0 -1 1 )
arc 15 12 ( 1 0.0 1 )
arc 16 17 ( 0 1.5 1 )
arc 17 18 (-1.5 0.0 1 )
arc 18 19 ( 0 -1.5 1 )
arc 19 16 ( 1.5 0.0 1 )
arc 20 21 ( 0 6.6 1 )
arc 21 22 (-6.6 0.0 1 )
arc 22 23 ( 0 -6.6 1 )
arc 23 20 ( 6.6 0.0 1 )
arc 24 25 ( 0 1 2.5 )
arc 25 26 (-1 0.0 2.5 )
arc 26 27 ( 0 -1 2.5 )
arc 27 24 ( 1 0.0 2.5 )
arc 28 29 ( 0 1.5 2.5 )
arc 29 30 (-1.5 0.0 2.5 )
arc 30 31 ( 0 -1.5 2.5 )
arc 31 28 ( 1.5 0.0 2.5 )
arc 32 33 ( 0 6.6 2.5 )
arc 33 34 (-6.6 0.0 2.5 )
arc 34 35 ( 0 -6.6 2.5 )
arc 35 32 ( 6.6 0.0 2.5 )
arc 36 37 ( 0 1 3 )
arc 37 38 (-1 0.0 3 )
arc 38 39 ( 0 -1 3 )
arc 39 36 ( 1 0.0 3 )
arc 40 41 ( 0 1.5 3 )
arc 41 42 (-1.5 0.0 3 )
arc 42 43 ( 0 -1.5 3 )
arc 43 40 ( 1.5 0.0 3 )
arc 44 45 ( 0 6.6 3 )
arc 45 46 (-6.6 0.0 3 )
arc 46 47 ( 0 -6.6 3 )
arc 47 44 ( 6.6 0.0 3 )
);
patches (
);
walls (
);
mergePatchPairs ();
bendel_boy is offline   Reply With Quote

Old   January 6, 2015, 06:09
Default
  #6
Member
 
Jeremy Dudley
Join Date: Jul 2010
Posts: 45
Rep Power: 16
bendel_boy is on a distinguished road
For completeness, this is the VBA code I was using to create the geometry.

Now to resolve the boundary patches!

Option Explicit

Sub CreateMesh()
Dim iFile As Long
Dim Ri As Single, Rs As Single, Ro As Single
Dim Hv As Single, Wh As Single, H As Single
Dim Hw As Single, theta As Single
Dim x As Single, y As Single

iFile = FreeFile
Open ThisWorkbook.Path & "\blockMeshDict" For Output As #iFile
Print #iFile, "FoamFile"
Print #iFile, "{version 2.0;"
Print #iFile, " format ascii;"
Print #iFile, " class dictionary;"
Print #iFile, " object blockMeshDict;}"

Ri = 1
Rs = 1.5
Ro = 6.6
Hv = 1
Wh = 0.5
H = 3

'
' Ri = inner radius
' Ro = outer radius
' Hv = Voluflow height
' Wh = Weir height
' Wv = Voluflow width
' Lw = Weir length
' H = Height

Hw = H - Wh ' Height to weir

' Create points
Print #iFile, "convertToMeters 1.0;"

Print #iFile, "vertices ("
' Cartesian coordinates (X Y Z)
Const PI = 3.1415926535
theta = 3 * PI / 8
' Feed point
Print #iFile, "("; Ri * Cos(theta); Ri * Sin(theta); " 0.0) // 0"
Print #iFile, "("; -Ri * Cos(theta); Ri * Sin(theta); " 0.0) // 1"
Print #iFile, "("; -Ri * Cos(theta); -Ri * Sin(theta); " 0.0) // 2"
Print #iFile, "("; Ri * Cos(theta); -Ri * Sin(theta); " 0.0) // 3"

' Sludge takeoff
' No hard data; assume opposite centre to inlet.
Print #iFile, "("; Rs * Cos(theta); Rs * Sin(theta); " 0.0) // 4"
Print #iFile, "("; -Rs * Cos(theta); Rs * Sin(theta); " 0.0) // 5"
Print #iFile, "("; -Rs * Cos(theta); -Rs * Sin(theta); " 0.0) // 6"
Print #iFile, "("; Rs * Cos(theta); -Rs * Sin(theta); " 0.0) // 7"

' Outer cylinder
Print #iFile, "("; Ro * Cos(theta); Ro * Sin(theta); " 0.0) // 8"
Print #iFile, "("; -Ro * Cos(theta); Ro * Sin(theta); " 0.0) // 9"
Print #iFile, "("; -Ro * Cos(theta); -Ro * Sin(theta); " 0.0) // 10"
Print #iFile, "("; Ro * Cos(theta); -Ro * Sin(theta); " 0.0) // 11"

' Feed top
Print #iFile, "("; Ri * Cos(theta); Ri * Sin(theta); Hv; ") // 12"
Print #iFile, "("; -Ri * Cos(theta); Ri * Sin(theta); Hv; ") // 13"
Print #iFile, "("; -Ri * Cos(theta); -Ri * Sin(theta); Hv; ") // 14"
Print #iFile, "("; Ri * Cos(theta); -Ri * Sin(theta); Hv; ") // 15"

Print #iFile, "("; Rs * Cos(theta); Rs * Sin(theta); Hv; ") // 16"
Print #iFile, "("; -Rs * Cos(theta); Rs * Sin(theta); Hv; ") // 17"
Print #iFile, "("; -Rs * Cos(theta); -Rs * Sin(theta); Hv; ") // 18"
Print #iFile, "("; Rs * Cos(theta); -Rs * Sin(theta); Hv; ") // 19"

Print #iFile, "("; Ro * Cos(theta); Ro * Sin(theta); Hv; ") // 20"
Print #iFile, "("; -Ro * Cos(theta); Ro * Sin(theta); Hv; ") // 21"
Print #iFile, "("; -Ro * Cos(theta); -Ro * Sin(theta); Hv; ") // 22"
Print #iFile, "("; Ro * Cos(theta); -Ro * Sin(theta); Hv; ") // 23"

' Weir base
Print #iFile, "("; Ri * Cos(theta); Ri * Sin(theta); Hw; ") // 24"
Print #iFile, "("; -Ri * Cos(theta); Ri * Sin(theta); Hw; ") // 25"
Print #iFile, "("; -Ri * Cos(theta); -Ri * Sin(theta); Hw; ") // 26"
Print #iFile, "("; Ri * Cos(theta); -Ri * Sin(theta); Hw; ") // 27"

Print #iFile, "("; Rs * Cos(theta); Rs * Sin(theta); Hw; ") // 28"
Print #iFile, "("; -Rs * Cos(theta); Rs * Sin(theta); Hw; ") // 29"
Print #iFile, "("; -Rs * Cos(theta); -Rs * Sin(theta); Hw; ") // 30"
Print #iFile, "("; Rs * Cos(theta); -Rs * Sin(theta); Hw; ") // 31"

Print #iFile, "("; Ro * Cos(theta); Ro * Sin(theta); Hw; ") // 32"
Print #iFile, "("; -Ro * Cos(theta); Ro * Sin(theta); Hw; ") // 33"
Print #iFile, "("; -Ro * Cos(theta); -Ro * Sin(theta); Hw; ") // 34"
Print #iFile, "("; Ro * Cos(theta); -Ro * Sin(theta); Hw; ") // 35"

' tank top
Print #iFile, "("; Ri * Cos(theta); Ri * Sin(theta); H; ") // 36"
Print #iFile, "("; -Ri * Cos(theta); Ri * Sin(theta); H; ") // 37"
Print #iFile, "("; -Ri * Cos(theta); -Ri * Sin(theta); H; ") // 38"
Print #iFile, "("; Ri * Cos(theta); -Ri * Sin(theta); H; ") // 39"

Print #iFile, "("; Rs * Cos(theta); Rs * Sin(theta); H; ") // 40"
Print #iFile, "("; -Rs * Cos(theta); Rs * Sin(theta); H; ") // 41"
Print #iFile, "("; -Rs * Cos(theta); -Rs * Sin(theta); H; ") // 42"
Print #iFile, "("; Rs * Cos(theta); -Rs * Sin(theta); H; ") // 43"

Print #iFile, "("; Ro * Cos(theta); Ro * Sin(theta); H; ") // 44"
Print #iFile, "("; -Ro * Cos(theta); Ro * Sin(theta); H; ") // 45"
Print #iFile, "("; -Ro * Cos(theta); -Ro * Sin(theta); H; ") // 46"
Print #iFile, "("; Ro * Cos(theta); -Ro * Sin(theta); H; ") // 47"

Print #iFile, ");"

' Create blocks
Print #iFile, "blocks ("
' Layer 1 - Floor to inlet top
WriteBlocks iFile, 0, 4, 4, 4 ' feed to sludge
WriteBlocks iFile, 4, 4, 4, 4 ' sludge to wall

' Layer 2 - inlet top to weir base
WriteBlocks iFile, 12, 4, 4, 4
WriteBlocks iFile, 12 + 4, 4, 4, 4

' Layer 3 - weir base to weir top
WriteBlocks iFile, 24, 4, 4, 4
WriteBlocks iFile, 24 + 4, 4, 4, 4

Print #iFile, ");"

' Create the circle quadrants
Print #iFile, "edges ("
Print #iFile, " arc 0 1 ("; 0; Ri; " 0.0)"
Print #iFile, " arc 1 2 ("; -Ri; " 0.0 "; " 0.0)"
Print #iFile, " arc 2 3 ("; 0; -Ri; " 0.0)"
Print #iFile, " arc 3 0 ("; Ri; " 0.0 "; " 0.0)"

Print #iFile, " arc 4 5 ("; 0; Rs; 0; ")"
Print #iFile, " arc 5 6 ("; -Rs; " 0.0 "; 0; ")"
Print #iFile, " arc 6 7 ("; 0; -Rs; 0; ")"
Print #iFile, " arc 7 4 ("; Rs; " 0.0 "; 0; ")"

Print #iFile, " arc 8 9 ("; 0; Ro; 0; ")"
Print #iFile, " arc 9 10 ("; -Ro; " 0.0 "; 0; ")"
Print #iFile, " arc 10 11 ("; 0; -Ro; 0; ")"
Print #iFile, " arc 11 8 ("; Ro; " 0.0 "; 0; ")"

Print #iFile, " arc 12 13 ("; 0; Ri; Hv; ")"
Print #iFile, " arc 13 14 ("; -Ri; " 0.0 "; Hv; ")"
Print #iFile, " arc 14 15 ("; 0; -Ri; Hv; ")"
Print #iFile, " arc 15 12 ("; Ri; " 0.0 "; Hv; ")"

' Arcs at Rs
Print #iFile, " arc 16 17 ("; 0; Rs; Hv; ")"
Print #iFile, " arc 17 18 ("; -Rs; " 0.0 "; Hv; ")"
Print #iFile, " arc 18 19 ("; 0; -Rs; Hv; ")"
Print #iFile, " arc 19 16 ("; Rs; " 0.0 "; Hv; ")"

Print #iFile, " arc 20 21 ("; 0; Ro; Hv; ")"
Print #iFile, " arc 21 22 ("; -Ro; " 0.0 "; Hv; ")"
Print #iFile, " arc 22 23 ("; 0; -Ro; Hv; ")"
Print #iFile, " arc 23 20 ("; Ro; " 0.0 "; Hv; ")"

Print #iFile, " arc 24 25 ("; 0; Ri; Hw; ")"
Print #iFile, " arc 25 26 ("; -Ri; " 0.0 "; Hw; ")"
Print #iFile, " arc 26 27 ("; 0; -Ri; Hw; ")"
Print #iFile, " arc 27 24 ("; Ri; " 0.0 "; Hw; ")"

Print #iFile, " arc 28 29 ("; 0; Rs; Hw; ")"
Print #iFile, " arc 29 30 ("; -Rs; " 0.0 "; Hw; ")"
Print #iFile, " arc 30 31 ("; 0; -Rs; Hw; ")"
Print #iFile, " arc 31 28 ("; Rs; " 0.0 "; Hw; ")"

' Arcs at Ro
Print #iFile, " arc 32 33 ("; 0; Ro; Hw; ")"
Print #iFile, " arc 33 34 ("; -Ro; " 0.0 "; Hw; ")"
Print #iFile, " arc 34 35 ("; 0; -Ro; Hw; ")"
Print #iFile, " arc 35 32 ("; Ro; " 0.0 "; Hw; ")"

Print #iFile, " arc 36 37 ("; 0; Ri; H; ")"
Print #iFile, " arc 37 38 ("; -Ri; " 0.0 "; H; ")"
Print #iFile, " arc 38 39 ("; 0; -Ri; H; ")"
Print #iFile, " arc 39 36 ("; Ri; " 0.0 "; H; ")"

Print #iFile, " arc 40 41 ("; 0; Rs; H; ")"
Print #iFile, " arc 41 42 ("; -Rs; " 0.0 "; H; ")"
Print #iFile, " arc 42 43 ("; 0; -Rs; H; ")"
Print #iFile, " arc 43 40 ("; Rs; " 0.0 "; H; ")"

Print #iFile, " arc 44 45 ("; 0; Ro; H; ")"
Print #iFile, " arc 45 46 ("; -Ro; " 0.0 "; H; ")"
Print #iFile, " arc 46 47 ("; 0; -Ro; H; ")"
Print #iFile, " arc 47 44 ("; Ro; " 0.0 "; H; ")"
Print #iFile, ");"

' Merge blocks

' Create boundary faces
Print #iFile, "patches ("
'Print #iFile, " patch inlet("
'Print #iFile, " ()"
'Print #iFile, " )"
'Print #iFile, " patch outlet("
'Print #iFile, " ()"
'Print #iFile, " )"
'Print #iFile, " patch sludge("
'Print #iFile, " ()"
'Print #iFile, " )"
Print #iFile, " );"

Print #iFile, "walls ("
Print #iFile, " );"

Print #iFile, "mergePatchPairs ();"
Close #iFile
End Sub

' NPR: Number of points in radial direction
' NPT: Number of points in tangential direction
' NPZ: Number of points in vertical direction
Sub WriteBlocks(iFile As Long, inc As Long, NPR As Long, NPT As Long, NPZ As Long)
Print #iFile, " hex (" & WriteHex("1 0 4 5 13 12 16 17", inc) & ")";
Print #iFile, " ("; NPR; NPT; NPZ; ")";
Print #iFile, " simpleGrading (1 1 1)"
Print #iFile, " hex (" & WriteHex("6 2 1 5 18 14 13 17", inc) & ")";
Print #iFile, " ("; NPR; NPT; NPZ; ")";
Print #iFile, " simpleGrading (1 1 1)"
Print #iFile, " hex (" & WriteHex("6 7 3 2 18 19 15 14", inc) & ")";
Print #iFile, " ("; NPR; NPT; NPZ; ")";
Print #iFile, " simpleGrading (1 1 1)"
Print #iFile, " hex (" & WriteHex("7 4 0 3 19 16 12 15", inc) & ")";
Print #iFile, " ("; NPR; NPT; NPZ; ")";
Print #iFile, " simpleGrading (1 1 1)"
End Sub

Function WriteHex(ByVal sLine As String, inc As Long) As String
Dim v As Variant
Dim i As Long
sLine = Trim$(sLine)
v = Split(sLine, " ")
sLine = ""
For i = LBound(v) To UBound(v)
sLine = sLine & v(i) + inc & " "
Next i
sLine = Trim$(sLine)
WriteHex = sLine
End Function
bendel_boy is offline   Reply With Quote

Reply

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
Flow pass 2D square cylinder using LES-channel 395 question Bashar OpenFOAM 1 January 8, 2021 02:53
Problem with verification of transverse freely moving cylinder aakie OpenFOAM Running, Solving & CFD 4 August 3, 2019 10:01
flow over a cylinder urgent! kevin FLUENT 8 August 11, 2015 14:00
Flow past rotating cylinder: Problem with ForeCoeffs raf1111 OpenFOAM 1 December 16, 2013 10:45
Solver and geometry choose for drag coefficient calculation around circular cylinder at large Re lin OpenFOAM Running, Solving & CFD 3 April 16, 2009 11:50


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