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

 July 23, 2017, 04:58 Question about Energy Equation #1 Member   Ashish Vinayak Join Date: Mar 2015 Location: Wuppertal, Germany Posts: 50 Rep Power: 10 Hi, I am a beginner in OpenFOAM and would like to understand the source code for the reactingOneDim.C. You might possibly not be familiar with the solver, but I am certain this form of equation also appears elsewhere. Code:  fvScalarMatrix hEqn ( fvm::ddt(rho_, h_) - fvm::laplacian(alpha, h_) + fvc::laplacian(alpha, h_) - fvc::laplacian(kappa(), T()) == chemistrySh_ - fvm::Sp(solidChemistry_->RRg(), h_) ); The text in bold is where I am a little confused. Why are there two terms which at first look the same? I know that fvm is an implicit method and fvc is explicit. However, what is the result of this part of the equation? Is this something done for stability? Please help me understand. Kummi likes this.

 July 28, 2017, 04:50 #2 Super Moderator     Tobias Holzmann Join Date: Oct 2010 Location: Tussenhausen Posts: 2,680 Blog Entries: 6 Rep Power: 49 Hi, I am not familiar with the pyrolysis models in OpenFOAM and with the equations that are solved here. If we would write the equations in vector form the two laplacian terms would look equal, right: I am not sure about the last Sp() term, I just removed it but I guess it is a source term of the chemistry too, which is either put to the matrix or source based on the sign (Sp()). The equation is equal to: Now, implementing both as fvm would not make any change (only more computational effort). If we change one to be an explicit one, and the other implicit, these terms get equal if the explicit terms are converged and then the implicit and explicit term should vanish. Why they do it? I have no idea but maybe it is based on the chemistry and it stabilizes it. For me and my colleague, this is the only explanation right now. But I am not an expert in that particular problem. Therefore I could be completely wrong. ashish.vinayak and Kummi like this. __________________ Keep foaming, Tobias Holzmann

 July 28, 2017, 05:25 #3 Member   Ashish Vinayak Join Date: Mar 2015 Location: Wuppertal, Germany Posts: 50 Rep Power: 10 This does clear out my understanding of those two terms. For future reference: the Sp() term on the RHS is due to transport of gas through control volume of solid and acts as a source term. It is positive since pyrolysis is endothermic and uses Sp() for diagonal dominance. One last question: By implicit and explicit you mean time steps (n+1) and (n) respectively right? Unless I am missing something. Just want to be sure

 July 28, 2017, 08:54 #4 Super Moderator     Tobias Holzmann Join Date: Oct 2010 Location: Tussenhausen Posts: 2,680 Blog Entries: 6 Rep Power: 49 Hi, thanks for explaining the Sp() term. As I said, based on the sign it should be pushed to the matrix (diag-dominance) or source. Maybe I mix it with SuSp, which checks the signs and pushes either to the diagonal or source. The thing with explicit was referred to previous iteration. E.g. in Stress calculation (the one I am using) we use the Duhamel-Neumann equation given as: Putting everything into the first one we get: Terms on the RHS: 1. fvm::laplacian() 2. fvc::div( of fvc::grad()) 3. tr ( fvc::grad()) So if term 2 and 3 would be from the old time step they are like constants, right? Therefore, we could solve the system directly within on outer loop. But in fact they are not constant and change with the outer loops because the fvc::grad(D) should use the values of the last iteration and not the one from the last time step. I was checking right now the fvm::laplacian and fvc::laplacian and went till the Gauss laplacian schemes. Here you will find the difference but I could not see anything related to old time steps. More likely that in fvc:: we calculate the values explicit with the fvc::div operator and in the fvm:: we make it implicit with a matrix, source etc... Unfortunately, I have no time to check it in more detail right now but if you would like to do it, I would be happy to get the information. Actually, I think the fvc:: will take the data of the last iteration. E.g. we update h and then put the new h into the fvc::laplacian() ... if you follow the way we calculate the laplacian using fvc, you will see that we use the values of h and not the previous time step. As far as I remember the old time steps are only included in the ddt:: terms. , I might be wrong here and it would be nice if someone can check it (no time). PS: If it would be old time step, then the terms only would vanish for the steady-state scenario. __________________ Keep foaming, Tobias Holzmann Last edited by Tobi; July 28, 2017 at 10:40.

September 12, 2019, 02:37
#5
Senior Member

Kumaresh
Join Date: Oct 2016
Posts: 346
Rep Power: 10
Hello Ashish Vinayak,
In my work, I defined the reactions with sevaral gaseous species (H2O CH4 C2H6 CO H2 CO2) as follows,
Quote:
 irreversibleSolidArrheniusHeterogeneousReaction coal = H2O + CO2 + C2H6 + char coal = CH4 + char coal = CO + char coal = H2 + char (1.3e13 200e3 400 1) // Arrhenius parameters
By default, I couldn't able to plot the devolatalized gaseous species (H2O CH4 C2H6 CO H2 CO2) during pyrolysis process using function objects.
Quote:
 functions { oven_hope { type probes; functionObjectLibs ("libsampling.so"); outputControl timeStep; outputInterval 50; region oven; probeLocations ( (0.1 1.0 0.05) // NEW2_at wall (0.15625 1.0 0.05) // NEW2_1/4 distance (0.2125 1.0 0.05) // NEW2_1/2 distance (0.26875 1.0 0.05) // NEW2_3/4 distance (0.325 1.0 0.05) // NEW2_centre ); fields (T Cp Ycoal Ychar YH2O YCH4 YC2H6 YCO YH2 YCO2 chemistrySh phiGas phiHsGas K rho); }}
Concerning above issue, I included the new source term "- fvm::Sp(solidChemistry_->RRg(), h_)" under reactingOneDim.C file to plot for the gaseous species. But, unfortunately, it results in same, no species can be plotted. However, the variables Ycoal, Ychar, T are plotted successfully from the beginning.

My question is,

Will the inlcusion of source term "- fvm::Sp(solidChemistry_->RRg(), h_)" help to plot the gaseous species ?
Because as per your above quote, transport of gas is taken into account on the source term literally
Quote:
 the Sp() term on the RHS is due to transport of gas through control volume of solid and acts as a source term
Quote:
 fvm::Sp makes the source term implicit so it contributes to the diagonal. This can help convergence when the source term is negative on the rhs (sink term). This is the case in the equation you've shown. The two other source terms are positive on the rhs and therefore left explicit. Making them implicit would reduce the diagonal dominance of the matrix and probably cause problems to the solver. Hope this helps
Understanding fvm::Sp()

Thank you

 Tags energy equation, pyrolysis, reactingonedim