CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   error in calculating mole fractions (https://www.cfd-online.com/Forums/openfoam/72715-error-calculating-mole-fractions.html)

lions85 February 16, 2010 04:16

error in calculating mole fractions
 
Hi, I have a problem: I would like to change the radiation model in openfoam 1.5-dev using a species-weighted absorption coefficient (wggs) to compare my results with fluent and experimental data. The point is that in the equation of wggs I have the mole fraction and not the mass fraction. I tried in the simplest way, using the equation to change mass fraction in mole fraction trough the total molecular weight. I wrote a code like this:

Code:

volScalarField unosuMWtot
(
    IOobject
    (
        "unosuMWtot",
        mesh_.time().timeName(),
        mesh_,
        IOobject::NO_READ,
        IOobject::NO_WRITE
    ),
    mesh_,
    dimensionedScalar("zero", dimensionSet(-1,0,0,0,1,0,0), 0.0)
);
for (label i=0;i<Y.size();i++)
{
unosuMWtot=unosuMWtot+Y[i]/chemistry->specieThermo()[i].W();
}

where chemistry is a pointer to a chemistrymodel object, Y is the ptrlist of the compositions and unosuMWtot would be 1 over the total molecular weight. In this way i get a segmentation fault error and i don't know why. probably this is for the chemistry->specieThermo()[i].W() row, because deleting it the error disappears. Anyway i don't understand because i used the same row in another class with a pointer to chemistrymodel in the same way and everything works fine.

So, anyway can find me a way to solve the problem, or maybe there is a direct function of chemistry model or hcomustionthermo where i can find the mole fraction without calculate it?

Thank you
Bye
Emanuele


All times are GMT -4. The time now is 04:56.