|
[Sponsors] |
January 20, 2017, 12:39 |
Chemistry Source Term RR()
|
#1 |
Super Moderator
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,711
Blog Entries: 6
Rep Power: 52 |
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") ); } } 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 |
|
January 23, 2017, 06:15 |
|
#2 |
Member
hekseli
Join Date: Mar 2013
Posts: 49
Rep Power: 13 |
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. |
|
July 25, 2018, 12:59 |
Seeing chemistry source term during runtime
|
#3 |
New Member
Eric Bringley
Join Date: Nov 2016
Posts: 14
Rep Power: 10 |
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 |
|
July 26, 2018, 05:43 |
Combustion vs Chemistry Model
|
#5 |
New Member
Eric Bringley
Join Date: Nov 2016
Posts: 14
Rep Power: 10 |
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 |
|
July 26, 2018, 09:06 |
|
#6 |
Senior Member
Yan Zhang
Join Date: May 2014
Posts: 120
Rep Power: 12 |
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; }
__________________
https://openfoam.top |
|
July 26, 2018, 09:40 |
|
#7 |
New Member
Eric Bringley
Join Date: Nov 2016
Posts: 14
Rep Power: 10 |
Thank you. I didn't realise the + operator took volume into account.
|
|
|
|
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 |