CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (http://www.cfd-online.com/Forums/openfoam-solving/)
-   -   groovyBC and the pow(x,y) function (http://www.cfd-online.com/Forums/openfoam-solving/94609-groovybc-pow-x-y-function.html)

romant November 21, 2011 07:03

groovyBC and the pow(x,y) function
 
Hej,

I wanted to implement a velocity profile with groovyBC. Unfortunately, for some reason I cannot use the pow(x,y) with a non integer :-) the following is supposed to be implemented for the velocity

Code:

    inlet
    {
        type            groovyBC;
        variables      "a=0.39556664;b=2.671836655;distance=0.015-sqrt(sqr(pos().y)+sqr(pos().x));";
        valueExpression "vector(0,0,b*pow(distance,0.39556664))";
        value          uniform (0 0 0);
    }

where I tried having a instead of the number withing the pow function as well, but then it said it was missing a numerical value. Maybe somebody has an idea. I get a floating point exception and everything points to swak4foam. The error message is

Code:

#0  Foam::error::printStack(Foam::Ostream&) in "/opt/openfoam201/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#1  Foam::sigFpe::sigHandler(int) in "/opt/openfoam201/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#2  in "/lib/x86_64-linux-gnu/libc.so.6"
#3  in "/lib/x86_64-linux-gnu/libm.so.6"
#4  Foam::pow(Foam::Field<double>&, Foam::UList<double> const&, double const&) in "/opt/openfoam201/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#5  Foam::pow(Foam::UList<double> const&, double const&) in "/opt/openfoam201/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#6  parserPatch::PatchValueExpressionParser::parse() in "/home/roman/OpenFOAM/roman-2.0.1/platforms/linux64GccDPOpt/lib/libswak4FoamParsers.so"
#7  Foam::PatchValueExpressionDriver::parse(std::string const&) in "/home/roman/OpenFOAM/roman-2.0.1/platforms/linux64GccDPOpt/lib/libswak4FoamParsers.so"
#8  Foam::groovyBCFvPatchField<Foam::Vector<double> >::updateCoeffs() in "/home/roman/OpenFOAM/roman-2.0.1/platforms/linux64GccDPOpt/lib/libgroovyBC.so"
#9  Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>::GeometricBoundaryField::updateCoeffs() in "/opt/openfoam201/platforms/linux64GccDPOpt/lib/libfiniteVolume.so"
#10  Foam::fvMatrix<Foam::Vector<double> >::fvMatrix(Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> const&, Foam::dimensionSet const&) in "/opt/openfoam201/platforms/linux64GccDPOpt/lib/libfiniteVolume.so"
#11  Foam::fv::gaussLaplacianScheme<Foam::Vector<double>, double>::fvmLaplacianUncorrected(Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> const&) in "/opt/openfoam201/platforms/linux64GccDPOpt/lib/libfiniteVolume.so"
#12  Foam::fv::gaussLaplacianScheme<Foam::Vector<double>, double>::fvmLaplacian(Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> const&) in "/opt/openfoam201/platforms/linux64GccDPOpt/lib/libfiniteVolume.so"
#13  Foam::fv::laplacianScheme<Foam::Vector<double>, double>::fvmLaplacian(Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> const&) in "/opt/openfoam201/platforms/linux64GccDPOpt/lib/libfiniteVolume.so"
#14  Foam::tmp<Foam::fvMatrix<Foam::Vector<double> > > Foam::fvm::laplacian<Foam::Vector<double>, double>(Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> const&, Foam::word const&) in "/opt/openfoam201/platforms/linux64GccDPOpt/lib/libincompressibleTurbulenceModel.so"
#15  Foam::tmp<Foam::fvMatrix<Foam::Vector<double> > > Foam::fvm::laplacian<Foam::Vector<double>, double>(Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> const&) in "/opt/openfoam201/platforms/linux64GccDPOpt/lib/libincompressibleTurbulenceModel.so"
#16  Foam::incompressible::RASModels::qZeta::divDevReff(Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>&) const in "/opt/openfoam201/platforms/linux64GccDPOpt/lib/libincompressibleRASModels.so"
#17 
 in "/opt/openfoam201/platforms/linux64GccDPOpt/bin/buoyantBoussinesqSimpleFoam"
#18  __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
#19 
 in "/opt/openfoam201/platforms/linux64GccDPOpt/bin/buoyantBoussinesqSimpleFoam"
Floating point exception


gschaider November 21, 2011 15:57

Quote:

Originally Posted by romant (Post 332906)
Hej,

I wanted to implement a velocity profile with groovyBC. Unfortunately, for some reason I cannot use the pow(x,y) with a non integer :-) the following is supposed to be implemented for the velocity

Code:

    inlet
    {
        type            groovyBC;
        variables      "a=0.39556664;b=2.671836655;distance=0.015-sqrt(sqr(pos().y)+sqr(pos().x));";
        valueExpression "vector(0,0,b*pow(distance,0.39556664))";
        value          uniform (0 0 0);
    }

where I tried having a instead of the number withing the pow function as well, but then it said it was missing a numerical value.

OK. That a is ont used can be considered a bug (I just checked the grammar and pow currently accepts a literal scalar as a second argument. Fixing that would require a change in the grammar. Please write a bug-report at the openFOAM-extend-Mantis if you consider it important

Quote:

Originally Posted by romant (Post 332906)
Maybe somebody has an idea. I get a floating point exception and everything points to swak4foam. The error message is

Code:

#0  Foam::error::printStack(Foam::Ostream&) in "/opt/openfoam201/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#1  Foam::sigFpe::sigHandler(int) in "/opt/openfoam201/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#2  in "/lib/x86_64-linux-gnu/libc.so.6"
#3  in "/lib/x86_64-linux-gnu/libm.so.6"
#4  Foam::pow(Foam::Field<double>&, Foam::UList<double> const&, double const&) in "/opt/openfoam201/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#5  Foam::pow(Foam::UList<double> const&, double const&) in "/opt/openfoam201/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#6  parserPatch::PatchValueExpressionParser::parse() in "/home/roman/OpenFOAM/roman-2.0.1/platforms/linux64GccDPOpt/lib/libswak4FoamParsers.so"
#7  Foam::PatchValueExpressionDriver::parse(std::string const&) in "/home/roman/OpenFOAM/roman-2.0.1/platforms/linux64GccDPOpt/lib/libswak4FoamParsers.so"
#8  Foam::groovyBCFvPatchField<Foam::Vector<double> >::updateCoeffs() in "/home/roman/OpenFOAM/roman-2.0.1/platforms/linux64GccDPOpt/lib/libgroovyBC.so"

 in "/opt/openfoam201/platforms/linux64GccDPOpt/bin/buoyantBoussinesqSimpleFoam"
Floating point exception


I beg to differ: swak doesn't throw the error. It is the pow-function of Foam ;)

My first suspicion: are you sure that all values of distance are bigger than 0? Because pow(x,0.3955) with negative x does NOT evaluate to a real number (which might be the cause for the FPE)

romant November 22, 2011 04:35

Sorry, I didn't wanna insult the swak4foam lib :) i personally like it alot :-)

I just found my mistake, thanks for the tip with the negative value input for x.

Will do a bug report.


All times are GMT -4. The time now is 09:52.