CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > General Forums > Main CFD Forum

3D Energy Spectrum

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 16, 2011, 06:46
Default 3D Energy Spectrum
  #1
New Member
 
Join Date: Nov 2011
Posts: 2
Rep Power: 0
CFDrookie is on a distinguished road
Hi all 1st post so be gentle!

I have a 3D (turbulent) velocity field. For the sake of example lets say this is contained in 3 n^3 arrays, ux, uy, uz.

I want the 3d energy spectrum, my method at the moment is to calculate fft of these arrays (everything below is in matlab syntax) i.e.

>fux=fftn(ux)/(n^3);
>fuy=fftn(uy)/(n^3);
>fuz=fftn(uz)/(n^3);

I then get real and imaginary parts:

>energyr=real(fux).^2+real(fuy).^2+real(fuz).^2;
>energyi=imag(fux).^2+imag(fuy).^2+imag(fuz).^2;

Define the maximum wavenumber

>midpt=n/2+1;

Now I compute energy spectra in shells,

spect(1:1.5*n)=0.;
for i=1:n
for j=1:n
for k=1:n
ii=i; jj=j; kk=k;
if ii>midpt ; ii=n-ii+1; ; end ;
if jj>midpt ; jj=n-jj+1; ; end ;
if kk>midpt ; kk=n-kk+1; ; end ;
r=round(sqrt(ii^2+jj^2+kk^2));
spect(r)=spect(r)+energyr(i,j,k)+energyi(i,j,k);
end
end
end

My question is, whilst this works well, I do not get the energy at the box scale (k=1). Where am I going wrong?

Many thanks in advance
CFDrookie is offline   Reply With Quote

Old   December 2, 2011, 08:20
Default
  #2
New Member
 
Join Date: Nov 2011
Posts: 2
Rep Power: 0
CFDrookie is on a distinguished road
Anyone got any ideas?
CFDrookie is offline   Reply With Quote

Old   December 3, 2011, 18:58
Default
  #3
Member
 
Mike
Join Date: Apr 2011
Location: Canada
Posts: 83
Rep Power: 14
saeedi is on a distinguished road
Hey,

You know you should first calculate the Autocorrelation or autocovariance, and then take the fft of that one not the vlocity itslf.
saeedi is offline   Reply With Quote

Old   September 23, 2015, 11:16
Default
  #4
New Member
 
V
Join Date: Sep 2015
Posts: 2
Rep Power: 0
CFDstudent07 is on a distinguished road
Hi
Did you figure it out? I may need the same code too

Quote:
Originally Posted by CFDrookie View Post
Hi all 1st post so be gentle!

I have a 3D (turbulent) velocity field. For the sake of example lets say this is contained in 3 n^3 arrays, ux, uy, uz.

I want the 3d energy spectrum, my method at the moment is to calculate fft of these arrays (everything below is in matlab syntax) i.e.

>fux=fftn(ux)/(n^3);
>fuy=fftn(uy)/(n^3);
>fuz=fftn(uz)/(n^3);

I then get real and imaginary parts:

>energyr=real(fux).^2+real(fuy).^2+real(fuz).^2;
>energyi=imag(fux).^2+imag(fuy).^2+imag(fuz).^2;

Define the maximum wavenumber

>midpt=n/2+1;

Now I compute energy spectra in shells,

spect(1:1.5*n)=0.;
for i=1:n
for j=1:n
for k=1:n
ii=i; jj=j; kk=k;
if ii>midpt ; ii=n-ii+1; ; end ;
if jj>midpt ; jj=n-jj+1; ; end ;
if kk>midpt ; kk=n-kk+1; ; end ;
r=round(sqrt(ii^2+jj^2+kk^2));
spect(r)=spect(r)+energyr(i,j,k)+energyi(i,j,k);
end
end
end

My question is, whilst this works well, I do not get the energy at the box scale (k=1). Where am I going wrong?

Many thanks in advance
CFDstudent07 is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
turbulent energy spectrum problem cfd.newbie Main CFD Forum 6 September 24, 2015 17:13
turbulent energy spectrum cfd.newbie Siemens 1 June 20, 2008 00:48
turbulent energy spectrum cfd.newbie FLUENT 0 June 18, 2008 19:34
LES correlation and turbulent energy spectrum Fabian Main CFD Forum 4 October 18, 2005 03:04
Energy Spectrum Emad Khalifa Main CFD Forum 3 June 30, 2003 17:03


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