
[Sponsors] 
January 11, 2016, 12:04 
Mathematics, Numerics, Derivations and OpenFOAM

#1 
Super Moderator
Tobias Holzmann
Join Date: Oct 2010
Location: Leoben (Austria)
Posts: 1,801
Blog Entries: 6
Rep Power: 32 
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:
http://www.holzmanncfd.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 

January 20, 2016, 14:51 

#2 
Member
Jon Elvar Wallevik
Join Date: Nov 2010
Location: Reykjavik, ICELAND
Posts: 84
Rep Power: 12 
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 nonNewtonian fluids, with some good references (the paper is using the MRF in OpenFOAM for nonNewtonian 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 4blades vane rheometer, International Journal of Heat and Fluid Flow, 50 (2014) 95–102. DOI: 10.1016/j.ijheatfluidflow.2014.06.001 

January 20, 2016, 16:11 

#3 
Super Moderator
Tobias Holzmann
Join Date: Oct 2010
Location: Leoben (Austria)
Posts: 1,801
Blog Entries: 6
Rep Power: 32 
Hi Jon,
thanks for the feedback and the hint to your paper. My colleague also uses your shearrate calculation for viscoplastic modeling but at the moment there was no time also to include NonNewtonian fluids. Mostly (as you already realized, I talk about Newtonian fluids). To the "extrastress 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 NonNewtonian 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 reynoldsaveraging 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 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': 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 

January 21, 2016, 06:30 

#4 
Member
Jon Elvar Wallevik
Join Date: Nov 2010
Location: Reykjavik, ICELAND
Posts: 84
Rep Power: 12 
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. 

January 22, 2016, 04:16 

#5 
Member

Quote:
I had the same question before, see this post http://www.cfdonline.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 

January 24, 2016, 15:00 

#6 
Member
Jon Elvar Wallevik
Join Date: Nov 2010
Location: Reykjavik, ICELAND
Posts: 84
Rep Power: 12 
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/OpenFOAM2.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. 

January 26, 2016, 07:22 

#7 
Super Moderator
Tobias Holzmann
Join Date: Oct 2010
Location: Leoben (Austria)
Posts: 1,801
Blog Entries: 6
Rep Power: 32 
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): Also the temperature equation has to be changed. The new PDF is up to date.
__________________
Keep foaming, Tobias Holzmann 

January 30, 2016, 08:54 

#8 
Super Moderator
Tobias Holzmann
Join Date: Oct 2010
Location: Leoben (Austria)
Posts: 1,801
Blog Entries: 6
Rep Power: 32 
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
__________________
Keep foaming, Tobias Holzmann 

January 31, 2016, 12:08 

#9  
Senior Member
Sergei
Join Date: Dec 2009
Posts: 184
Rep Power: 10 
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. 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/energyequation/ Misprints: eq. (2.21): rho was left out. eq. (4.27): nabla was left out. Anyway, good job! 

January 31, 2016, 16:14 

#10  
Super Moderator
Tobias Holzmann
Join Date: Oct 2010
Location: Leoben (Austria)
Posts: 1,801
Blog Entries: 6
Rep Power: 32 
It could be, I can offer the LaTeX files and everybody can include some stuff.
Quote:
Quote:
Quote:
Quote:
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 NonNewtonian + Energyderivation to the documentation. Good night to everybody. Tobi > New PDF Uploaded
__________________
Keep foaming, Tobias Holzmann 

February 15, 2016, 11:09 

#11 
Senior Member
Join Date: Oct 2013
Posts: 380
Rep Power: 7 
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). Last edited by chriss85; February 17, 2016 at 09:18. 

February 17, 2016, 05:40 

#12 
Senior Member
Join Date: Oct 2013
Posts: 380
Rep Power: 7 
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. 

February 17, 2016, 09:40 

#13 
Super Moderator
Tobias Holzmann
Join Date: Oct 2010
Location: Leoben (Austria)
Posts: 1,801
Blog Entries: 6
Rep Power: 32 
Hey Chris,
I checked your summary and its fine. Just a few hints. You never mentioned what the term 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 nonconserved 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 

February 17, 2016, 09:53 

#14  
Senior Member
Join Date: Oct 2013
Posts: 380
Rep Power: 7 
Thanks for your comment!
Quote:
Quote:
Quote:


February 17, 2016, 11:30 

#15  
Super Moderator
Tobias Holzmann
Join Date: Oct 2010
Location: Leoben (Austria)
Posts: 1,801
Blog Entries: 6
Rep Power: 32 
Quote:
and the total derivative: Till now everything is clear for everybody. Next step is to add the continuity equation to the total derivative like: Now (maybe) some people are wondering why you multiply the conti by . For me it is clear why you do this and why we have to multiply by . Everybody who is familiar with the mathematic background will not complain about that but beginners or nonfamiliar math guys get confused or do not know why 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 nonconserved equations. If you did this once, of course you can do it vice versa (: Anyway Well done.
__________________
Keep foaming, Tobias Holzmann 

February 18, 2016, 10:57 

#16 
Super Moderator
Tobias Holzmann
Join Date: Oct 2010
Location: Leoben (Austria)
Posts: 1,801
Blog Entries: 6
Rep Power: 32 
Dear all,
I investigated time to extend the paper / summary as follow:
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.
__________________
Keep foaming, Tobias Holzmann 

February 19, 2016, 17:19 

#17 
Senior Member
Matvey Kraposhin
Join Date: Mar 2009
Location: Moscow, Russian Federation
Posts: 330
Rep Power: 12 
Dear colleagues,
Do you keep in mind, that OF is intended to solve integral equations, but not differential.
__________________
Winter OpenFOAM days in Moscow  http://www.opencloudconf.ru/en/oscome.html 

February 20, 2016, 12:34 

#18 
Member
Jon Elvar Wallevik
Join Date: Nov 2010
Location: Reykjavik, ICELAND
Posts: 84
Rep Power: 12 
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.divaportal.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. 

February 28, 2016, 08:21 

#19 
Super Moderator
Tobias Holzmann
Join Date: Oct 2010
Location: Leoben (Austria)
Posts: 1,801
Blog Entries: 6
Rep Power: 32 
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:
The equations are given in the following forms in the first part:
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.holzmanncfd.de Feedback, errorreport, etc. is welcomed,
__________________
Keep foaming, Tobias Holzmann 

February 29, 2016, 04:41 

#20  
Senior Member
Join Date: Oct 2013
Posts: 380
Rep Power: 7 
Quote:


Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Verifying LES assumption in OpenFOAM  djh2  OpenFOAM Running, Solving & CFD  2  July 28, 2014 06:39 