|
[Sponsors] |
June 26, 2018, 00:50 |
Species Reaction Rate RR()
|
#1 |
New Member
Join Date: Feb 2018
Posts: 7
Rep Power: 8 |
Hi,
I am trying to output fuel reaction rate defined on each cell for further calculations (reactingFoam). What I did is : 1) In createFields.H, add : autoPtr<psiChemistryModel> pChemistry(psiChemistryModel::New(mesh)); psiChemistryModel& chemistry = pChemistry(); volScalarField::Internal rr ( IOobject ( "rr", runTime.timeName(), mesh, IOobject::NO_READ, //READ_IF_PRESENT, IOobject::AUTO_WRITE ), mesh ); 2) In myreactingFoam.C, add: rr = chemistry.RR(2); Compilation has no problem, but as you can see in log attached: reaction rate = dimensions [1 -3 -1 0 0 0 0] value uniform 0; --->I am expecting the values calculated from Arrenius law based on cell mass fraction which shouldn't be 0. Can anyone help pls? Thanks in advance. Kai. |
|
June 26, 2018, 11:30 |
|
#2 |
Senior Member
Adhiraj
Join Date: Sep 2010
Location: Karnataka, India
Posts: 187
Rep Power: 16 |
I was able to access the reaction rates in OpenFOAM 2.3.x like this:
Code:
forAll(Y, i) { ROP_[i].field() = -(reaction->R(Y[i])()).source()/mesh.V(); } |
|
June 26, 2018, 12:12 |
|
#3 |
New Member
Join Date: Feb 2018
Posts: 7
Rep Power: 8 |
Hi,
Thanks for your reply. I will see if I could find similar functions. Btw, did you add anything in createFields.H such as how is 'reaction' defined?( something like what I have done above?) Kai. |
|
June 26, 2018, 13:13 |
|
#4 |
Senior Member
Adhiraj
Join Date: Sep 2010
Location: Karnataka, India
Posts: 187
Rep Power: 16 |
Unfortunately at the moment I am not familiar enough with the source code of OpenFOAM 5.x to tell you the exact changes you need to make.
In version 2.3.x for reactingFoam, the variable reaction is defined at the top of the createFields.H. This is already there as part of OpenFOAM's original code: Code:
Info<< "Creating reaction model\n" << endl; autoPtr<combustionModels::psiCombustionModel> reaction ( combustionModels::psiCombustionModel::New(mesh) ); Code:
PtrList<volScalarField> ROP_(Y.size()); forAll(Y, i) { const word RRname = "ROP." + Y[i].name(); ROP_.set ( i, new volScalarField ( IOobject ( RRname, runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE ), mesh, dimensionedScalar("zero", dimMass/dimVolume/dimTime, 0.0) ) ); } |
|
June 26, 2018, 22:02 |
|
#5 |
New Member
Join Date: Feb 2018
Posts: 7
Rep Power: 8 |
Hi,
Many thanks, it seems that also works in 5.x. I will to some more checks to make sure it does return the right values. Thanks again! Kai. |
|
October 16, 2018, 03:17 |
|
#6 | |
New Member
Faezeh
Join Date: Oct 2011
Posts: 6
Rep Power: 15 |
Quote:
I think we should not divide R by mesh.V Coz the dimension of RR in chemistryModel.C is kg/(m3s). Don't ya think so? |
||
October 16, 2018, 04:57 |
|
#7 | |
Senior Member
Yan Zhang
Join Date: May 2014
Posts: 120
Rep Power: 12 |
Quote:
But, R(volScalarField& Y) in combustionModel class returns an fvScalarMatrix, which is kg/s. Ref:Chemistry Source Term RR() |
||
October 16, 2018, 05:02 |
|
#8 |
New Member
Join Date: Feb 2018
Posts: 7
Rep Power: 8 |
Yes, you are right regarding the RR unit = kg(m3s), but when we want to use it in equation or further calculation, what we need will be volumetric RR, i.e RR divided by mesh.V.
|
|
October 16, 2018, 05:10 |
|
#9 | |
New Member
Faezeh
Join Date: Oct 2011
Posts: 6
Rep Power: 15 |
Quote:
fvm::ddt(rho, Yi) + mvConvection->fvmDiv(phi, Yi) - fvm::laplacian(turbulence->muEff(), Yi) == reaction->R(Yi) + fvOptions(rho, Yi) the dimension of all terms are kg/(m3s). so the source term should have the same dimension. I don't have a clue why we divide it by volume again? |
||
October 16, 2018, 05:23 |
|
#10 | |
New Member
Join Date: Feb 2018
Posts: 7
Rep Power: 8 |
Quote:
The reaction->R() below has a unit of kg/s, and what you need will be R/mesh.V in your Yi equation. forAll(Y, i) { ROP_[i].field() = -(reaction->R(Y[i])()).source()/mesh.V(); } |
||
September 12, 2021, 12:09 |
No output
|
#11 | |
New Member
Felix Biermann
Join Date: Sep 2021
Posts: 2
Rep Power: 0 |
Quote:
I tried your solution, added your code to createFields.H and compiled the solver with wmake. However, if I run a case with my solver, the simulation works but the reaction rates are not printed out. Did I miss something? Regards |
||
September 20, 2021, 15:54 |
|
#12 | |
Senior Member
Adhiraj
Join Date: Sep 2010
Location: Karnataka, India
Posts: 187
Rep Power: 16 |
Quote:
Which version of OpenFOAM is this? Are the variables not written to the time directories at all, or do you get zeros? |
||
September 21, 2021, 06:16 |
Thank for the quick reply
|
#13 | |
New Member
Felix Biermann
Join Date: Sep 2021
Posts: 2
Rep Power: 0 |
Quote:
I was able to fix my issue, it was a small bug somewhere else that I just found by chance. However, thank you a lot, this forum and especially you were incredibly helpful! Anyway, as this forum left one minor uncertainty (at least for beginners in C++), this might help some future readers: 1. Definition of new field(s) in createFields.H 2. Calculation of the source terms in YEqn.H (It might work differently, but this is how I implemented it and it sort of makes sense) |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Species transport for decomposition reaction | achrofi | FLUENT | 1 | August 1, 2017 13:26 |
Modelling species transport and implementing reaction rates | res | FLUENT | 0 | May 11, 2017 11:29 |
Defining reaction rate with multiple surface reaction | Fred Marias | FLUENT | 1 | September 12, 2013 05:56 |
calculate species reaction rate | Anna_p | FLUENT | 2 | July 1, 2013 14:10 |
UDF for catalyst volumetric reaction, temperature overshoot though rate is small | elmcmaster | FLUENT | 0 | October 11, 2010 10:37 |