CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Calculating Density in ParaView (https://www.cfd-online.com/Forums/openfoam-solving/228526-calculating-density-paraview.html)

mahsankhan July 4, 2020 13:06

Calculating Density in ParaView
 
Dear Users,

Can someone please help with how to get the density in ParaView?
I am using interMixingFoam solver of OpenFOAM, and the parameters I get after the run are p, p_rgh, U, alpha.water, alpha.air, alpha.other, nut, nuTilda... but there is no rho for the density...

I want to have a density profile since my density in the domain changes as two fluids mix together. Can I get it somehow? Is there a way to achieve that?

I tried to use the calculator filter with (p-p_rgh)/(9.81*coordsZ) but this gives huge values at the bottom of the domain, probably due to a "zero" in the denominator... can someone please help me with this issue...?

Thanks a lot in advance :)

Have a good day!!!

jherb July 20, 2020 19:43

You should be able to write rho with a writeObjects function object: https://www.openfoam.com/documentati...teObjects.html

mahsankhan May 27, 2021 08:50

Alternate and faster solution
 
Quote:

Originally Posted by jherb (Post 778296)
You should be able to write rho with a writeObjects function object: https://www.openfoam.com/documentati...teObjects.html


Thank you for your reply. :)
However, what you suggested would need the simulation to start over again. There exist another option:
Once you have run the OpenFOAM simulation, just open it in ParaView and apply the calculator filter like this (-p+p_rgh)/(9.81*(CoordZ)) and this will give you the density for the whole domain.

Tobermory May 28, 2021 10:13

Quote:

Originally Posted by mahsankhan (Post 804793)
Thank you for your reply. :)
However, what you suggested would need the simulation to start over again.

No - you misunderstood jherb - just run the solver with the -postProcess flag and the writeObjects func, and it will spit out the field for you without running any more of the simulation. Eg.:

Code:

someFoamSolver -postProcess -latestTime -func "writeObjects(h, rho)"


All times are GMT -4. The time now is 18:04.