Skip to content

Commit

Permalink
Add an XFoil fix for the case where no points are successful by preal…
Browse files Browse the repository at this point in the history
…locating; ensure working directory is always a Path type
  • Loading branch information
peterdsharpe committed Feb 19, 2024
1 parent 1a27fc0 commit 08a6683
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions aerosandbox/aerodynamics/aero_2D/xfoil.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,11 @@ def __init__(self,
self.xfoil_repanel = xfoil_repanel
self.verbose = verbose
self.timeout = timeout
self.working_directory = Path(working_directory)

if working_directory is None:
self.working_directory = None
else:
self.working_directory = Path(working_directory)

def __repr__(self):
return f"XFoil(airfoil={self.airfoil}, Re={self.Re}, mach={self.mach}, n_crit={self.n_crit})"
Expand Down Expand Up @@ -375,6 +379,22 @@ def str_to_float(s: str) -> float:
except ValueError:
return np.nan

output = {
column: []
for column in [
"alpha",
"CL",
"CD",
"CDp",
"CM",
"Cpmin",
"Xcpmin",
"Chinge",
"Top_Xtr",
"Bot_Xtr",
]
}

for pointno, line in enumerate(data_lines):
data = [str_to_float(entry) for entry in line.split()]

Expand Down Expand Up @@ -402,12 +422,6 @@ def str_to_float(s: str) -> float:
+ "\n".join(lines)
)

if pointno == 0:
output = {
column: []
for column in columns
}

for i in range(len(columns)):
output[columns[i]].append(data[i])

Expand Down

0 comments on commit 08a6683

Please sign in to comment.