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

Bugs in FFT

Register Blogs Community New Posts Updated Threads Search

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

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)

or

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?
  #2
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,715
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
Or maybe just check directly?
eg,

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


BTW: how often do people use ffts in OpenFOAM?
I have a Singleton FFT kicking about (ie, http://www.netlib.org/go/ 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
  #3
Senior Member
 
Join Date: Mar 2009
Posts: 854
Rep Power: 22
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.

H
henry 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
Bugs in fvcsurfaceIntegrate su_junwei OpenFOAM Bugs 4 July 7, 2013 11:29
Wiki - Bugs Andy R Main CFD Forum 0 July 25, 2008 14:15
bugs in starcd 4.06 whitemelon Siemens 0 July 11, 2008 07:26
Bugs in polySplineEdgeC kbr OpenFOAM Bugs 2 June 6, 2008 14:04
starcd 3.24 has bugs? whitemelon Siemens 6 May 16, 2008 11:44


All times are GMT -4. The time now is 10:45.