Good Morning Everybody,

I am trying to generate a code close to TurbSim in Matlab getting a 3-dimensional turbulent wind speed field on a square grid,by making use of the only Kaimal and Von Karman PSD models.

Let’s say that these are the main features for the simulation:

HubHt = 84 [m];

GridWidth = 80 [m];

GridHeight = 80 [m];

RotorDiameter = 80 [m];

NumGrid_Y = 31;

NumGrid_Z = 31;

AnalysisTime = 600;

UsableTime = 40;

TimeStep = 0.5;

UHub = 11.4;

IECTurbC = ‘B’;

IECed = ‘2’;

TurbModel = ‘IECKAI’;

Even within Matlab I handle the Coherence matrix by means of the spptrf lapack function, so that the coherence matrix is an array made up of 961*(961+1)/2 indipendent elements ( an this array should be mono-dimensional), since the coherence matrix is a symmetric positive definite one.

After having got the Veers Matrix (packed into a one-dimensional array??) , I should go to calculate the correlated fourier coefficients by means of this code:

```
! Calculate the correlated fourier coefficients.
! -------------------------------------------------------------
```

DO IVec = 1,3

IF2 = 0

DO IFREQ = 1,NumFreq

```
IF2 = IF2 + 2
IF1 = IF2 - 1
DO J=1,NTot
! Apply a random phase to each of the columns of H to
! produce random phases in the wind component.
! Then sum each of the rows into the vector V.
IRand = IFreq + (J-1)*NumFreq + (IVec-1)*NTot*NumFreq ! This sorts the random numbers as they were done previously
Ph = TwoPi*RandNum(IRand)
CPh = COS( Ph )
SPh = SIN( Ph )
Indx = NTot*(J-1) - J*(J-1)/2 + J !Index of H(I,J)
DO I=J,NTot
V(IF1,I,IVec) = V(IF1,I,IVec) + TRH(Indx)*CPh !Real part
V(IF2,I,IVec) = V(IF2,I,IVec) + TRH(Indx)*SPh !Imaginary part
Indx = Indx + 1 !H(I,J)
ENDDO ! I
ENDDO ! J
```

ENDDO !IFreq

ENDDO !IVec

But, then, matlab tells me that there’s a mismatch between the left-side dimensions (3 because of V) and the right-side dimensions; and having a look at the code,this seems right.

So I would like to know how to overcome this issue;maybe I missed some passages or ,even worse, I did not get the right way TurbSim handle these data.

I look forward to getting some hints,whenever possible.

Kind regards,

Francesco Perrone