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

Question about Energy Equation

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes
  • 1 Post By ashish.vinayak
  • 2 Post By Tobi

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 23, 2017, 03:58
Default Question about Energy Equation
  #1
Member
 
Ashish Vinayak
Join Date: Mar 2015
Location: Wuppertal, Germany
Posts: 50
Rep Power: 11
ashish.vinayak is on a distinguished road
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.
ashish.vinayak is offline   Reply With Quote

Old   July 28, 2017, 03:50
Default
  #2
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51
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
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:

\frac{\partial \rho h}{\partial t} = \nabla \bullet (\lambda \nabla T) + \dot{\omega}

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:

\frac{\partial \rho h}{\partial t} = \nabla \bullet (\lambda \nabla T) + \dot{\omega} + \nabla \bullet (\alpha \nabla h) - \nabla \bullet (\alpha \nabla h)

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

Old   July 28, 2017, 04:25
Default
  #3
Member
 
Ashish Vinayak
Join Date: Mar 2015
Location: Wuppertal, Germany
Posts: 50
Rep Power: 11
ashish.vinayak is on a distinguished road
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
ashish.vinayak is offline   Reply With Quote

Old   July 28, 2017, 07:54
Default
  #4
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51
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
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:

\frac{\partial \rho \partial D}{\partial t^2} = \nabla \bullet \boldsymbol \sigma

\boldsymbol \sigma = 2\mu \textbf{D} + \lambda \mathrm{tr}({\textbf{D}}) \textbf{I}

\textbf{D} = \frac{1}{2}\left[\nabla \otimes \textbf{D} + (\nabla \otimes \textbf{D})^{\mathrm{T}}\right]

Putting everything into the first one we get:

\frac{\partial \rho \partial D}{\partial t^2} = \nabla \bullet \left[\mu \nabla\otimes\textbf{D}\right] + \nabla \bullet  \left[\mu (\nabla\otimes\textbf{D})^\mathrm{T}\right]
+ \lambda \mathrm{tr}({\textbf{D})} \textbf{I}

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 09:40.
Tobi is offline   Reply With Quote

Old   September 12, 2019, 01:37
Default
  #5
Senior Member
 
Kumaresh
Join Date: Oct 2016
Posts: 347
Rep Power: 11
Kummi is on a distinguished road
Send a message via Yahoo to Kummi
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
In addition, Simon Lapointe exaplained about fvm::Sp as
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()

Kindly share your ideas please.

Thank you
Kummi is offline   Reply With Quote

Reply

Tags
energy equation, pyrolysis, reactingonedim


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 03:09
Energy equation in bouyant*Foam solvers makaveli_lcf OpenFOAM Running, Solving & CFD 0 December 21, 2009 04:09
Viscosity and the Energy Equation Rich Main CFD Forum 0 December 16, 2009 14:01
Energy equation convergence problem Reza Main CFD Forum 0 August 27, 2003 13:09
Energy equation Suresh Balasubramanian FLUENT 1 April 6, 2003 02:54


All times are GMT -4. The time now is 08:24.