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

[blockMesh] A script for combining two blockMeshDict

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread 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: 17
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


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
[ICEM] ICEM CFD Replay Script Command ANSYS_Newbie ANSYS Meshing & Geometry 2 June 12, 2019 17:58
[ICEM] Script: problems with face names Maweil ANSYS Meshing & Geometry 3 April 16, 2019 09:10
Split connectors at their intersection FOUAD12 Pointwise & Gridgen 3 October 8, 2018 10:42
[Workbench] Run ICEM Script in Workbench Script MIZOR ANSYS Meshing & Geometry 9 April 4, 2018 07:45
CentFOAM Python Script Installation: Error socon009 OpenFOAM Installation 2 May 26, 2012 09:36


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