Importing airfoils

92 views
Skip to first unread message

Bruno Marques

unread,
Sep 27, 2017, 7:19:56 PM9/27/17
to SUAVE FORUM
Hi,

I am currently trying to import an airfoil to my code in SUAVE to add to the main wing of my aircraft. The airfoil that I am trying to import is a NACA 64(2)-415 and its .dat file is attached to this question. In my code the airfoil importation appears like this (the coordinate file continues until the location of the .dat file):

I am using the last line of code to import the points on the .dat file. However, When I print these points to see if they were passed currently I get this:

It seems that only the first 3 points and the last 3 points are being passed. Am I doing anything wrong?

Thanks in advance for your feedback,

Kind regards,

Bruno
naca642415.dat

Emilio

unread,
Sep 27, 2017, 7:37:46 PM9/27/17
to SUAVE FORUM
Hi Bruno,
If you notice there is a ..., in between the first 3 and last 3 points. That indicates there is more data in between that is not being printed. You can safely assume the points are in there.

-Emilio

Bruno Marques

unread,
Sep 27, 2017, 7:40:25 PM9/27/17
to SUAVE FORUM
Thanks Emilio,

But is there anyway to see if the points are actually there? Cause I also tried to write a file with the points and the same thing in the image appeared with the ..., between the first 3 and the last 3 points

Emilio

unread,
Sep 27, 2017, 7:50:24 PM9/27/17
to SUAVE FORUM
Most data in SUAVE is a subset of Numpy. So you can use this Numpy function to save the array to a file:

Try that out. It should save the complete array.

-Emilio

Bruno Marques

unread,
Sep 27, 2017, 8:01:20 PM9/27/17
to SUAVE FORUM
Yes, it worked perfectly. Thank you very much.


However after I tried to put the airfoil into my wing segment I got a new error. This is my code.


 And this is the error I got:


How can I fix this?


Emilio

unread,
Sep 27, 2017, 8:32:09 PM9/27/17
to SUAVE FORUM
Hi Bruno,
The issue you're having is a known problem with the latest version of Numpy. It will be fixed in the upcoming 1.1 release.

So, if you're going to send this to OpenVSP we don't actually pass the points. We let OpenVSP read the file directly. Here's an example of how I made a 737 wing for your reference of how to set this up:
    # Root
    root_airfoil = SUAVE.Components.Wings.Airfoils.Airfoil()
    root_airfoil.coordinate_file = 'B737a.dat'
    
    segment = SUAVE.Components.Wings.Segment()
    segment.tag                   = 'root'
    segment.percent_span_location = 0.0
    segment.twist                 = 4. * Units.deg
    segment.root_chord_percent    = 1.
    segment.dihedral_outboard     = 2.5 * Units.degrees
    segment.sweeps.quarter_chord  = 28.225 * Units.degrees
    segment.append_airfoil(root_airfoil)
    wing.Segments.append(segment)    

See if that works, I have a feeling this bug could be specific to your installed version of Numpy.

-Emilio

Bruno Marques

unread,
Sep 27, 2017, 8:41:22 PM9/27/17
to SUAVE FORUM
Yes that works. Thank you very much. I will start working on sending the aircraft data to OpenVSP cause I still don't know how to do it. Can you tell me what should be my starting point?

Erik Sánchez

unread,
Nov 25, 2021, 11:34:53 AM11/25/21
to SUAVE FORUM
Hello everyone,

I'm getting exactly the same error that Bruno has when I tried to add an airfoil for a section, however the solution that Emilio suggest seems to be for an older version of SUAVE, is there any new suggestion?

wing = SUAVE.Components.Wings.Main_Wing()
    wing.tag = 'main_wing'
    
    
    
    wing.chords.root = 0.37 * Units.meters
    wing.chords.tip = 0.18 * Units.meters
    wing.spans.projected = 3.63*2 * Units.meters
    wing.origin = [[0.,0.,0.]]
    wing.vertical = False
    wing.symmetric = True
    wing.dynamic_pressure_ratio = 1.0
    wing.aspect_ratio = 12
       
    segment = SUAVE.Components.Wings.Segment()
    segment.tag = 'section_1'
    segment.percent_span_location = 0.0
    segment.twist = 0. * Units.deg
    segment.root_chord_percent = 1.
    segment.dihedral_outboard = 0. * Units.degrees
    segment.sweeps.quarter_chord  = 0.0 * Units.degrees
    
    airfoil = SUAVE.Methods.Geometry.Two_Dimensional.Cross_Section.Airfoil.import_airfoil_dat("lednicerdatfile.dat")
    segment.Airfoil = airfoil
    wing.Segments.append(segment)  

-ErikScreenshot from 2021-11-25 10-34-09.png

ebot...@gmail.com

unread,
Nov 27, 2021, 1:50:12 PM11/27/21
to SUAVE FORUM
Hi,
This is totally different from Brunos problem. I do not suggest you use an older version of SUAVE.

But this is a simple fix. Try this code:

 airfoil                             = SUAVE.Components.Airfoils.Airfoil()
 airfoil.coordinate_file  = "lednicerdatfile.dat"
 segment.append_airfoil(airfoil)

The airfoil import method is not something a user usually needs to touch.

-Emilio
Reply all
Reply to author
Forward
0 new messages