# Writing .bts file

**URL:** <https://forums.nlr.gov/t/writing-bts-file/7308>\
**Category:** Computer-Aided Engineering Software Tools\
**Created:** [July 22, 2024, 11:07am UTC](https://forums.nlr.gov/t/writing-bts-file/7308 "2024-07-22T11:07:14Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Riad.Elhamoud](https://dub1.discourse-cdn.com/nrel/user_avatar/forums.nlr.gov/riad.elhamoud/32/5481_2.png) [@Riad.Elhamoud](https://forums.nlr.gov/u/Riad.Elhamoud)\
**Post date:** [July 22, 2024, 11:07am UTC](https://forums.nlr.gov/t/writing-bts-file/7308/1 "2024-07-22T11:07:14Z")

</div>

Dear @Jason.Jonkman,

Hope you are doing well.

I want to ask you whether there is a MATLAB (or Python) function that writes a .bts file ?

Thank you in advance.

Best Regards,

Riad

---

<div class="post-metadata">

**Author:** ![Jason.Jonkman](https://dub1.discourse-cdn.com/nrel/user_avatar/forums.nlr.gov/jason.jonkman/32/3086_2.png) [@Jason.Jonkman](https://forums.nlr.gov/u/Jason.Jonkman)\
**Post date:** [July 22, 2024, 12:38pm UTC](https://forums.nlr.gov/t/writing-bts-file/7308/2 "2024-07-22T12:38:41Z")

</div>

Dear @Riad.Elhamoud

Dear Abhay,

Python script _turbsim\_file.py_ in the openFAST-Toolbox reads and writes binary formatted TurbSim (_.bts_) files: [openfast\_toolbox/openfast\_toolbox/io/turbsim\_file.py at main · OpenFAST/openfast\_toolbox · GitHub](https://github.com/OpenFAST/openfast_toolbox/blob/main/openfast_toolbox/io/turbsim_file.py).

From the matlab-toolbox, there is a script _readfile\_BTS.m_ that will read a TurbSim binary file into the MATLAB workspace: [matlab-toolbox/Utilities at main · OpenFAST/matlab-toolbox · GitHub](https://github.com/OpenFAST/matlab-toolbox/tree/main/Utilities). I’m not aware that an equivalent MATLAB-based script to write a TurbSim binary file has been developed, but I’m sure that would be possible using _readfile\_BTS.m_ as a starting point.

Best regards,

---

<div class="post-metadata">

**Author:** ![Pietro.Bortolotti](https://avatars.discourse-cdn.com/v4/letter/p/c6cbf5/32.png) [@Pietro.Bortolotti](https://forums.nlr.gov/u/Pietro.Bortolotti)\
**Post date:** [July 24, 2024, 8:34pm UTC](https://forums.nlr.gov/t/writing-bts-file/7308/3 "2024-07-24T20:34:03Z")

</div>

Python codes are also available, see here [WEIS/weis/aeroelasticse/turbsim\_util.py at develop · WISDEM/WEIS · GitHub](https://github.com/WISDEM/WEIS/blob/develop/weis/aeroelasticse/turbsim_util.py)

---

<div class="post-metadata">

**Author:** ![Jundong.Wang](https://avatars.discourse-cdn.com/v4/letter/j/45deac/32.png) [@Jundong.Wang](https://forums.nlr.gov/u/Jundong.Wang)\
**Post date:** [August 13, 2024, 10:56am UTC](https://forums.nlr.gov/t/writing-bts-file/7308/4 "2024-08-13T10:56:09Z")

</div>

I’m attempting to generate a BTS file using a user-defined time series file. However, I’ve noticed that in the resulting wind file, both the v and w components are zero. I’m unsure how to proceed.

When I try to use the “IECKAI” TurbModel, it appears that I can’t utilize the time series file. This seems to contradict the comments in the INP file. However, upon reviewing the user manual, I found that time series can only be used with the TIMESR turbulence model.

I’ve attached the relevant files for reference. Here is key information:

```auto

This summary file was generated by TurbSim on 13-Aug-2024 at 17:35:04.

Runtime Options:

    123456 Random seed #1
    RANLUX Type of random number generator
         F Output binary HH turbulence parameters?
         F Output formatted turbulence parameters?
         F Output AeroDyn HH files?
         T Output AeroDyn FF files?
         F Output BLADED FF files?
         F Output tower data?
         F Output formatted FF files?
         F Output coherent turbulence time step file?
         T Clockwise rotation when looking downwind?
 0 - NONE IEC turbulence models scaled to exact specified standard deviation

Turbine/Model Specifications:

        45 Vertical grid-point matrix dimension
        61 Horizontal grid-point matrix dimension
     0.500 Time step [seconds]
  5000.000 Analysis time [seconds]
  5000.000 Usable output time [seconds]
   115.000 Hub height [m]
   220.000 Grid height [m]
   300.000 Grid width [m]
     0.000 Vertical flow angle [degrees]
     0.000 Horizontal flow angle [degrees]

Meteorological Boundary Conditions:

    TIMESR User-input time series spectral model
       N/A IEC standard
       N/A IEC turbulence characteristic
       N/A IEC turbulence type
       N/A IEC Extreme Turbulence Model (ETM) "c" parameter [m/s]
       PL Wind profile type
    90.000 Reference height [m]
    10.000 Reference wind speed [m/s]
       N/A Jet height [m]
     0.130 Power law exponent
     0.030 Surface roughness length [m]

Non-IEC Meteorological Boundary Conditions:

    45.000 Site latitude [degrees]
     0.050 Gradient Richardson number
     0.480 Friction or shear velocity [m/s]
       N/A Mixing layer depth [m]
       N/A Mean hub u'w' Reynolds stress
       N/A Mean hub u'v' Reynolds stress
       N/A Mean hub v'w' Reynolds stress

Spatial Coherence Models:

       IEC u-component coherence model
       IEC v-component coherence model
       IEC w-component coherence model
( 12.000, 0.659E-03) u-component coherence parameters
( 12.000, 0.659E-03) v-component coherence parameters
( 12.000, 0.659E-03) w-component coherence parameters
       N/A Coherence exponent

Profiles from User-Defined Time-Series Input:

  Height Wind Speed Horizontal Angle Vertical Angle
   (m) (m/s) (deg) (deg)    
  ------ ---------- ---------------- --------------
  105.00 12.20 15.00 7.25
  105.00 12.14 15.00 7.25
   75.00 10.97 15.00 7.25
   75.00 10.77 15.00 7.25

You have requested that the following file(s) be generated:

   leice.bts (AeroDyn/TurbSim full-field wind file)

Turbulence Simulation Scaling Parameter Summary:

   Turbulence model used = User-input time series
   Gradient Richardson number = 0.050
   Monin-Obukhov (M-O) z/L parameter = 0.067
   Monin-Obukhov (M-O) length scale = 1725.000 m
   Mean wind speed at hub height = 10.324 m/s

   Wind profile type = Power law
   Power law exponent = 0.130
   Mean shear across rotor disk = 0.020 (m/s)/m
   Assumed rotor diameter = 220.000 m
   Surface roughness length = 0.030 m

   Nyquist frequency of turbulent wind field = 1.000 Hz

   Number of time steps in the FFT = 10000
   Number of time steps output = 10000
   Number of points simulated = 2747

Mean Flow Angles:

   Vertical = 0.0 degrees
   Horizontal = 0.0 degrees

Mean Wind Speed Profile:

   Height Wind Speed Horizontal Angle Vertical Angle U-comp (X) V-comp (Y) W-comp (Z)
     (m) (m/s) (degrees) (degrees) (m/s) (m/s) (m/s)   
   ------ ---------- ---------------- -------------- ---------- ---------- ----------
    225.0 11.27 0.00 0.00 11.27 0.00 0.00
    220.0 11.23 0.00 0.00 11.23 0.00 0.00
    215.0 11.20 0.00 0.00 11.20 0.00 0.00
    210.0 11.16 0.00 0.00 11.16 0.00 0.00
    205.0 11.13 0.00 0.00 11.13 0.00 0.00
    200.0 11.09 0.00 0.00 11.09 0.00 0.00
    195.0 11.06 0.00 0.00 11.06 0.00 0.00
    190.0 11.02 0.00 0.00 11.02 0.00 0.00
    185.0 10.98 0.00 0.00 10.98 0.00 0.00
    180.0 10.94 0.00 0.00 10.94 0.00 0.00
    175.0 10.90 0.00 0.00 10.90 0.00 0.00
    170.0 10.86 0.00 0.00 10.86 0.00 0.00
    165.0 10.82 0.00 0.00 10.82 0.00 0.00
    160.0 10.78 0.00 0.00 10.78 0.00 0.00
    155.0 10.73 0.00 0.00 10.73 0.00 0.00
    150.0 10.69 0.00 0.00 10.69 0.00 0.00
    145.0 10.64 0.00 0.00 10.64 0.00 0.00
    140.0 10.59 0.00 0.00 10.59 0.00 0.00
    135.0 10.54 0.00 0.00 10.54 0.00 0.00
    130.0 10.49 0.00 0.00 10.49 0.00 0.00
    125.0 10.44 0.00 0.00 10.44 0.00 0.00
    120.0 10.38 0.00 0.00 10.38 0.00 0.00
    115.0 10.32 0.00 0.00 10.32 0.00 0.00
    110.0 10.26 0.00 0.00 10.26 0.00 0.00
    105.0 10.20 0.00 0.00 10.20 0.00 0.00
    100.0 10.14 0.00 0.00 10.14 0.00 0.00
     95.0 10.07 0.00 0.00 10.07 0.00 0.00
     90.0 10.00 0.00 0.00 10.00 0.00 0.00
     85.0 9.93 0.00 0.00 9.93 0.00 0.00
     80.0 9.85 0.00 0.00 9.85 0.00 0.00
     75.0 9.77 0.00 0.00 9.77 0.00 0.00
     70.0 9.68 0.00 0.00 9.68 0.00 0.00
     65.0 9.59 0.00 0.00 9.59 0.00 0.00
     60.0 9.49 0.00 0.00 9.49 0.00 0.00
     55.0 9.38 0.00 0.00 9.38 0.00 0.00
     50.0 9.26 0.00 0.00 9.26 0.00 0.00
     45.0 9.14 0.00 0.00 9.14 0.00 0.00
     40.0 9.00 0.00 0.00 9.00 0.00 0.00
     35.0 8.84 0.00 0.00 8.84 0.00 0.00
     30.0 8.67 0.00 0.00 8.67 0.00 0.00
     25.0 8.47 0.00 0.00 8.47 0.00 0.00
     20.0 8.22 0.00 0.00 8.22 0.00 0.00
     15.0 7.92 0.00 0.00 7.92 0.00 0.00
     10.0 7.52 0.00 0.00 7.52 0.00 0.00
      5.0 6.87 0.00 0.00 6.87 0.00 0.00

Harvested Random Seeds after Generation of the Random Numbers:

    382863125 K 1
            0 K 2

Hub-Height Simulated Turbulence Statistical Summary:

   Type of Wind Min (m/s) Mean (m/s) Max (m/s) Sigma (m/s) TI (%)
   ---------------- --------- ---------- --------- ----------- ------
   Longitudinal (u) 8.46 10.32 12.12 0.524 5.072
   Lateral (v) -0.00 0.00 0.00 0.000 0.000
   Vertical (w) -0.00 -0.00 0.00 0.000 0.000
   U component 8.46 10.32 12.12 0.524 5.072
   V component -0.00 0.00 0.00 0.000 0.000
   W component -0.00 -0.00 0.00 0.000 0.000
   Horizontal (U&V) 8.46 10.32 12.12 0.524 5.072
   Total 8.46 10.32 12.12 0.524 5.072

                       Min Reynolds Mean Reynolds Max Reynolds Correlation
   Product Stress (m/s)^2 Stress (m/s)^2 Stress (m/s)^2 Coefficient
   ---------------- -------------- -------------- -------------- -----------
   u'w' -0.000 -0.000 0.000 -0.004
   u'v' -0.000 0.000 0.000 0.002
   v'w' -0.000 0.000 0.000 0.028

   Friction Velocity (Ustar) = 0.000 m/s
   Maximum Instantaneous TKE = 1.740 (m/s)^2
   Maximum Instantaneous CTKE = 0.000 (m/s)^2

```

Any insights or suggestions would be greatly appreciated.

Has anyone else experienced similar issues or know of a workaround? Thank you in advance for your help!  
[usr-turbsim](https://1drv.ms/f/c/fc56a1237d5508ed/Ep4-SbW6b5NGqoISV8nL9rwBlfFwhP60euT3FQB9XZo5bg?e=WKwQye)

Best Regrads,  
Junius

---

<div class="post-metadata">

**Author:** ![Jason.Jonkman](https://dub1.discourse-cdn.com/nrel/user_avatar/forums.nlr.gov/jason.jonkman/32/3086_2.png) [@Jason.Jonkman](https://forums.nlr.gov/u/Jason.Jonkman)\
**Post date:** [August 13, 2024, 12:58pm UTC](https://forums.nlr.gov/t/writing-bts-file/7308/5 "2024-08-13T12:58:39Z")

</div>

Dear @Jundong.Wang,

I’m not sure why the v and w components are showing up as zeros when you specified nonzero values, but I found a couple oddities in your inputs:

- The user-specified points you’ve set are far to one side of the grid and the reference point (`RefPtID`) is outside the grid altogether
- Your user-specified v and w components seem to have a nonzero mean, even though your profile and wind direction are zero.

I would first suggest using one user-specified point, placing this point within the domain, and ensuring that the v and w components have zero mean.

Also, which version of TurbSim are you running?

Best regards,

---

<div class="post-metadata">

**Author:** ![Jundong.Wang](https://avatars.discourse-cdn.com/v4/letter/j/45deac/32.png) [@Jundong.Wang](https://forums.nlr.gov/u/Jundong.Wang)\
**Post date:** [August 15, 2024, 3:23am UTC](https://forums.nlr.gov/t/writing-bts-file/7308/6 "2024-08-15T03:23:25Z")

</div>

Dear @Jason.Jonkman ,

Thank you for your reply. I misunderstood the definition of pointyi, thinking it referred to the global coordinate system, but I’ve made the necessary adjustments.  
BTW, Turbsim version information:

```auto
 **************************************************************************************************
 TurbSim

 Copyright (C) 2021 National Renewable Energy Laboratory
 Copyright (C) 2021 Envision Energy USA LTD

 This program is licensed under Apache License Version 2.0 and comes with ABSOLUTELY NO WARRANTY.
 See the "LICENSE" file distributed with this software for details.
 **************************************************************************************************

 TurbSim-v2.5.0-648-g2221ba53
 Compile Info:
  - Compiler: GCC version 9.3.0
  - Architecture: 64 bit
  - Precision: single
  - Date: Apr 6 2021
  - Time: 21:20:00
 Execution Info:
  - Date: 08/15/2024
  - Time: 11:21:42+0800

```

Following your suggestions, I tested three scenarios: single-point data, data from two points at the same height, and data from two points at different heights on the same side. Unfortunately, the velocity components v and w both have zero results.

I’ve uploaded the relevant files to OneDrive for your review. I’m also examining the source code, and I’ll share any updates here.

[usr-turbsim-test](https://1drv.ms/f/c/fc56a1237d5508ed/Ep4-SbW6b5NGqoISV8nL9rwBlfFwhP60euT3FQB9XZo5bg?e=cO8O39)

---

<div class="post-metadata">

**Author:** ![Jason.Jonkman](https://dub1.discourse-cdn.com/nrel/user_avatar/forums.nlr.gov/jason.jonkman/32/3086_2.png) [@Jason.Jonkman](https://forums.nlr.gov/u/Jason.Jonkman)\
**Post date:** [August 15, 2024, 5:06pm UTC](https://forums.nlr.gov/t/writing-bts-file/7308/7 "2024-08-15T17:06:41Z")

</div>

Dear @Jundong.Wang,

I would first focus on the singe-point test (_leice-test1.inp_). I still see that the mean value of your user-specified v and w components have a sizeable nonzero mean. Do the results make more sense if you remove this mean?

Also, does upgrading to the newest version of TurbSim provided with OpenFAST resolve the issue: [https://github.com/OpenFAST/openfast/releases/download/v3.5.3/TurbSim\_x64.exe](https://github.com/OpenFAST/openfast/releases/download/v3.5.3/TurbSim_x64.exe).

Best regards,

---

<div class="post-metadata">

**Author:** ![Jundong.Wang](https://avatars.discourse-cdn.com/v4/letter/j/45deac/32.png) [@Jundong.Wang](https://forums.nlr.gov/u/Jundong.Wang)\
**Post date:** [August 16, 2024, 10:33am UTC](https://forums.nlr.gov/t/writing-bts-file/7308/8 "2024-08-16T10:33:50Z")

</div>

@Jason.Jonkman ,  
Thank you so much for your suggestion. I’ve been using the latest version of TurbSim for the simulation. I apologize for only just noticing the issue you mentioned about the non-zero mean of the v and w velocity components. I suspect the reason the simulation results were zero is that the wind speed data I provided has significant values in both the horizontal and vertical directions, whereas I intended for the data to generate as zero. However, it seems there are also quite a bit of fluctuations in the reference documents provided by TurbSim. I’m unsure how the average inflow angle is set.

Once I removed the time average from the v and w components, the program ran properly. You can check it out from the following link:  
[3 items](https://1drv.ms/f/c/fc56a1237d5508ed/EkAUdh2eNNhFi1AxgIUs1-8BYavgjI25ieq9yJTZVtA8sQ?e=GbI8ls)  
Thanks to your kind reminder.

I may need to further confirm if I should adjust the average inflow angle at different height layers by modifying the source code to better match the data.

Best Regards,  
Junius

---

<div class="post-metadata">

**Author:** ![Jason.Jonkman](https://dub1.discourse-cdn.com/nrel/user_avatar/forums.nlr.gov/jason.jonkman/32/3086_2.png) [@Jason.Jonkman](https://forums.nlr.gov/u/Jason.Jonkman)\
**Post date:** [August 16, 2024, 4:21pm UTC](https://forums.nlr.gov/t/writing-bts-file/7308/9 "2024-08-16T16:21:27Z")

</div>

Dear @Jundong.Wang,

I’m glad that solved the problem. TurbSim generally works by superimposing turbulent fluctuations with zero mean with a mean wind profile. The mean wind profile can include a change of wind speed with height (shear) as well as a change in wind direction with height (veer), depending on what profile you’ve selected.

Best regards,
