CFD Online Logo CFD Online URL
Home > Forums > OpenFOAM Bugs

Bugs in FFT

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

LinkBack Thread Tools Display Modes
Old   January 27, 2009, 13:31
Default Hi, maybe there is a little
Luca M.
Join Date: Mar 2009
Location: Luzern, Switzerland
Posts: 59
Rep Power: 10
luca is on a distinguished road

maybe there is a little bug in fft.C file at line 52: the algorithm seems to check if the size of the field is a power of two.
The source is written as

if ((pow2 - int(pow2 + 0.5)) > SMALL)

but should be:

if (mag(pow2 - int(pow2 + 0.5)) > SMALL)


if (mag(pow2 - int(pow2)) > SMALL).

The first one does not work.
luca is offline   Reply With Quote

Old   January 27, 2009, 14:03
Default Or maybe just check directly?
Senior Member
Mark Olesen
Join Date: Mar 2009
Posts: 810
Rep Power: 21
olesen will become famous soon enough
Or maybe just check directly?

// check for power of two
unsigned int dimCount = nn[idim];
if (!dimCount || (dimCount & (dimCount - 1)))

BTW: how often do people use ffts in OpenFOAM?
I have a Singleton FFT kicking about (ie, fft-olesen.tar.gz) that benchmarked quite well in the first FFTW roundup.

With radix-4 or radix-8 data it gives good speedup, but also handles arbitrary data without padding [I used it for image processing]. The only issue I remember is that the NR routine (ie, the one in OpenFOAM) handles the scaling a bit different.

Is there a bit enough call for FFTs, that it should be ported from the C version into usingthe OpenFOAM structures? Or would it be better (and easier) just to have FFTW as ThirdParty?
olesen is offline   Reply With Quote

Old   January 27, 2009, 16:40
Default Yep checking directly is much
Senior Member
Join Date: Mar 2009
Posts: 854
Rep Power: 15
henry is on a distinguished road
Yep checking directly is much more sensible, I will push this change to OpenFOAM-1.5.x.

I don't think the FFT in OpenFOAM is used much; we only use it for noise analysis and we don't need it to be particularly efficient but it would be useful if it were more flexible, i.e. allowed arbitrary number of data in arbitrary dimensions. If yours can do this then it would be interesting to integrate it into OpenFOAM somehow.

henry is offline   Reply With Quote


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Bugs in fvcsurfaceIntegrate su_junwei OpenFOAM Bugs 4 July 7, 2013 10:29
Wiki - Bugs Andy R Main CFD Forum 0 July 25, 2008 13:15
bugs in starcd 4.06 whitemelon Siemens 0 July 11, 2008 06:26
Bugs in polySplineEdgeC kbr OpenFOAM Bugs 2 June 6, 2008 13:04
starcd 3.24 has bugs? whitemelon Siemens 6 May 16, 2008 10:44

All times are GMT -4. The time now is 22:31.