CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Pre-Processing (http://www.cfd-online.com/Forums/openfoam-pre-processing/)
-   -   defining variables in funkySetFieldDict (http://www.cfd-online.com/Forums/openfoam-pre-processing/99540-defining-variables-funkysetfielddict.html)

supvika April 5, 2012 17:33

defining variables in funkySetFieldDict
 
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

eelcovv April 6, 2012 07:08

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.

gschaider April 9, 2012 18:11

Quote:

Originally Posted by supvika (Post 353361)
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

supvika April 9, 2012 23:43

Hello Bernhard,

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

Thanks again,
Victoria


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