CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Running, Solving & CFD (
-   -   JANAF (

tangd July 18, 2006 06:02

Hi all, I have a question rel
Hi all,
I have a question related to "janaf". I searched the janaf keyword in the message board and found that the janaf is aimed to handle some complicated boundary conditions. I guess it can be used to define the temperature dependent Cp, am I right? If so, how do I use it correctly? Thanks!

tangd July 19, 2006 03:20

Now I know how to use the jana
Now I know how to use the janaf table, which is described in Chapter 8.1 of user guide. But at the same time, a new question arises. Where is the computed value of Cp stored? Since I want to output the Cp value and use it for other purposes.

david_h July 19, 2006 08:47

If you look in "createFields.H
If you look in "createFields.H" from reactingFoam or one of the other combustion applications an instance of the thermodynamic class named "thermo" is created. The specific heat of the fluid can be extracted using:


Note that this calculates the specific heat of the mixture in contrast to other functions such as, thermo->h() or thermo->p(), which return references to internal variables of "thermo" or copy the data from the internal variables.

The relevant class definitions are in:
/src/thermophysicalModels/combustion/mixtureThermos/hMixtureThermo and hhuMixtureThermo

tangd July 19, 2006 09:39

Thanks for your quick reply. H
Thanks for your quick reply. Here I clarify my question more, I tried to implement the totalTemperature B.C. where the total temperature equation has the term Cp, so I want to extract the value of Cp from somewhere in the code. Since the code of my boundary condition locates in src/finiteVolume/fields/fvPatchFields/derivedFvPatchFields/timeVaryingUniformTot alPressure, if I used #include "createFields.H", it is obvious not correct. So I need to ask you further how I get the Cp value. Thank you so much for your help.

david_h July 19, 2006 10:50

If I understand your question,
If I understand your question, you need to find a way to get to the information from the "thermo" object into a "timeVaryingUniformTotalPressure" object.

The boundary conditions for enthalpy(h) require access to the thermo class since the boundary conditions are specified during model setup in terms of the species mass fractions and temperature. The function "fixedEnthalpyFvPatchScalarField::updateCoeffs ()" in the directory: "./src/thermophysicalModels/basic/derivedFvPatchFields"

has a statement which starts:

const basicThermo& thermo =

I would guess that this functionality could be adapted for you problem to get the thermo object you need to get Cp.

dihao July 19, 2006 12:59

Thanks for your information, I
Thanks for your information, I will try this functionality tomorrow.
Additionally, I'm thinking about the use of overloading operator, since I don't have any experience in C++. In totalPressure code, I found that the static pressure is represented by operator which is:
operator==(p0_/(1.0+0.5*psi*(1.0-pos(phip))*magSqr(Up))). So let's assume the operator is assigned a value, then this value should be also used by other objects. If it is the case, how is the value passed to other objects? I think the mechanism is somewhat similar to my case. Forgive my poor C++ skills. Thanks again by the way!

tangd July 20, 2006 08:37

Thanks, you are right! I inclu
Thanks, you are right! I included the basicThermo library into the Make/options, then I can pass value between two objects. For the sake of safety, can you check for me to see if it is right?

I implemented like this, first defined:

const basicThermo& thermo = db().lookupObject<basicthermo>

and then access the Cp by using thermo.Cp()(not ->, because thermo doesn't have this member). I inspected myself by outputting the Cp values while using different temperature values, I found the Cp value varied.

david_h July 20, 2006 10:39

Great, glad it works. You
glad it works.

You have to use the dot operator(".") because basicThermo is "reference" to an object. The "->" operator is for a "pointer" to an object.

tangd July 21, 2006 05:07

Unfortunately, there is a new
Unfortunately, there is a new problem due to the new inserted basicThermo library into the src/finiteVolume/Make/options, a lot of errors were created. One of them is listed below if I made recompilation:

g++ -m32 -Dlinux -DDP -Wall -W -Wno-unused-parameter -Wold-style-cast -O3 -DNoRepository -ftemplate-depth-30 -I/workdir/flux1/e7gast/OpenFOAM/OpenFOAM-1.3/src/finiteVolume/lnInclude -I/workdir/flux1/e7gast/OpenFOAM/OpenFOAM-1.3/src/OpenFOAM/lnInclude -IlnInclude -I. -fPIC -pthread Make/linuxGcc4DPOpt/sonicLiquidFoam.o -L/workdir/flux1/e7gast/OpenFOAM/OpenFOAM-1.3/lib/linuxGcc4DPOpt \
-lfiniteVolume -lOpenFOAM -liberty -o /workdir/flux1/e7gast/OpenFOAM/OpenFOAM-1.3/applications/bin/linuxGcc4DPOpt/soni cLiquidFoam
/workdir/flux1/e7gast/OpenFOAM/OpenFOAM-1.3/lib/linuxGcc4DPOpt/libbasicThermophy undefined reference to `Foam::specie::Tstd'
/workdir/flux1/e7gast/OpenFOAM/OpenFOAM-1.3/lib/linuxGcc4DPOpt/libbasicThermophy undefined reference to `Foam::specie::RR'
/workdir/flux1/e7gast/OpenFOAM/OpenFOAM-1.3/lib/linuxGcc4DPOpt/libbasicThermophy undefined reference to `Foam::perfectGas::perfectGas(Foam::Istream&)'
collect2: ld returned 1 exit status

It seems that this new insert affected a lot of objects. Sorry to bother you once again. Do you know how to fix this problem? Thank you very much!

tangd July 21, 2006 07:06

Hmmm, the problem is now solve
Hmmm, the problem is now solved which was caused by not including the libspecie. So it complained that "undefined reference to `Foam::specie::Tstd'". After adding this library in the make file, I restarted the Allwmake, now it looks fine!

olesen July 26, 2006 03:25

While we are on the topic of j
While we are on the topic of janaf ...

1) Is there a numerical/historical/philosophical reason that OpenFOAM uses a 5 coefficient form instead of the 7 coefficient JANAF form favoured by NASA Glenn?

2) Assuming that my viscosity variations are important and the Cp variants are secondary, is there any particular reason that the combination sutherlandTransport and hConstThermo are not defined?

hThermo<puremixture<sutherlandtransport<speciether mo<hconstthermo<perfectgas>>>> >;


hjasak July 26, 2006 03:39

Heya, (don't know the first

(don't know the first answer). On the second, the software is assembled throught templates for efficiency in this way and you should be able to instantiate any combination of models that you need to do. In short, the combination you mention has not been instantiated simply because nobody needed it so far - you should be able to do it yourself without problems.



tangd July 26, 2006 04:26

If I want the Cp value to be w
If I want the Cp value to be written into the time file, say "0.01", how do I change the code? I think I should use something similar to this structure which is found from hThermo.C:

const fvMesh& mesh = T_.mesh();

tmp<volscalarfield> tCp
new volScalarField
dimensionSet(0, 2, -2, -1, 0)

I tried to change IOobject::NO_WRITE into IOobject::AUTO_WRITE, but it doesn't work as I expected. Please give me some suggestion how to use it. Thanks!

All times are GMT -4. The time now is 19:26.