binary .wnd specification

Provide feedback, request enhancements, and get help with wind-turbine computer-aided engineering tools.

Moderators: Bonnie.Jonkman, Jason.Jonkman

Stefan.Kapp
Posts: 7
Joined: Fri Jul 03, 2009 10:18 am
Location: Germany

binary .wnd specification

Postby Stefan.Kapp » Tue Jul 07, 2009 9:20 am

Does anyone know the binary file specification of .wnd-files for TurbSim?

In http://wind.nrel.gov/designcodes/preprocessors/turbsim/TurbSim.pdf on page 21 they are called "Full-Field BLADED-Style Binary Files".

For .bts files ("Full-Field TurbSim Binary Files") such a format definition is given on page 30.

Thanks for your help
Stefan

Bonnie.Jonkman
Posts: 574
Joined: Thu Nov 10, 2005 10:51 am
Organization: Envision Energy USA
Location: Colorado
Location: Boulder, CO
Contact:

Postby Bonnie.Jonkman » Wed Jul 08, 2009 9:49 am

Hi Stefan,

I have a Matlab function that reads TurbSim's FF Bladed-style .wnd files (and associated .sum files). You can download it in the zip file at http://wind.nrel.gov/public/bjonkman/. The file name is readBLgrid.m.

Let me know if you need the text description as well. I have a description from GH, but it needs a little updating before I post it.
Bonnie Jonkman

Envision Energy USA, 2016-
National Renewable Energy Laboratory, 2003-2016

Stefan.Kapp
Posts: 7
Joined: Fri Jul 03, 2009 10:18 am
Location: Germany

Postby Stefan.Kapp » Fri Jul 10, 2009 9:02 am

Hi Bonnie,

thank you very much for your rapid reply and the Matlab code.

I'm trying to generate .wnd files for our needs hence your reading script is very useful.
If you should have developed a writing scipt as well or you're interested in my script (once it works) let me know.

Best regards
Stefan

Endowed Chair of Wind Energy
University of Stuttgart

Bonnie.Jonkman
Posts: 574
Joined: Thu Nov 10, 2005 10:51 am
Organization: Envision Energy USA
Location: Colorado
Location: Boulder, CO
Contact:

Postby Bonnie.Jonkman » Fri Jul 10, 2009 12:09 pm

Stefan,

I have some Fortran code that can be used to create the .wnd files (and the .sum files that AeroDyn needs to read and scale the .wnd files). I put it on the website with the Matlab code.

If you get a working Matlab script that creates the files (and you don't mind sharing with others), I would appreciate a copy. I have had other people request the same.

Thanks,

Bonnie
Bonnie Jonkman

Envision Energy USA, 2016-
National Renewable Energy Laboratory, 2003-2016

Stefan.Kapp
Posts: 7
Joined: Fri Jul 03, 2009 10:18 am
Location: Germany

Postby Stefan.Kapp » Thu Aug 06, 2009 11:52 am

Hi Bonnie,

I've successfully implemented the following code for writing wnd files.
We use it to add EOGs to windfield data.
Maybe someone has similar needs.

Thanks again for your support!

Regards,
Stefan



Code: Select all

function writeBLgrid(FileName, velocity, dy, dz, dt, zOffset, z0, SummVars)


% writeBLgrid('testWind', velocity, dy, dz, dt, zOffset, z0, SummVars)
%
% writes wind velocity data to binary .wnd files
%

% inputs - FileName: Name of output .wnd-file (extension will be added)
%        - velocity: 4D-array: (time, 3D-windcomp, y, z)
%        - dz
%        - dy
%        - dt
%        - SummVars: 6 variables from the summary file {zHub, Clockwise, UBAR, TI_u, TI_v, TI_w}
%                                                         90          1    12    12   9.6     6
%        - zOffset: (=90) Reference height (m) = Z(1) + GridHeight / 2.0
%        - z0 = .03;      Roughness length (m)

%-----------------------------------------
% INITIALIZE VARIABLES
%-----------------------------------------
fileFmt  = 'int16';

fc = 4;                 % should be 4 to allow turbulence intensity to be stored in the header
lat = 0;                % latitude (deg)

zHub = SummVars(1);     % hub height [m]
MFFWS = SummVars(3);    % mean full-field wind speed
TI_U = SummVars(4);     % Turbulence Intensity of u component (%)
TI_V = SummVars(5);     % Turbulence Intensity of v component (%)
TI_W = SummVars(6);     % Turbulence Intensity of w component (%)

[nt, nffc, ny nz] = size(velocity); % determin dimensions of windfield, e.g. [1286,3,23,23]

z1 = zHub - dz*(nz-1)/2;  %this is the bottom of the grid

dx = dt*MFFWS;          % delta x in m           
nt_header = floor(nt/2);% half the number of time steps


%-----------------------------------------
% OPEN FILE
%-----------------------------------------
len    = length(FileName);
ending = FileName(len-3:len);

if strcmpi( ending, '.wnd' )
    FileName = FileName(1:len-4);
end
fid_wnd   = fopen( [ FileName '.wnd' ], 'w' ); % Open file, or create new file, for writing; discard existing contents, if any.
if ( fid_wnd <= 0 )
   error( 'Wind file could not be opened.' );
   return;
end


%-----------------------------------------
%WRITE THE HEADER OF THE BINARY FILE
%-----------------------------------------
% THE NEWER-STYLE AERODYN WIND FILE
    fwrite( fid_wnd, -99, 'int16' );             % number of components
    fwrite( fid_wnd, fc, 'int16' );              % should be 4 to allow turbulence intensity to be stored in the header
    fwrite( fid_wnd, nffc, 'int32' );            % number of components (should be 3)
    fwrite( fid_wnd, lat, 'float32' );           % latitude (deg)
    fwrite( fid_wnd, z0, 'float32' );            % Roughness length (m)
    fwrite( fid_wnd, zOffset, 'float32' );       % Reference height (m) = Z(1) + GridHeight / 2.0
    fwrite( fid_wnd, TI_U, 'float32' );          % Turbulence Intensity of u component (%)
    fwrite( fid_wnd, TI_V, 'float32' );          % Turbulence Intensity of v component (%)
    fwrite( fid_wnd, TI_W, 'float32' );          % Turbulence Intensity of w component (%)

    fwrite( fid_wnd, dz, 'float32' );            % delta z in m
    fwrite( fid_wnd, dy, 'float32' );            % delta y in m
    fwrite( fid_wnd, dx, 'float32' );            % delta x in m           
    fwrite( fid_wnd, nt_header, 'int32' );       % half the number of time steps
    fwrite( fid_wnd, MFFWS, 'float32');          % mean full-field wind speed

       fwrite( fid_wnd, [0 0 0], 'float32' );    % unused variables (for BLADED): write zeros
       fwrite( fid_wnd, [0 0], 'int32' );        % unused variables (for BLADED): write zeros
    fwrite( fid_wnd, nz, 'int32' );              % number of points in vertical direction
    fwrite( fid_wnd, ny, 'int32' );              % number of points in horizontal direction
       fwrite( fid_wnd, zeros(3*(nffc-1),1), 'int32' );     % unused variables (for BLADED): write zeros
               
%-----------------------------------------
% WRITE GRID DATA
%-----------------------------------------
Scale    = 0.00001*SummVars(3)*SummVars(4:6);
Offset   = [SummVars(3) 0 0];


if SummVars(2) > 0 %clockwise rotation
    %flip the y direction....
    %let's change the dimension of velocity so that it's 4-d instead of 3-d   
    y_ix = ny:-1:1;
else
    y_ix = 1:ny;   
end

v = zeros(nz*ny*nffc,1);

for it = 1:nt
    cnt = 1;
    for iz = 1:nz
        for iy = y_ix
            for k=1:nffc
                v(cnt) = (velocity(it,k,iy,iz) - Offset(k))/Scale(k);
                cnt = cnt + 1;
                %velocity(it,k,iy,iz) = v(cnt2)*Scale(k) + Offset(k);
            end %for k
        end %iy
    end % iz 
   
    fwrite( fid_wnd, v, fileFmt );
   
end %it

%-----------------------------------------
% CLOSE .WND FILE
%-----------------------------------------
fclose(fid_wnd);

Bonnie.Jonkman
Posts: 574
Joined: Thu Nov 10, 2005 10:51 am
Organization: Envision Energy USA
Location: Colorado
Location: Boulder, CO
Contact:

Postby Bonnie.Jonkman » Thu Aug 06, 2009 5:18 pm

Hi Stefan,

I'm glad you got it working. Thanks for posting the code!
Bonnie Jonkman

Envision Energy USA, 2016-
National Renewable Energy Laboratory, 2003-2016

Simon.Fobe
Posts: 3
Joined: Tue Mar 03, 2020 6:18 am
Organization: KU Leuven
Location: Belgium

Re: binary .wnd specification

Postby Simon.Fobe » Mon Jun 08, 2020 10:05 am

Hi
Starting from an existing y-z wind field (Matlab array), I would like to write a .wnd file to be input to a FAST simulation.
I was wondering whether it makes sense to interpolate the data (over time and over space), or does FAST automatically interpolate the wind data ?

Besides, would you recommend to use the aforementioned Matlab function (writeBLgrid) to write this .wnd file ? If yes, what are the following constants used for : TI_u ... TI_w, z0, UBAR, zHub ? In my opinion, all the information (wind velocity at each time step and for every grid point) is already contained in the velocity array. Aren't these constants then redundant ?

Thanks in advance for your help
Simon

Jason.Jonkman
Posts: 5428
Joined: Thu Nov 03, 2005 4:38 pm
Location: Boulder, CO
Contact:

Re: binary .wnd specification

Postby Jason.Jonkman » Mon Jun 08, 2020 11:29 am

Dear Simon,

Yes, the InflowWind module of FAST will interpolate the wind data as necessary; if you already have the full y-z wind field as a function of time , there is no need for you to interpolate the data further.

Some of those data stored in the Bladed-formatted binary (*.wnd) file are not used by InflowWind. And the wind field data in that file must be normalized. See Appendix E from the TurbSim v2.00.00 User's Guide for more information: https://wind.nrel.gov/public/jjonkman/T ... urbSim.pdf. Yes, I would recommend using the writeBLgrid function above to write your data to the binary file.

Best regards,
Jason Jonkman, Ph.D.
Senior Engineer | National Wind Technology Center (NWTC)

National Renewable Energy Laboratory (NREL)
15013 Denver West Parkway | Golden, CO 80401
+1 (303) 384 – 7026 | Fax: +1 (303) 384 – 6901
nwtc.nrel.gov

Simon.Fobe
Posts: 3
Joined: Tue Mar 03, 2020 6:18 am
Organization: KU Leuven
Location: Belgium

Re: binary .wnd specification

Postby Simon.Fobe » Wed Jun 10, 2020 8:30 am

Dear Jason,

Thank you very much for your rapid reply. I have been able to encode the binary .wnd file and use it in the simulation. The wind velocities are as expected.

However, no .sum file is generated by the writeBLgrid function. I thus used a .sum file from another wind field and removed almost all the lines (the essential lines are kept and adjusted to my current wind field).

For instance, I used arbitrary values for UBar (=9) and TI_u...w (=1).
If I understand it correctly, these arbitrary values do not change the de-coded wind velocities as long as the same values for UBar and TI_u...w are used for the encoding and de-coding (i.e. same value used in the writeBLgrid function and in the .sum file). Is this correct ?

That said, I noticed that a time shift of the wind velocities occurs when UBar changes (not a problem from a statistical point of view).

Could you please confirm that this procedure leaves the wind velocities used in the simulation unchanged (disrespecting any delay), with respect to the original Matlab array ?

Kind regards
Simon

windInflowLES.txt
Modified .sum file (with .txt extension for the upload)
(979 Bytes) Downloaded 50 times

Bonnie.Jonkman
Posts: 574
Joined: Thu Nov 10, 2005 10:51 am
Organization: Envision Energy USA
Location: Colorado
Location: Boulder, CO
Contact:

Re: binary .wnd specification

Postby Bonnie.Jonkman » Wed Jun 10, 2020 11:32 am

The basic summary file that InflowWind will read should be in this format: https://github.com/old-NWTC/InflowWind/ ... m_File.pdf

The values in the summary file are used to scale the values from the binary file back to dimensional velocities, so they should be the values you used to scale in the Matlab script. UBar is also used in Taylor's Frozen Turbulence hypothesis to determine the conversion from time to space.
Bonnie Jonkman

Envision Energy USA, 2016-
National Renewable Energy Laboratory, 2003-2016

Simon.Fobe
Posts: 3
Joined: Tue Mar 03, 2020 6:18 am
Organization: KU Leuven
Location: Belgium

Re: binary .wnd specification

Postby Simon.Fobe » Sat Jun 13, 2020 2:45 am

Hi,

In the InflowWind.dat file, the output variable "Wind1VelX" is described as being the 'X-direction wind velocity at point WindList(1)'.
Do you know where this WindList file can be accessed/modified?
Is it also possible to output wind speeds at several grid points such that an instantaneous average over the whole rotor disc area can be computed ?

Thank you in advance for your help.
Kind regards
Simon

Jason.Jonkman
Posts: 5428
Joined: Thu Nov 03, 2005 4:38 pm
Location: Boulder, CO
Contact:

Re: binary .wnd specification

Postby Jason.Jonkman » Sun Jun 14, 2020 11:15 am

Dear Simon,

The InflowWind input file allows you to specify up to 9 points (NWindVel) where ambient wind data can be output, with the corresponding X/Y/Z locations specified via InflowWind inputs WindVxiList/WindVyiList/WindVziList. If you are running InflowWind coupled to OpenFAST, you'd have to make a small change to the source code to output wind data at more than 9 points. If you are running InflowWind from the standalone InflowWind driver, there is functionality to output ambient wind at many more points. See the InflowWind User's Guide for more information.

Best regards,
Jason Jonkman, Ph.D.
Senior Engineer | National Wind Technology Center (NWTC)

National Renewable Energy Laboratory (NREL)
15013 Denver West Parkway | Golden, CO 80401
+1 (303) 384 – 7026 | Fax: +1 (303) 384 – 6901
nwtc.nrel.gov


Return to “Computer-Aided Engineering Software Tools”

Who is online

Users browsing this forum: No registered users and 1 guest