CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM

mykEpsilon - How to set a min/max constraint for a term with units

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

Reply
 
LinkBack Thread Tools Display Modes
Old   October 11, 2010, 19:18
Unhappy mykEpsilon - How to set a min/max constraint for a term with units
  #1
New Member
 
elektra79's Avatar
 
K Russell
Join Date: Oct 2010
Location: Chicago, IL
Posts: 3
Rep Power: 6
elektra79 is on a distinguished road
Hello all,

I have implemented a k-epsilon turbulence model and named my directory "mykEpsilon".

In mykEpsilon.C, I have a term called "sstar_" that has units of (1/sec^2) that is defined as a volScalarField in mykEpsilon.H. Now, in mykEpsilon.C, I would like to fix a "min" constraint on this term. The code compiles but I get an error when running (regarding unmatched dimensions). These are the lines that I use in mykEpsilon.C to initialize:

gradU_(fvc::grad(U)),
ss_(0.5*(gradU_ + gradU_.T())),
sstar_(sqrt(max(ss_ && ss_.T(),1.0e-10))),

The problem is with the term "sstar_".
"ss_" is defined as a volTensorField.
"ss_ && ss_.T()" should give a volScalarField with units of (1/sec^2).
"sstar_" is defined as a volScalarField.

So the error is coming up because the code is attempting to compare a term that has units of (1/sec^2) to a number (1e-10) that is unitless. Does anyone know how to fix this? Thank you!

FYI, my code was running well before I attempted to add the "min" constraint.
elektra79 is offline   Reply With Quote

Old   October 12, 2010, 02:31
Default
  #2
Member
 
Sabin Ceuca
Join Date: Mar 2010
Location: Munich
Posts: 42
Rep Power: 7
sabin.ceuca is on a distinguished road
Hi elektra79,
my simplest solution would be to initialize a field in createFields.H which has the desired dimension and a constant value. It would look something like this
volScalarField yourConstantValueScalarField
(
IOobject
(
"yourConstantValueScalarField",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensionedScalar("zero",dimensionSet
(0, 0, -2, 0, 0, 0, 0), 1e-10)
);
It might not be the most elegant way to solve your problem but it does the trick.
Ciao,
Sabin
sabin.ceuca is offline   Reply With Quote

Old   October 12, 2010, 13:52
Default
  #3
New Member
 
elektra79's Avatar
 
K Russell
Join Date: Oct 2010
Location: Chicago, IL
Posts: 3
Rep Power: 6
elektra79 is on a distinguished road
Hi Sabin. Thank you for your reply.

Here is what I added to "createFields.H" which is located in the "applications/solvers/incompressible/pisoFoam" directory:

volScalarField s_lim
(
IOobject
(
"s_lim",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensionedScalar("one-e-neg-ten",
dimensionSet(0, 0, -2, 0, 0, 0, 0),1.0e-10)
);

My questions now are:

(1) How would this feed back to the directory that holds my turbulence model? How would I denote a "pointer" to this variable?

(2) How would I use this in "mykEpsilon.C"? I tried the following in "mykEpsilon.C" and got errors when trying to compile:

gradU_(fvc::grad(U)),
ss_(0.5*(gradU_ + gradU_.T())),
sstar_(sqrt(max(ss_ && ss_.T(),"one-e-neg-ten"))),

Thank you!
elektra79 is offline   Reply With Quote

Old   October 12, 2010, 18:12
Default
  #4
New Member
 
elektra79's Avatar
 
K Russell
Join Date: Oct 2010
Location: Chicago, IL
Posts: 3
Rep Power: 6
elektra79 is on a distinguished road
It is now working. I am able to fix a min/max constraint for the term "sstar_".

In "mykEpsilon.C", I did the following for initializing:

gradU_(fvc::grad(U)),
ss_(0.5*(gradU_ + gradU_.T())),

s_lim
(
IOobject
(
"s_lim",
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimensionedScalar("s_lim",dimensionSet(0, 0, -2, 0, 0, 0, 0),1.0e-10)
)
,

sstar_(pow(max(ss_ && ss_.T(),s_lim),0.5)),

In "mykEpsilon.H", I added:

volTensorField gradU_;
volTensorField ss_;

volScalarField s_lim;
volScalarField sstar_;

Thank you for the tips!
elektra79 is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
ATTENTION! Reliability problems in CFX 5.7 Joseph CFX 14 April 20, 2010 15:45
About units of mass source term bg2306 FLUENT 0 April 1, 2005 11:46
Source term units in 2D Chief FLUENT 1 August 23, 2004 12:40
set a source term to some specific area beginner1 CFX 1 February 19, 2003 05:51
UDS source term units Ale FLUENT 2 July 12, 2002 13:01


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