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

Chemistry Source Term RR()

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes
  • 2 Post By zhangyan
  • 1 Post By ebringley

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 20, 2017, 12:39
Default Chemistry Source Term RR()
  #1
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,711
Blog Entries: 6
Rep Power: 52
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Hey all,

at the moment I am checking how FOAM is calculating the source terms for different species. For that purpose I checked the chemFoam. Here we will find the header file where we calculate the species i, named YEqn.H. In that file we see that we call a function from the chemistry object named RR(label).
Code:
{                                                                               
    forAll(Y, specieI)                                                          
    {                                                                           
        volScalarField& Yi = Y[specieI];                                        
                                                                                
        solve                                                                   
        (                                                                       
            fvm::ddt(rho, Yi) - chemistry.RR(specieI),                          
            mesh.solver("Yi")                                                   
        );                                                                      
    }                                                                           
}
Howver If I make a source code search for a function of type RR(const label i), I find the function in thermophysicalModels/solidChemistryModel/basicSolidChemistryModel/basicSolidChemistryModel.C

However, it seems that this function just returns zero, right?
Code:
const Foam::DimensionedField<Foam::scalar, Foam::volMesh>&                      
Foam::basicSolidChemistryModel::RR(const label i) const                         
{                                                                               
    NotImplemented;                                                             
    return (DimensionedField<scalar, volMesh>::null());                         
}                                                                               
                                                                                
                                                                                
Foam::DimensionedField<Foam::scalar, Foam::volMesh>&                            
Foam::basicSolidChemistryModel::RR(const label i)                               
{                                                                               
    NotImplemented;                                                             
                                                                                
    return dynamic_cast<DimensionedField<scalar, volMesh>&>                     
    (                                                                           
        const_cast<DimensionedField<scalar, volMesh>& >                         
        (                                                                       
            DimensionedField<scalar, volMesh>::null()                           
        )                                                                       
    );                                                                          
}

I am confused :P
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   January 23, 2017, 06:15
Default
  #2
Member
 
hekseli
Join Date: Mar 2013
Posts: 49
Rep Power: 13
heksel8i is on a distinguished road
Quick post:

Apparently the access function is in basicChemistryModel.H and then in the constructor of chemistryModel.C one creates new fields RR_ pointing to the original RR and the RR_ are updated in the end of the solve() routine in chemistryModel.C.
heksel8i is offline   Reply With Quote

Old   July 25, 2018, 12:59
Default Seeing chemistry source term during runtime
  #3
New Member
 
Eric Bringley
Join Date: Nov 2016
Posts: 14
Rep Power: 10
ebringley is on a distinguished road
Hi Tobias,

Were you able figure out how to access the source term? I'm using reactingFoam for a laminar combustion simulation but cannot figure out how to access the RR_ field updated in the reaction->correct(); routine to see the value at runtime.

Thanks,
Eric
ebringley is offline   Reply With Quote

Old   July 25, 2018, 16:35
Default
  #4
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,711
Blog Entries: 6
Rep Power: 52
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Yes I was able. Check the source and you will get it.
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   July 26, 2018, 05:43
Default Combustion vs Chemistry Model
  #5
New Member
 
Eric Bringley
Join Date: Nov 2016
Posts: 14
Rep Power: 10
ebringley is on a distinguished road
Hi Tobias,

I think I may be incorrect to have asked my question here. We are trying to do the same thing, but using different methods: You are looking at chemFoam which uses a psiChemistryModel and the source term is called through the chemistry.RR(label specI) method. I am looking at this from reactingFoam which uses a combustionModels:: psiCombustionModel and calls the source term reaction->R(Yi) which returns an fvMatrix. This R(Yi) member function of a combustion model accesses the protected chemistryPtr_ to access the a-fore-mentioned RR function. To my knowledge, I cannot access the chemistry pointer from a combustionModel. I was wondering if there was some C++ knowledge I am missing here to access this pointer to the chemistry.

Some of my questions are as follows:
1. How can I access, from a psiCombustionModel, the chemistry source term? I'd like to print to screen, or ideally, write to file to compare different chemistry methods. It may be that I should switch to chemFoam for this...
2. in the reaction->R(Yi) method, it returns a fvMatrix with units dimMass/dimTime, by adding the RR_[i] of the chemistryModel (kg/m3/s) (accessed through the RR(label i) inline chemistryModel method). What is the reason for this? Why do the units change?
3. Is there any specific references I should look at regarding the way the chemistry models / combustion models / solvers are programmed? I'd like to be able to know whats the best place to find stuff like this on my own.


PS. I am using OpenFOAM v5. There are changes in v6 that may cause some confusion, such as the chemistryModel class is renamed in v6.

Last edited by ebringley; July 26, 2018 at 05:46. Reason: fix accidental smile
ebringley is offline   Reply With Quote

Old   July 26, 2018, 09:06
Default
  #6
Senior Member
 
zhangyan's Avatar
 
Yan Zhang
Join Date: May 2014
Posts: 120
Rep Power: 12
zhangyan is on a distinguished road
fvMatrix.C:
Code:
template<class Type>
Foam::tmp<Foam::fvMatrix<Type>> Foam::operator+
(
    const fvMatrix<Type>& A,
    const DimensionedField<Type, volMesh>& su
)
{
    checkMethod(A, su, "+");
    tmp<fvMatrix<Type>> tC(new fvMatrix<Type>(A));
    tC.ref().source() -= su.mesh().V()*su.field();
    return tC;
}
Rochi and bany like this.
__________________
https://openfoam.top
zhangyan is offline   Reply With Quote

Old   July 26, 2018, 09:40
Default
  #7
New Member
 
Eric Bringley
Join Date: Nov 2016
Posts: 14
Rep Power: 10
ebringley is on a distinguished road
Thank you. I didn't realise the + operator took volume into account.
Zhiheng Wang likes this.
ebringley is offline   Reply With Quote

Reply


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
Source Term due to evaporation in energy transport equation styleworker OpenFOAM Programming & Development 3 September 7, 2022 04:09
[OpenFOAM.org] Error creating ParaView-4.1.0 OpenFOAM 2.3.0 tlcoons OpenFOAM Installation 13 April 20, 2016 18:34
[swak4Foam] Swak4FOAM 0.2.3 / OF2.2.x installation error FerdiFuchs OpenFOAM Community Contributions 27 April 16, 2014 16:14
[swak4Foam] build problem swak4Foam OF 2.2.0 mcathela OpenFOAM Community Contributions 14 April 23, 2013 14:59
UDFs for Scalar Eqn - Fluid/Solid HT Greg Perkins FLUENT 0 October 11, 2000 04:43


All times are GMT -4. The time now is 07:06.