|
[Sponsors] |
[PyFoam] Merge and Stitch meshes using pyFoam libraries |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
February 19, 2018, 08:04 |
Merge and Stitch meshes using pyFoam libraries
|
#1 |
Member
Shailesh BG
Join Date: Aug 2017
Location: Bangalore
Posts: 39
Rep Power: 9 |
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 is successful: 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") 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
__________________
Regards, Shailesh |
|
February 25, 2018, 12:56 |
|
#2 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
Code:
mergeRun=BasicRunner(argv=['mergeMeshes','-overwrite',muscleWork.name,tissueWork.name])
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request |
||
March 2, 2018, 07:01 |
|
#3 |
Member
Shailesh BG
Join Date: Aug 2017
Location: Bangalore
Posts: 39
Rep Power: 9 |
Hi Bernhard,
Thank you very much for your reply, this is working perfectly. Alternatively, I am using subprocess to call in the bash functions directly in python.
__________________
Regards, Shailesh |
|
Tags |
merge meshes, pyfoam, python script, snappyhexmesh, stitchmesh |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Merge and Stitch meshes using pyFoam libraries | shaileshbg | OpenFOAM Programming & Development | 1 | February 19, 2018 02:30 |
[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 |