CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Programming & Development (
-   -   how to use current t, rho and species for calculations (

marcbest June 28, 2010 11:05

how to use current t, rho and species for calculations
Hello Foamers,

i want to implement a new absorptionEmission Modell for P1-Modell in OpenFoam 1.5 similar to "greyMeanAbsorptionEmission" in openfoam 1.6.

for this i want to calculate the partial pressure of a species with the equations (in words):
moleweigth: mw = density *8314.5 * temperature / pressure
partial pressure: p_CH4 = massfraction_CH4 (mw / mw_CH4 ) * pressure / 10^5

how can i get the values of T, p, rho and Yi to do this calculation?

Thanks in advance


marcbest June 29, 2010 06:03

ok the partial pressure can simplified be calculated as
pi = Yi * p

but which objects must be included and how is the correct definition of T, p and Yi ?

do i need hMixtureThermo.H or basicThermo.H?

marcbest July 2, 2010 03:11

i think i could help myself. in the .H-file i added for T and p

#include "basicThermo.H"

and under private:

const basicThermo& thermo_;

for the .C-file

i added to construstors

thermo_(mesh.lookupObject<basicThermo>("thermophys icalProperties"))

in the member functions, i allocated T and p

const volScalarField& T = thermo_.T();
const volScalarField& p = thermo_.p();

as well as the following for species

const volScalarField& CH4 = mesh.lookupObject<volScalarField>(CH4);

for calculations of the partial pressure,

forAll (..., celli)

p_ch4 = CH4[celli] * p[celli]/(1E+5);


(T was used for another calculation)

if experienced programmers know a better way to do this calculation, please tell me

shajitah September 16, 2010 13:59

Hi Marc,

I've encountered a problem which is similar to yours.

Actually, the solver (alternateSteadyReactingFoam) I'm working on is only executable under OpenFOAM 1.5, and as you know this version of OpenFOAM is not equipped with the radiation sub-model "greyMeanAbsorptionEmission". I've tried several days to add this module to the available radiation sub-models, but it fails! I was wondering if you have any idea of attaching these sub-models to OpenFOAM 1.5. The other question is about the way you attached your model to the code.

Thanks for your care.


All times are GMT -4. The time now is 12:33.