CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Running, Solving & CFD

Calculating Reaction Rates

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   June 14, 2010, 14:12
Default Calculating Reaction Rates
  #1
Senior Member
 
mturcios777's Avatar
 
Marco A. Turcios
Join Date: Mar 2009
Location: Vancouver, BC, Canada
Posts: 728
Rep Power: 20
mturcios777 will become famous soon enough
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.
mturcios777 is offline   Reply With Quote

Old   June 16, 2010, 03:30
Default
  #2
New Member
 
mehdi
Join Date: Jun 2009
Posts: 7
Rep Power: 9
mehdi-combustion is on a distinguished road
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.
mehdi-combustion is offline   Reply With Quote

Old   July 5, 2010, 18:54
Default
  #3
Senior Member
 
Hassan Kassem
Join Date: May 2010
Location: UK
Posts: 231
Rep Power: 10
hk318i is on a distinguished road
I have the same problem. what should I do to access specieThermo.Hc()?
hk318i is offline   Reply With Quote

Old   October 7, 2010, 17:31
Default [solved]
  #4
Senior Member
 
mturcios777's Avatar
 
Marco A. Turcios
Join Date: Mar 2009
Location: Vancouver, BC, Canada
Posts: 728
Rep Power: 20
mturcios777 will become famous soon enough
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.

Last edited by mturcios777; October 7, 2010 at 18:15. Reason: FOUND A SOLUTION
mturcios777 is offline   Reply With Quote

Old   June 3, 2016, 03:24
Default
  #5
New Member
 
Mr.liu
Join Date: Sep 2012
Posts: 24
Rep Power: 6
lx882211 is on a distinguished road
Quote:
Originally Posted by mturcios777 View Post
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.
I meet a problem in Openfoam 2.3.0, reactingFoam, i need the data of CH4 reaction rate, but i failed to autowrite it like U or Yi.

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.
lx882211 is offline   Reply With Quote

Reply

Tags
chemistry, ode, solver, thermodynamic, thermophysical

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


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 10:38
chemical reaction - decompostition La S. Hyuck CFX 1 May 23, 2001 00:07
Reaction rates Szasz Robert FLUENT 1 May 10, 2000 06:06


All times are GMT -4. The time now is 11:24.