0

Given a data-set of X-Y coordinates in a matrix of 61x2 for points of an airfoil. How would I go about creating normal vectors along each point along the airfoil. I've plotted the airfoil so far:

Picture of the airfoil.

Cris Luengo
  • 55,762
  • 10
  • 62
  • 120
Seru
  • 3
  • 3
  • take a look at this [airfoil profile geometry plotting](https://stackoverflow.com/a/25973788/2521214) for some additional ideas on rendering the geometry – Spektre Sep 18 '18 at 03:38
  • Are you aware that you can work with complex functions (see Joukowski transformation on Wikipedia or http://www.diam.unige.it/~irro/lecture_e.html) ? – Jean Marie Becker Nov 02 '18 at 17:04

1 Answers1

3

Let us assume that your airfoil is closed.

To calculate the normals at each points you can average the normals to each segment.

This should take care of the trailing edge issue…

I suppose your data is x, y

xtmp1 = [x, x(1)]
ytmp1 = [y, y(1)]
xtmp2 = [x(end), x]
ytmp2 = [y(end), y]
nx =   (diff(ytmp1)+diff(ytmp2))/2.0
ny =  -(diff(xtmp1)+diff(xtmp2))/2.0

nx will contain x-component of your normal and ny will contain y-component of your normal

of course you can normalize the result if you want normals of equal length

ntmp = 1.0 ./ sqrt(nx.*nx+ny.*ny)
nx = nx .* tmp
ny = ny .* tmp

As suggested you can also normalize each segment's normal and then average as such

xtmp1 = [x, x(1)]
ytmp1 = [y, y(1)]
xtmp2 = [x(end), x]
ytmp2 = [y(end), y]
nxF =   diff(ytmp1)    
nyF =  -diff(xtmp1)
nxB =   diff(ytmp2)
nyB =  -diff(xtmp2)
ntmp = 1.0 ./ sqrt(nxF.*nxF+nyF.*nyF)
nxF = nxF .* tmp
nyF = nyF .* tmp
ntmp = 1.0 ./ sqrt(nxB.*nxB+nyB.*nyB)
nxB = nxB .* tmp
nyB = nyB .* tmp
nx = (nxF+nxB)/2.0
ny = (nyF+nxB)/2.0

And then normalize nx and ny

PilouPili
  • 2,601
  • 2
  • 17
  • 31
  • 1
    Are your diff's normalized to equal lengths? – MBo Sep 18 '18 at 02:22
  • yes they should be normalized and also the normal should be averaged between the 2 neighbors ... otherwise they would be shifted which is not a big problem if the points are dense ... but if they are sparse or you are computing aerodynamics it might be a problem – Spektre Sep 18 '18 at 03:41
  • @Spektre they are averaged between the 2 neighbours; One diff computes Xn+1-Xn cyclicly the other one Xn-Xn-1 cyclicly then averaged (/2.0). But as I said what you get for the trailing edge is always arguable. If you are solving Navier-Stokes equation it's not a problem, boundary condition is v=0. For Euler you have to be careful with the slip boundary condition at trailing edge. If you are integrating pressure to get CD and CL (for example) then once again it should be rather done segment by segment with a normal at each segment. – PilouPili Sep 18 '18 at 06:57
  • Seems you did not understand what must be normalized - two neighbor normals in general case have different lengths – MBo Sep 18 '18 at 07:29
  • @MBo I have edited the answer. Is this what you were suggesting ? Also we could average by the length of the neighbour segments. – PilouPili Sep 18 '18 at 07:44