CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Complex operations on scalar fields (https://www.cfd-online.com/Forums/openfoam-programming-development/220988-complex-operations-scalar-fields.html)

dplamp September 30, 2019 05:42

[SOLVED] Complex operations on scalar fields
 
My case involves heat and mass transfer (of some alcohol in an air stream). I modified scalarTransportFoam to add mass transfer in the form of a new scalar field called "C".



Now, I want to calculate, for every point in the mesh, the pressure of the vapor, the saturation pressure and ultimately the ratio of the two. These calculations involve exponential functions, with T and C as entry parameters.


I could not find any scalar field operators to do that. I was wondering if the sample utility combined with some external code (C or Python) could help me do that ?

joshm September 30, 2019 08:32

Quote:

Originally Posted by dplamp (Post 745856)
My case involves heat and mass transfer (of some alcohol in an air stream). I modified scalarTransportFoam to add mass transfer in the form of a new scalar field called "C".



Now, I want to calculate, for every point in the mesh, the pressure of the vapor, the saturation pressure and ultimately the ratio of the two. These calculations involve exponential functions, with T and C as entry parameters.


I could not find any scalar field operators to do that. I was wondering if the sample utility combined with some external code (C or Python) could help me do that ?

You could write a filed function object which uses that new scalar field. Checkout src/functionObjects/field/ for some examples.

dplamp October 22, 2019 02:12

Hi


I found a solution that suits me better than function objects : the post processing sampling utility, to sample scalar fields on a plane. Then, I can easily manipulate the data and do whatever calculation and plots I want, in my case with Python.


D.


All times are GMT -4. The time now is 13:40.