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

Why ESI and Foundation have different k-epsilon implementation?

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By MMRC

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 19, 2024, 08:50
Default Why ESI and Foundation have different k-epsilon implementation?
  #1
Member
 
Marķa Rosales
Join Date: Mar 2023
Location: Spain
Posts: 48
Rep Power: 3
MMRC is on a distinguished road
Dear community, maybe my math skills are not current enough to confirm these 02 implementations are the same. Please check with me the production term and the FIRST term in the right side of the dissipation rate equation that for both software, are not the same, or are they?:


In openfoam ESI either 2012 or 2306 we have for production term:
Code:
const volScalarField::Internal divU
(fvc::div(fvc::absolute(this->phi(), U))().v() );
tmp<volTensorField> tgradU = fvc::grad(U);     const volScalarField::Internal GbyNu
     (
this->type() + ":GbyNu",
         tgradU().v() && dev(twoSymm(tgradU().v()))
     );
     const volScalarField::Internal G(this->GName(), nut()*GbyNu);
     tgradU.clear();
And, for epsilon equation this:
Code:
// Dissipation equation
      tmp<fvScalarMatrix> epsEqn
     (
         fvm::ddt(alpha, rho, epsilon_)
       + fvm::div(alphaRhoPhi, epsilon_)
       - fvm::laplacian(alpha*rho*DepsilonEff(), epsilon_)
      ==
         C1_*alpha()*rho()*GbyNu*Cmu_*k_()
 - fvm::SuSp(((2.0/3.0)*C1_ - C3_)*alpha()*rho()*divU, epsilon_)
 - fvm::Sp(C2_*alpha()*rho()*epsilon_()/k_(), epsilon_)
       + epsilonSource()
       + fvOptions(alpha, rho, epsilon_)
     );

In openfoam Foundation 9, we have for production term:
Code:
                           volScalarField::Internal divU
     (
         fvc::div(fvc::absolute(this->phi(), U))()
     );
 
 
     tmp<volTensorField> tgradU = fvc::grad(U);
     volScalarField::Internal G
     (
         this->GName(),
         nut()*(dev(twoSymm(tgradU().v())) && tgradU().v())
     );
     tgradU.clear();
And, for epsilon equation this:


Code:
  // Dissipation equation
                 tmp<fvScalarMatrix>             epsEqn
                 (
                     fvm::ddt(alpha,             rho, epsilon_)
                   +             fvm::div(alphaRhoPhi, epsilon_)
                   -             fvm::laplacian(alpha*rho*DepsilonEff(), epsilon_)
                  ==
                                 C1_*alpha()*rho()*G*epsilon_()/k_()
             -             fvm::SuSp(((2.0/3.0)*C1_ - C3_)*alpha()*rho()*divU, epsilon_)
              -             fvm::Sp(C2_*alpha()*rho()*epsilon_()/k_(), epsilon_)
                   +             epsilonSource()
                   +             fvModels.source(alpha, rho, epsilon_)
                 );
Key differences are:
1)
In the section of Production G definition in ESI version, these variables are set as constants, would this imply they won't be modifiable while running the simulation?

2) Curiousity, is this math operation conmmutative of dot products commutative in order to asume that both source codes 'implements the same' ?

ESI:
const volScalarField::Internal GbyNu
(
IOobject::scopedName(this->type(), "GbyNu"),
tgradU().v() && devTwoSymm(tgradU().v())
);
const volScalarField::Internal G(this->GName(), nut()*GbyNu);


Foundation:
volScalarField::Internal G
(
this->GName(),
nut()*(dev(twoSymm(tgradU().v())) && tgradU().v())
);
3) The first term in RHS of dissipation equation... both are the same, right?
ESI: C1_*alpha()*rho()*GbyNu*Cmu_*k_()
Foundation: C1_*alpha()*rho()*G*epsilon_()/k_()


I'd truly appreciate any clarification.

Last edited by MMRC; February 19, 2024 at 16:25. Reason: Improving redaction
MMRC is offline   Reply With Quote

Old   February 29, 2024, 08:09
Default
  #2
Member
 
Marķa Rosales
Join Date: Mar 2023
Location: Spain
Posts: 48
Rep Power: 3
MMRC is on a distinguished road
Hello community,

I solved my inquiry. Even though ESI and Foundation looks different in code implementation, at the end is the same. I tested by changing the definition of G and the first term of the RHS of transport of epsilon, in different tests and it prompts the same.

My inquiry came from the trying to implement a new type of turbulence model based on k-e and changing the way of cumputing nut. My first experience was getting different results than expected, and the issue was in these lines of code where my modified nut was not considered because old definition was used.
MMRC is offline   Reply With Quote

Old   February 29, 2024, 08:39
Default
  #3
Senior Member
 
Join Date: Apr 2020
Location: UK
Posts: 736
Rep Power: 14
Tobermory will become famous soon enough
Quote:
1) In the section of Production G definition in ESI version, these variables are set as constants, would this imply they won't be modifiable while running the simulation?
Not quite - remember that the contents of GbyNu are discarded once the variable goes out of scope, i.e. once the kEpsilon::correct() function has executed. It then gets created afresh (as a const) when the correct function is next called, i.e. the next iteration. The const label simply means that within the correct() function it is constant. I am not sure why the change was made - it's probably more correct/safer .... pls comment anyone else if you have insight to share.

Quote:
2) Curiousity, is this math operation conmmutative of dot products commutative in order to asume that both source codes 'implements the same' ?
The double dot product \mathbf{a}:\mathbf{b} = \mathbf{a}_{ij} \mathbf{b}_{ij} is indeed commutative - just think about how the above terms expand out, and you'll see you have terms like a_{12}b_{12}, which is the same as b_{12}a_{12} since multiplication is commutative.


Quote:
3) The first term in RHS of dissipation equation... both are the same, right?
Yes. Just substitute the definition of nut in \nu_t = C_\mu \frac{k^2}{\epsilon} and you will see that GbyNu*Cmu_*k_() is the same as G*epsilon_()/k_()
Tobermory is offline   Reply With Quote

Old   February 29, 2024, 10:27
Default
  #4
Member
 
Marķa Rosales
Join Date: Mar 2023
Location: Spain
Posts: 48
Rep Power: 3
MMRC is on a distinguished road
Hola Tobermory, I trully appreciate your reply, thanks for the clarifications.



Quote:
Originally Posted by Tobermory View Post
Not quite - remember that the contents of GbyNu are discarded once the variable goes out of scope, i.e. once the kEpsilon::correct() function has executed. It then gets created afresh (as a const) when the correct function is next called, i.e. the next iteration. The const label simply means that within the correct() function it is constant. I am not sure why the change was made - it's probably more correct/safer .... pls comment anyone else if you have insight to share.


The double dot product \mathbf{a}:\mathbf{b} = \mathbf{a}_{ij} \mathbf{b}_{ij} is indeed commutative - just think about how the above terms expand out, and you'll see you have terms like a_{12}b_{12}, which is the same as b_{12}a_{12} since multiplication is commutative.



Yes. Just substitute the definition of nut in \nu_t = C_\mu \frac{k^2}{\epsilon} and you will see that GbyNu*Cmu_*k_() is the same as G*epsilon_()/k_()
Tobermory likes this.
MMRC is offline   Reply With Quote

Reply

Tags
kepsilon, openfoam, source code


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
Formulation in compressibleInterFoam scttmllr OpenFOAM Running, Solving & CFD 72 June 26, 2023 08:42
[solidMechanics] Support thread for "Solid Mechanics Solvers added to OpenFOAM Extend" bigphil OpenFOAM CC Toolkits for Fluid-Structure Interaction 686 December 22, 2022 10:10
OpenFOAM version switch from ESI to Foundation vronti OpenFOAM 1 May 2, 2022 04:48
AMI implementation: Foundation vs. ESI heksel8i OpenFOAM Programming & Development 1 July 1, 2021 12:53
Overview on the different OF-players like "CFD Direct" or OpenCFD Ltd (ESI Group) elvis OpenFOAM 4 August 16, 2017 15:34


All times are GMT -4. The time now is 17:51.