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

[swak4Foam] groovyBC error: velocity profile (2D) >> what's wrong?

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 18, 2014, 17:04
Default groovyBC error: velocity profile (2D) >> what's wrong?
  #1
Member
 
Tommy Sp
Join Date: Jan 2014
Posts: 51
Rep Power: 12
vitorspadeto is on a distinguished road
groovyBC error

Hi everybody!



I'm trying to implement a parabolic velocity profile to my inlet (2D), cordinates: (x,z) . Inlet is located between the coordinates z= 0 and z=0.001. the parabolic equation for this profile is

Velocity_x_direction = 99*z - 98072*z².

This equation in this range of points (between z= 0 and z=0.001) give the exact velocity profile that I need.

I already add "libs" lines in the end of ControlDict file (I'm using swak4Foam to use GroovyBC):

Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2.3.0                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    "system";
    object      controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

application     icoFoam;

startFrom       startTime;

startTime       0;

stopAt          endTime;

endTime        10;

deltaT          0.1;

writeControl    adjustableRunTime;

writeInterval  1;

purgeWrite      0;

writeFormat     ascii;

writePrecision  6;

writeCompression off;

timeFormat      general;

timePrecision   6;

runTimeModifiable true;

adjustTimeStep  yes;

maxCo           1; 

maxAlphaCo      1;

 maxDeltaT       1;



libs (
      "libOpenFOAM.so"
      "libsimpleSwakFunctionObjects.so"
      "libswakFunctionObjects.so"
      "libgroovyBC.so"
     ); 


// ************************************************************************* //
And this is my U file, with the profile velocity:

Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2.3.0                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       volVectorField;
    object      U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions      [0 1 -1 0 0 0 0];

internalField   uniform (0 0 0);

boundaryField
{
    inlet
    {
     type            groovyBC;
     variables "zp=pts().z;    velocity=(99.036*zp-98072.289*pow(zp,2));";
     valueExpression "velocity";
    value           uniform (0.02 0 0);
   }


    outlet
    {
        type            zeroGradient; // At the outlet the velocity is unknown so we take the gradient of velocity as zero here
    }

    wall
    {
        type            fixedValue;
	value		uniform (0 0 0); // we use the no slip condition at the walls so u = v = 0
    }
   
 frontAndBack
    {
        type            empty;
    }

}

// ************************************************************************* //

This is the error that appeared on the terminal:

HTML Code:
sp@sp-945GCM-S2C:~/PGSPAD/exemplos_para_o_PG/blood/Newtonian$ icoFoam
/*---------------------------------------------------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2.2.0                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
Build  : 2.2.0-5be49240882f
Exec   : icoFoam
Date   : Jun 18 2014
Time   : 17:01:52
Host   : "sp-945GCM-S2C"
PID    : 4579
Case   : /home/sp/PGSPAD/exemplos_para_o_PG/blood/Newtonian
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster
allowSystemOperations : Disallowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create mesh for time = 0

Reading transportProperties

Reading field p

Reading field U

Reading/calculating face flux field phi


Starting time loop

Time = 0.1

Courant Number mean: 0.00555556 max: 10
word::stripInvalid() called for word velocity
    For debug level (= 2) > 1 this is considered fatal
Abortado (imagem do núcleo gravada)

What Should I do to correct this error?

THANKS FRIENDS!
vitorspadeto is offline   Reply With Quote

Old   June 18, 2014, 17:24
Default
  #2
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by vitorspadeto View Post
groovyBC error

Hi everybody!



I'm trying to implement a parabolic velocity profile to my inlet (2D), cordinates: (x,z) . Inlet is located between the coordinates z= 0 and z=0.001. the parabolic equation for this profile is

Velocity_x_direction = 99*z - 98072*z².

This equation in this range of points (between z= 0 and z=0.001) give the exact velocity profile that I need.

I already add "libs" lines in the end of ControlDict file (I'm using swak4Foam to use GroovyBC):

Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2.3.0                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    "system";
    object      controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

application     icoFoam;

startFrom       startTime;

startTime       0;

stopAt          endTime;

endTime        10;

deltaT          0.1;

writeControl    adjustableRunTime;

writeInterval  1;

purgeWrite      0;

writeFormat     ascii;

writePrecision  6;

writeCompression off;

timeFormat      general;

timePrecision   6;

runTimeModifiable true;

adjustTimeStep  yes;

maxCo           1; 

maxAlphaCo      1;

 maxDeltaT       1;



libs (
      "libOpenFOAM.so"
      "libsimpleSwakFunctionObjects.so"
      "libswakFunctionObjects.so"
      "libgroovyBC.so"
     ); 


// ************************************************************************* //
And this is my U file, with the profile velocity:

Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2.3.0                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       volVectorField;
    object      U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions      [0 1 -1 0 0 0 0];

internalField   uniform (0 0 0);

boundaryField
{
    inlet
    {
     type            groovyBC;
     variables "zp=pts().z;    velocity=(99.036*zp-98072.289*pow(zp,2));";
     valueExpression "velocity";
    value           uniform (0.02 0 0);
   }


    outlet
    {
        type            zeroGradient; // At the outlet the velocity is unknown so we take the gradient of velocity as zero here
    }

    wall
    {
        type            fixedValue;
	value		uniform (0 0 0); // we use the no slip condition at the walls so u = v = 0
    }
   
 frontAndBack
    {
        type            empty;
    }

}

// ************************************************************************* //

This is the error that appeared on the terminal:

HTML Code:
sp@sp-945GCM-S2C:~/PGSPAD/exemplos_para_o_PG/blood/Newtonian$ icoFoam
/*---------------------------------------------------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2.2.0                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
Build  : 2.2.0-5be49240882f
Exec   : icoFoam
Date   : Jun 18 2014
Time   : 17:01:52
Host   : "sp-945GCM-S2C"
PID    : 4579
Case   : /home/sp/PGSPAD/exemplos_para_o_PG/blood/Newtonian
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster
allowSystemOperations : Disallowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create mesh for time = 0

Reading transportProperties

Reading field p

Reading field U

Reading/calculating face flux field phi


Starting time loop

Time = 0.1

Courant Number mean: 0.00555556 max: 10
word::stripInvalid() called for word velocity
    For debug level (= 2) > 1 this is considered fatal
Abortado (imagem do núcleo gravada)

What Should I do to correct this error?

THANKS FRIENDS!
The problem is probably the spaces between ";" and "velocity".

Which version of swak4Foam are you using? I thought that problem was already fixed
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   June 18, 2014, 17:35
Default
  #3
Member
 
Tommy Sp
Join Date: Jan 2014
Posts: 51
Rep Power: 12
vitorspadeto is on a distinguished road
swak4Foam 0.3.0


Inserting "normal()"


inlet
{
type groovyBC;
variables "zp=pts().z;velocity=((99.036*zp)-98072.289*pow(zp,2))*normal();";
valueExpression "velocity";
value uniform (1 0 0);
}


new error:

Code:
 --> FOAM FATAL ERROR: 
 Parser Error for driver PatchValueExpressionDriver at "1.10-11" :"syntax error, unexpected pointScalarID"
"((99.036*zp)-98072.289*pow(zp,2))*normal()"
           ^^
-----------| 

Context of the error:


- From dictionary: /home/sp/PGSPAD/exemplos_para_o_PG/blood/Newtonian/0/U.boundaryField.inlet
  Evaluating expression "((99.036*zp)-98072.289*pow(zp,2))*normal()"


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

FOAM exiting
vitorspadeto is offline   Reply With Quote

Old   June 18, 2014, 19:36
Default
  #4
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by vitorspadeto View Post
swak4Foam 0.3.0


Inserting "normal()"


inlet
{
type groovyBC;
variables "zp=pts().z;velocity=((99.036*zp)-98072.289*pow(zp,2))*normal();";
valueExpression "velocity";
value uniform (1 0 0);
}


new error:

Code:
 --> FOAM FATAL ERROR: 
 Parser Error for driver PatchValueExpressionDriver at "1.10-11" :"syntax error, unexpected pointScalarID"
"((99.036*zp)-98072.289*pow(zp,2))*normal()"
           ^^
-----------| 

Context of the error:


- From dictionary: /home/sp/PGSPAD/exemplos_para_o_PG/blood/Newtonian/0/U.boundaryField.inlet
  Evaluating expression "((99.036*zp)-98072.289*pow(zp,2))*normal()"


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

FOAM exiting
Scalar constants are "on the faces". To use them on points you'll have to wrap them in toPoint().

Anyway: leave that. I think you want to use pos() instead of pts().
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   June 19, 2014, 16:31
Smile
  #5
Member
 
Tommy Sp
Join Date: Jan 2014
Posts: 51
Rep Power: 12
vitorspadeto is on a distinguished road
thanks gschaider!

Problem Solved! Now beginners can use this post to learn more about swak4Foam/GroovyBC!
vitorspadeto is offline   Reply With Quote

Reply


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] problem with Velocity Profile with groovyBC ssss OpenFOAM Community Contributions 1 August 7, 2014 15:44
[swak4Foam] whats wrong with this groovyBC expression in parenthesis? immortality OpenFOAM Community Contributions 11 June 5, 2013 08:54
[swak4Foam] is this expression as bolean sentence wrong in groovyBC? immortality OpenFOAM Community Contributions 6 March 8, 2013 06:24
[swak4Foam] "field U not existing or of wrong type" groovyBC error. immortality OpenFOAM Community Contributions 1 February 4, 2013 16:08
reactingFoam - wrong (temperature) profile megacrout OpenFOAM 1 August 1, 2011 06:11


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