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

defining variables in funkySetFieldDict

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

Reply
 
LinkBack Thread Tools Display Modes
Old   April 5, 2012, 17:33
Default defining variables in funkySetFieldDict
  #1
New Member
 
Victoria Suponitsky
Join Date: Jan 2011
Location: Vancouver
Posts: 5
Rep Power: 6
supvika is on a distinguished road
Hello,

I would like to define some variables and use them in the evaluation of 'expression' in 'funkySetFieldsDict'. I added it according to the example in www.openfoamworkshop.org/6th...2011/.../gschaider_slides.pdf as:

setCircle
{
field alpha1 ;
keepPatches true ;
expression "width" ;
variables (
"width=max(pos().x)-min(pos().x);"
);
}


When I run funkySetFields the following error message always happens:

Create time
Create mesh for time = 0
Time = 0
Using funkySetFieldsDict

Part: setCircle
Putting "width" into field alpha1 at t = "0" if condition "true" is true
Keeping patches unaltered

--> FOAM FATAL ERROR:
Parser Error at "1.0-4" :"field width not existing or of wrong type"
"width"
"^^^^^"

From function parsingValue
in file ValueExpressionDriver.C at line 84.

FOAM exiting


I will be very gratefull if somebody can help me to resolve this issue. Just to make sure, without attempting to define the variables funkySetFiles works fine. I am using OF1.7.

Thanks,
Victoria
supvika is offline   Reply With Quote

Old   April 6, 2012, 07:08
Default
  #2
Senior Member
 
Eelco van Vliet
Join Date: Mar 2009
Location: The Netherlands
Posts: 122
Rep Power: 9
eelcovv is on a distinguished road
I wonder if your definition for width does not give 0 as a outcome, since you take the max of the local x-position (which is equal to the local x-position) and subtract the min of the local x-position (which is again equal to the local x-position).

Apart from that, it complains about the type of the field, perhaps that the type definition in your alpha1 field is not set to volScalarField.

For the rest I don't see anything wrong in your syntax, so it should work.
eelcovv is offline   Reply With Quote

Old   April 9, 2012, 18:11
Default
  #3
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,915
Rep Power: 40
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by supvika View Post
Hello,

I would like to define some variables and use them in the evaluation of 'expression' in 'funkySetFieldsDict'. I added it according to the example in www.openfoamworkshop.org/6th...2011/.../gschaider_slides.pdf as:

setCircle
{
field alpha1 ;
keepPatches true ;
expression "width" ;
variables (
"width=max(pos().x)-min(pos().x);"
);
}


When I run funkySetFields the following error message always happens:

Create time
Create mesh for time = 0
Time = 0
Using funkySetFieldsDict

Part: setCircle
Putting "width" into field alpha1 at t = "0" if condition "true" is true
Keeping patches unaltered

--> FOAM FATAL ERROR:
Parser Error at "1.0-4" :"field width not existing or of wrong type"
"width"
"^^^^^"

From function parsingValue
in file ValueExpressionDriver.C at line 84.

FOAM exiting


I will be very gratefull if somebody can help me to resolve this issue. Just to make sure, without attempting to define the variables funkySetFiles works fine. I am using OF1.7.
Just tried your expression and it works fine for me. Which version of FSF are you using? Only the ones that come with swak4Foam (not the standalone) support variables
gschaider is offline   Reply With Quote

Old   April 9, 2012, 23:43
Default
  #4
New Member
 
Victoria Suponitsky
Join Date: Jan 2011
Location: Vancouver
Posts: 5
Rep Power: 6
supvika is on a distinguished road
Hello Bernhard,

Thanks a lot for your response. I indeed used the stand alone FSF version.
Now with swak4Foam everything works.

Thanks again,
Victoria
supvika 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
ADDITIONAL VARIABLES LIMITERS N.P CFX 5 December 1, 2011 08:47
Defining additionally variables of U in OF 1.6 lentschi OpenFOAM 3 March 7, 2011 10:10
Accessing other variables in defining boundary condition Cynthia Poon OpenFOAM Running, Solving & CFD 0 March 25, 2009 04:36
Defining New Variables Tim Phoenics 0 September 30, 2003 14:52
PHI file structure Eugene Phoenics 9 November 2, 2001 23:00


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