|
[Sponsors] |
June 14, 2010, 15:12 |
Calculating Reaction Rates
|
#1 |
Senior Member
Marco A. Turcios
Join Date: Mar 2009
Location: Vancouver, BC, Canada
Posts: 740
Rep Power: 28 |
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. |
|
June 16, 2010, 04:30 |
|
#2 |
New Member
mehdi
Join Date: Jun 2009
Posts: 7
Rep Power: 17 |
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. |
|
July 5, 2010, 19:54 |
|
#3 |
Senior Member
Hassan Kassem
Join Date: May 2010
Location: Germany
Posts: 242
Rep Power: 18 |
I have the same problem. what should I do to access specieThermo.Hc()?
|
|
October 7, 2010, 18:31 |
[solved]
|
#4 |
Senior Member
Marco A. Turcios
Join Date: Mar 2009
Location: Vancouver, BC, Canada
Posts: 740
Rep Power: 28 |
Figured it out. psiChemistryModel is built somewhat on basicChemistryModel. I need to add a
Code:
virtual void calculate() Last edited by mturcios777; October 7, 2010 at 19:15. Reason: FOUND A SOLUTION |
|
June 3, 2016, 04:24 |
|
#5 | |
New Member
Mr.liu
Join Date: Sep 2012
Posts: 27
Rep Power: 14 |
Quote:
First i added this code in the CreatField.H, volScalarField Rrate ( IOobject ( "Rrate", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE ), mesh, dimensionedScalar("Rrate", dimMass/dimVolume/dimTime, 0.0) ); Then, i added this code in YEqn, forAll(Y, i) { if (Y[i].name() != "CH4") Rrate = reaction->R(Yi); } After wmake, it shows YEqn.H:26:14: error: no match for ‘operator=’ (operand types are ‘Foam::volScalarField {aka Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>}’ and ‘Foam::tmp<Foam::fvMatrix<double> >’) Rrate = reaction->R(Yi); Can you tell me how to do that? Thank you very much. |
||
Tags |
chemistry, ode, solver, thermodynamic, thermophysical |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
combustion - reaction rates - urgent help needed | siri | Main CFD Forum | 2 | March 3, 2007 13:25 |
How to update polyPatchbs localPoints | liu | OpenFOAM Running, Solving & CFD | 6 | December 30, 2005 18:27 |
EDC l- Reaction Rates are Zero for some Reactions | Atul | FLUENT | 2 | October 7, 2005 11:38 |
chemical reaction - decompostition | La S. Hyuck | CFX | 1 | May 23, 2001 01:07 |
Reaction rates | Szasz Robert | FLUENT | 1 | May 10, 2000 07:06 |