CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Running, Solving & CFD

groovyBC and the pow(x,y) function

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   November 21, 2011, 07:03
Default groovyBC and the pow(x,y) function
  #1
Senior Member
 
romant's Avatar
 
Roman Thiele
Join Date: Aug 2009
Location: Stockholm, Sweden
Posts: 359
Rep Power: 11
romant is on a distinguished road
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
__________________
~roman
romant is offline   Reply With Quote

Old   November 21, 2011, 15:57
Default
  #2
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,915
Rep Power: 40
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by romant View Post
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 View Post
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)
gschaider is offline   Reply With Quote

Old   November 22, 2011, 04:35
Default
  #3
Senior Member
 
romant's Avatar
 
Roman Thiele
Join Date: Aug 2009
Location: Stockholm, Sweden
Posts: 359
Rep Power: 11
romant is on a distinguished road
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.
__________________
~roman
romant is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 05:35.