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

[swak4Foam] expressionField

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes
  • 1 Post By aylalisa
  • 2 Post By gschaider

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 28, 2014, 08:58
Default expressionField
  #1
Senior Member
 
Join Date: Nov 2012
Location: Bavaria
Posts: 145
Rep Power: 13
aylalisa is on a distinguished road
Hi All,

I've a question about expressionField (,already discussed in other threads. discussion, example from above)

Version 1:
Code:
functions
{             
yPlusField             
{type expressionField;                
outputControl timeStep;                 
outputInterval 1;                 
fieldName yPlus;                 
expression "pow(0.09,0.25)*sqr(k)*nearDist()/mu";                 
autowrite true;             
}            

yPlusWall             
{                 
type patchExpression;                 
expression "pow(0.09,0.25)*sqr(k)*dist()/mu";                 
accumulations 
(                     
min                     
max                     
average                 
);                 
patches (wall);                 
verbose true;             
}         
}
I've tried to extract the desired value on a patch with following variation but only receive result 0, whereas the upper version works. Does this mean that expressionField computes an internal field?

Version 2
Code:
functions
{             
yPlusField            
{                 
type expressionField;                 
outputControl timeStep;                 
outputInterval 1;                 
fieldName yPlus;                 
expression "pow(0.09,0.25)*sqr(k)*nearDist()/mu";                 
autowrite true;            
}             
yPlusWall             
{                 
type patchExpression;                 
expression "yPlus";                 
accumulations 
(                     
min                     
max                     
average                
);                 
patches (wall);                 
verbose true;             
}         
}
I've tried as well to add accumulations( average ) to the expressionField object to condense the field to one scalar but don't get a result either.

Creating expression field yPlus... type:volScalarField (but no scalar) and...
Expression compute_yPlus on bottom: average=0 sum=0
Is Version 1 the only possibility to write the result in the log-File?

Aylalisa
DaveD! likes this.
aylalisa is offline   Reply With Quote

Old   October 28, 2014, 17:42
Default
  #2
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by aylalisa View Post
Hi All,

I've a question about expressionField (,already discussed in other threads. discussion, example from above)

Version 1:
Code:
functions
{             
yPlusField             
{type expressionField;                
outputControl timeStep;                 
outputInterval 1;                 
fieldName yPlus;                 
expression "pow(0.09,0.25)*sqr(k)*nearDist()/mu";                 
autowrite true;             
}            

yPlusWall             
{                 
type patchExpression;                 
expression "pow(0.09,0.25)*sqr(k)*dist()/mu";                 
accumulations 
(                     
min                     
max                     
average                 
);                 
patches (wall);                 
verbose true;             
}         
}
I've tried to extract the desired value on a patch with following variation but only receive result 0, whereas the upper version works. Does this mean that expressionField computes an internal field?

Version 2
Code:
functions
{             
yPlusField            
{                 
type expressionField;                 
outputControl timeStep;                 
outputInterval 1;                 
fieldName yPlus;                 
expression "pow(0.09,0.25)*sqr(k)*nearDist()/mu";                 
autowrite true;            
}             
yPlusWall             
{                 
type patchExpression;                 
expression "yPlus";                 
accumulations 
(                     
min                     
max                     
average                
);                 
patches (wall);                 
verbose true;             
}         
}
I've tried as well to add accumulations( average ) to the expressionField object to condense the field to one scalar but don't get a result either.

Creating expression field yPlus... type:volScalarField (but no scalar) and...
Expression compute_yPlus on bottom: average=0 sum=0
Is Version 1 the only possibility to write the result in the log-File?

Aylalisa
The usual behaviour of the internalField-parser (which is used by the expressionField-function object) is to only calculate the internal field (hence the name) and calculate a zeroGradient for the patches (which basically means that a face gets the value of the neighbour cell). Why that is 0 in your case ... I don't know (unless nearDist is 0 in the boundary cells)

Anyway: variation 1 is better anyway.
a) because it only has to be computed on the boundary. Not on the whole field
b) you get yPlus for the face. Not the value of the cell projected onto the face. Which might differ (think of a stretched cell in a corner: all three boundary faces of that cell will get the same value. Although they don't have the same yPlus)

There is another way to calculate that. You could use the readAndUpdateField-functionObject to load a field myYPlus. In that field you implement the expression from version 1 as a groovyBC. Then you can use the patchExpression from version 2. The only advantage of this is that afterwards you have the whole field on disc and can visualize the distribution of yPlus in paraView
tiam and DaveD! like this.
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider 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
[swak4Foam] Trouble accessing fields within expressionField aerogt3 OpenFOAM Post-Processing 6 May 12, 2017 15:02
how to initalize an expressionField for the walldistance? david112 OpenFOAM Pre-Processing 1 March 23, 2017 02:23
[swak4Foam] Using fieldAverage together with swak4foam expressionField tiam OpenFOAM Community Contributions 33 December 18, 2016 07:49
[swak4Foam] swakFoam - expressionField marluc OpenFOAM Community Contributions 1 April 22, 2015 12:50
Problems creating a volScalarField with expressionField function-object zfaraday OpenFOAM Running, Solving & CFD 2 January 12, 2015 07:49


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