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

Merge and Stitch meshes using pyFoam libraries

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 13, 2018, 07:02
Default Merge and Stitch meshes using pyFoam libraries
  #1
Member
 
Shailesh BG
Join Date: Aug 2017
Location: Bangalore
Posts: 39
Rep Power: 9
shaileshbg is on a distinguished road
Hello Foamers,

Newbie to python and pyFoam, I am looking to automate my simulation using pyFoam libraries.
Problem Statement: I have two different bodies which I have meshed but I want to merge and then stitch the two meshes.

The meshing of my two regions muscle and tissue:
Code:
# Muscle Meshing
orig = SolutionDirectory(path.expandvars("muscle"), archive=None, paraviewLink=False)
work = orig.cloneCase("muscle1")

blockRun = BasicRunner(argv=["blockMesh", "-case", work.name], silent=True, server=False, writeState=False)
blockRun.start()
if not blockRun.runOK():
    error("There was a problem with blockMesh")

snapRun = BasicRunner(argv=["snappyHexMesh", "-case", work.name], silent=True, server=False, writeState=False)
snapRun.start()
if not snapRun.runOK():
    error("There was a problem with snappyHexMesh")

# Tissue Meshing
orig = SolutionDirectory(path.expandvars("tissue"), archive=None, paraviewLink=False)
work = orig.cloneCase("tissue1")

blockRun = BasicRunner(argv=["blockMesh", "-case", work.name], silent=True, server=False, writeState=False)
blockRun.start()
if not blockRun.runOK():
    error("There was a problem with blockMesh")

snapRun = BasicRunner(argv=["snappyHexMesh", "-case", work.name], silent=True, server=False, writeState=False)
snapRun.start()
if not snapRun.runOK():
    error("There was a problem with snappyHexMesh")
The bash equivalent of what I want to do:
Code:
runApplication mergeMeshes -overwrite . ../tissue/              # Merge tissue mesh onto the muscle mesh
runApplication stitchMesh -partial -toleranceDict toleranceDict -overwrite muscle_ext muscle_int   # partial stitch muscle patches per tolerance
cd 0
rm  meshPhi                           # remove meshPhi
cd ..
rm log.*                             # remove current merge and stitch logs
cd constant/polyMesh/                # move to constant polymesh to remove current zones
rm *Zones                            # remove all current zone files
rm meshModifiers                     # remove mesh modifiers
Any help would be greatly appreciated.
__________________
Regards,
Shailesh
shaileshbg is offline   Reply With Quote

Old   February 19, 2018, 02:30
Default
  #2
Member
 
Shailesh BG
Join Date: Aug 2017
Location: Bangalore
Posts: 39
Rep Power: 9
shaileshbg is on a distinguished road
Hi,

Could anyone please help me out with this.
__________________
Regards,
Shailesh
shaileshbg is offline   Reply With Quote

Reply


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
[blockMesh] How to merge blocks? Match, merge or stitch? gerritgroot OpenFOAM Meshing & Mesh Conversion 0 November 13, 2015 21:59
[blockMesh] Struggling to stitch or merge these blocks Jabo OpenFOAM Meshing & Mesh Conversion 1 November 7, 2014 05:39


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