|
[Sponsors] |
![]() |
![]() |
#1 |
Member
Dihao Tang
Join Date: Mar 2009
Posts: 78
Rep Power: 17 ![]() |
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! |
|
![]() |
![]() |
![]() |
![]() |
#2 |
Member
Dihao Tang
Join Date: Mar 2009
Posts: 78
Rep Power: 17 ![]() |
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.
|
|
![]() |
![]() |
![]() |
![]() |
#3 |
Member
E. David Huckaby
Join Date: Mar 2009
Posts: 57
Rep Power: 17 ![]() |
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:
thermo->Cp(); 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/hCombustionThermo /src/thermophysicalModels/combustion/mixtureThermos/hMixtureThermo and hhuMixtureThermo |
|
![]() |
![]() |
![]() |
![]() |
#4 |
Member
Dihao Tang
Join Date: Mar 2009
Posts: 78
Rep Power: 17 ![]() |
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.
|
|
![]() |
![]() |
![]() |
![]() |
#5 |
Member
E. David Huckaby
Join Date: Mar 2009
Posts: 57
Rep Power: 17 ![]() |
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 = db().lookupObject<basicthermo> I would guess that this functionality could be adapted for you problem to get the thermo object you need to get Cp. |
|
![]() |
![]() |
![]() |
![]() |
#6 |
New Member
Dihao Tang
Join Date: Mar 2009
Posts: 1
Rep Power: 0 ![]() |
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! |
|
![]() |
![]() |
![]() |
![]() |
#7 |
Member
Dihao Tang
Join Date: Mar 2009
Posts: 78
Rep Power: 17 ![]() |
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. |
|
![]() |
![]() |
![]() |
![]() |
#8 |
Member
E. David Huckaby
Join Date: Mar 2009
Posts: 57
Rep Power: 17 ![]() |
Great,
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. |
|
![]() |
![]() |
![]() |
![]() |
#9 |
Member
Dihao Tang
Join Date: Mar 2009
Posts: 78
Rep Power: 17 ![]() |
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 sicalModels.so: undefined reference to `Foam::specie::Tstd' /workdir/flux1/e7gast/OpenFOAM/OpenFOAM-1.3/lib/linuxGcc4DPOpt/libbasicThermophy sicalModels.so: undefined reference to `Foam::specie::RR' /workdir/flux1/e7gast/OpenFOAM/OpenFOAM-1.3/lib/linuxGcc4DPOpt/libbasicThermophy sicalModels.so: 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! |
|
![]() |
![]() |
![]() |
![]() |
#10 |
Member
Dihao Tang
Join Date: Mar 2009
Posts: 78
Rep Power: 17 ![]() |
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!
|
|
![]() |
![]() |
![]() |
![]() |
#11 |
Senior Member
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,714
Rep Power: 40 ![]() ![]() |
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? eg, hThermo<puremixture<sutherlandtransport<speciether mo<hconstthermo<perfectgas>>>> >; Thanks, /mark |
|
![]() |
![]() |
![]() |
![]() |
#12 |
Senior Member
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,906
Rep Power: 33 ![]() |
Heya,
(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. Enjoy, Hrv
__________________
Hrvoje Jasak Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk |
|
![]() |
![]() |
![]() |
![]() |
#13 |
Member
Dihao Tang
Join Date: Mar 2009
Posts: 78
Rep Power: 17 ![]() |
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 ( IOobject ( "Cp", mesh.time().timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE ), mesh, 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! |
|
![]() |
![]() |
![]() |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
DieselFoam and temperature out of janaf range | hoogland | OpenFOAM Running, Solving & CFD | 5 | January 28, 2016 12:30 |
Janaf Tables | Mark | Main CFD Forum | 2 | July 4, 2011 11:57 |
Inverted Janaf formula | gianpaolo | CFX | 2 | October 1, 2007 05:13 |