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] problem with groovyBC (https://www.cfd-online.com/Forums/openfoam-community-contributions/122815-problem-groovybc.html)

Jonathan August 28, 2013 14:42

problem with groovyBC
 
hi guys,

i was hoping someone could give me a hand with the following issue i am having with groovyBC???

below is my groovy "code":

Code:

    INLET
    {
    //type        fixedValue;
    //value        uniform (0 0 21.38);
        type            groovyBC;

    lookuptables (
    {
        name z_velocity;
        outOfBounds clamp;
        fileName "$FOAM_CASE/rel_z_velocity";
    }
    {
        name y_velocity;
        outOfBounds clamp;
        fileName "$FOAM_CASE/rel_y_velocity";
    }
    {
        name x_velocity;
        outOfBounds clamp;
        fileName "$FOAM_CASE/rel_x_velocity";
    }
    );

    variables    "radius=sqrt(pow(pos().x,2) + pow(pos().y,2));theta=asin(mag(pos().x/pos().y));";
    valueExpression    "vector(x_velocity(radius)*sin(theta),y_velocity(radius),z_velocity(radius))";
        value        uniform (0 0 0);
    }

and this is the error message i am getting!

Code:

#0  Foam::error::printStack(Foam::Ostream&) in "/home/jonathan/OpenFOAM/OpenFOAM-2.1.1/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#1  Foam::sigFpe::sigHandler(int) in "/home/jonathan/OpenFOAM/OpenFOAM-2.1.1/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#2  in "/lib/x86_64-linux-gnu/libc.so.6"
#3  asin in "/lib/x86_64-linux-gnu/libm.so.6"
#4  Foam::asin(Foam::Field<double>&, Foam::UList<double> const&) in "/home/jonathan/OpenFOAM/OpenFOAM-2.1.1/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#5  Foam::asin(Foam::UList<double> const&) in "/home/jonathan/OpenFOAM/OpenFOAM-2.1.1/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#6  parserPatch::PatchValueExpressionParser::parse() in "/home/jonathan/OpenFOAM/jonathan-2.1.1/platforms/linux64GccDPOpt/lib/libswak4FoamParsers.so"
#7  Foam::PatchValueExpressionDriver::parse(std::string const&) in "/home/jonathan/OpenFOAM/jonathan-2.1.1/platforms/linux64GccDPOpt/lib/libswak4FoamParsers.so"
#8  Foam::CommonValueExpressionDriver::evaluateVariable(Foam::word const&, Foam::string const&) in "/home/jonathan/OpenFOAM/jonathan-2.1.1/platforms/linux64GccDPOpt/lib/libswak4FoamParsers.so"
#9  Foam::CommonValueExpressionDriver::addVariables(Foam::string const&, bool) in "/home/jonathan/OpenFOAM/jonathan-2.1.1/platforms/linux64GccDPOpt/lib/libswak4FoamParsers.so"
#10  Foam::CommonValueExpressionDriver::addVariables(Foam::List<Foam::string> const&, bool) in "/home/jonathan/OpenFOAM/jonathan-2.1.1/platforms/linux64GccDPOpt/lib/libswak4FoamParsers.so"
#11  Foam::CommonValueExpressionDriver::clearVariables() in "/home/jonathan/OpenFOAM/jonathan-2.1.1/platforms/linux64GccDPOpt/lib/libswak4FoamParsers.so"
#12  Foam::groovyBCFvPatchField<Foam::Vector<double> >::updateCoeffs() in "/home/jonathan/OpenFOAM/jonathan-2.1.1/platforms/linux64GccDPOpt/lib/libgroovyBC.so"
#13  Foam::fvMatrix<Foam::Vector<double> >::fvMatrix(Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> const&, Foam::dimensionSet const&) in "/home/jonathan/OpenFOAM/OpenFOAM-2.1.1/platforms/linux64GccDPOpt/bin/SRFSimpleFoam"
#14 
 at SRFSimpleFoam.C:0
#15 
 in "/home/jonathan/OpenFOAM/OpenFOAM-2.1.1/platforms/linux64GccDPOpt/bin/SRFSimpleFoam"
#16  __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
#17 
 in "/home/jonathan/OpenFOAM/OpenFOAM-2.1.1/platforms/linux64GccDPOpt/bin/SRFSimpleFoam"
Floating point exception (core dumped)

Any ideas???

many thanks in advance,
best regards
jon

gschaider August 28, 2013 14:56

Quote:

Originally Posted by Jonathan (Post 448583)
hi guys,

i was hoping someone could give me a hand with the following issue i am having with groovyBC???

below is my groovy "code":

Code:

<snip>

    variables    "radius=sqrt(pow(pos().x,2) + pow(pos().y,2));theta=asin(mag(pos().x/pos().y));";
    valueExpression    "vector(x_velocity(radius)*sin(theta),y_velocity(radius),z_velocity(radius))";
        value        uniform (0 0 0);
    }

and this is the error message i am getting!

Code:

#0  Foam::error::printStack(Foam::Ostream&) in "/home/jonathan/OpenFOAM/OpenFOAM-2.1.1/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#1  Foam::sigFpe::sigHandler(int) in "/home/jonathan/OpenFOAM/OpenFOAM-2.1.1/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#2  in "/lib/x86_64-linux-gnu/libc.so.6"
#3  asin in "/lib/x86_64-linux-gnu/libm.so.6"
#4  Foam::asin(Foam::Field<double>&, Foam::UList<double> const&) in "/home/jonathan/OpenFOAM/OpenFOAM-2.1.1/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#5  Foam::asin(Foam::UList<double> const&) in "/home/jonathan/OpenFOAM/OpenFOAM-2.1.1/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#6  parserPatch::PatchValueExpressionParser::parse() in "/home/jonathan/OpenFOAM/jonathan-2.1.1/platforms/linux64GccDPOpt/lib/libswak4FoamParsers.so"

<snip>

Floating point exception (core dumped)

Any ideas???

many thanks in advance,
best regards
jon

Let me quote from the man-page of asin:
Code:

asin(x) returns a NAN and raises the "invalid" floating-point exception for |x| > 1.
groovyBC does not check whether you use the functions correctly. Probably your |x/y|>1

Jonathan September 3, 2013 14:50

thanks
 
hi Bernhard,

:p yes thanks - that was it. i had a asin instead of an atan which was a pretty dumb mistake, and was throwing me off

thanks for your help + a great tool,

best regards
jonathan


All times are GMT -4. The time now is 06:17.