|
[Sponsors] |
November 22, 2021, 05:18 |
Post processing an internal plane/surface
|
#1 |
Member
Callum Guy
Join Date: Dec 2019
Location: Scotland
Posts: 44
Rep Power: 6 |
Hi Foamers,
I know there are a few threads on this but I am incredibly confused with them all and I know some of the information is outdated so I'm going to ask again. I'm generating very large case files on our server and I want to postProcess single planes of data for export. I have a very simple rectangular domain and I would like to "slice/cut plane/internal surface" (whatever you want to call it!) so I am taking the field data from central y-normal and x-normal planes and later view them in ParaView. Could anyone clarify (for dummies!) how to do this? I should mention I'm on v1912. Cheers, Callum |
|
November 24, 2021, 05:15 |
|
#2 |
Senior Member
|
Hi Callum,
There is a tutorial that uses the surfaces functionObject for this. Please have a look at: $FOAM_TUTORIALS/incompressible/pimpleFoam/RAS/propeller/ The relevant files are the controlDict and the surfaces files in the system folder. As you see, the surfaces file is read in the functions subDict of the controlDict. The example usage of the surfaces functionObject is described in the surfaces file. You would need to modify it towards your needs, but I think you should get it from there. Cheers, Tom Last edited by tomf; November 24, 2021 at 05:16. Reason: grammar |
|
December 14, 2021, 04:22 |
|
#3 |
Member
Callum Guy
Join Date: Dec 2019
Location: Scotland
Posts: 44
Rep Power: 6 |
Hi Tom,
thanks very much for your reply and the advice! For the benefit of others I ended up adding the following to my controlDict: Code:
functions { cuttingPlanes { type surfaces; outputControl timeStep; outputInterval 1; surfaceFormat vtk; fields (U alpha.water); interpolationScheme cellPoint; surfaces ( yplane { type cuttingPlane; planeType pointAndNormal; pointAndNormalDict { point (0 -5.5 0); normal (0 -1 0); } interpolate true; } xplane { type cuttingPlane; planeType pointAndNormal; pointAndNormalDict { point (5 0 0); normal (1 0 0); } interpolate true; } ); } } Code:
import os def main(): cutPlanesDir = "postProcessing/cuttingPlanes/" directories = os.listdir(cutPlanesDir) directories.sort() directories = [d for d in directories if "series" not in d] with open(cutPlanesDir+"yplane.vtp.series", 'w') as yf: yf.write("{\n") yf.write(" \"file-series-version\" : \"1.0\",\n") yf.write(" \"files\" : [\n") with open(cutPlanesDir+"yplane.vtp.series", 'a') as yf: for time in directories: if time != directories[-1]: yf.write(" { \"name\" : \""+time+"/yplane.vtp\", \"time\" : "+time+" },\n") else: yf.write(" { \"name\" : \""+time+"/yplane.vtp\", \"time\" : "+time+" }\n") yf.write(" ]\n") yf.write("}") with open(cutPlanesDir+"xplane.vtp.series", 'w') as yf: yf.write("{\n") yf.write(" \"file-series-version\" : \"1.0\",\n") yf.write(" \"files\" : [\n") with open(cutPlanesDir+"xplane.vtp.series", 'a') as yf: for time in directories: if time != directories[-1]: yf.write(" { \"name\" : \""+time+"/xplane.vtp\", \"time\" : "+time+" },\n") else: yf.write(" { \"name\" : \""+time+"/xplane.vtp\", \"time\" : "+time+" }\n") yf.write(" ]\n") yf.write("}") return if __name__ == "__main__": main() Callum |
|
December 14, 2021, 04:29 |
|
#4 |
Senior Member
|
Hi Callum,
Glad you got it working. Just a final hint (also for others) as there is a utility in OpenFOAM that can do the 'series' for you. It is called foamSequenceVTKFiles. If you have the .vtp extension it is invoked as: Code:
foamSequenceVTKFiles -vtp Cheers, Tom |
|
December 14, 2021, 05:29 |
|
#5 |
Member
Callum Guy
Join Date: Dec 2019
Location: Scotland
Posts: 44
Rep Power: 6 |
Excellent Tom!
I only wrote my own script because when I tried the command foamSequenceVTKFiles it didn't work, which I'm assuming is because I didn't use the flag '-vtp'. Brilliant! Merry Christmas Foamers!! |
|
December 16, 2021, 03:49 |
|
#6 | |
Senior Member
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,686
Rep Power: 40 |
Quote:
BTW: all of the machinery for generating vtk.series files is already in there (src/fileFormats) and it is most certainly being used for foamToVTK, for example. |
||
September 24, 2023, 14:57 |
|
#7 | |
Senior Member
Farzad Faraji
Join Date: Nov 2019
Posts: 204
Rep Power: 7 |
Thanks a lot for your explanation, it was helpful.
Farzad Quote:
|
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
wind turbine - post processing | er_ijaz | FLUENT | 0 | September 30, 2013 05:28 |
post processing for CEL expressions | Niru | CFX | 0 | May 10, 2013 13:13 |
Automated post processing using CFD Post | shreyasr | ANSYS | 0 | January 28, 2013 06:21 |
post processing in CFX11.0 | u k jha | CFX | 1 | September 17, 2010 05:53 |
post processing in CFD | MANISH BHARGAVA | Main CFD Forum | 0 | October 17, 1998 20:51 |