CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM

Species Reaction Rate RR()

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

Like Tree7Likes
  • 1 Post By kaizhangqmul
  • 2 Post By adhiraj
  • 1 Post By faeze.d
  • 1 Post By zhangyan
  • 1 Post By kaizhangqmul
  • 1 Post By kaizhangqmul

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 26, 2018, 00:50
Post Species Reaction Rate RR()
  #1
New Member
 
Join Date: Feb 2018
Posts: 7
Rep Power: 6
kaizhangqmul is on a distinguished road
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.
Attached Files
File Type: txt log.txt (5.4 KB, 24 views)
Kummi likes this.
kaizhangqmul is offline   Reply With Quote

Old   June 26, 2018, 11:30
Default
  #2
Senior Member
 
Adhiraj
Join Date: Sep 2010
Location: Maryland, United States
Posts: 185
Rep Power: 14
adhiraj is on a distinguished road
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();
    }
Maybe you can see if there is an equivalent for version 5.x?
adhiraj is offline   Reply With Quote

Old   June 26, 2018, 12:12
Default
  #3
New Member
 
Join Date: Feb 2018
Posts: 7
Rep Power: 6
kaizhangqmul is on a distinguished road
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.
kaizhangqmul is offline   Reply With Quote

Old   June 26, 2018, 13:13
Default
  #4
Senior Member
 
Adhiraj
Join Date: Sep 2010
Location: Maryland, United States
Posts: 185
Rep Power: 14
adhiraj is on a distinguished road
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)
);
I added a variable to store and print the reaction rates like this:

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)
        )
    );    
}
Kummi and alainislas like this.
adhiraj is offline   Reply With Quote

Old   June 26, 2018, 22:02
Default
  #5
New Member
 
Join Date: Feb 2018
Posts: 7
Rep Power: 6
kaizhangqmul is on a distinguished road
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.
kaizhangqmul is offline   Reply With Quote

Old   October 16, 2018, 03:17
Default
  #6
New Member
 
Faezeh
Join Date: Oct 2011
Posts: 6
Rep Power: 13
faeze.d is on a distinguished road
Quote:
Originally Posted by adhiraj View Post
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();
    }
Maybe you can see if there is an equivalent for version 5.x?
Hi, Thanks for the post. It was very helpful.
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?
Mirza8 likes this.
faeze.d is offline   Reply With Quote

Old   October 16, 2018, 04:57
Default
  #7
Senior Member
 
zhangyan's Avatar
 
Yan Zhang
Join Date: May 2014
Posts: 120
Rep Power: 10
zhangyan is on a distinguished road
Quote:
Originally Posted by faeze.d View Post
Hi, Thanks for the post. It was very helpful.
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?
Yes, RR in chemistryModel.C is kg/(m3s).
But, R(volScalarField& Y) in combustionModel class returns an fvScalarMatrix, which is kg/s.
Ref:Chemistry Source Term RR()
faeze.d likes this.
zhangyan is offline   Reply With Quote

Old   October 16, 2018, 05:02
Default
  #8
New Member
 
Join Date: Feb 2018
Posts: 7
Rep Power: 6
kaizhangqmul is on a distinguished road
Quote:
Originally Posted by faeze.d View Post
Hi, Thanks for the post. It was very helpful.
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?
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.
faeze.d likes this.
kaizhangqmul is offline   Reply With Quote

Old   October 16, 2018, 05:10
Default
  #9
New Member
 
Faezeh
Join Date: Oct 2011
Posts: 6
Rep Power: 13
faeze.d is on a distinguished road
Quote:
Originally Posted by kaizhangqmul View Post
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.
Thanks for your prompt reply. I'm confused because in Yi equation we have:
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?
faeze.d is offline   Reply With Quote

Old   October 16, 2018, 05:23
Default
  #10
New Member
 
Join Date: Feb 2018
Posts: 7
Rep Power: 6
kaizhangqmul is on a distinguished road
Quote:
Originally Posted by faeze.d View Post
Thanks for your prompt reply. I'm confused because in Yi equation we have:
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?
My mistake, I was thinking of an energy equation in my code, and get confused with the code here.
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();
}
faeze.d likes this.
kaizhangqmul is offline   Reply With Quote

Old   September 12, 2021, 12:09
Smile No output
  #11
New Member
 
Felix Biermann
Join Date: Sep 2021
Posts: 2
Rep Power: 0
felixFoam is on a distinguished road
Quote:
Originally Posted by adhiraj View Post
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)
);
I added a variable to store and print the reaction rates like this:

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)
        )
    );    
}
Hello adhiraj,

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

Old   September 20, 2021, 15:54
Default
  #12
Senior Member
 
Adhiraj
Join Date: Sep 2010
Location: Maryland, United States
Posts: 185
Rep Power: 14
adhiraj is on a distinguished road
Quote:
Originally Posted by felixFoam View Post
Hello adhiraj,

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
Can you give some more information?

Which version of OpenFOAM is this? Are the variables not written to the time directories at all, or do you get zeros?
adhiraj is offline   Reply With Quote

Old   September 21, 2021, 06:16
Default Thank for the quick reply
  #13
New Member
 
Felix Biermann
Join Date: Sep 2021
Posts: 2
Rep Power: 0
felixFoam is on a distinguished road
Quote:
Originally Posted by adhiraj View Post
Can you give some more information?

Which version of OpenFOAM is this? Are the variables not written to the time directories at all, or do you get zeros?
Thanks a lot for the quick reply,

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)
felixFoam is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
Pingbacks are On
Refbacks are On


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


All times are GMT -4. The time now is 05:28.