CFD Online Logo CFD Online URL
Home > Forums > OpenFOAM Native Meshers: blockMesh

blockMeshDict for repeating geometry

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

LinkBack Thread Tools Display Modes
Old   July 2, 2013, 11:37
Default blockMeshDict for repeating geometry
New Member
Rama Prasad
Join Date: Apr 2013
Posts: 5
Rep Power: 6
rama261 is on a distinguished road
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
rama261 is offline   Reply With Quote

Old   July 20, 2013, 04:31
Yosmcer Mocktai
Join Date: Apr 2013
Location: Behind a computer
Posts: 48
Rep Power: 10
Yosmcer will become famous soon enough
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:
grep -r m4 $FOAM_TUTORIALS
You can define 'functions' that will make each operations you wants 20 time with the required space.

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).
Yosmcer is offline   Reply With Quote


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Import geometry from CAD Giuseppe (Giuseppe) OpenFOAM Pre-Processing 34 December 14, 2017 17:24
Problem Importing Geometry ProE to CFX fatb0y CFX 3 January 14, 2012 20:42
2D geometry to 3D geometry Sgonzalezg ANSYS Meshing & Geometry 11 April 8, 2011 11:02
SnappyHexMesh meshes inside and outside of an STL geometry villier OpenFOAM Mesh Utilities 17 June 15, 2010 19:51
[GAMBIT] import terrain geometry cfdworker ANSYS Meshing & Geometry 2 May 24, 2009 21:40

All times are GMT -4. The time now is 02:24.