CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Post-Processing (https://www.cfd-online.com/Forums/openfoam-post-processing/)
-   -   Script to obtain "real" static pressure (pressure times density) (https://www.cfd-online.com/Forums/openfoam-post-processing/146763-script-obtain-real-static-pressure-pressure-times-density.html)

arnaud6 January 6, 2015 11:43

Script to obtain "real" static pressure (pressure times density)
 
Hello,

I am struggling with making the really easy scripting line which I am sure is very useful for all OpenFOAM users !
How to obtain the "real" static pressure from an openfoam incompressible solver ?
So performing p*density on the relevant lines.
Let's say in a bash line, it would be perfect :)!

for example, my "p" file looks like

PHP Code:

scalar
part
         1
hexa8
 6.11803e+02
 6.11877e+02
 6.11775e+02
 6.11666e+02 

and after using
Quote:

awk -F " " '{print $1*1.225}' p > p_output
PHP Code:

0
0
1.225
0
749.459
749.549
749.424
749.291 

While of course I would like to have

PHP Code:

scalar
part
         1
hexa8
  749.459
  749.549
  749.424
  749.291 

To have a p field still working in openfoam.

Any idea how to set this condition in awk ? Or using sed ? Or running something in openfoam ?

wyj216 May 5, 2021 09:22

If anybody comes to find solution here like me. I have tried out the simple way in OF2012

Code:

postProcess -func "staticPressure(p, pRef=**, rho=rhoInf, rhoInf=**)"
Just replace ** with the values you want. Results is then stored in static(p). I use this to transfer results from pimpleFoam to interPhaseChangeFoam.


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