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. |
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. |
I have the same problem. what should I do to access specieThermo.Hc()?
|
[solved]
Figured it out. psiChemistryModel is built somewhat on basicChemistryModel. I need to add a
Code:
virtual void calculate() |
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. |
All times are GMT -4. The time now is 01:54. |