Advertisement
Guest User

Untitled

a guest
Jun 17th, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. !------------------------------------------------------------------------------
  2. !AIRFOIL BUILDER SUBROUTINE by Chris Teubert
  3. !
  4. !This Subroutine takes an input of a NACA 4-digit airfoil mptt and the Number
  5. !of points to split the airfoil into and builds arrays of x and y values of the
  6. !points on the airfoil
  7. !
  8. !Inputs: N, m, p, tt
  9. !Outputs: x(N), y(N)
  10. !~Christopher Teubert
  11. !------------------------------------------------------------------------------
  12.  
  13. SUBROUTINE AIRFOIL_BUILDER(N,m,p,tt,x,y)
  14. IMPLICIT NONE
  15.  
  16. INTEGER                                 ::      N
  17. REAL (KIND=8)                           ::      m, p, tt
  18. REAL (KIND=8)                           ::      x(N), y(N)
  19.  
  20. INTEGER                                 ::      i
  21. REAL (KIND=8)                           ::      yc(N), yt(N), c1, c2, c3, c4, c5
  22.  
  23. !set C Values
  24. c1 = 0.296375
  25. c2 = -0.12635
  26. c3 = -0.35195
  27. c4 = 0.283775
  28. c5 = -0.10185
  29.  
  30. !adjusting...
  31. m = m / 100
  32. p = p / 10
  33. tt = tt / 100
  34.  
  35. !Creates Airfoil
  36. DO i=1, N
  37.         IF (real(i) < N/2) THEN !Sets x values
  38.                 x(i) = 1. - (i-1.) * (1/(N/2))
  39.         ELSE
  40.                 x(i) = (i-N/2)*(1/(N/2))
  41.         END IF
  42.  
  43.         IF (x(i)<p) THEN !Sets yc (center cord
  44.                 yc(i) = m/(p*p)*(2*p*x(i)-x(i)*x(i))
  45.         ELSE
  46.                 yc(i) = m / ((1-p)*(1-p)) * ((1-2*p) + 2*p*x(i) - x(i) * x(i))
  47.         END IF
  48.        
  49.         !Thickness
  50.         yt(i) = tt / .2d0 * (c1 * DSQRT(x(i)) + c2*x(i) + c3*x(i)*x(i) + c4*x(i)*x(i)*x(i) + c5*x(i)**4)
  51.  
  52.         IF (real(i) < N/2) THEN !Calculates y(i) from center cord and thickness
  53.                 y(i) = yc(i) - yt(i)
  54.         ELSE
  55.                 y(i) = yc(i) + yt(i)
  56.         ENDIF
  57. END DO
  58.  
  59. END SUBROUTINE AIRFOIL_BUILDER
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement