I was given this exact airfoil (NACA 2412) as part of an assignment for my graduate level Aerodynamics coursework, and since I already solved it, I figured I'd post it for the benefit of all future students who found this page.
My solution technique comes from pages 358 and surrounding of Anderson's "Fundamentals of Aerodynamics".
import numpy as np
import scipy.integrate as integrate
alpha = np.linspace(-10, 10, 100) # deg
NACA = '2412'
c = 1.2 # m
def z_prime(x, naca, c):
m = float(naca[0]) / 100
p = float(naca[1]) * c / 10
if 0 <= x / c <= p:
return (2 * m) * (p - x) / (p ** 2)
if p < x / c <= 1:
return (2 * m) * (p - x) / ((1 - p) ** 2)
def integrand_0(x, naca, c):
return 2 * z_prime(x, naca, c)/ c / np.sqrt(1 - (2 * x / c - 1) ** 2)
def integrand_1(x, naca, c):
return 2 * z_prime(x, naca, c) * (1 - 2 * x / c) / c / np.sqrt(1 - (2 * x / c - 1) ** 2)
def integrand_2(x, naca, c):
return 4 * z_prime(x, naca, c) * (1 - 2 * x / c) / c / np.sqrt(1 - (2 * x / c - 1) ** 2)
A0 = np.zeros(len(alpha))
A1 = np.zeros(len(alpha))
A2 = np.zeros(len(alpha))
c_L = np.zeros(len(alpha))
for i in range(len(alpha)):
A0[i] = np.deg2rad(alpha[i]) - integrate.quad(integrand_0, 0, c, args = (NACA, c))[0] / np.pi
A1[i] = 2 * integrate.quad(integrand_1, 0, c, args = (NACA, c))[0] / np.pi
A2[i] = 2 * integrate.quad(integrand_2, 0, c, args = (NACA, c))[0] / np.pi
c_L[i] = np.pi * (2 * A0[i] + A1[i])
import matplotlib.pyplot as plt
plt.plot(alpha, c_L, label = "NACA {0}".format(NACA))
plt.axhline(0, linestyle = 'dashed')
plt.title("Coefficient of Lift over Angle of Attack")
plt.xlabel(r"$\alpha$ (deg)")
plt.ylabel(r"$c_L$")
plt.legend()
plt.show()