CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Community Contributions (https://www.cfd-online.com/Forums/openfoam-community-contributions/)
-   -   [swak4Foam] Timedependent groovybc (https://www.cfd-online.com/Forums/openfoam-community-contributions/126897-timedependent-groovybc.html)

Jakob1 November 28, 2013 08:59

Timedependent groovybc
 
Hey, I am just doing my first baby steps with groovybc and as a start I want to set a T boundary condition to a simple time dependent function. Not sure what I am doing wrong, this is the code:

Code:

oben   
    {
        type            groovyBC;
        valueExpression "313-(20*exp(a*time())";
        variables        "a=(-2.1/(0.001*2400))";
        timelines        ();
    }

paraFoam tells me:

Code:

--> FOAM Warning :
    From function groovyBCFvPatchField<Type>::groovyBCFvPatchField(const fvPatch& p,const DimensionedField<Type, volMesh>& iF,const dictionary& dict)
    in file groovyBCFvPatchField.C at line 131
    No value defined for T on oben therefore using 66{0}

When I try to run the simulation I get

Code:

--> FOAM FATAL ERROR:
 Parser Error for driver PatchValueExpressionDriver at "1.22-21" :"syntax error, unexpected $end"
"313-(20*exp(a*time())"
                     
-----------------------

Context of the error:


- From dictionary: /home/jakob/OpenFOAM/jakob-2.2.x/run/setCyl20k_10/0/T.boundaryField.oben
  Evaluating expression "313-(20*exp(a*time())"


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

FOAM exiting

What am I doing wrong here? I added the libs into the controlDict and set the boundary type to groovyBC. Thanks guys

gschaider November 28, 2013 15:33

Quote:

Originally Posted by Jakob1 (Post 463910)
Hey, I am just doing my first baby steps with groovybc and as a start I want to set a T boundary condition to a simple time dependent function. Not sure what I am doing wrong, this is the code:

Code:

oben   
    {
        type            groovyBC;
        valueExpression "313-(20*exp(a*time())";
        variables        "a=(-2.1/(0.001*2400))";
        timelines        ();
    }

paraFoam tells me:

Code:

--> FOAM Warning :
    From function groovyBCFvPatchField<Type>::groovyBCFvPatchField(const fvPatch& p,const DimensionedField<Type, volMesh>& iF,const dictionary& dict)
    in file groovyBCFvPatchField.C at line 131
    No value defined for T on oben therefore using 66{0}

When I try to run the simulation I get

Code:

--> FOAM FATAL ERROR:
 Parser Error for driver PatchValueExpressionDriver at "1.22-21" :"syntax error, unexpected $end"
"313-(20*exp(a*time())"
                     
-----------------------

Context of the error:


- From dictionary: /home/jakob/OpenFOAM/jakob-2.2.x/run/setCyl20k_10/0/T.boundaryField.oben
  Evaluating expression "313-(20*exp(a*time())"


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

FOAM exiting

What am I doing wrong here? I added the libs into the controlDict and set the boundary type to groovyBC. Thanks guys

There's two things here:
- the syntax error: count the ( and the ) and you will be enlightened
- "no value defined": groovyBC does not evaluate valueExpression during loading (the reason is that the expression might use a field that has not yet been loaded) so it falls back 'value' - if that is there. If it is not there it falls back to '0' - which it tells you in the warning. That is "good enough" for many applications. In your case (temperature) it is not so good (unless your physics make sense at 0 K). Solution is to provide a 'value' for the initialization with a sensible value ("value $internalField" is always a good guess)


All times are GMT -4. The time now is 23:51.