|
[Sponsors] |
June 26, 2019, 21:12 |
Logging/writing postProcess values
|
#1 |
Senior Member
Brett
Join Date: May 2013
Posts: 216
Rep Power: 14 |
Hey foamers,
I've got a simulation where I'm interested in knowing information at the patches once its converged. I know how to do this in the command line, for example: postProcess -func 'patchAverage(name=outlet,p,U)' -latestTime will give me the patch average of pressure and velocity on the patch 'outlet'. All good. However how do I get it to log/write this information to a text file? What if I wanted to repeat this command for several other patches and have their information recorded in the same log file?? Any thoughts?? |
|
June 27, 2019, 05:53 |
|
#2 |
Senior Member
Zander Meiring
Join Date: Jul 2018
Posts: 125
Rep Power: 8 |
in linux, having a > at the end of a command tells it to write to a file rather than a terminal. If it's a two of them (ie: >>) then it only appends to a file, instead of rewriting.
So to accomplish what you want: postProcess -func 'patchAverage(name=outlet,p,U)' -latestTime > output and it will create the file called output, and write in there instead of terminal. Alternatively, look into adding functions in your control dict. For patch averaging for example, you'd want something along the lines of this at the bottom of your controldict file: Code:
functions { patchAverage { #includeEtc "caseDicts/postProcessing/surfaceFieldValue/surfaceRegion.cfg" operation areaAverage; fields (p, U); writeControl runTime; writeInterval 1; } } |
|
June 28, 2019, 01:20 |
|
#3 |
Senior Member
Brett
Join Date: May 2013
Posts: 216
Rep Power: 14 |
Thanks for that!
That's definitely the nicest response I've ever had, usually people just pick out what they think is wrong with your comment! I'm using OpenFoam on windows, are the arrows ( >, >> ) still the same? I wonder if you could elaborate a bit more on: #includeEtc "caseDicts/postProcessing/surfaceFieldValue/surfaceRegion.cfg" Thanks heaps again |
|
July 1, 2019, 06:00 |
|
#4 | |
Senior Member
Zander Meiring
Join Date: Jul 2018
Posts: 125
Rep Power: 8 |
Quote:
the include grabs the file within the quotation marks from the directory 'etc', which is located in your openFoam install file path. Most of these type of postProcessing scripts are small scripts built up on top of each other, and the key is finding one you are interested in. My recommendation is to navigate to this folder. Within it, there are files with a .cfg extension, and files with no extension (at least that's the case on linux). These extensionless ones show demonstrations of how to use different post processing functions. For example, in postProcessing/surfaceFieldValue/ there is a file called 'patchAverage' which contains: Code:
/*--------------------------------*- C++ -*----------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Web: www.OpenFOAM.com \\/ M anipulation | ------------------------------------------------------------------------------- Description Calculates the average value of one or more fields on a patch. \*---------------------------------------------------------------------------*/ name <patchName>; fields (<field names>); operation average; #includeEtc "caseDicts/postProcessing/surfaceFieldValue/patch.cfg" // ************************************************************************* // |
||
Tags |
openfaom, postprocess, scripting |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
TimeVaryingMappedFixedValue | irishdave | OpenFOAM Running, Solving & CFD | 32 | June 16, 2021 07:55 |
using chemkin | JMDag2004 | OpenFOAM Pre-Processing | 2 | March 8, 2016 23:38 |
Velocity values are normal but pressure values are too big | rv82 | OpenFOAM Running, Solving & CFD | 4 | April 13, 2015 04:59 |
Setting patch field values equal to internal field values | leroyv | OpenFOAM Programming & Development | 1 | October 21, 2014 16:49 |
Plotting raw data values | Wilesco | Siemens | 0 | January 5, 2006 06:34 |