|
[Sponsors] |
January 11, 2014, 03:10 |
Extracting Reaction Rates OF20x
|
#1 |
New Member
Ah Cai
Join Date: Dec 2010
Location: Malaysia
Posts: 16
Rep Power: 16 |
Hi,
I am using the tutorial dieselFoam with its global n-heptane mechanism to simulate diesel combustion. I wanted to output the reaction rates for CO2 as the fuel combusts. I checked that in basicChemistryModel.H and found that RR() refers to Reaction rates. However, when I type "chemistry.RR()" it does not work. If I write it this way where I include the chemistry.RR() in a for loop. PHP Code:
If I were to write it as such: PHP Code:
My guess is that "rr" will output the reaction rates of ALL the species at ALL the cells while "rr[3]" will only output the reaction rates of ALL the species at cell[3]. What I had in mind is to extract only the RR for one of the species (for my case, CO2) over all the cells. Thanks. Ahcai |
|
January 13, 2014, 15:09 |
|
#2 |
Senior Member
Marco A. Turcios
Join Date: Mar 2009
Location: Vancouver, BC, Canada
Posts: 740
Rep Power: 28 |
The RR in basicChemistryModel is a virtual function and is implemented later, in ODEChemistry (this isn't immediately obvious, but by looking at the thermyphysicalType in the thermphysicalProperties file you can see it). It also returns a scalar field, which is why you are able to initialize rr in both cases. If you look at ODEChemistryModelI.H at line 71, what RR(const label i) actually does is return the reation rate for species i.
In both cases, rr contains the entire RR field for whatever species happens to be in index cellI. Since Y is a PtrList for scalarfields, what you are actually doing is stepping through all 5 species. Have a look at YEqn.H to see what I mean. In the first case, you are returning the entire RR field for each species (for each iteration, you should see 5 outputs of "Reaction Rate". In the second, you are obtaining the reation rate for each species at cell index 3 (again, you have 5 outputs corresponding to the 5 species). What you need to find is the index of CO2 in your thermo setup, then call chemistry.RR(CO2 index), which will give what you are looking for. |
|
January 27, 2014, 05:07 |
|
#3 | |
New Member
Ah Cai
Join Date: Dec 2010
Location: Malaysia
Posts: 16
Rep Power: 16 |
Quote:
Thanks for the explanation. It helped a lot and I manage to make it work =) Cheers~ |
||
June 2, 2016, 13:01 |
|
#4 | |
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") RR = 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 |
dieselfoam, reaction rate |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Segmentation fault in running alternateSteadyReactingFoam,why? | NewKid | OpenFOAM | 18 | January 20, 2011 17:55 |
combustion - reaction rates - urgent help needed | siri | Main CFD Forum | 2 | March 3, 2007 13:25 |
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 |