algorithmic modeling for Rhino
So I'm working with airfoils. When exporting an airfoil from Xfoil and then importing it into Rhino, a lot of Control Points (CP) are created (more or less 100). The standard Rebuild function of Rhino is not accurate enough, so I'm using Grasshopper instead.
Currently I'm interpolating the curve by hand. Adding control points to the curve and then moving them along the curve to get an error of <0.2mm at the leading edge and an error of <2mm for the rest of the airfoil. In total I use +-24 CP, but most of those are located at the leading edge, so in practice it is very useable. It's not that long a process but it will become very tedious very quickly when you have to do it quite a few times.
So I was wondering the following:
Is there a way to program Grasshoper (maybe with Galapagos) so that it does the following:
- Automatically interpolate the imported airfoil (the one with 100+ CP)
- So that it meets a set tolerance
- While using as few CP as possible.
- Bonus: Maybe there is a way to set the tolerance for different regions of the curve, so that it can interpolate precisely for the leading edge and less precise in other regions
Would be great if anyone had an idea or a view pointers so I can work this out.
UPDATE: Was wondering if I could maybe write a PythonScript to do the job.
All it really needs to do is start out with InterpCrv.gh, check the MaxDev inbetween two control points, add one if MaxDev > Tolerance or move to the next two point if MaxDev < Tol.
Tags:
Replies are closed for this discussion.
Your question has been around the aerospace industry for many years. Do you know the airfoil curve equation? In the US at least airplane geometry is right-handed with X pointing out the left wing, Y going aft, and Z going up. The airfoil equation is
Z = a*(Y***) + b*(Y**) + c*(Y) + d + e*(sgrt(Y)) , where a,b,c,d,e are numbers that control the shape of the curve. There are books full of table that contain the characteristics of curves with differeing values for a - e.
If you make an expression using this equation you can evaluate the airfoil shape wherever you want. The tolerance of your generated curve can be calculated by taking the perpendicular distance between the midpoint of the line joining 2 calculated points and the actual airfoil equation. This value is called the Directed Distance (DRD.)
Your question boils down to how to space out the Y values so you keep the tolerance close to what you want. You are correct in assuming you want as few points as possible. Any CNC milling machine will work best (meaning faster) with fewer rather than more GoTo points.
There are 2 ways to calculate the Y increment.
The simpler way is to start at the leading edge's front most point (usually Y = 0) and use an arbitrary Y increment to calculate a new point. Then check the tolerance of the chord between these 2 points - this is the DRD for that point. If the DRD is too big, cut the Y increment in half and try again. If it is too small, double it and try again. This is called binary iteration and it always works. But it takes a lot of computing since there can be lots of iterations.
A more complex but much better way is to calculate the radius of curvature of the current point and assume the airfoil looks like a circle having this radius. Then you can calculate the Y increment exactly with on equation. Over short distances this yields good results, and is far faster than iterating. It breaks down when the radius of curvature gets huge, but in that case the binary method works quite quickly. You'll need Calculus first and second derivitives to calculate the radius of curvature (sorry, I just don't remember the actual equation) but it is not a complicated one.
I don't know Python, but if it is like most other programming languages it should be possible to code all this in a page or two.
Your file doesn't have internalized data and seems to be missing some connections?
I get NACA foil data as a .csv file of points from here: http://airfoiltools.com/airfoil/details?airfoil=n0012-il
I would re-build the curves like this - note the 'Count' slider in the white group, the 'Tangents' toggle and the "Total Difference" panel that shows the sum of differences between 100 points along the two curves:
If an automated solution is required, I would use Anemone instead of Galapagos.
This isn't all you asked for but does show some of the issues, eh?
The GH file with internalized NACA data, as well as the ability to read from a pair of files (top and bottom curves of the foil).
Some improvements?
Note that the value of "100" to the 'N' input of 'Divide' is arbitrary and can be increased for more "check points" where the difference between the original and rebuilt curves is measured.
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by