CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (http://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Calculating Reaction Rates (http://www.cfd-online.com/Forums/openfoam-solving/77137-calculating-reaction-rates.html)

mturcios777 June 14, 2010 14:12

Calculating Reaction Rates
 
I'm updating a solver I have from 1.4 to 1.6, and I've run into a problem with chemical reactions. In 1.4 I could call chemistry.calculate() to calculate reaction rates. With the new way chemistry models are created, that call fails (complaints of trying to access a non-existent member function). Looking through the source, I'm not sure I would do this in the new version.

My solver uses a psiChemistryModel; here are some of the relevant entries from the code and from the case

createFields.H:
autoPtr<psiChemistryModel> pChemistry
(
psiChemistryModel::New(mesh)
);
psiChemistryModel& chemistry = pChemistry();
(just like in reactingFoam)

constant/chemistryProperties: psiChemistryModel ODEChemistryModel<gasThermoPhysics>

constant/thermophysicalProperties: thermoType hPsiMixtureThermo<reactingMixture<gasThermoPhysics >>;

I know there must be some way to call the member function, but I'm struggling to understand the new way things are done.

mehdi-combustion June 16, 2010 03:30

If you define the chemistry as:

Info<< nl << "Reading thermophysicalProperties" << endl;
autoPtr<psiChemistryModel> pChemistry
(
psiChemistryModel::New(mesh)
);
psiChemistryModel& chemistry = pChemistry();

hCombustionThermo& thermo = chemistry.thermo();

basicMultiComponentMixture& composition = thermo.composition();
PtrList<volScalarField>& Y = composition.Y();

How you can access to the thermodynamic properties of the specie such as enthalpy at a given temprature Ti and molecular weight and so on ?
In OpenFoam-1.5 you could write:

scalar hi = chemistry.specieThermo()[i].h(Ti); //openFoam-1.5

However, If you write the same in OpenFoam-1.6 you would get
psiChemistryModel does not have member function named specieThermo.

hk318i July 5, 2010 18:54

I have the same problem. what should I do to access specieThermo.Hc()?

mturcios777 October 7, 2010 17:31

[solved]
 
Figured it out. psiChemistryModel is built somewhat on basicChemistryModel. I need to add a

Code:

virtual void calculate()
to basicChemsitryModel.H. This may cause problems if your implementation of psiChemistryModel doesn't use ODEChemistryModel, but at present I don't see any solvers that have it otherwise.


All times are GMT -4. The time now is 20:06.