Get the rate of reactions from the reactingFoam solver
Hello everyone,
I am running a combustion simulation by the reactingFoam solver in openFOAM 6.0, and everything works fine. I am using a detailed reaction mechanism with 62 species and 262 reactions. After the calculations are finished, I want to write the output and observe the fields of the two following parameters: 1- (My major problem) The rate of each reaction in my domain (262 different fields). 2- (Minor problem) The source term of each species in my domain (62 different fields). For the first parameter, when I try to look into code to find out where the Arrhenius reaction rates are calculated, I get confused between all the reactionModels, chemistryModels and ODESolvers. Hence I do not know where the rate of each reaction is calculated and how I can get access to it in the solver code. Is there any postProcess tool for this purpose? Or is there any simple code which can be added to the solver to access and get output from the desired fields? I searched the google and the forums but I could not find anything helpful. However, for the second parameter, we have access to source term of species Y[i] through Code:
reaction->R(Y[i]) Code:
Ri_[i] = reaction->R(Y[i]) & Y[i]; I highly appreciate any suggestion or advice on this matter! Best regards, Morteza |
Hi there,
I have the same problem. I'm still a beginner in openfoam (and C++ for that matter) but I'm not sure the line of code you have there is multiplication. I think it is bitwise AND between a pointer to reaction.R(Yi) and Y(i), not sure that helps. I think what you need is something like it is done in the createFields.H for Qdot (I haven't tried it yet): Code:
volScalarField Qdot but for each species. No idea how to get the rate of each reaction though and I'm very interested if you find out how :) |
1 Attachment(s)
Hi Paulo,
Thanks for your response. I want to apply your suggestion, but still I do not get how to convert fvMatrix to volScalarField? You see, I did something similar to the code you provided from createFields.h , to create the Ri_ fields: Code:
PtrList<volScalarField> Ri_; So, in case we agree on the fact that & is the inner product operator here, what does "reaction->R(Y[i]) & Y[i];" mean exactly? Is this the correct way to get the source terms for species? |
Hi there,
I didn't know the "&" operator could be used as inner product in openfoam (good to know actually :)). I looked at the code suggested in the topic you refered (Qdot function in singleStepCombustion.C) and it looks like this: Code:
singleStepCombustion<ReactionThermo, ThermoType>::Qdot() const and (R(YFuel) & YFuel) does seem to return the rate, but I'll be honest and say I don't understand why (not sure how the structure of fvMatrix works here for the product). Maybe the best way to be sure is to set a simple case in chemFoam and compare if another software where you can access the rates (eg Cantera). I also found this topic that handled the problem differently, haven't tried the solution yet though. |
1 Attachment(s)
Thanks again Paul! I have added the other method from the topic that you mentioned to calculate the species source terms. So, now I have two volScalarField variables to calculate the source terms with the following two methods:
Code:
// method 1 Now I think I can trust the results that we obtain by either of the two mentioned methods! However, it would be nice if somebody could explain why we multiplied reaction->R(Y[i]) to Y[i] in the first method? And why is there a negative sign before (reaction->R(Y[i])()).source() in the second method? Finally, back to my major problem, can somebody explain how we can get the reaction rates instead of species source terms? :confused: |
Alam
1 Attachment(s)
Hi Mirza, I am newbie in openfoam and using reactingFoam in of5.
I am looking into solution for species source term using the same code you mentioned. But, I have found the following error in attachment. Could you please tell me about any solution for this? |
Hi Nuralam,
I do not have OF5 to test the same code right now. But the error seems to be related to the surfaceScalarField phi, which is missing! I think you need to make sure that your modifications are made after the createFields.H, in which the Code:
#include "compressibleCreatePhi.H" Best wishes, Morteza |
Great. Now, its working. Thank you.
-NurAlam |
Hi Morteza
I want to measure the following parameter: dydt [n]= {Y(n-1) - Y (n+1)} / {t(n-1)-t(n+1)} where, Y(n-1) and Y(n+1) are mass fraction of species at time t(n-1) and t(n+1) respectively. Could you please tell me how I can store time date and calculate dydt? Redards, NurAlam |
All times are GMT -4. The time now is 07:42. |