Modeling a wind turbine blade from external data + later animation

Hi all,

I’m just joining the community and I have a project I want to do for my PhD thesis. My research field is wind turbine blades and I’m studing fluid-structure interaction. Since a couple of days I’m trying to get information and ideas on how to start the post-processing of all the data I have into a nice animation and I thought Blender+Python would be a powerful combination. Yes yes yes, before you say it, I’ll say it: I’m reading and watching basic tutorials as well as trying to get information on basic python scripting. but as you know, there are so many things out there to learn that I decided to ask for some help and guidance as I have limited time to be able to get this working and at the same time finishing many other things on my dissertation. As they say, a good way to learn is when you have limited time and things to get done! haha.

Well, I’ll describe a picture of what I have:

I model my blade from standard airfoil sections at certain spans. In between the spans, the airfoil sections are morphed. I’m doing all this with Matlab as later I’m using the crossections to assign materials, internal structure distributions and finally compute rigidity and inertia matrices using finite elements methods (no standard codes, all custom codes under Matlab). Once I have my blade, I also coded a flow dynamic model which will give me aerodynamic forces for my structural model. Long story short, among many other things, I end up having 3 displacements + 3 rotations for every blade section along the blade axis along a time simulation.

Ok, but what do you need to do? (you would ask) :

  • I can export every single blade section on a text file with (X Y Z) coordinates. Don’t worry about the internal structures, just the skin of the blade is fine. Yes, all sections with the same amount of nodes to later do the following…

-I should be able to load (and this is when python coding enters the picture) the coordinates into Blender and position them. After that, I should be able to do something like this: Blender Skinning. (Can I also automatize this by coding? …mmm sure I can, I guess)

-Next step would be loading a reference line (blade axis) which has multiple nodes. This reference line should be like a “spine” where every “vertebra” is a node.

-Finally, I should input the 3 displacements and 3 rotations for every node on that reference line for every time-step to be able to animate my simulation results from Matlab. (Yes, I can hear you, bone simulation!)

Well… that’ s all. As you see, I have an idea of what I need to do, but as I’m totally new to this world, I’m looking for help as I don’t know where to start! I would really appreciate any kind of help you could give me. Any tip, any reference tutorial link, python script would be welcome!

Thank you very much for your time and help and I’m looking forward to learn new things and being able in the future to help others too!

Thanks Again.

Have you seen these tutorials, they show how to use Python to create an object, as well as (Part 2) export mesh data into a text file.

That might solve one problem…

PS – what are you getting a PhD in? Sounds like fluid dynamics or physics…
I am a PhD candidate in Electrical Engineering here…and probably should be studying.

first go to python forum for any scripts ideas!

1- reading data file
give us the Ascii format for the data

2 -
sorry but for the spine and nodes i don’t understand what you mean here
can you make a diagram showing this if possible or give an example

are you talking like frame on a video sequence?

are you going to use some external program to do you flow analysis or make your own math model inside blender?

have fun

Hi Daren,

I’ll put it in my list. I started with the Introduction to Scripting in Python in Blender. But I’ll have a look for sure! What I need to do is to import data into blender (the airfoil coordinates) I don’t know if the video would help, but it will definitely give me an idea on how things work for sure! Thanks!

I’m doing a Ph in Mechanical Engineering. yes, working with fluids, structural analysis, finite elements, etc. :wink:

Thanks a lot again Daren!

Hi Ricky,

Yeah, I doubted to post here or in python section, but as my question was general to modeling… I started here. I’m looking also into the python forum, thanks!

For 1): I can easily output a .dat file from Matlab. this file contains text separated with a space, tab and I think I could do comma too. It would look something like this:

Blade NREL5MW intermediate airfoil # 0026 @ 0.7717
99.9964169    0.1593491
99.5968741    0.2654285
99.1973315    0.3715086
98.7977888    0.4775887
98.3982449    0.5836638
97.9986992    0.6897326
97.5991468    0.7957760
97.1995735    0.9017405
96.7999692    1.0075881
96.4003275    1.1132943
96.0006290    1.2187855
95.6008463    1.3239574
95.2009588    1.4287299
94.8009508    1.5330415
94.4008165    1.6368674
94.0005792    1.7402957
93.6002690    1.8434413
93.1999099    1.9463972
92.7995231    2.0492450
92.3991258    2.1520524
91.9987307    2.2548682

Those are just (X Y) data, but they could easily be (X Y Z).

For 2):

Sorry, I’ll try to put an example and later try to sketch something in paper at least to scan it and attach it here to the thread. Imagine that you need to animate a character, a guy dancing. you have the upper skeleton. You have the ribs and you have the spine. You will input data for the animation as displacements and rotations at every vertebra. Yes, you will input a bunch of data for every time-frame in the animation. As a result, the ribs will then displace and rotate (if they are rigidly connected with the spine). Ok, now from the metaphor (?) :confused: to reality: The “ribs” are going to be the airfoil crossections (as the boat sections in the skinning example).

The “spine” is the imaginary axis which aligns all the crossections. Just like if you assign a node for every “Z” position in the reference line where you have a curve in the above figure.

Don’t worry about the simulations results, those are already done and the only thing I need to do here is to “animate” the blade according to those displacements and rotations I mentioned for a time-line I also have already defined. This data would also need to be imported to blender… but if I get the way to import coordinates for the crossections… I can use the same technique to import the data for the animation.

As you see, this is a two part project. First, get the blade model and that “reference line” into Blender. Second, input the needed data for the animation.

Thanks a lot for your help Ricky! I hope to be more clear now.

i see it should be easy to read this data

i’ll see if i can find a script to read this ascii data somewhere on my disk!

and be back soon

are you on windows ?

and what maximum number of data lines here ?
i assume you read lines and add these to an array here

ok here is a quick modified script that i had
you can modify it to suit your own datas

and it will read your lines as shown earlier

don’t forget to modify the path to the file and filename

import bpy, math
from bpy.props import *
from mathutils import *
from math import *  
import re
import string
vertsData, edgesData, facesData=[],[],[]
print ()
# C:\Users\RJ\0blend25\0basciprogram1\stlaurent1\filestlaur1
points = []
print ()
p1 = re.compile('(-|N|W)')
for line in fo.readlines():
# print ('l1=',l1,'line =',line)
# print ('l1',l1,'kk=',kk)
 if kk > 0:    #  Skip first line
#  print ('linedata [',kk-1,']=',linedata[kk-1])
#  print ()
  a12=p1.sub( ' ', linedata[kk-1], count=0)  # Get rid of spaces
#  print ('a12split=',a12split)
  for u1 in range (0,2):         # Convert string "00" or "000"  to float = 0
   if len(a12split[u1])==a12split[u1].count('0') :
   else :
#  print ('u1=',u1,'nval=',nval)
#  print ()
# nval.append(eval(a12split[u1].lstrip('0')))
#  linenum.append(kk)
  print ('linenum [',kk-1,']=',linenum[kk-1])
#  print ()
fo.close    # Close the file

this gives you an array with float numbers from the files’ data

have fun

If you would have troubles with the bones, you could try to update a lattice modifier in every frame of the film, according this data.
The lattice sections can apply deformations to initially undeformed blade mesh. If your deformation vectors are expressed in the global coordinates, it will be easier to apply them to an lattice, than to the bones. (Bones are better for the relative coordinates).
BTW: are you new to the Python language? Maybe this bookletwill help you a little in writing Blender scripts, if you know the language basics…

Thank you so much!!! I’ll give it a try and let you know later. THANKS!


…what to say?! I saw your website and I’m impressed. your work is excellent (ha! …and you call it hobbie!) I’m new to Blender and yes, also to Python. For the few things I’ve been reading, the general flavor is not so distant to scripting and making functions in Matlab. Your book will come in very handy, thanks so much!

Regarding the lattice modifiers, I don’t know if I would be able to use it or not because the rotations of a section, for example, are calculated at the point where the reference line is. What I mean is, the whole cross-section should “pivot” in that point at the reference line. But on the other hand, yes, my displacements and rotations are reported referred to a global coordinate system. I think I should explain with more details my data for the animation, but this has to do more with the mathematical model I’m using than other thing and I don’t want to bore people here. If you like, or if this called your attention, I can send you later a PM and tell you more a bout it! Never the less I will dig deeper in a near future to see if I can implement lattice modifiers instead of bones.

Thank you so much for stopping by!

not certain here what you gone do with the data!

i mean is each line representing like a location or a rotation may be

for the animation not certain what you mean here function of the data you have in this file !

may be later i’ll see what you mean for a prop
i can see the prop shape but are you saying that for each level on the propr it can have a different rotation may be along the main axis

depending on the wind acting on it !

sorry for all questions
but may help later for the animation

something like this may be

or completely wrong here !

RickyBlender, I think you have made right assumption in the post #12. (I think that santasemilla wants to make a visualisation of aeroelastic deformations, but of course it is just m y assumption).

santasemilla: no problem, you can contact me through the PM. On the other hand, I think that you should not worry about publishing such things in your own thread :eyebrowlift:. There are plenty of other mathemathics here - ligth path algorithms and so - which only a render guru can understand, and nobody complains about it. Many users here are familiar to the language of matrices and vectors!

If Ricky Blender will be so kind to keep helping you, this thread is the easiest way to communicate… I think that eventual solution may be also useful for the others, who would look at this thread in the future

well there is this feature in blender to show stress map

may be this effect can be use here ?

what do you think ?

Hi RickyBlender, Witold,

Sure! No problem. I will post more about my work so you can understand what I’m doing and what I want to do with Blender. Ricky, your mind is spinning! You are throwing ideas one after the other :smiley: I’m glad you find this project interesting.

I would like to write down some basics on a separate sheet to make sure it makes sense and is is readable. I’ll try to do it today.

Thanks both for the interest!

see this wili page on stress map which can be done with nodes

but depends on data available i guess!

hope it helps

you seems to have an interesting project here!

one question here

is there some web page where you can get the blade shape in 3D to be done in blender
i mean i’d like to find a way to make a real nice 3D model for some propeler but not certain where to get the right info
and get a real conform 3D model ?

if you need to get the latest version go here

click on the right on the icon for your system
and then select the latest version with add on contrib if you want to get latest scripts

i just got 40-789 for vista

have fun

In general, the propeller blade and the wind turbine blade have similar geometry. They are like an airplane wing, but twisted around their span, to keep a constant angle of attack (just a few degrees) to the airflow along whole blade. (The airflow is a vector sum of two velocities: the wind and the rotation of the turbine. This second component is growing in a linear fashion along the propeller radius). Maybe you would look at the pages 100 - 108 of this free e-book. I have shaped there a little bit simplified propeller blade. Well, the text is in Polish, but there is a picture for every step, and the Blender commands are in English… Maybe it will give you an idea about the geometry.

which one should i get

is it the first one

then go page 108 to get how to shape it

i hope you can translate it in English seems to be a very interesting tutorial

would make it easier for peoples here on forum to read and learn from it!

but i was also interested in the standard plane properler
ok this may not have anything to do with windmill blades

but still interesting how to shape a nice prop with right twisting which is not that simple!

thanks for feedback

Hi again!

Do you know X-Plane? It is an excellent flight simulator and it has a very big community of developers. Airplanes aerodynamic forces are computed in real-time using Blade Element Theory. The thing is that people model propellers and blades on a quite realistic way. Have a look at the community forum. You will find a lot of information, examples and guys doing the same things you want to do :wink:

Have fun!