- **OpenFOAM Bugs**
(*https://www.cfd-online.com/Forums/openfoam-bugs/*)

- - **Bugs in FFT **
(*https://www.cfd-online.com/Forums/openfoam-bugs/62333-bugs-fft.html*)

Hi,
maybe there is a littleHi,
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. |

Or maybe just check directly? 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? |

Yep checking directly is much 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 |

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