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

add filed to OpenFOAM

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

Reply
 
LinkBack Thread Tools Display Modes
Old   April 27, 2009, 10:50
Default add filed to OpenFOAM
  #1
Member
 
Sven Degner
Join Date: Mar 2009
Location: Zürich
Posts: 54
Rep Power: 8
sven82 is on a distinguished road
Hi ,

at the moment I work with OpenFOAM especially with a new DES case.
After I finish the implementation I like to visual the individual zones (RANS or LES) with a easy 0 or 1, just to see in which zones work a RANS simulation and in which a LES

the idea

create a field in the turbulenceModell.C like this

DES_
(
IOobject
(
"DES",
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimensionedScalar("DES", dimless, 0.0)
),

in the next step I create the two fields that I like to compare, and the turn

volScalarField keps_ = pow(sqrt(k_),3) / epsilon_;

volScalarField CDESdelta_ = CDES_ * delta();


if( keps < CDESdelta_ )
{DES_ = 1.0;}
else
{DES_ = 0.0;}

DES_.write();

But I got a problem when I run the case with my new DES, the field look like this

dimensions [0 0 0 0 0 0 0]; //Time 1e5 and NOT t=0
internalField uniform 1;
boundaryField
{
inlet
{
type calculated;
value uniform 1;
}
outlet
{
type calculated;
value uniform 1;
}
upperWall
{
type calculated;
value uniform 1;
}
lowerWall
{
type calculated;
value uniform 1;
}
}

My question now is whats wrong with the code.
The output of the values of the two compares parameters, CDESdelta and keps_, are correct (values of both possibilities , CDESdelta<keps and CDESdelta>keps) !

I hope anybody got a idea

best regards
sven
sven82 is offline   Reply With Quote

Old   April 27, 2009, 11:08
Default
  #2
Senior Member
 
Henrik Rusche
Join Date: Mar 2009
Location: Braunschweig, Niedersachsen, Germany
Posts: 275
Rep Power: 9
henrik is on a distinguished road
Dear Sven,

DES_ = 1.0 sets the whole field to 1.0, likewise DES_ = 0.0;

You need a loop or translate the if into some function that is defined for fields.

Nice error, wonder what CDESdelta_ evaluates to in scalar context. Print it and enlighten me.

Henrik
henrik is offline   Reply With Quote

Old   April 28, 2009, 06:14
Default
  #3
Senior Member
 
Henrik Rusche
Join Date: Mar 2009
Location: Braunschweig, Niedersachsen, Germany
Posts: 275
Rep Power: 9
henrik is on a distinguished road
Some more info on the gory details:

Code:
forAll(DES_, cellI)
{
    if( keps_[cellI] < CDESdelta_[cellI] )
    {DES_[cellI] = 1.0;}
    else 
    {DES_[cellI] = 0.0;}
}

DES_.write();
Henrik
henrik 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
Superlinear speedup in OpenFOAM 13 msrinath80 OpenFOAM Running, Solving & CFD 18 March 3, 2015 06:36
64bitrhel5 OF installation instructions mirko OpenFOAM Installation 2 August 12, 2008 18:07
Adventure of fisrst openfoam installation on Ubuntu 710 jussi OpenFOAM Installation 0 April 24, 2008 14:25
OpenFOAM Debian packaging current status problems and TODOs oseen OpenFOAM Installation 9 August 26, 2007 13:50
Adding jpeg picture file in OpenFoam post in add a message window kumar2 OpenFOAM 1 March 22, 2006 23:17


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