CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (http://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   how to use current t, rho and species for calculations (http://www.cfd-online.com/Forums/openfoam-programming-development/77590-how-use-current-t-rho-species-calculations.html)

 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?

Marc

 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

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.