3.5 | 2 ratings Rate this file 38 Downloads (last 30 days) File Size: 3.54 KB File ID: #35867

3D Turbulent Wind Field Simulation by means of Sandia Method for wind energy applications



27 Mar 2012 (Updated )

3D turbulent wind field generator with Kaimal model

| Watch this File

File Information

This code is meant for all those people interested or actively involved within the wind energy business.

It tries to couple the best features of already existing tools, such as TurbSim and Bladed.

The code has been quite tested and reviewed since the previous version, in order to overcome issues dealing with the Coherence function as well as the Gaussian statistics.

Easy to use and free-source.


1) Hub Height [m]
2) Grid Width [m]
3) Grid Height[m]
4) Number of points along Y
5) Number of points along Z
6) Number of FFT points (2^12 recommended)
7) Analysis Time (generally 600s)
8) Hub Average Wind Speed [m/s]
9) Coherence Model (TurbSim or Bladed)


1) U: Turbulent time series for v-component [m/s]
2) V: Turbulent time series for v-component [m/s]
3) W: Turbulent time series for v-component [m/s]

Required Products Statistics and Machine Learning Toolbox
MATLAB release MATLAB 8.0 (R2012b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (5)
09 May 2013 kai

kai (view profile)

Thank you for your sharing code. I wonder that if you use FFT to transform frequency matrix to time series correlty. The code you written is as follows:
for ii = 1:N
tmp_u = (fft((H_u(ii,:)))); % FFT
tmp_v = (fft((H_v(ii,:))));
tmp_w = (fft((H_w(ii,:))));

% Up to this point only the one-sided spectrum has been considered to
% lighten the computational effort, since the double-sided spectrum is
% an even function about the frequency axis.
% Therefore, we can now merge real and imaginary part of the fft to get
% the ultimate time series.

U(ii,:) = [real(tmp_u) imag(tmp_u)];
V(ii,:) = [real(tmp_v) imag(tmp_v)];
W(ii,:) = [real(tmp_w) imag(tmp_w)];

I think ifft should be used here.

Comment only
21 Nov 2012 Jean

Jean (view profile)

Thank you for this script.
I think there is a mistake in the IEC 61400-1 implementation, the power spectrum for Kaimal should be with a 5/3 power and not a 5/6:

PSD(i,IVec)=SigmaLU(IVec)/(1.0 + LU(IVec)*Freq(i))^Exp3

with Exp3=5/3
Moreover the calculated time series is artifically scaled to the desired mean & standard deviation, but the calculation output seems to be very far from the desired value. I therefore suspect an error in the code.
A lot of lines could be vectorized.

19 Oct 2012 Hamid Sarlak  
05 May 2012 Francesco Perrone

You should download the lapack package here


as said within "Other Requirements!

Comment only
05 May 2012 Allan

Allan (view profile)

Thank you for your sharing work.
I met the following problem. It seems that function lapack can't be found.
Is this subroutine needs additional toolbox?

Undefined function 'lapack' for input arguments of type 'char'.

Error in Sandia_3D_method (line 287)
U = lapack('SPPTRF','L',Ntot,H,0);

Comment only
16 Apr 2012

In this new version, I set the coherence matrix properly according to Sandia Method. The past release contained a simplified version of it

02 Apr 2013

the code has been reviewed and achieves better performances.

Contact us