CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Native Meshers: blockMesh

A script for combining two blockMeshDict

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

Reply
 
LinkBack Thread Tools Display Modes
Old   August 26, 2009, 16:05
Smile A script for combining two blockMeshDict
  #1
New Member
 
Yingfeng Shen
Join Date: Mar 2009
Location: Finland
Posts: 8
Rep Power: 8
yingfeng is on a distinguished road
Sometimes I need to combine two blockMeshDict to create multi zone mesh or more complicated geometry. The vertex index in one of the dictionary has to be increased before you can copy and paste the text. Here is a short script I would like to share. Please feel free to improve and add more functionalities.

##/usr/bin/bash
# ./BlockMeshInc blockMeshDictUpper 100
#

if [ $# -eq 0 ]; then
echo 'Increase the point index of a BlockMeshDict for combining with another'
echo 'usage: BlockMeshInc blockMeshDict number'
exit 1
fi

sed -e 's/(\([0-9]\)/( \1/' -e 's/\([0-9]\))/\1 )/' $1 | \

awk -v N=$2 \
'
BEGIN {}
{if ($1=="hex") print "\t",$1,$2,$3+N,$4+N,$5+N,$6+N,$7+N,$8+N,$9+N,$10+ N,$11,$12,$13,$14,$15,$16,$17,$18}
{if ($1=="arc") print "\t",$1,$2+N,$3+N,$4,$5,$6,$7,$8}
{if ($1=="(" && $6 ==")") print "\t\t",$1,$2+N,$3+N,$4+N,$5+N,$6}
{if (NF==1 && $1!=");" || $1!=");" && $1!="(" && $1!="hex" && $1!="arc") print $0}
{if ($1=="(" && $5==")") print $0}
{if ($1==");") print $1}
END {}
yingfeng is offline   Reply With Quote

Reply

Tags
blockmeshdict, combining, merging

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
icem script prad CFX 5 July 23, 2010 16:30
Perl script for intialisation pratik mehta CFX 2 September 10, 2008 03:09
awk script question awk script question Main CFD Forum 0 March 28, 2005 02:06
linking the script Mavinakere FLUENT 0 September 12, 2002 11:57
TASCflow,problem with script and parallel mode Zbynek Hrncir CFX 0 October 2, 2001 07:30


All times are GMT -4. The time now is 15:31.