Skip to content

Mach number has no effect on calculations #5

Description

@spinjet

Hello,
I've correctly installed your module but when I attempt to set a Mach Number, it doesn't have any effect on the calculations. The coefficients stay the same.
Here's a plot with the generated polars of a NACA 0012 with different Mach numbers.

immagine

And this is the code I used:

from xfoil import XFoil
import numpy as np
import matplotlib.pyplot as plt

xf = XFoil()

def loadAirfoil(name):
    with open(name + '.dat') as f:
        content = f.readlines()
 
    xcrd = []
    ycrd = []
        
    for line in content[1:]:
        xcrd.append(float(line.split()[0]))
        ycrd.append(float(line.split()[1]))
        
    airfoilObj = xf.airfoil
    airfoilObj.x = np.array(xcrd)
    airfoilObj.y = np.array(ycrd)
    
    return airfoilObj


n0012 = loadAirfoil('n0012')

xf.airfoil = n0012
xf.Re = 5e6
xf.max_iter = 100


Mach = np.array([0.0, 0.3, 0.4, 0.5, 0.6, 0.7])

aeroData = []

for m in Mach:
    xf.M = m
    xf.repanel()
    a, cl, cd, cm, cp = xf.aseq(-20,20,0.5)
    aeroData.append([m, [a, cl, cd, cm]])

plt.figure(1)
plt.plot(aeroData[0][1][2], aeroData[0][1][1], label='{:.2f}'.format(aeroData[0][0]))
plt.plot(aeroData[1][1][2], aeroData[1][1][1], label='{:.2f}'.format(aeroData[1][0]))
plt.plot(aeroData[2][1][2], aeroData[2][1][1], label='{:.2f}'.format(aeroData[2][0]))
plt.plot(aeroData[3][1][2], aeroData[3][1][1], label='{:.2f}'.format(aeroData[3][0]))
plt.plot(aeroData[4][1][2], aeroData[4][1][1], label='{:.2f}'.format(aeroData[4][0]))
plt.plot(aeroData[5][1][2], aeroData[5][1][1], label='{:.2f}'.format(aeroData[5][0]))
plt.legend()
plt.xlim([0.0, 0.06])

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions