CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Native Meshers: blockMesh (http://www.cfd-online.com/Forums/openfoam-meshing-blockmesh/)
-   -   blockMeshDict for repeating geometry (http://www.cfd-online.com/Forums/openfoam-meshing-blockmesh/120205-blockmeshdict-repeating-geometry.html)

rama261 July 2, 2013 11:37

blockMeshDict for repeating geometry
 
I am starting to use openFoam. I am trying to solve the flow in a pump suction sump. There are 20 pump suction pipes drawing water from the sump, all spaced equally apart in a line and all of the same diameter. There is a thin solid wall midway between each pair of adjacent pipes and all the walls are of identical size. So the vertices of the blocks are of the same pattern. If I write down the vertices for one bay, is there a simple method to generate vertices for the other 19 bays? Would be grateful for an answer

Yosmcer July 20, 2013 04:31

A way to do it would be to use a m4 script that generate the blockMest file for you.

m4 is a macro processor under Linux systems.

I usually see it use with pearl for the calculations parts.

You can find some examples in the openFoam tutorials:
Code:

grep -r m4 $FOAM_TUTORIALS
You can define 'functions' that will make each operations you wants 20 time with the required space.

Example:
Code:

changecom(//)changequote([,]) dnl>
define(calc, [esyscmd(perl -E 'use Math::Trig; print ($1)')]) dnl>
define(VCOUNT, 0)
define(vlabel, [[// ]Vertex $1 = VCOUNT define($1, VCOUNT)define([VCOUNT], incr(VCOUNT))])

define(space, 10)

define(vertexb20, ($1    $2    $3)    vlabel(ba1$4)
($1    calc($2+space)    $3)    vlabel(ba2$4)
($1    calc($2+2*space)    $3)    vlabel(ba3$4)
($1    calc($2+3*space)    $3)    vlabel(ba4$4)
($1    calc($2+4*space)    $3)    vlabel(ba5$4)
($1    calc($2+5*space)    $3)    vlabel(ba6$4)
($1    calc($2+6*space)    $3)    vlabel(ba7$4)
($1    calc($2+7*space)    $3)    vlabel(ba8$4)
($1    calc($2+8*space)    $3)    vlabel(ba9$4)
($1    calc($2+9*space)    $3)    vlabel(ba10$4)
.
.
.
)

Of course take into consideration the possibility of symmetry to ease your work after.


Hope it is clear enough an that it helps.

(do not hesitate to suggest other ways that may be easiest).


All times are GMT -4. The time now is 21:20.