# Favre or Reynolds Average in OpenFOAM?

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

 September 20, 2017, 05:52 Favre or Reynolds Average in OpenFOAM? #1 Member     Join Date: Oct 2015 Location: Germany Posts: 84 Rep Power: 6 Dear FOAMers, I'm a bit confused. I cannot determine exactly whether OpenFOAM uses Reynolds (RANS) or Favre averaging (FANS) when performing compressible 'RAS' simulations. The OpenFOAM terminology clearly implies it's RANS, so the turbulent fluctuations are not density-normalised. This assumption proves reasonable for many compressible flows (and thus would fit my needs) but not unconditionally for supersonic flows or such including combustion etc. Instead, rationality suggests OpenFOAM solves FANS since (to my knowlegde) its 'RAS' models are applicable to incompressible as well as compressible cases with no need for any user interaction. Or does OpenFOAM choose the best suited approach by itself based on solver conditioning (fvSolution) or else? I searched the forum and the source but did not find a clear answer. Any help is appreciated. Regards and thanks in advance

 November 24, 2017, 15:27 Favre or Reynolds Average in OpenFOAM? #2 New Member   Patrick H. Join Date: Aug 2017 Location: Germany Posts: 3 Rep Power: 4 Hello NablaDyn, This is a question wich i ask myself a lot in the last time. So I am also really interested in the 'right' answer and i already think i did some progress in it. Well I think the problem with the compressible Reynolds-averaged-Navier-Stokes-Equations is, if they are averaging is done with the time averaging: and the splitting into: , the resulting equations are very unhandy because of the products of fluctuations between density and othe variables like the velocity (c.f. [1], p.91). This is shown as example in [2] for the continunity equation in index notation (c.f. [2], p.100): . The equations for the momentum and e.g. the total energy will much more complex. Beacause of this a density-weighted averaged is introduced (c.f. e.g. [1], p.91): and . This leads to the following equations without sources and body forces in index notation (c.f. [3], Equations (12), (13) and (14)): Continunity equation: Momentum equation: Total energy: . (You can also find these equations in [1], p.92 (without total energy equation) and in [4], p.176) These equations are called Favre-averaged Navier-Stokes equations but are also termed as compressible Reynolds-averaged Navier-Stokes equations (c.f. [5]). As shown in [3], after some assumptions the equations can be written as: , where . In tensor notation it should be: (1) (2) (3) (4) (5) . (6) Im looking on sonicFoam of OpenFOAM 4.1, which is a solver forr trans-sonic/supersonic, turbulent flow and there is first the continunity equation solved in rhoEqn.H (code-snippet of the equation): Code:  fvScalarMatrix rhoEqn ( fvm::ddt(rho) + fvc::div(phi) == fvOptions(rho) ); which i think could be translated into: (7) after that UEqn.H is called (code-snippet of the equation): Code:  fvVectorMatrix UEqn ( fvm::ddt(rho, U) + fvm::div(phi, U) + MRF.DDt(rho, U) + turbulence->divDevRhoReff(U) == fvOptions(rho, U) ); . . . if (pimple.momentumPredictor()) { solve(UEqn == -fvc::grad(p)); fvOptions.correct(U); K = 0.5*magSqr(U); } which i think could be translated into: (8) (the is due to the negativ implementation of the terms in the function divDevRhoReff()) where (see [2], cap. 10.2): (9) and (c.f. [6]): (10) if we use (10) with (8): (11) and sort it: (12) and after that EEqn.H is called (code-snippet of the equation): Code:  fvScalarMatrix EEqn ( fvm::ddt(rho, e) + fvm::div(phi, e) + fvc::ddt(rho, K) + fvc::div(phi, K) + fvc::div(fvc::absolute(phi/fvc::interpolate(rho), U), p, "div(phiv,p)") - fvm::laplacian(turbulence->alphaEff(), e) == fvOptions(rho, e) ); which i think could be translated into: (13) which is in coincidence with [7] if is used: .(14) The term is a aproxximation for the heat flux so we get after sorting and using (10) (c.f. [7]): (15) and with .(16) So if I interpret the following variables as averaged and favre averaged in the equations (7), (12) and (15): I get out of (7): . which is equivalent to (1). I get out of (12): and if I use I get: which is equivalent to (2). I get out of (15): . This equation is not equivalent. The variable is the approximation for . This leads me to the assumption, that the term is totaly neglected and also the part of the tensor is neglected in the total energy equation. Now this is my actual interpretation of the Code and the equations which were aviable to me until now. Does someone agree or disagree with the above text? The questions which are arising in me are: If the pressure, which is modeled in OpenFoam, is divided up like shown in equation (10), is this neglected in the Calculation of the equation of state? In which cases would the neglection of the terms in the total energy equation lead to a discrepancy of the solution which is not negligible? [1] Hirsch, Charles (2007): Fundamentals of computational fluid dynamics. 2. ed. Amsterdam: Elsevier/Butterworth-Heinemann (Numerical computation of internal and external flows, / Charles Hirsch ; Vol. 1). [2] Tobias Holzmann (2016): Mathematics, Numerics, Derivations and OpenFOAMŪ: Holzmann CFD. [3] https://www.cfd-online.com/Wiki/Favr...okes_equations [4] Wilcox, David C. (1993): Turbulence modeling for CFD. La Caņada, Calif.: DCW Industries Inc. [5] https://turbmodels.larc.nasa.gov/implementrans.html [6] https://www.openfoam.com/documentati...lence-ras.html [7] https://cfd.direct/openfoam/energy-equation/ fedvasu, Taataa, randolph and 3 others like this.

December 4, 2017, 12:44
#3
Senior Member

Lucky Tran
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 3,830
Rep Power: 46
Quote:
 Originally Posted by patrex If the pressure, which is modeled in OpenFoam, is divided up like shown in equation (10), is this neglected in the Calculation of the equation of state?
Yes there is the problem with pressure in which OF solves for p* and not p, which can be inferred from this line where you see only grad(p).
Code:
solve(UEqn == -fvc::grad(p));
So this is the only p that OF keeps track of, which it goes and uses for its thermo. It's also the p that gets written to file. So the pressure that you get out of OF is not the true mechanical/thermodynamic pressure but a modified pressure. In theory, one could subtract the contribution from the tke before calculating the thermo, but this is not done in general. I can't think of a solver which actually does this off the top-of-my-head. One would have to check the source code to make sure.

However, the difference goes like the I^2 so it is small except for very high turbulence intensity scenarios. Note the origin comes from the Boussinesq hypothesis. It's not a compressibility issue. You find the same modified pressure p* for both RANS and FANS. Star-CCM and Fluent do the same thing. There is also a mention of it in Pope's book. It seems the general approach is to assume that the k contribution to pressure is negligible.

This thread is useful, on calculating divdevreff but also contains some comments in the discussion on the modified pressure.
Calculating divDevReff

Quote:
 Originally Posted by patrex In which cases would the neglection of the terms in the total energy equation lead to a discrepancy of the solution which is not negligible?
It affects the pressure and them subsequent thermo quantities derived from pressure.
First you need super high values of k. That should be apparent because k modifies the pressure. For thermo, you need an EOS which is pressure dependent. The other thing you need to check is properties. Very often, one assumes ideal gas where the specific heat and internal energy are only temperature dependent. So the modified pressure does not affect energy equation beyond pressure. So very often this modified pressure does not break anything. But you can imagine that you have a EOS that is highly dependent on pressure where this becomes a problem; and shouldn't forget to mention shockwaves.

Quote:
 Originally Posted by patrex This leads me to the assumption, that the term is totaly neglected and also the part of the tensor is neglected in the total energy equation.
Yes, the viscous terms are neglected in the energy equation in many solvers.

Btw to answer the original question:
Quote:
 Originally Posted by NablaDyn Dear FOAMers, I'm a bit confused. I cannot determine exactly whether OpenFOAM uses Reynolds (RANS) or Favre averaging (FANS) when performing compressible 'RAS' simulations. The OpenFOAM terminology clearly implies it's RANS, so the turbulent fluctuations are not density-normalised. This assumption proves reasonable for many compressible flows (and thus would fit my needs) but not unconditionally for supersonic flows or such including combustion etc. Instead, rationality suggests OpenFOAM solves FANS since (to my knowlegde) its 'RAS' models are applicable to incompressible as well as compressible cases with no need for any user interaction. Or does OpenFOAM choose the best suited approach by itself based on solver conditioning (fvSolution) or else?
The FANS equations should look identical to the RANS equations w/o density fluctuations. The other interpretation is that if you use the RANS equations, the equation is also valid for compressible flows as long as you remember that you should replace the Reynolds-average variables with their Favre-counterparts. This ability to completely interchange variables and have the same physics is precisely why Favre-averaging is useful. This is not 100% true because actually you do not always get the same equations w/ RANS as FANS. There are some assumptions you have to make to force to be able to recover RANS from FANS.

From a solver perspective, there is a fixed set of equations that gets solved (and they are the same equation). Hence the solver, (OF or any other solver) does not know whether these variables are the Reynolds ones or Favre ones because it's the same equation. Only the interpretation of the variables needs to be different. Remember in FANS you do not solve for the true velocity but a biased velocity, etc.

January 13, 2018, 09:06
#4
Member

Join Date: Oct 2015
Location: Germany
Posts: 84
Rep Power: 6
Dear Patrick and Lucky,

thank you for your very detailed and helpful contributions to this thread. It really cleared things up.

Quote:
 Originally Posted by LuckyTran From a solver perspective, there is a fixed set of equations that gets solved (and they are the same equation). Hence the solver, (OF or any other solver) does not know whether these variables are the Reynolds ones or Favre ones because it's the same equation. Only the interpretation of the variables needs to be different. Remember in FANS you do not solve for the true velocity but a biased velocity, etc.
Well, this now seems ridiculously obvious to me... However, I think I should have a closer look at Pope's work to get a better, intuitive feel regarding FANS.

Thanks again!

Martin

June 12, 2018, 17:31
#5
Member

Join Date: Oct 2013
Posts: 88
Rep Power: 8
Quote:
 Originally Posted by patrex Hello NablaDyn, This is a question wich i ask myself a lot in the last time. So I am also really interested in the 'right' answer and i already think i did some progress in it. Well I think the problem with the compressible Reynolds-averaged-Navier-Stokes-Equations is, if they are averaging is done with the time averaging: and the splitting into: , the resulting equations are very unhandy because of the products of fluctuations between density and othe variables like the velocity (c.f. [1], p.91). This is shown as example in [2] for the continunity equation in index notation (c.f. [2], p.100): . The equations for the momentum and e.g. the total energy will much more complex. Beacause of this a density-weighted averaged is introduced (c.f. e.g. [1], p.91): and . This leads to the following equations without sources and body forces in index notation (c.f. [3], Equations (12), (13) and (14)): Continunity equation: Momentum equation: Total energy: . (You can also find these equations in [1], p.92 (without total energy equation) and in [4], p.176) These equations are called Favre-averaged Navier-Stokes equations but are also termed as compressible Reynolds-averaged Navier-Stokes equations (c.f. [5]). As shown in [3], after some assumptions the equations can be written as: , where . In tensor notation it should be: (1) (2) (3) (4) (5) . (6) Im looking on sonicFoam of OpenFOAM 4.1, which is a solver forr trans-sonic/supersonic, turbulent flow and there is first the continunity equation solved in rhoEqn.H (code-snippet of the equation): Code:  fvScalarMatrix rhoEqn ( fvm::ddt(rho) + fvc::div(phi) == fvOptions(rho) ); which i think could be translated into: (7) after that UEqn.H is called (code-snippet of the equation): Code:  fvVectorMatrix UEqn ( fvm::ddt(rho, U) + fvm::div(phi, U) + MRF.DDt(rho, U) + turbulence->divDevRhoReff(U) == fvOptions(rho, U) ); . . . if (pimple.momentumPredictor()) { solve(UEqn == -fvc::grad(p)); fvOptions.correct(U); K = 0.5*magSqr(U); } which i think could be translated into: (8) (the is due to the negativ implementation of the terms in the function divDevRhoReff()) where (see [2], cap. 10.2): (9) and (c.f. [6]): (10) if we use (10) with (8): (11) and sort it: (12) and after that EEqn.H is called (code-snippet of the equation): Code:  fvScalarMatrix EEqn ( fvm::ddt(rho, e) + fvm::div(phi, e) + fvc::ddt(rho, K) + fvc::div(phi, K) + fvc::div(fvc::absolute(phi/fvc::interpolate(rho), U), p, "div(phiv,p)") - fvm::laplacian(turbulence->alphaEff(), e) == fvOptions(rho, e) ); which i think could be translated into: (13) which is in coincidence with [7] if is used: .(14) The term is a aproxximation for the heat flux so we get after sorting and using (10) (c.f. [7]): (15) and with .(16) So if I interpret the following variables as averaged and favre averaged in the equations (7), (12) and (15): I get out of (7): . which is equivalent to (1). I get out of (12): and if I use I get: which is equivalent to (2). I get out of (15): . This equation is not equivalent. The variable is the approximation for . This leads me to the assumption, that the term is totaly neglected and also the part of the tensor is neglected in the total energy equation. Now this is my actual interpretation of the Code and the equations which were aviable to me until now. Does someone agree or disagree with the above text? The questions which are arising in me are: If the pressure, which is modeled in OpenFoam, is divided up like shown in equation (10), is this neglected in the Calculation of the equation of state? In which cases would the neglection of the terms in the total energy equation lead to a discrepancy of the solution which is not negligible? [1] Hirsch, Charles (2007): Fundamentals of computational fluid dynamics. 2. ed. Amsterdam: Elsevier/Butterworth-Heinemann (Numerical computation of internal and external flows, / Charles Hirsch ; Vol. 1). [2] Tobias Holzmann (2016): Mathematics, Numerics, Derivations and OpenFOAMŪ: Holzmann CFD. [3] https://www.cfd-online.com/Wiki/Favr...okes_equations [4] Wilcox, David C. (1993): Turbulence modeling for CFD. La Caņada, Calif.: DCW Industries Inc. [5] https://turbmodels.larc.nasa.gov/implementrans.html [6] https://www.openfoam.com/documentati...lence-ras.html [7] https://cfd.direct/openfoam/energy-equation/
This is a clear and detailed explanation of how averaging is done in OpenFOAM and how to interpret the notation.

Thanks.

Last edited by fedvasu; June 12, 2018 at 23:38.

 October 13, 2018, 13:25 #6 Senior Member   Join Date: Mar 2011 Posts: 158 Rep Power: 11 Thank you for the detailed and illustrative contribution. It really helped me to better understand how OpenFoam deals with Reynolds and Favre averaging. But what is still unclear for me is the following: How do I get to know which solver uses RANS or FANS equations? Do all solvers using the compressible NS equations solve for the FANS (=compressible RANS) equations? When I assume, as you already indicated, that the same equations are solved, where is the massweighted time averaging done? I do not find a hint in the code, where the velocity and specific enthalpy (which are the variables which are averaged with the density) are treated separately. What also confuses me a little bit: No word about Favre averaging is spent here: https://www.openfoam.com/documentati...lence-ras.html So how are the compressible NS equations time averaged when using RANS equations? Best Regards

October 13, 2018, 13:34
#7
Senior Member

Lucky Tran
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 3,830
Rep Power: 46
Quote:
 Originally Posted by tH3f0rC3 How do I get to know which solver uses RANS or FANS equations?

You never know. The solver solves an equation like Ax=b and x can be anything. You have to infer based on the models whether x is a RANS of FANS or neither.

In the case of RANS and FANS, the equations are identical (the A and b are the same). So you can say all solvers always solve the FANS. No one ever talks about it, because the equations are the same. Once you are given a solver you don't get to decide what x is. The solver solves for x.

 October 13, 2018, 14:18 #8 Senior Member   Join Date: Mar 2011 Posts: 158 Rep Power: 11 OK, yes, that's right. If the equations are the same, x is the time averaged velocity when using the RANS equations and x is the massweighted time averaged velocity, for example. Thus, somewhere in the code there must be hidden the corresponding averaging equation, which provides the x to the solver. And I can't find such a hint in the code. Do you get my point? Last edited by tH3f0rC3; October 13, 2018 at 14:20. Reason: Misspelling

 October 14, 2018, 14:52 #9 New Member   Patrick H. Join Date: Aug 2017 Location: Germany Posts: 3 Rep Power: 4 It is the following way: If you had all values continuous in time and spatial direction for a given problem. You could calculate the how ever shaped averaged value. If there is a flow, for which the simplifications, which are made for the incompressible Reynolds-averaging, are valid, you could now calculate the averaged values from the continuous values. The averaged values which a RANS-Solver would calculate directly. The same applies for a flow, for which the simplifications, made for the FANS-equation, are valid. As shown in different Sources and my previous post the Equations for incompressible RANS and the compressible FANS are under somehow shaped simplifications the same. So now it depends on your calculated flow how you have to interpret the of your solver calculated values. So if you only look at the equations (FANS and RANS) there could be two different flows, one compressible and one incompressible, which are different shaped in their actual values, but with proper averaging (FANS- and RANS-averaging consecutively) are the same in their averaged values. Means: OpenFOAM does no averaging. The averaged values are calculated directly with the solver.

 October 15, 2018, 07:01 #10 Senior Member   Join Date: Mar 2011 Posts: 158 Rep Power: 11 Thanks patrex for your explanation. This point is also clear to me. I will try it this way to explain my problem: Let's assume we have a flow, for which the simplifications, which are made for the incompressible Reynolds-averaging, are valid. Which solver do I use in contrast to a case, where we assume a flow, for which the simplifications, made for the FANS-equation, are valid. After having solved the compressible Navier Stokes equations using for example the solver buoyantSimpleFoam I get values for u, p, T. After solving the incompressible Nasvier-Stokes equations using for example the solver buoyantBoussineswSimpleFoam I also get values for u, p, T. As far as I understand, the Reynolds-averaging is used to treat turbulence for incompressible problems and Favre-averaging to treat turbulence for compressible problems (to secure the validity of the continuity equation for the averaged flow). Comming back to my first question: -> How do I get to know which solver uses RANS or FANS equations?