Hi all,
I have got a theoretical question concerning the coherence function as defined within the TurbSim user’s manual.
Preamble: by using Matlab, I am trying to code my own wind file generator, in accordance with Sandia theory and Kaimal spectrum. Now, assuming that N = Ny*Nz, I generally calculate a distance matrix with size b[/b]; the frequency array is, instead, a NumFreq*1 array.
Therefore, when applying the coherence formula, there is a clear mismatch between frequency vector size and distance matrix size: I expect the coherence matrix to be sized as the distance matrix, that means a N*N coherence matrix.
In which way may I overcome this size issue? Would you mind to shed a light? My code, up to now, looks like this:
[code]clc, clear all, close all
%% INITIALIZATION
tic
HubHt = 110; % Hub Height
GridWidth = 150; % Grid length along Y axis
GridHeight = 150; % Grid length along Z axis
RotorDiameter = min(GridWidth,GridHeight); % Turbine Diameter
Ny = 7;
Nz = 7;
N = Ny*Nz;
AnalysisTime = 600;
UsableTime = 40; % Time as output
TimeStep = 0.05;
Uhub = 8; % Average wind speed at hub height
TI = ‘A’; % Turbulent intensity
%set delta1 according to guidelines (chap.6)
if HubHt < 60
lambda1 = 0.7HubHt;
else
lambda1 = 42;
end
L = 0.8lambda1;%IEC, (B.12)
%IEC, Table 1, p.22
%IEC, sect. 6.3.1.3
b=5.6;
if isequal(TI,‘A’)
Iref = 0.16;
sigma1 = Iref*(0.75Uhub + b);
elseif isequal(TI,‘B’)
Iref = 0.14;
sigma1 = Iref(0.75Uhub + b);
elseif isequal(TI,‘C’)
Iref = 0.12;
sigma1 = Iref(0.75*Uhub + b);
else
sigma1 = str2num(TI)*Uhub/100;
end
% sigma1=Iref*(0.75*Uhub+b);
sigma2=0.8*sigma1;
sigma3=0.5*sigma1;
%derived constants
l=0.8*lambda1; %IEC, (B.12)
xLu = 8.1*l; % Integral length scale along X axis
xLv = 2.7*l; % Integral length scale along Y axis
xLw = 0.66*l; % Integral length scale along Z axis
% Frequency defition
NumOutSteps =ceil((UsableTime + GridWidth/Uhub)/TimeStep);
NumSteps =max(ceil(AnalysisTime/TimeStep), NumOutSteps);
INumSteps =1.0/NumSteps;
NumFreq =NumSteps/2;
DelF =1.0/(NumStepsTimeStep);
DelF5 =DelF0.5;
f= ((1:NumFreq)*DelF);
%% GRID DEFINITION
dy = GridWidth/(Ny-1);
dz = GridHeight/(Nz-1);
if isequal(mod(Ny,2),0)
iky = [(-Ny/2:-1) (1:Ny/2)];
else
iky = -floor(Ny/2):ceil(Ny/2-1);
end
if isequal(mod(Nz,2),0)
ikz = [(-Nz/2:-1) (1:Nz/2)];
else
ikz = -floor(Nz/2):ceil(Nz/2-1);
end
[Y Z] = ndgrid(ikydy,(ikzdz + HubHt));
% define distance matrix
dist = pdist2([Y(:), Z(:)], [Y(:), Z(:)]);[/code]