Mann Turbulence in TurbSim

Hi,

I am planning to use the Mann turbulence model in my wind turbine simulations and was hoping there was an easy fix to this in AeroDyn and TurbSim. Is there such an option? I know one can generate a turbulent field from the Mann model using the IEC Turbulence simulator (risoe.dtu.dk/WAsP/Products/W … lator.aspx), but is it possible to import such data into the program?

If there is no easy fix, could you give me some guidance to the “hard way”? I have seen that there are several places in the source code that Manns turbulence is mentioned.

Regards

L

Hi, Lene.

I think the comments you saw in the AeroDyn source code refer to the Mann model in Bladed format full-field files. TurbSim does not generate turbulence using the Mann model, but Bladed can.

In the past, we have used a program that Marshall Buhl wrote to convert HAWC formatted files into Bladed format. I also recently created a version of AeroDyn’s InflowWind module that reads HAWC-format wind files, like the ones generated in Risoe’s IEC Turbulence Simulator. The input file needs a little work, and it hasn’t been fully tested, yet. But, if you would like to test the program, I will make an archive that you can download and compile in place of AeroDyn’s current InflowWind module.

Hi Bonnie,

Thanks for te quick reply. It would be great if I could test your program.

Regards
Lene

I have created a web page for an alpha version of InflowWind at http://wind.nrel.gov/designcodes/simulators/inflowwind/. (link edited 12-Dec-2012)

This module is intended to take the place of AeroDyn’s InflowWind routines, which are found in the AeroDyn archive’s Source/InflowWind/Source folder. Here are a few things you should note:

  • The new module contains an extra source file, HAWCWind.f90, so make sure you add this file to any compile script/makefile/Visual Studio project/etc. that you use.
  • The new module needs a routine in NWTC Subroutine Library v1.04.00c-mlb, so download this alpha version (or a later version) of the library.
  • To use the HAWC wind format, start with the text input file, SampleInflowWindInput.hwc, in the archive’s Samples folder, and change the input values as necessary. The name of this file must be specified on the “WindFile” line in the AeroDyn input file.

Please remember that this alpha version is a work in progress. In the future, we will have a different input file, and there will likely be other changes before the module officially replaces the current code in AeroDyn.

Regards,
Bonnie

Thanks for the files Bonnie :slight_smile: I have been able to generate some turbulence files using the Inflow Program. I am however a novice in using Fortran, and I am having some problems compiling Aerodyn. I get the following message when trying to compile it:

--------------------Configuration: AeroDyn - Win32 Release--------------------
Linking…
dfor.lib(DFORMAIN.OBJ) : error LNK2001: unresolved external symbol MAIN_
Release/AeroDyn.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

AeroDyn.exe - 2 error(s), 0 warning(s)

I guess there is something wrong when I build the program. I build the NWTC files and the Inflow files in the order as you have given in the “ReadMe.txt” file, and the AeroDyn files in the following order; AeroMods, AeroSubs, GenSubs, SharedTypes and AeroDyn. I am using Compaq Visual Fortran v6.6c.

I also had some troubles with “CTWind.f90” in the new version of Inflow, and used an older version that I had downloaded together with AeroDyn. The new version gave me the following error message:
--------------------Configuration: AeroDyn - Win32 Release--------------------
Compiling Fortran…
C:\NREL\AeroDyn\Source\InflowWind_new\Source\CTWind.f90
C:\NREL\AeroDyn\Source\InflowWind_new\Source\CTWind.f90(763) : Error: This name does not have a type, and must have an explicit type. [PATHISRELATIVE]
IF ( PathIsRelative( CTPscaling%CTTSfile ) ) THEN
--------^
C:\NREL\AeroDyn\Source\InflowWind_new\Source\CTWind.f90(763) : Error: A logical data type is required in this context. [PATHISRELATIVE]
IF ( PathIsRelative( CTPscaling%CTTSfile ) ) THEN
--------^
C:\NREL\AeroDyn\Source\InflowWind_new\Source\CTWind.f90(780) : Error: A logical data type is required in this context. [PATHISRELATIVE]
IF ( PathIsRelative( CTPscaling%CTbackgr ) ) THEN
--------^
Error executing df.exe.

CTWind.obj - 3 error(s), 0 warning(s)

Have a nice weekend :slight_smile:

Lene

First off, I’d like to strongly suggest that you upgrade the Compaq Visual Fortran to a newer Fortran compiler. We are using some Fortran 2003 features that CVF does not always handle properly. Some people have told me it works fine with FAST v7.00.01a-bjj, but I have also had cases where I said “A=B” then printed both A and B and they were NOT the same.

Now that I have tried to scare you, I will try to answer your questions. :slight_smile:

AeroDyn is not a standalone executable program, so if you are recompiling it, you will have to actually compile it with FAST or Adams2AD or whatever structural dynamics code you are using. (There is no main PROGRAM in the AeroDyn source files, which is why you are getting the linking error you mentioned). Assuming you are using FAST, you can look at the Compile_FAST.bat script that comes in the FAST archive and see all of the files you must compile and link together (but remember to include the new HAWCWind.f90 file in the list just after FFWind.f90). When you get it compiled, you can use your new FAST executable file to run the FAST CertTest to make sure you get the same answers (this is especially important if you choose to use CVF).

The error you get with the new CTWind.f90 code is because the PathIsRelative() function is in NWTC Subroutine Library v1.04.00c-mlb. It was not in older versions of the subroutine library. See bullet #2 in my previous post. You will have to compile using v1.04.00c-mlb of the library. ( You can also just use the older version of CTWind.f90 if you’d like. )

Hope that helps.

Hallo Bonnie,

it’s again me :slight_smile:
I’m interested in the Mann turbulent model as well,but because I would like to implement it as well as done with the Kaimal or von Karman in my Matlab code.
I’ve read the Mann’s papers,but I’m still wondering if there’s any straightforward mathematical equation that enables you to estimate the one-sided power spectrum and the coherence matrix.
From IEC-64100 3rd edtion it seems possible to get the one-sided spectrum formula,by setting the shear factor gamma = 3.9,but there’s no mention about the appraisal of the coherence matrix.

Would you mind to give me some further and thorough clues about this topic?

I thank you in advance and apologize for trivial queries.

Kind Regards,
Francesco Perrone

Hi, Francesco.

This isn’t a trivial query. :slight_smile:

The Mann model is generated in a fundamentally different way than the way Kaimal or von Karman turbulence is generated in the Veers/Sandia Method. (The coherence is built into the Mann turbulence using some assumptions about atmoshperic physics; it is not added to independently generated points.) Jacob Mann at Risoe would be a much better resource for explaining the details to you. You might ask him for some guidance on how you can implement it in Matlab (though he’s a Mathematica guy :stuck_out_tongue:).

TurbSim does not include the Mann model because it would require a lot of effort on our part to reproduce a model that Risoe already allows you to use for free. It was much easier to figure out how to read their data files.

Hei Bonnie.

Thank you for your good and quick response. I am now able to run Mann turbulence in my FAST program. I am still using my old compiler, but will use a newer version later. Thanks for the warning :slight_smile:

I have one more question however. I would like to get the wind speed in all three directions from an arbitrary point in the flow field, is this possible? I have found the option of plotting at hub height, but wondered if it is possible to get the output from several locations.

regards

L

There is no built-in way to output wind at an arbitrary point in space in FAST v7.00.*. You could, however, add this feature fairly easily. In the FAST.f90 source file, you will find the following code to get the hub-height wind speed currently output:

[code] HHWndVec(:slight_smile: = AD_GetUndisturbedWind( ZTime, (/REAL(0.0, ReKi), REAL(0.0, ReKi), FASTHH /), ErrStat )

AllOuts( WindVxi) = HHWndVec(1)
AllOuts( WindVyi) = HHWndVec(2)
AllOuts( WindVzi) = HHWndVec(3)
[/code]

If you would like the wind speed at a different point, you would just have to modify the (/0.0, 0.0, FASTHH/) array to be whatever point you want (using the X-Y-Z ground coordinate system).

The InflowWind archive also has a TestRoutines folder, which contains some other ways to look at the wind data outside of FAST. One is a sample Fortran code that you can modify to read the file you want and create your own output. The other is a Matlab dll (mex function) that interfaces with the InflowWind module. It is slow, but because it uses the exact same Fortran code, it will return the same wind speeds that you get with FAST. There are some instructions at the top of WindInflow_gateway.f90 that explain this in more detail, but basically you open the .hwc file in Matlab like this:

[Err]=WindInflow_mex(0,'D:\InflowWind\Samples\SampleInflowWindInput.hwc',-1,90,140) (the last 2 input values are required, but aren’t used for the .hwc wind files).

Then you can call the mex function to get the wind speeds you want.

[Err,v]=WindInflow_mex(3,[0:1:5],[0,0,90]) returns wind speeds, v, at t=0,1,2,3,4, & 5 seconds at position (0,0,90 m), which is 90 above the undisplaced tower centerline. v is a 6x3 array (each row is a time, and the 3 columns are the wind speeds along the X-, Y-, and Z-axis respectively).

When you are finished analyzing the wind file, you should call [Err] = WindInflow_mex( 9 ) (or close Matlab) so that Matlab doesn’t run out of memory.

I also noticed that the .hwc wind files aren’t read properly in the Matlab mex function provided in InflowWind v1.00.01a-bjj. I’ve fixed this in a new archive for v1.00.01b-bjj, which you’ll have to download if you want to use that option.

Hi everybody,

the last 8 months I’ve been involved within the modeling of a 3D turbulent
wind field upstream a wind turbine rotor, because of my Master thesis work
at “Politecnico di Bari” (Bari - Italy).

By means of Matlab, I implemented both the Sandia model and the Mann model.
The latter was coded as recommended by the IEC 61400-1 3rd Edition, then
without the initial integration needed for small turbulence scales.

I would like to ask you if you, your group and the whole NWTC would have
any interest in evaluating it. What I mean is sharing the code with you in
order to have a free tool like TurbSim. I already know about the existance
of the IEC Turbulence Simulator released by the DTU, but the user has no
clue about what the code is really doing (even if he previously read Mann
papers).

I don’t have any commercial interest, I just would like to share a tool,
which could be interesting to release as freeware.

Let me know whenever possible, I really look forward to getting a response.

Kindest regards,
Francesco Perrone

Hi Francesco,

I work with Bonnie here at the NWTC. My job is to take field data and use it to help improve TurbSim, so I’m always interested in work like yours. And, I prefer matlab to Fortran…

So, well done on coding the Sandian and Mann models! How much testing have you done up to now? Have you looked at the power spectra at all?

I am interested in seeing what you’ve done. But one thing to remember is that it’s not really `free’ code, because not everyone has matlab. Porting code from matlab to other languages can be really, really, really hard. I would suggest that you should submit your code to the MATLAB file exchange at http://www.mathworks.com/matlabcentral/fileexchange. That’s a good place to get feedback from people very quickly, and it’s useful for version control.

Can you post the link here, so everyone can find it?

Thanks,

Andy

Hi Andy,

I warmly thank you for replying my post.

Regarding to the Mann model test whitin Matlab, I did perfom the tests below:

  • Gaussianity: I mean calculation in order to attain if the time series match a gaussian process (mean,variance,skewness and kurtosis); up to now, all the statistics perfectly match the theoretical values;
  • Power Spectrum density: in Matlab, I called the function periodogram, which gave back quite reasonable spectra for u-,v- and w- components.

Actually, to get the proper spectrum a double integral of the spectrum PHI is to be performed, but I did not have enough time to develop it further.
Of course my model have to be checked, and as soon as I can I’ll post it on the Mathworks exchangefile.

Anyway, my code might at least help somehow to get how the Mann model is working.

So, let’s keep in touch. I’ll come up with the exchangefile link sooner than possible.

Best regards,
Francesco

Hallo everybody,

the Mann model file in Matlab is now available here:

mathworks.com/matlabcentral/ … mann-model

Please follow the instructions and download the external files required.

Within the model, I used the function normrnd(), which is a Statistical Toolbox function: it can be easily abondoned in favour of randn, which is a standard function.

Please let me have a feedback: any critic is welcome :slight_smile:

Best regards.