Menu

#210 swak4foam parser can not handel dot in field naming

wont-fix
None
normal
minor
always
none
0.2.4
other
2014-02-26
2014-02-26
No

In OF23x, the multiphase models specify the variables of the different phases using a dot, such as U.water, alpha.air. This dot can not by parsed by the swak4foam parser, for example when the following is calculated

UwaterSF
{
ŒŒŒ type expressionField;
ŒŒŒ outputControlMode outputTime;
ŒŒŒ outputInterval 1;
ŒŒŒ fieldName UwaterSF;
ŒŒŒ expression "U*alpha.water";
ŒŒŒ autowrite true;
}
~
---- additional_information ----
Output of the parse of the above expressionFiel is
--> FOAM FATAL ERROR:
Parser Error for driver FieldValueExpressionDriver at "1.3-7" :"field alpha not existing or of wrong type"
"U*alpha.water"
ŒŒŒ ^^^^^
----|ŒŒŒ

Context of the error:

- Driver constructed from scratch
ΠEvaluating expression "U*alpha.water"

ŒŒŒ From function parsingValue
ŒŒŒ in file lnInclude/CommonValueExpressionDriverI.H at line 1188.

FOAM exiting

And example based on the weirOverflow interFoam tutorial is added to the report

Discussion

  • Eelco van Vliet

    Eelco van Vliet - 2014-02-26
     
  • Bernhard Gschaider

    This is known. The problem is that OpenFOAM-words allow a lot of characters that the parser uses for other purposes (I think even +). Letting the parser accept these would either result in a rather weird expression syntax or a very ugly parser code. For this reason there is a workaround implemented in the parser since two versions back: the aliases-table (this is documented in the incomplete reference manual).

    In your example add

    aliases {
    ŒŒŒ alphaWater alpha.water;
    }

    to the specification directory. Then alphaWater in your expression will transparentlyΠuse alpha.water

     

Log in to post a comment.