CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Community Contributions

[Publications] Mathematics, Numerics, Derivations and OpenFOAM

Register Blogs Community New Posts Updated Threads Search

Like Tree103Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 11, 2016, 12:04
Default Mathematics, Numerics, Derivations and OpenFOAM
  #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
Dear all,

during the derivation of the stress equations that are implemented in OpenFOAM, I started to derive the mass, momentum and (not complete) the energy equation. Furthermore, I showed and proofed that the vector form of the equations are equal to the Cartesian notation.

The content is:

  • Derivation of mass and momentum equation
  • General conserved equation
  • Energy equation
  • Reynolds-Averaging
  • Shear-Rate Tensor
  • Mathematics
  • Numerics
  • Turbulence modelling
  • More about divDevRhoREff and divDevReff
  • Derive shear-rate tensor for pisoFoam
  • Different notations for the NS-Equations
  • Matrix Algebra
  • Cauchy - Stress tensor, shear-rate tensor and pressure

http://www.holzmann-cfd.de/index.php/en/publications




Feel free to comment on that and I hope that it is helpful, clear and understandable.

Happy new year to everybody
__________________
Keep foaming,
Tobias Holzmann

Last edited by Tobi; January 22, 2016 at 06:03. Reason: Changed the link
Tobi is offline   Reply With Quote

Old   January 20, 2016, 14:51
Default
  #2
Senior Member
 
Jon Elvar Wallevik
Join Date: Nov 2010
Location: Reykjavik, ICELAND
Posts: 103
Rep Power: 20
JonW will become famous soon enough
Nice work Tobias!

I have newer seen the name “shear rate tensor” for tau (usually referred to as the extra stress tensor, as you also use). What you probably mean with “shear rate tensor” is when “tau” represents the GNM (the Generalized Newtonian Model). But the extra stress tensor “tau” can be much nastier than GNM.

Regarding Chapter 6, if you want also to explain why shear rate is calculated as is done in OpenFOAM (sqrt(2 e:e)), then in my paper I show proof of that in Section 3. It also explains the GNM and it relationship with non-Newtonian fluids, with some good references (the paper is using the MRF in OpenFOAM for non-Newtonian fluids). If you use this, please make ref to my paper. Thanks.

Again, nice work man.

Cheers
J.

P.s. the reference is...
J.E. Wallevik, Effect of the hydrodynamic pressure on shaft torque for a 4-blades vane rheometer, International Journal of Heat and Fluid Flow, 50 (2014) 95–102.
DOI: 10.1016/j.ijheatfluidflow.2014.06.001
JonW is offline   Reply With Quote

Old   January 20, 2016, 16:11
Default
  #3
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
Hi Jon,

thanks for the feedback and the hint to your paper. My colleague also uses your shear-rate calculation for visco-plastic modeling but at the moment there was no time also to include Non-Newtonian fluids. Mostly (as you already realized, I talk about Newtonian fluids).

To the "extra-stress tensor" tau. In many of my literature (maybe due to the fact that most of them are German books, are using this form. Also Ferziger and Perić use this nomenclature. That the extra stress tensor could be much worser is clear, especially if we have Non-Newtonian fluids.

If I have access to the paper (I think I have it at my university), I will check it out and extend it. But at the moment I have a lot of other stuff to do.

By the way, there is still a problem in my reynolds-averaging that I do not know exactly. Maybe you can answer this question: I showed how we get the RANS equation and used the Buossinesq approximation where I said that the term -2/3k\delta_{ij} is neglected. The question is, is it really neglected because Pope et. al. wrote that we can take this term to the pressure and get a modified pressure p':

p' = p + 2/3 k \delta_{ij}

Do you know if we calculate p' in OpenFOAM or do you have any other hint to that? I am not 100% sure about it. The hint came from Gerhald Holzinger (Linz).

Thanks again,
Tobi
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   January 21, 2016, 06:30
Default
  #4
Senior Member
 
Jon Elvar Wallevik
Join Date: Nov 2010
Location: Reykjavik, ICELAND
Posts: 103
Rep Power: 20
JonW will become famous soon enough
I will take a look,... pretty max out right now, but I will give feedback soon on this, if I have anything on this or not.
cheers
J.
JonW is offline   Reply With Quote

Old   January 22, 2016, 04:16
Default
  #5
Member
 
Likun
Join Date: Feb 2013
Posts: 52
Rep Power: 13
Likun is on a distinguished road
Send a message via Skype™ to Likun
Quote:
Originally Posted by Tobi View Post
By the way, there is still a problem in my reynolds-averaging that I do not know exactly. Maybe you can answer this question: I showed how we get the RANS equation and used the Buossinesq approximation where I said that the term -2/3k\delta_{ij} is neglected. The question is, is it really neglected because Pope et. al. wrote that we can take this term to the pressure and get a modified pressure p':

p' = p + 2/3 k \delta_{ij}

Do you know if we calculate p' in OpenFOAM or do you have any other hint to that? I am not 100% sure about it. The hint came from Gerhald Holzinger (Linz).

Thanks again,
Tobi
Hi Tobis,

I had the same question before, see this post http://www.cfd-online.com/Forums/ope...-stresses.html. And I realized that the second term is indeed negligible compared to p, unless k is very large.

Best,
Likun
Tobi and JonW like this.
Likun is offline   Reply With Quote

Old   January 24, 2016, 15:00
Default
  #6
Senior Member
 
Jon Elvar Wallevik
Join Date: Nov 2010
Location: Reykjavik, ICELAND
Posts: 103
Rep Power: 20
JonW will become famous soon enough
Hi Tobi and Likun

When going into the source code of simpleFoam, I cannot see it is possible that the solver is working with a modified pressure. If this were the case, the pressure equation would have to get the term 2/3*k*I from somewhere, but there is no hint of this term anywhere in the solver.

However, I did another test. I went into
~/OpenFOAM/OpenFOAM-2.4.x/src/turbulenceModels/incompressible/RAS/kEpsilon/kEpsilon.C

...and did this (see the member function R() above the member divDevReff())...

tmp<fvVectorMatrix> kEpsilon::divDevReff(volVectorField& U) const
{
return
(
// - fvm::laplacian(nuEff(), U)
// - fvc::div(nuEff()*dev(T(fvc::grad(U))))
// --------------------------------------------------------
// Y16M01D24:
- fvm::laplacian(nuEff(), U)
- fvc::div( nuEff()*dev(T(fvc::grad(U))) - ((2.0/3.0)*I)*k_ )
);
}

Thereafter, I tested pitzDaily with and without the modification,
after running stressComponents, I saw no difference between the
the two cases. So if one want, it is possible to add this, but at least in the
pitsDaily case, it is not important.

Note, with modification, you have to add
div(((nuEff*dev(T(grad(U))))-((0.666667)*k))) Gauss linear;
into ./system/fvSchemes (in divSchemes)

J.
Likun likes this.
JonW is offline   Reply With Quote

Old   January 26, 2016, 07:22
Default
  #7
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 Jon,

thanks for the clearness. As I supposed in my paper it is neglected. Thanks for checking this.

@all. I found a mistake in the enthalpy equation of chapter 3. I changed it and added one more hint. The correct diffusion term is (of course):
\nabla \bullet (\lambda \nabla T)

Also the temperature equation has to be changed. The new PDF is up to date.
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   January 30, 2016, 08:54
Default
  #8
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
Hi all,

again I found some mistakes in my paper. I will change it the next days and let you know when it is finished and uploaded.

Cheers
ssss likes this.
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   January 31, 2016, 12:08
Default
  #9
Senior Member
 
Zeppo's Avatar
 
Sergei
Join Date: Dec 2009
Posts: 261
Rep Power: 22
Zeppo will become famous soon enough
Quote:
Originally Posted by Tobi View Post
Feel free to comment on that and I hope that it is helpful, clear and understandable.
Very interesting! Can this article develop into anything big?
I think it would be better if your text was more in line with the books (Ferziger, Versteeg, Anderson) you reference to. Specifically for the part when you derive momentum equation (2.14). The second term in the right hand side of the equation comes with minus sign (-nabla . tau); so does components of a shear stress tensor in equations (4.1)-(4.6). Even though those minuses just cancel out in the end and the final equation (4.13) is the same as in the books, it would be more easy to follow your text if your text followed the books.

Looking at the energy equation (3.4) it is not clear where all the terms come from. I suggest that you should derive the energy equation the way you did with continuum and momentum equations, i.e. start with an infinitesimal fluid volume, formulate the equation in Cartesian scalar notation and transform it into a vector form. Here is the useful link: http://cfd.direct/openfoam/energy-equation/

Misprints:
eq. (2.21): rho was left out.
eq. (4.27): nabla was left out.

Anyway, good job!
Tobi likes this.
Zeppo is offline   Reply With Quote

Old   January 31, 2016, 16:14
Default
  #10
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
Quote:
Originally Posted by Zeppo View Post
Very interesting! Can this article develop into anything big?
It could be, I can offer the LaTeX files and everybody can include some stuff.
Quote:
I think it would be better if your text was more in line with the books (Ferziger, Versteeg, Anderson) you reference to. Specifically for the part when you derive momentum equation (2.14). The second term in the right hand side of the equation comes with minus sign (-nabla . tau); so does components of a shear stress tensor in equations (4.1)-(4.6). Even though those minuses just cancel out in the end and the final equation (4.13) is the same as in the books, it would be more easy to follow your text if your text followed the books.
Of course the minus signs will turn to "+" at least but due to my derivation we get the -nabla . tau at the beginning. I followed the book of Bird (Transport Phenomena) here very close.

Quote:
Looking at the energy equation (3.4) it is not clear where all the terms come from. I suggest that you should derive the energy equation the way you did with continuum and momentum equations, i.e. start with an infinitesimal fluid volume, formulate the equation in Cartesian scalar notation and transform it into a vector form. Here is the useful link: http://cfd.direct/openfoam/energy-equation/
Of course it would be the best but I had no time for that and just took the term from the books. If you want, I will do the same work for energy equation to demonstrate where the terms come from (good hint). But for it was clear after the first two derivation how to do it and I was not sure if anybody is think that this could be useful. At least due to the fact, that a lot of books are out.

Quote:
Misprints:
eq. (2.21): rho was left out.
eq. (4.27): nabla was left out.
Thank you for the good reviewing.

Quote:
Anyway, good job!
Thank you again. Very nice critic. Now I can improve it more.

PS: I also found other mistakes (icoFoam) and derivation to POISSON equation. These are fixed. I will also fix the stuff you mentioned and maybe add Non-Newtonian + Energy-derivation to the documentation.

Good night to everybody.
Tobi

--> New PDF Uploaded
Taataa likes this.
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   February 15, 2016, 11:09
Default
  #11
Senior Member
 
Join Date: Oct 2013
Posts: 397
Rep Power: 19
chriss85 will become famous soon enough
I have recently written a document about the derivation of the enthalpy equation from the total energy equation and the handling of source terms. I figured it might be of some interest here so I'm posting it. Please let me know what you think and if there are errors.

Edit: Some updates to the document.
Edit 2: Added heat conduction term which arises when h=h(p,T).
Attached Files
File Type: pdf Derivation of the enthalpy equation.pdf (107.0 KB, 131 views)
Tobi and JonW like this.

Last edited by chriss85; February 17, 2016 at 09:18.
chriss85 is offline   Reply With Quote

Old   February 17, 2016, 05:40
Default
  #12
Senior Member
 
Join Date: Oct 2013
Posts: 397
Rep Power: 19
chriss85 will become famous soon enough
Has anyone checked the derivation for errors? I recently learned in a discussion with mkraposhin that there is also an additional heat conduction term when the enthalpy function depends on pressure. I have updated the document to reflect this.

I have done some tests to investigate the influence of the additional mass and momentum source terms in the energy equation as well as the additional heat conduction term. In my case they provide small but visible differences so I would suggest to include them.

Edit: Actually the inclusion of the E*S_M term in the enthalpy equation looks to be significant for my case at later times in the simulation.

Last edited by chriss85; February 17, 2016 at 09:19.
chriss85 is offline   Reply With Quote

Old   February 17, 2016, 09:40
Default
  #13
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 Chris,

I checked your summary and its fine. Just a few hints. You never mentioned what the term S_M stand for. Of course it is the mass source term but you should mention that it is zero. Normally we are not dealing with fusion or sth. like that. Additional, people who are not familiar with the mathematic would not know why you multiply the continuity equation by the energy E eqn. (5). Therefore (it is my opinion) the derivation is in the wrong direction. For me it would be clear to derive the conserved energy equation and use the conti to go to the non-conserved form. You did it vice versa and hence, people can get confused why you e.g. multiply the conti by E.

Nontheless, nice stuff.

PS: A lot of authors use the total derivative to derive conserved equations.
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   February 17, 2016, 09:53
Default
  #14
Senior Member
 
Join Date: Oct 2013
Posts: 397
Rep Power: 19
chriss85 will become famous soon enough
Thanks for your comment!
Quote:
Originally Posted by Tobi View Post
You never mentioned what the term S_M stand for. Of course it is the mass source term but you should mention that it is zero. Normally we are not dealing with fusion or sth. like that.
Agreed, some explanation of the terms might be useful. I included a mass source because it can appear in ablation or evaporation models that don't implement it through a boundary condition but as source in the first cell layer. If you can point me to a proper implementation of such models through boundary conditions I would be quite happy .

Quote:
Additional, people who are not familiar with the mathematic would not know why you multiply the continuity equation by the energy E eqn. (5). Therefore (it is my opinion) the derivation is in the wrong direction. For me it would be clear to derive the conserved energy equation and use the conti to go to the non-conserved form. You did it vice versa and hence, people can get confused why you e.g. multiply the conti by E.
In this case I started with the equation for the total energy which is present in Versteeg, "Computational Fluid Dynamics" and derived the equation which is used in the pisoCentralFoam solver by mkraposhin while considering these additional terms. I feel that this is the most generic solution because you can still just omit terms from the equations which are zero.
Quote:
PS: A lot of authors use the total derivative to derive conserved equations.
Yes, but I wanted to show how to get to the final equation that is used in the solver.
chriss85 is offline   Reply With Quote

Old   February 17, 2016, 11:30
Default
  #15
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
Quote:
Originally Posted by chriss85 View Post
In this case I started with the equation for the total energy which is present in Versteeg, "Computational Fluid Dynamics" and derived the equation which is used in the pisoCentralFoam solver by mkraposhin while considering these additional terms. I feel that this is the most generic solution because you can still just omit terms from the equations which are zero.
I know, also in other literature you will start with the total derivative (but here you miss always the conti equation) and you start with a non-conservative form. Of course you will end up in a conservative form because you use the continuity equation but it is not as straight forward as derive the conservative form directly and then go to the non-conservative form. If you are familiar with the guys its not a problem, but for other people its "like" a mystery. For example you use the continuity equation:

\frac{\partial \rho}{\partial t} + \nabla (\rho \textbf{U}) = E_M

and the total derivative:

\rho \frac{\textbf{D}\phi}{\textbf{D}t} = \rho \frac{\partial \phi}{\partial t} + \textbf{U} \bullet \nabla \phi

Till now everything is clear for everybody. Next step is to add the continuity equation to the total derivative like:

\rho \frac{\textbf{D}\phi}{\textbf{D}t} = \rho \frac{\partial \phi}{\partial t} + \textbf{U} \bullet \nabla \phi + \phi \left(\frac{\partial \rho}{\partial t} + \nabla (\rho \textbf{U}) - E_M\right)

Now (maybe) some people are wondering why you multiply the conti by \phi. For me it is clear why you do this and why we have to multiply by \phi. Everybody who is familiar with the mathematic background will not complain about that but beginners or non-familiar math guys get confused or do not know why \phi has to be added

Thats the reason why I said (in my opinion) the better way would be to derive the conservative form first and then do simplifications or not. Why I tell you this, because I got really confused about all the equations. Everywhere and everybody uses other derivations, start from integrals, total derivatives etc. It like you read this book and this and you get more confused about the equations. Of course maybe I am a stupid guy who need a strict forward line (maybe); that was the reason why I derived everything out of a volume element. Then you really get the conserved equations, which can be simplified using the conti to non-conserved equations. If you did this once, of course you can do it vice versa (:

Anyway Well done.
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   February 18, 2016, 10:57
Default
  #16
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
Dear all,

I investigated time to extend the paper / summary as follow:
  • Math section extended and cleared (also mistakes removed)
  • Total-Derivatives and math operations included
  • Derivation of kinetic energy done
  • Derivation of total energy done
  • Derivation of internal energy done
  • Derivation of non-conserved equations of momentum, total energy, internal energy and kinetic energy added


The document is now 45 pages big. Further improvements: speech and logical structure.




I will need a bit more time to get it ready but I will keep you updated. Notice that the derivations are done using a volume element. Therefore we get the conservative forms straight forward.
Xinze, JonW, chriss85 and 1 others like this.
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   February 19, 2016, 17:19
Default
  #17
Senior Member
 
mkraposhin's Avatar
 
Matvey Kraposhin
Join Date: Mar 2009
Location: Moscow, Russian Federation
Posts: 355
Rep Power: 21
mkraposhin is on a distinguished road
Dear colleagues,

Do you keep in mind, that OF is intended to solve integral equations, but not differential.

\frac{d \delta m}{d t} = J = \frac{d  \rho \delta \tau}{d t}
mkraposhin is offline   Reply With Quote

Old   February 20, 2016, 12:34
Default
  #18
Senior Member
 
Jon Elvar Wallevik
Join Date: Nov 2010
Location: Reykjavik, ICELAND
Posts: 103
Rep Power: 20
JonW will become famous soon enough
Dear Matvey

I am pretty sure that most of us know that OF uses the finite volume approach. It is fairly straight forward to transform an integral equation into a differential one. See for example p. 387 in my PhD thesis @ http://ntnu.diva-portal.org/smash/re...2:124984&rvn=1

Also, when programming a solver, a differential approach is used (e.g. UEqn.H in interFoam), which OF transforms into an integral approach (in this case, by the fvm::div(), fvm::laplacian(), fvm::grad() and etc -class)), thus in the end, it is nicer to have the equations in its differential state, rather than in integral state.

Hope this helps
cheers
J.
Tobi and SHUBHAM9595 like this.
JonW is offline   Reply With Quote

Old   February 28, 2016, 08:21
Default
  #19
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
Dear all,

I am happy to announce that I have published the new paper. A lot of changes are done and can not compared to the original (: The document has 45 pages and include the following:

  • Mathematic Notation
  • Derivation of governing equations
    • Continuity
    • Momentum
    • Total Energy
    • Mechanical (Kinetic) Energy
    • Internal (Thermo) Energy
    • Enthalpy
  • Governing equations for engineers
    • Continuity
    • Momentum
    • Enthalpy
    • SUMMARY OF EQUATIONS
  • Shear-Rate tensor and Navier-Stoke
    • Newtonian Fluids
  • Relation between Cauchy, shear-rate and pressure
  • Derivatives of momentum equations
  • Turbulence modeling
  • Derivations of shear-rate functions (openfoam)


The equations are given in the following forms in the first part:
  • Conserved partial
  • Non-Conserved partial
  • Integral


Finally I added the literature I used and gave some cites.





After I restarted working on the stuff, I realized that a lot of stuff is not straight forward and rearranged a lot. Furthermore the english speak was improved and checked. A few mathematic errors were found and corrected.


Everything can be found on my updated page www.holzmann-cfd.de
Feedback, error-report, etc. is welcomed,
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   February 29, 2016, 04:41
Default
  #20
Senior Member
 
Join Date: Oct 2013
Posts: 397
Rep Power: 19
chriss85 will become famous soon enough
Quote:
Originally Posted by Tobi View Post
Everything can be found on my updated page www.holzmann-cfd.de
Feedback, error-report, etc. is welcomed,
Why do you require a login to download the document?
chriss85 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
Verifying LES assumption in OpenFOAM djh2 OpenFOAM Running, Solving & CFD 6 May 25, 2020 19:23


All times are GMT -4. The time now is 11:36.