Difference between revisions of "HowTo postProcMultiregion"
AntonChupin (Talk | contribs) |
m (Changed internal links, since the "app_" prefix ended up not being used... Fixed a few typos as well) |
||
Line 1: | Line 1: | ||
− | Current versions of [[ | + | Current versions of [[paraFoam]] don't support the postprocessing of simulations that use multiple mesh-regions (like [[contrib_icoStructFoam|icoStructFoam]] or [[Tut Small Study on Conjugate Heat Transfer|the conjugated heat transfer solver]]. This describes ways to cope with that shortcoming. |
− | == Using [[ | + | == Using [[ParaView]] == |
− | To write the data of the two regions for [[ | + | To write the data of the two regions for [[ParaView]] just use [[foamToVTK]]: |
foamToVTK . icoStructFoamTest -mesh region1 | foamToVTK . icoStructFoamTest -mesh region1 | ||
Line 21: | Line 21: | ||
(the last has to be done for every time-step) | (the last has to be done for every time-step) | ||
− | Now create a stub in one case (<tt>touch meshCase2/meshCase2.foam</tt>), open the other case from the command line (<tt>paraFoam . meshCase1</tt>), in that [[ | + | Now create a stub in one case (<tt>touch meshCase2/meshCase2.foam</tt>), open the other case from the command line (<tt>paraFoam . meshCase1</tt>), in that [[paraFoam]] open the stub you created using the File->Open-dialog. |
=== Example script === | === Example script === |
Revision as of 12:19, 29 August 2015
Current versions of paraFoam don't support the postprocessing of simulations that use multiple mesh-regions (like icoStructFoam or the conjugated heat transfer solver. This describes ways to cope with that shortcoming.
1 Using ParaView
To write the data of the two regions for ParaView just use foamToVTK:
foamToVTK . icoStructFoamTest -mesh region1 foamToVTK . icoStructFoamTest -mesh region2
2 Generating pseudo case-directories
An alternative Way was described on the Message board:
Basically what you do is create two cases that point to the real data.
Suppose you have your case in aTaleOfTwoMeshes. Create two directories meshCase1, meshCase2. For each directory create these links:
meshCaseX/system -> aTaleOfTwoMeshes/system meshCaseX/constant/polyMesh -> aTaleOfTwoMeshes/constant/regionX/polyMesh meshCaseX/0 -> aTaleOfTwoMeshes/0/regionX
(the last has to be done for every time-step)
Now create a stub in one case (touch meshCase2/meshCase2.foam), open the other case from the command line (paraFoam . meshCase1), in that paraFoam open the stub you created using the File->Open-dialog.
2.1 Example script
An example for the implementation of this strategy would be this script written in Python using the PyFoam-library:
#! /usr/bin/python from os import mkdir,path,symlink,system,listdir import sys from PyFoam.RunDictionary.SolutionDirectory import SolutionDirectory def buildCase(original,region): dirName=original+"."+region case=path.basename(original) print "Creating pseudocase",dirName system("rm -rf "+dirName) mkdir(dirName) mkdir(path.join(dirName,"constant")) symlink(path.join(path.pardir,path.pardir,case,"constant",region,"polyMesh"), path.join(dirName,"constant","polyMesh")) symlink(path.join(path.pardir,case,"system"), path.join(dirName,"system")) sol=SolutionDirectory(original) for t in sol.getTimes(): symlink(path.join(path.pardir,case,t,region), path.join(dirName,t)) return dirName caseName=sys.argv[1] if caseName[-1]==path.sep: caseName=caseName[:-1] firstRegion=None for region in listdir(path.join(caseName,"constant")): name=buildCase(caseName,region) if not firstRegion: firstRegion=name else: f=open(path.join(name,path.basename(name)+".foam"),"w") f.close() print "\n\n Open first region with \"paraFoam %s %s\".\n All others from the File menu" % (path.normpath(path.dirname(firstRegion)),path.basename(firstRegion))
It can be used like this (if it saved to buildRegionPseudocases.py):
python buildRegionPseudocases.py thingOnAStick
It builds the directories for the regions it finds.
Note: I'm well aware that there are shorter ways to write this script, but I like the thought that it should work on Windows should I ever have the misfortune to work on that OS