-
-
Notifications
You must be signed in to change notification settings - Fork 132
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Study on control surface coefficients
- Loading branch information
1 parent
41c297b
commit 1d2d750
Showing
1 changed file
with
69 additions
and
0 deletions.
There are no files selected for viewing
69 changes: 69 additions & 0 deletions
69
studies/NeuralFoilControlSurfaceValidation/cross_validation.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import aerosandbox as asb | ||
import aerosandbox.numpy as np | ||
|
||
af = asb.Airfoil("naca0012") | ||
Re = 1e6 | ||
mach = 0.1 | ||
|
||
control_surface = asb.ControlSurface( | ||
deflection=1, | ||
hinge_point=0.75 | ||
) | ||
|
||
af_deflected = af.add_control_surface( | ||
deflection=1, | ||
hinge_point_x=0.75, | ||
) | ||
alpharange = np.linspace(-5, 5, 31) | ||
|
||
aeros = {} | ||
|
||
aeros["XFoil Undeflected"] = asb.XFoil( | ||
airfoil=af, | ||
Re=Re, | ||
mach=mach, | ||
max_iter=100, | ||
verbose=True | ||
).alpha(alpharange) | ||
aeros["XFoil Deflected"] = asb.XFoil( | ||
airfoil=af_deflected, | ||
Re=Re, | ||
mach=mach, | ||
max_iter=100, | ||
verbose=True | ||
).alpha(alpharange) | ||
aeros["NeuralFoil Undeflected"] = af.get_aero_from_neuralfoil( | ||
alpha=alpharange, | ||
Re=Re, | ||
mach=mach, | ||
model_size="xxxlarge", | ||
) | ||
aeros["NeuralFoil Undeflected"]["alpha"] = alpharange | ||
aeros["NeuralFoil Deflected"] = af_deflected.get_aero_from_neuralfoil( | ||
alpha=alpharange, | ||
Re=Re, | ||
mach=mach, | ||
model_size="xxxlarge", | ||
) | ||
aeros["NeuralFoil Deflected"]["alpha"] = alpharange | ||
|
||
import matplotlib.pyplot as plt | ||
import aerosandbox.tools.pretty_plots as p | ||
|
||
fig, ax = plt.subplots(1, 3, sharex=True) | ||
|
||
for i, var in enumerate(["CL", "CD", "CM"]): | ||
for label, aero in aeros.items(): | ||
ax[i].plot( | ||
aero["alpha"], | ||
aero[var], | ||
label=label + " " + var, | ||
color="C0" if "XFoil" in label else "C1", | ||
linestyle="-" if "Undeflected" in label else "--", | ||
alpha=0.5 | ||
) | ||
|
||
p.show_plot( | ||
"Control Surface Validation", | ||
xlabel="Angle of Attack [deg]", | ||
) |