Perl script for Riblett airfoil generation

HomeBuiltAirplanes.com

Help Support HomeBuiltAirplanes.com:

addaon

Well-Known Member
Lifetime Supporter
Joined
Feb 24, 2008
Messages
1,696
Location
San Jose, CA
I've been working on a project that required generating Riblett airfoils again, and yet again I ended up writing a simple perl script to help. I've attached that script in case its useful to others; I'll probably update it occasionally, mostly to add more features for my own use. Be aware: All values are typed in by me, with little double checking, so be careful and let me know about any errors!


In its simplest form, you can run the script as, for example, ./riblett.pl 35A315. If you do, you'll see output like this:


Code:
Series:    35
Cusp:      no (A)
Camber:    3 (design CL 0.3)
Thickness: 15%
Options:   none




         35A315
  Sta      upper      lower
  0.00      0.000      0.000
  0.25      0.938     -0.812
  0.50      1.323     -1.083
  0.75      1.618     -1.278
  1.25      2.119     -1.569
  2.50      3.079     -2.079
  5.00      4.470     -2.766
  7.50      5.500     -3.264
 10.00      6.332     -3.662
 15.00      7.625     -4.259
 20.00      8.577     -4.661
 25.00      9.264     -4.918
 30.00      9.724     -5.044
 35.00      9.953     -5.039
 40.00      9.959     -4.911
 45.00      9.758     -4.672
 50.00      9.357     -4.359
 55.00      8.755     -4.019
 60.00      7.998     -3.642
 65.00      7.120     -3.226
 70.00      6.152     -2.784
 75.00      5.135     -2.327
 80.00      4.114     -1.868
 85.00      3.095     -1.409
 90.00      2.074     -0.950
 95.00      1.053     -0.491
100.00      0.032     -0.032

I also support a bit more flexibility in cambers and widths. Cambers between 0 and GA-6 are interpolated; for non-integral cambers, use brackets. Arbitrary thicknesses are supported; for non-integral thicknesses, use brackets. So ./riblett.pl 35A[2.5][14.5] is valid.


I support a single option at this point -- if sharp is specified on the command line, the coordinates are tweaked to make the trailing edge perfectly sharp. Some but not all Riblett thickness distributions have this property, and it's pretty important for comparing different airfoils in, for example, XFoil.


Speaking of XFoil, if output files are specified on the command line, data of the appropriate format is written to that file. I currently support .txt (human-readable table), .dat (XFoil-style), and .dxf (for Rhino import, etc). Pulling it all together, then, you might try something like this: ./riblett.pl 37A3[14.5] sharp /tmp/out.dat /tmp/out.dxf.


Code:
Series:    37
Cusp:      no (A)
Camber:    3 (design CL 0.3)
Thickness: 14.5%
Options:   sharp


Writing to /tmp/out.dat...
Writing to /tmp/out.dxf...

Let me know if this is useful to you guys, and if there's any other features that you'd like to see added. As mentioned, I'll probably be fiddling with it for a bit, so good time to ask!


View attachment 37410
 

Attachments

Last edited:

AJLiberatore

Well-Known Member
Joined
Nov 27, 2011
Messages
118
Location
Canton MI
Whey in perl and not as an excel file? Scanned briefly on getting a perl file up and running, I am not sure I have the time to tinker with it or is it easier than it looks? I would love a Riblett Generator, can it be done in something already on our platforms aka Windows or a Mac?

my best,
Anthony
 

dcstrng

Well-Known Member
Joined
Oct 17, 2010
Messages
913
Location
VA or NoDak
Am bordering on being digitally illiterate so generally the best I can do is the old spreadsheet (using Harry’s guidance for scaling in his book), but this looks fun to play with… planning to sketch up a Riblett leading edge (spar forward) this weekend so we’ll see…
 

addaon

Well-Known Member
Lifetime Supporter
Joined
Feb 24, 2008
Messages
1,696
Location
San Jose, CA
I did a perl script rather than an excel file because it's easier for me -- certainly easier to output formats like DXF.


If you're running on a Linux or OS X machine, just download the zip file. If you download it into ~/Downloads, open Terminal.app and:


Code:
$ cd ~/Downloads       # Go to the right place
$ unzip riblett.pl.zip # Extract the script itself
$ chmod +x riblett.pl  # Make the script executable
$ ./riblett.pl 35A317  # Start playing with it

If you're on a Windows machine, I can't help.


If people are really interested in this, I could probably set up a web service to run it through a web page, but it would take some effort on my part.
 

Doug2233

Well-Known Member
Joined
Jan 10, 2011
Messages
48
Location
Sydney, Australia
Here is a python script to convert the out.dat file into a pdf if you want to generate a printable full scale rib outline. The 'pyx' package needs to be installed for this to run, this is not diffiult on a linux system and should be the same for OSX. Windows users are in the cold here.
The constant 'scale' is the required length of the rib in inches eg 60 for a 5 foot chord rib. I have had these files printed but requires a plan printing machine. Be sure to print full scale.

Code:
#!/usr/bin/python
import os
import math
import pyx


fst  = open("out.dat","r")
lines = fst.readlines()
fst.close()
airfoil = []

#scale = 60.    #length in inches
scale = 10.     #length in inches

airfoil.append((0., 0.))
airfoil.append((scale, 0.))

for line in lines:
        if line[0] <> ' ': continue
        point = line.strip().replace('  ',' ').split(" ")
        airfoil.append((scale * float(point[0]),scale * float(point[1])))

pyx.unit.set(defaultunit="inch")
c = pyx.canvas.canvas()
last_pt=0,0
for pt in airfoil:
        p = pyx.path.path(pyx.path.moveto(last_pt[0],last_pt[1]), pyx.path.lineto(pt[0],pt[1]))
        last_pt = pt
        #c.stroke(p, [pyx.style.linewidth.thin])
        c.stroke(p)
c.writePDFfile("out")
 

TinBender

Well-Known Member
Joined
Mar 4, 2010
Messages
218
Location
Charlotte, NC, USA
I created the excel generator a couple years ago but found the pretty picture did not update by itself after additional profiles were added. Excel has a bug over 10 years old that prevents the auto-updating if more than about 20 basic shapes are added. I never published it publicly because I consider it data to be distributed to the purchaser of Riblett's book. I made a Windows program that also does it. I need to finish putting in anti piracy features.
 

addaon

Well-Known Member
Lifetime Supporter
Joined
Feb 24, 2008
Messages
1,696
Location
San Jose, CA
TinBender, numbers aren't copyrightable -- totally kosher to distribute this stuff. Of course, I try to make the attribution as clear as humanly possible -- if you're using these generators, you should buy the book to understand where they come from.

Doug2233 -- I could drop pdf support into the perl script pretty easily and save a step, is there much demand for this sort of thing?
 

Doug2233

Well-Known Member
Joined
Jan 10, 2011
Messages
48
Location
Sydney, Australia
I used my python script to generate forms to wire cut or sand foam into an accurate section for fiberglass layup so I think it would be useful.

In particuar I built gear leg fairings using a very low drag symmetrical section for my RV-6.

Attached is your Riblet airfoil (./riblett.pl 37A3[14.5] sharp out.dat out.dxf).
 

Attachments

fly2kads

Well-Known Member
HBA Supporter
Joined
Jan 2, 2010
Messages
1,794
Location
Justin, TX
I like the .pdf export script, as that is, as Doug suggested, a quick way to generate templates. I personally would be more likely to use it as a separate step, after manipulating the airfoil file generated by Addaon's nifty script. I usually wind up running airfoil files through Xfoil or XFLR5 to add points, smooth, analyze, and tweak. The end product would be what would be written to pdf. I think that there are times when a quickie is all that's needed, so I can certainly see the utility of building it in as an additional output option. I recognize that generating the pdf has the potential to complicate what is otherwise a pretty straight-forward script, so I think there would need to be some thought as to how it might be implemented.
 

addaon

Well-Known Member
Lifetime Supporter
Joined
Feb 24, 2008
Messages
1,696
Location
San Jose, CA
Update for y'all.

New features / changes:
• sharp was renamed to sharp_te for consistency with future features.
• pdf output is supported -- just give a pdf file type.
• a new scale option is supported; works for all output types, but most useful for pdf. For Doug's example, you'd do ./riblett.pl 37A3[14.5] sharp_te scale=60 out.pdf.
• a new points option is supported, that re-interpolates points to give smoother curves. 100+ points gives a nice curve to most of the airfoil, but the leading edge gets a bit wobbly due to issues I haven't yet spent the time to work around.

View attachment riblett.pl.zip
 
M

Manticore

Thought I might have a go at converting it into C++. Looked at it. Remembered why I hate Perl.
 

addaon

Well-Known Member
Lifetime Supporter
Joined
Feb 24, 2008
Messages
1,696
Location
San Jose, CA
Two updates for today, both pretty minor.

• The spacing of points for the 'points' option is a bit less nose-heavy; smooth PDF profiles can be obtained with values closer to 100 than 500 now.
• The approach used for implementing the 'sharp_te' option is adjusted to avoid creating a discontinuity in the second derivative in the leading edge of the airfoil. Before, a 'wedge' was cut out of the airfoil and the airfoil 'snapped shut' around it; now, the outlines of that wedge are parabolic, with zero slope at the leading edge. Still not a good idea to use 'sharp_te' for adjustments of more than a percent or so, but those are the only cases that come up in the Riblett data, so until I share the 'straight_te' option (next release?) it should be fine.
 

Attachments

addaon

Well-Known Member
Lifetime Supporter
Joined
Feb 24, 2008
Messages
1,696
Location
San Jose, CA
1.03 (yesterday): Some minor bug fixes, update to documentation, etc.


1.04 (today): Added the straight_te option. This is mostly for me, and requires very careful use, as it can produce unreasonable airfoils if not careful. Basically, this defines a geometric constraint that the aft N% of both the top and bottom surfaces of the airfoil be completely flat/straight. The no-cusp Riblett profiles have approximately flat aft sections, but carry curvature in their mean lines all the way to the trailing edge. The way this is implemented is by effectively "chopping off" the airfoil at the given point, and extending the upper and lower surfaces continuously and with continuous first derivative to the trailing edge station. Intuitively, this doesn't guarantee that the trailing edge of the airfoil stay closed; but in cases that are interesting to me (no-cusp sections, straight_te percent < 30, etc) it's pretty close. If you're using this option, I strongly recommend you do a run with straight_te but without sharp_te first and confirm that the trailing edges are no more than a percent or so apart at the trailing edge; if things look good, then add sharp_te and go with it. Note that the points option doesn't have any special handling for straight_te, so combining the two can cause slight curvature just at the transition as cubic spline matching attempts to make the second derivative continuous, which is inconsistent with the geometry.
 

Attachments

addaon

Well-Known Member
Lifetime Supporter
Joined
Feb 24, 2008
Messages
1,696
Location
San Jose, CA
Today's update adds the first 'query' option, te_angle?, which prints the trailing edge angle of the generated airfoil. Needed this for a particular geometric constraint; but also glad to get the mechanism in, as I'm sure I'll think of more queries I'll want to add.
 

Attachments

Retiree

Well-Known Member
Joined
Nov 29, 2010
Messages
104
Location
USA
I was working with the GA37212 and decided to try your perl script to see if the script would generate the coordinates properly. There was a problem at the 0.95 station. Comparing your data to Riblett's, your 2 meanline is wrong at this station it should be 0.198. Anyway thanks for providing this script.
Doug
 
Top