CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (http://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   accessing thermophysical properties on a lower level (http://www.cfd-online.com/Forums/openfoam-programming-development/125383-accessing-thermophysical-properties-lower-level.html)

romant October 24, 2013 10:20

accessing thermophysical properties on a lower level
 
Hej,

I have a question about the accessing thermophysical properties on a lower level than the ones given.

I would like to obtain for example rho at a certain temperature, which is not the cell temperature, therefore I can't use the normal approach via
Code:

volScalarField rho = thermo.rho();
or similar, since this gives me only access to the whole field (or sub fields later on).

I would like to be able to just obtain rho, without a specific cell attached to it, similar to
Code:

scalar rho = thermo.rho(pressure, temperature);
in order to use it as a iteration value in a function.

I know that these functions exist in the thermophysical properties like icoPolynomial, however, they are not accessible, since this class is templated into heRhoThermo, which does not provide these functions, as far as I can see.

Does anybody have an idea on how to access this?

Chris Lucas October 25, 2013 03:32

Hi,

as far as I know, this is not possible without some minor changes. I still use OF2.1 so you must find the equivalent file in OF2.2.

An easy way is to add a dummy function in the thermo class called by the solver (e.g. basicPsiThermo), which returns the value if the class already knows the fields and has access to the mixture class (this is not true for basicPsiThermo). If not, return a dummy value. Then, in the real thermo classes (e.g. hPsiThermo) you redefine the function (function overload) so that the correct value is returned.

Have a look at my realGasThermo library. In basicPsiThermo I added an additional function so that the solver gets access to the new fields.


Christian

dkxls October 25, 2013 12:06

Depends on your mixture type. If your thermo class is a 'basicMultiComponentMixture', then you should have (or can add) in your solver something like this:
Code:

    basicMultiComponentMixture& composition = thermo.composition();
and you get the per species thermo properties like this:
Code:

    scalar rhoSpecie0 = composition.rho(0, 1e5, 273.15);
For a 'basicMixture', i.e. single component mixture, this doesn't work anymore. So you would need some own coding.

May I ask what you want to do with the "raw" thermo data?

romant October 28, 2013 05:15

Quote:

Originally Posted by dkxls (Post 459024)
Depends on your mixture type. If your thermo class is a 'basicMultiComponentMixture', then you should have (or can add) in your solver something like this:
Code:

    basicMultiComponentMixture& composition = thermo.composition();
and you get the per species thermo properties like this:
Code:

    scalar rhoSpecie0 = composition.rho(0, 1e5, 273.15);
For a 'basicMixture', i.e. single component mixture, this doesn't work anymore. So you would need some own coding.

May I ask what you want to do with the "raw" thermo data?


I am trying to implement advanced wall functions, for which I need the thermophysical properties of the fluid in points at a distance y away from the wall. This distance y does not correspond to a fixed point in the grid space. It could be the edge of the thermal or momentum sublayer, for which I have a temperature and then need the the thermophysical properties of the fluid.

dkxls October 28, 2013 09:25

Sorry, I not really familiar with wall function modeling. So, no further ideas...


All times are GMT -4. The time now is 15:34.