Hi Foamers!
I'm trying to imp
Hi Foamers!
I'm trying to implement some analytical solutions of the Linearized Euler Equations and I need to evaluate a spatioal convolution product: p(x,y,t) = f(x,y)@dG(x,y,t)/dt where G is the free space green function. To solve this convolution I apply this property: FourierTransform(a(x,y)@b(x,y))=FourierTransform(a (x,y)) FourierTransform(b(x,y)) then I come back to physical space with the inverse fft. My code is: .... Kmesh K(mesh); volScalarField f = eps*exp(Foam::log(2.0)/2*(sqr(xx_mon/lRef)+sqr(yy_mon/lRef))); Info << "\nEvaluating FFT" << endl; complexField fFour = fft::forwardTransform(ReComplexField(f), K.nn()); etc etc.... but when I execute it I have: Create time Create mesh for time = 0 Reading parameters Reading field U (1.99 1.99 0.2) 3(200 200 1) 442.056 Evaluating FFT #0 Foam::error::printStack(Foam:http://www.cfdonline.com/OpenFOAM_D...part/proud.gifstream&) in "/opt/OpenFOAM/OpenFOAM1.5/lib/linux64GccDPOpt/libOpenFOAM.so" #1 Foam::sigSegv::sigSegvHandler(int) in "/opt/OpenFOAM/OpenFOAM1.5/lib/linux64GccDPOpt/libOpenFOAM.so" #2 ?? in "/lib64/libc.so.6" #3 Foam::fft::transform(Foam::Field<foam::complex>&, Foam::List<int> const&, Foam::fft::transformDirection) in "/opt/OpenFOAM/OpenFOAM1.5/lib/linux64GccDPOpt/librandomProcesses.so" #4 Foam::fft::forwardTransform(Foam::tmp<foam::field< foam::complex> > const&, Foam::List<int> const&) in "/opt/OpenFOAM/OpenFOAM1.5/lib/linux64GccDPOpt/librandomProcesses.so" #5 main in "/home/ivan/OpenFOAM/ivan1.5/applications/bin/linux64GccDPOpt/monopolo" #6 __libc_start_main in "/lib64/libc.so.6" #7 Foam::regIOobject::readIfModified() in "/home/ivan/OpenFOAM/ivan1.5/applications/bin/linux64GccDPOpt/monopolo" Segmentation fault I have a square bidimensional mesh. What does it means this segmentation fault? Thanks 
Segmentation fault means that
Segmentation fault means that it accesses outside the allocated memory. See e.g. http://openfoamwiki.net/index.php/HowTo_debugging.

Ok, the correct question is:
Ok, the correct question is:
I'm doing something wrong in my setup, something like the use of fft::forwardTransform is incorrect or it works only with 3D meshes, or there are any bestpractise for the use of fft? Thanks 
basic info with fft in OF
Hi Yvan,
Did you find a solution? I'm trying to implement 1D fft with the velocities in my solver and I'm not able to compile the solver... kMesh, fft and complexField have not been declared the error message said. How can I use the kMesh and fft class in OF 1.6.x. Would it be easier if create a utility for the fft? Any advice would be great! Thank you, Pascal 
Hi all,
I've tried to implement a postprocess in order to evaluate the FFT in a 3D mesh. What I've done is: 1. To include the required header files (and modify accordingly the 'options' file): #include "fft.H"2. To calculate the FFT of the x velocity component (this can be discussed) Kmesh K(mesh);where Ufft is a scalarField of the same dimensions as the mesh. I guess that Ufft is the yaxis of a typical FFT diagram but, what should be the xaxis? Sorry if this is a very basic question, I'm familiar with FFT in time but I've never dealt with FFT in space. Thanks!! elisabet 
Fftw 2.1.5
Hi Elisabet,
The simplest solution I found was to link the public code FFTW 2.1.5 with OpenFOAM 1.6.x. All you need to do is modify your solver: option file and add a few line of code in order to calculate your FFT. You will have great flexibility using FFTW. Note: Also, you can all do that as an postprocess utility. Regard, Pascal 
Thanks Pascal for the answer.
First of all, now I know what the final output should be (correct me if I'm wrong): a volScalarField in order to the see the peaks on my mesh (with paraview for example) I've been looking to use FFTW properly. I've found the place: http://www.fftw.org/doc/ComplexOne_...onalDFTs.html but, as fas as I understand, my 'in' (of fft_complex type) would be a ReComplexField of size K.sizeOfBox(), as well as my 'out' variable. Afterwords, I would convert the 'out' to a scalarField. However, I still have the same question: how to convert a scalarField to a volScalarField in order to visualize the resulting FFT in the physical space? Any suggestion? Or other ways to handle it? Elisabet 
1 Attachment(s)
Hi Elisabet,
When I use FFTW I need 1D array (standard C++) and volVectorField (I'm using 1D FFT on velocity vector): Code:
for (int nzi = 0; nzi < nz; nzi++) // Écriture du nouveau champ vectoriel Entire code of this utility is attached to the post. Hope this help. Pascal 
Thank you very much Pascal! it was very useful!
If I understand it well, you call 'mode' a given xy plane (defined by z). Is it correct? Thus, it's reasonable to just look the FFT at a given xy plane, but I don't see the reason why you are interested in looking all xy planes except one. elisabet 
Hi Elisabet,
I'm doing FFT along 'z' axis (1D) and I calculate the most interesting mode (n) from 0 to nz/21 or wavenumber (k = 2*pi*n/Lz). I have also the possibility to observe all the modes except one. For example, I could be interested by all the modes except mode 0 (which is the base flow or 2D field) Doing that it will allow me to visualize the perturbed field which is very interesting depending what you are looking for. The calculation is applied to the entire domain of simulation. Regards, Pascal 
All times are GMT 4. The time now is 21:20. 