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

[swak4Foam] Error using groovyBC - 'parser error for expression driver'

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By odellar
  • 1 Post By odellar

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 7, 2015, 09:13
Default Error using groovyBC - 'parser error for expression driver'
  #1
Member
 
Olie
Join Date: Oct 2013
Posts: 51
Rep Power: 13
odellar is on a distinguished road
I'm using a valueExpression in my 0/U file in order to implement a boundary condition which is a function of a 'measurement' (probe reading). In the controlDict I have:

Code:
    vorticity
    {
        type expressionField;
        autowrite true;
        dimension [0 0 -1 0 0 0 0];
        fieldName "vorticity";
        expression "curl(U)";
        verbose true;
        autowrite true;
        outputControl timeStep;
    }
in order to compute the vorticity flow field whilst solving, followed by (again in the controlDict):

Code:
 sensorMeasurement
        {
        type createSampledSet;
        outputControl outputTime;
        outputInterval 1;
        setName vorticity_sensor1;
        set {
                type cloud;
                axis xyz;
                points (
                        (0 -0.5 0.5)
                );
        } }
in order to 'measure' the vorticity at a point, (0 -0.5 0.5), using a probe - the setName is vorticity_sensor1.

In my 0/U file I then have something which looks like this:
Code:
BOUNDARY1
{
type groovyBC;
value uniform (0 0 0);
variables (
"vorticityMeasurement{set'vorticity_sensor1}=average(vorticity);"
"w=vorticityMeasurement;"
"wMovingAvg=deltaT()*w/15.4+(1-deltaT()/15.4)*wMovingAvg;" //**** THIS LINE ****
);
storedVariables (
{
name wMovingAvg;
initialValue "0";
}
);
valueExpression "vector(1.4142*wMovingAvg,1.4142*wMovingAvg,0)";
}
However when I try run the solver (pimpleFoam) I get the following error (clearly corresponding to the line I've highlighted above):

Code:
[0] --> FOAM FATAL ERROR:
[0]  Parser Error for driver PatchValueExpressionDriver at "1.45-44" :"syntax error, unexpected $end"
"deltaT()*w/15.4+(1-deltaT()/15.4)*wMovingAvg"

----------------------------------------------

Context of the error:


- From dictionary: /mnt/fastdata/cop13ojd/BFS_H_Infinity/processor0/0/U.boundaryField.actuator
  Evaluating expression "deltaT()*w/15.4+(1-deltaT()/15.4)*wMovingAvg"
[0]
[0]
[0]     From function parsingValue
[0]     in file lnInclude/CommonValueExpressionDriverI.H at line 1181.
[0]
FOAM parallel run exiting
[0]
[3]
[3]
[3] --> FOAM FATAL ERROR:
[3]  Parser Error for driver PatchValueExpressionDriver at "1.45-44" :"syntax error, unexpected $end"
"deltaT()*w/15.4+(1-deltaT()/15.4)*wMovingAvg"

----------------------------------------------
Can anyone help me out here?
Thank you
Kummi likes this.
odellar is offline   Reply With Quote

Old   September 21, 2015, 09:34
Default No ideas?
  #2
Member
 
Olie
Join Date: Oct 2013
Posts: 51
Rep Power: 13
odellar is on a distinguished road
No ideas?
odellar is offline   Reply With Quote

Old   September 21, 2015, 10:25
Default An idea
  #3
Member
 
Olie
Join Date: Oct 2013
Posts: 51
Rep Power: 13
odellar is on a distinguished road
I've just thought - this could potentially because I'm using a quantity I've computed called vorticity, which is a vector quantity - I actually only mean the z-component of the vector - what is the syntax in openFOAM to address a particular element of the variable?

In matlab for example one would write vorticity(3) to access the third element of the vector.

Thanks
odellar is offline   Reply With Quote

Old   September 21, 2015, 12:14
Default
  #4
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Quick answer: I'm not familiar enough with groovyBC, but I suspect that the problem is in the first line of the expression list, namely this part:
Code:
set'vorticity_sensor1
The separator between "set" and "vorticity_sensor1" is a quote which is opened but not closed.

Where did you read about this feature, namely the ability to use the value on a "set"?
wyldckat is offline   Reply With Quote

Old   September 21, 2015, 12:51
Default
  #5
Member
 
Olie
Join Date: Oct 2013
Posts: 51
Rep Power: 13
odellar is on a distinguished road
Quote:
Originally Posted by wyldckat View Post
Quick answer: I'm not familiar enough with groovyBC, but I suspect that the problem is in the first line of the expression list, namely this part:
Code:
set'vorticity_sensor1
The separator between "set" and "vorticity_sensor1" is a quote which is opened but not closed.

Where did you read about this feature, namely the ability to use the value on a "set"?
Thanks, but that is the correct way of using that expression.

I *think* I've now got it working, by saying average(vorticity.z) in order to access the z-component. It seems to be running fine, so we'll see.
wyldckat likes this.
odellar is offline   Reply With Quote

Reply

Tags
groovybc, parser error, valueexpression


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] groovyBC for oscillatory flow liybzd OpenFOAM Community Contributions 5 November 12, 2018 08:53
[swak4Foam] reactingMultiPhaseEulerFoam problems with groovyBC zanilu70 OpenFOAM Community Contributions 4 December 13, 2016 07:46
[swak4Foam] Change in alpha and U with groovyBC in twoPhaseEulerFoam dani2702 OpenFOAM Community Contributions 0 November 17, 2016 04:30
[swak4Foam] whats wrong with this groovyBC expression in parenthesis? immortality OpenFOAM Community Contributions 11 June 5, 2013 08:54
[swak4Foam] groovyBC and Eqn.setReference() benk OpenFOAM Community Contributions 3 June 2, 2011 09:49


All times are GMT -4. The time now is 15:58.