Skip to content

Commit

Permalink
allow for different polar fitted data (#136)
Browse files Browse the repository at this point in the history
* allow for any airfoil data

* add tau as independent var if fit has d=3
  • Loading branch information
Michael Burton committed Nov 11, 2017
1 parent b7c0afa commit 217294e
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions gpkitmodels/GP/aircraft/wing/wing.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def setup(self, N):

class WingAero(Model):
"wing aerodynamic model with profile and induced drag"
def setup(self, static, state):
def setup(self, static, state, fitdata="jho_fitdata.csv"):
"wing drag model"
Cd = Variable("C_d", "-", "wing drag coefficient")
CL = Variable("C_L", "-", "lift coefficient")
Expand All @@ -70,15 +70,20 @@ def setup(self, static, state):
Re = Variable("Re", "-", "Reynold's number")
cdp = Variable("c_{dp}", "-", "wing profile drag coeff")

path = os.path.dirname(__file__)
df = pd.read_csv(path + os.sep + "jho_fitdata.csv")
path = os.path.dirname(os.path.abspath(fitdata))
df = pd.read_csv(path + os.sep + fitdata)
fd = df.to_dict(orient="records")[0]

if fd["d"] == 2:
independentvars = [CL, Re]
elif fd["d"] == 3:
independentvars = [CL, Re, static["\\tau"]]

constraints = [
Cd >= cdp + CL**2/np.pi/static["AR"]/e,
Re == state["\\rho"]*state["V"]*static["c_{MAC}"]/state["\\mu"],
# XfoilFit(fd, cdp, [CL, Re], airfoil="jho1.dat"),
XfoilFit(fd, cdp, [CL, Re]),
XfoilFit(fd, cdp, independentvars),
CL <= CLstall
]

Expand Down

0 comments on commit 217294e

Please sign in to comment.