CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Running, Solving & CFD (
-   -   Temperaturedependent material properties (

almanstoetter May 30, 2005 09:15

Hi, how can I use temperatu

how can I use temperature-dependent material properties in OpenFOAM given as ASCII data for thermal conductivity, viscosity at specific temperatures ? Is there a simple way to read in this data ?


hjasak May 30, 2005 22:04

You will need to write some co
You will need to write some code for it yourself. If you want to use straight interpolation between your data points, there's the "interpret graph" stuff - should be described in the manual.

However, the thermodynamicalProperties library contains a lot of pre-packaged temperature- and pressure-dependent material properties for liquids and gasses. Unless you're doing something pretty exotic, the chance is that the data (e.g. JANAF tables or similar) is already there, ready to use.



almanstoetter June 6, 2005 12:55

Sorry, but I can't find any "i
Sorry, but I can't find any "interpret graph" stuff in the manual.
Actually, I wanted to modify the laplacianFoam/flange example to use a temperature-dependent thermal conductivity for the solid, given as temperature/data pairs.
How can I change the scalar variable DT to represent thermal conductivity which is linear interpolated between the data points:

fvm::ddt(T) - fvm::laplacian(DT, T)

Gas or liquid properties are not applicable here.


hjasak June 7, 2005 09:50

Heya, In that case, you wil

In that case, you will need to make a field DT and fill it in yourself using the values form the lookup table.

Two things for you:

An example for the interpolation part from the graph (i.e. you give me a graph and an x and I give you a value) can be found in:


have a look at: engineValve.C, line 174:

Foam::scalar Foam::engineValve::lift(const scalar theta) const

return interpolateXY

Here, I calculate the crank angle such that it falls between the ends of the graph and then "read off" the graph value using interpolateXY. InterpolateXY lives in the sampling library in src.

Yo can also find examples on how I read in the graph etc in the same class.

The second bit yo need is to make a field and fill it in with values. It's is done like this (below).

In this function I make a temporary field and fill it with values of brick_.cpVapour - instead of this, you will be using interpolateXY. If you wish, you can make and fill in the field straight in the main code, avoiding the function and all this tmp field stuff.



Foam::tmp<foam::volscalarfield> Foam::brickState::cpVapour() const
tmp<volscalarfield> tcpVapour
new volScalarField

volScalarField& cp = tcpVapour();

scalarField& cpInternal = cp.internalField();
const scalarField& TInternal = T_.internalField();

forAll (cpInternal, cellI)
cpInternal[cellI] = brick_.cpVapour(TInternal[cellI]);

forAll (cp.boundaryField(), patchI)
scalarField& patchCp = cp.boundaryField()[patchI];

const scalarField& patchT = T_.boundaryField()[patchI];

forAll (patchCp, faceI)
patchCp[faceI] = brick_.cpVapour(patchT[faceI]);

return tcpVapour;

liugx212 December 5, 2005 15:33

Dear All: Could you help me
Dear All:

Could you help me see my code and errors. I do know what is wrong in it. Please give some advice.

// set the nu for each cell
116: volScalarField& nuInternal = nu.internalField();
forAll (nuInternal, celli)
if (componentValue[celli] > 0)
nuInternal[celli] = 0.3;
else nuInternal[celli] = 0.1;
// set the rho for each cell
125: volScalarField& rhoInternal = rho.internalField();
forAll (rhoInternal, celli)
if (componentValue[celli] > 0)
rhoInternal[celli] = 2000000;
else rhoInternal[celli] = 20000;

// set the E for each cell
134: volScalarField& EInternal = E.internalField();
forAll (EInternal, celli)
if (componentValue[celli] > 0)
EInternal[celli] = 7854;
else EInternal[celli] = 1000;

Error as:

stressedFoam.C:116: error: 'struct Foam::dimensionedScalar' has no member named 'internalField'
stressedFoam.C:125: error: 'struct Foam::dimensionedScalar' has no member named 'internalField'
stressedFoam.C:134: error: 'E' was not declared in this scope
stressedFoam.C:134: error: '<typeprefixerror>E' previously declared here

Thanks deeply,

marico April 23, 2009 07:48


has anyone done something like descibed above? I could need a temperature dependant viscosity (probably also conductivity)! (with topological changes...)


AnjaMiehe June 27, 2012 08:17

This thread is quite old, I know. For anyone crossing this while looking for "how to implement temperature dependent thermophysical properties and interpolate them on the mesh": the answer is given in this post:

Have fun, Anja

All times are GMT -4. The time now is 05:01.