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

Q: How to access turbulent production term G from TKE in scalarCodedSource

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By Kbshariff
  • 1 Post By Tobermory

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 11, 2022, 06:51
Default Q: How to access turbulent production term G from TKE in scalarCodedSource
  #1
Member
 
Kabir Shariff
Join Date: Oct 2016
Location: France
Posts: 53
Rep Power: 10
Kbshariff is on a distinguished road
Hello,

I would like to implement a source term into k-epsilon model in a given location using the scalar coded source in fvOptions.

I implemented the k source and it works fine, but the epsilon source term need the production term of the TKE, G. How can I get this term into the equation?

The source term is given in the figure attached herewith.
G.JPG



Thank you.
Kbshariff is offline   Reply With Quote

Old   January 11, 2022, 09:47
Default
  #2
Senior Member
 
Julio Pieri
Join Date: Sep 2017
Posts: 109
Rep Power: 9
JulioPieri is on a distinguished road
Is this field natively available by the solver?

You can check it by running a "dummy" functionObject that will give you an error and print all available fields:

Code:
FIELDSAVAILABLE
    {
        type                 writeObjects;
        libs            ("libfieldFunctionObjects.so");
        executeControl  writeTime;
        writeControl        writeTime;
        objects
        ("HIMYFRIEND");
    }
Check if you can see the field you're looking for printed.

If you can, you may access it with something like

Code:
mesh().lookupObject<volScalarField>("FIELD");
changing Scalar to Vector depending on the type.

If you can't, then you might need to re-write it from the other available fields
JulioPieri is offline   Reply With Quote

Old   January 11, 2022, 10:34
Default
  #3
Member
 
Kabir Shariff
Join Date: Oct 2016
Location: France
Posts: 53
Rep Power: 10
Kbshariff is on a distinguished road
Quote:
Originally Posted by JulioPieri View Post
Is this field natively available by the solver?

You can check it by running a "dummy" functionObject that will give you an error and print all available fields:

Code:
FIELDSAVAILABLE
    {
        type                 writeObjects;
        libs            ("libfieldFunctionObjects.so");
        executeControl  writeTime;
        writeControl        writeTime;
        objects
        ("HIMYFRIEND");
    }
Check if you can see the field you're looking for printed.

If you can, you may access it with something like

Code:
mesh().lookupObject<volScalarField>("FIELD");
changing Scalar to Vector depending on the type.

If you can't, then you might need to re-write it from the other available fields

Hello, thanks for the reply, I checked the term is not listed in the available field list.
the TKE production term G is defined in the KEps model as;

It is defined in the .C fine as

Code:
    const volScalarField::Internal G(this->GName(), nut()*GbyNu);
    tgradU.clear();
here

Code:
    // Turbulent kinetic energy equation
    tmp<fvScalarMatrix> kEqn
    (
        fvm::ddt(alpha, rho, k_)
      + fvm::div(alphaRhoPhi, k_)
      - fvm::laplacian(alpha*rho*DkEff(), k_)
     ==
        alpha()*rho()*G
      - fvm::SuSp((2.0/3.0)*alpha()*rho()*divU, k_)
      - fvm::Sp(alpha()*rho()*epsilon_()/k_(), k_)
      + kSource()
      + fvOptions(alpha, rho, k_)
    );
How can I get the production term for the solver?
Clément_G likes this.
Kbshariff is offline   Reply With Quote

Old   January 11, 2022, 10:52
Default
  #4
Senior Member
 
Julio Pieri
Join Date: Sep 2017
Posts: 109
Rep Power: 9
JulioPieri is on a distinguished road
Hmm so this is harder. I'd try recreating this expression:

Code:
tgradU().v() && dev(twoSymm(tgradU().v())) * nut()
but I'm not sure how to get each of the terms, though they might be accessible.

As alternatives you could edit the code to make this variable accessible, or use swak4Foam that usually have access to more fields. Not sure how to use it for fvOptions though.
JulioPieri is offline   Reply With Quote

Old   January 11, 2022, 15:57
Default
  #5
Senior Member
 
Join Date: Apr 2020
Location: UK
Posts: 746
Rep Power: 14
Tobermory will become famous soon enough
You are right Julio, but most of those terms (tgradU(), twoSymm(tgradU().v())) will not be stored on the registry, so you'll have to recreate them from the velocity field. Just follow the coding in the kEpsilon model, and you should be fine.
JulioPieri likes this.
Tobermory is offline   Reply With Quote

Reply

Tags
fvoptions, kepsilon, scalarcodedsource, source term


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
scalarCodedSource how to access to field instance samiahmed OpenFOAM 1 June 30, 2019 21:51
How to access nu and nut values for a Turbulent Solver suman91 OpenFOAM Programming & Development 9 December 19, 2018 07:17
laplacian term in turbulent model chai OpenFOAM Running, Solving & CFD 4 March 8, 2012 10:28
ATTENTION! Reliability problems in CFX 5.7 Joseph CFX 14 April 20, 2010 16:45
Numerical method for the k-epsilon production term carlslack Main CFD Forum 0 January 23, 2003 17:13


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