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

Accessing turbulence variables in fvOptions

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 17, 2019, 15:00
Default Accessing turbulence variables in fvOptions
  #1
Senior Member
 
Andrea
Join Date: Feb 2012
Location: Leeds, UK
Posts: 179
Rep Power: 16
Andrea1984 is on a distinguished road
Hello,

I am trying to define a source term for the epsilon equation using a scalarCodedSource in fvOptions.

I am using OF v6 and my solver is simpleFoam.

In my code I can easily access attributes of my mesh as, for instance:

Code:
const vectorField& C = mesh_.C();
to access the coordinates of the cell centres.

The source term I am trying to implement depends also on k and epsilon. Any idea on how I can access the turbulence variable fields from fvOptions?

I have tried both
Code:
const scalarField& eps = epsilon_;
and

Code:
const scalarField& eps = turbulence->epsilon();
but without any success.

Any help would be greatly appreciated.

Andrea
Andrea1984 is offline   Reply With Quote

Old   July 18, 2019, 08:25
Default
  #2
Senior Member
 
Joachim Herb
Join Date: Sep 2010
Posts: 650
Rep Power: 22
jherb is on a distinguished road
Try something like (see https://github.com/OpenFOAM/OpenFOAM...nsfer.C#L105):
Code:
const compressible::turbulenceModel &turb = mesh_.lookupObject<compressible::turbulenceModel>
        (
            turbulenceModel::propertiesName
        );
const volScalarField &eps = turb.epsion();

Perhaps you have to change it to a non-compressible turbulence class depending on your solver.
jherb is offline   Reply With Quote

Old   July 19, 2019, 11:51
Default
  #3
Senior Member
 
Andrea
Join Date: Feb 2012
Location: Leeds, UK
Posts: 179
Rep Power: 16
Andrea1984 is on a distinguished road
Hi Joachim

thanks for your reply. I have tested your approach but it does not work because compressible::turbulenceModel (or incompressible::turbulenceModel for incompressible cases) is not a valid type to declare within fvOptions. Maybe this can be fixed with a few include statements but I could not find a quick fix.

However, I have discovered that the following syntax does the trick:

Code:
const scalarField& eps = mesh_.lookupObject<volScalarField>("epsilon");
this can be used without including any additional header files since mesh_ is already available in fvOptions.

Andrea
Andrea1984 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
Turbulence postprocessing Mohsin FLUENT 2 October 3, 2016 15:18
Question on Turbulence Intensity Eric FLUENT 1 March 7, 2012 05:30
UDF to calculate phase-averaged turbulence variables in a periodic flow ShuangqingXu Fluent UDF and Scheme Programming 0 October 27, 2011 00:48
Accessing private variables robertmaier9 OpenFOAM Programming & Development 4 May 30, 2011 08:06
turbulence modeling questions llowen Main CFD Forum 3 September 11, 1998 05:24


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