This is a widget-heavy notebook that uses the methods from the airfoil designer to repanel an existing airfoil that has been loaded from a text file. There is no aerodynamic analysis done here.
# Plot nice and large
%matplotlib inline
%config InlineBackend.figure_format = 'svg'
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
import viiflowtools.vf_tools as vft
# Import airfoil designer modules
from af_bezier import *
from af_ui import *
from af_pac import *
from af_analysis import *
# Import some widgets
import ipywidgets as widgets
from ipywidgets import interactive, interact
from ipywidgets import FloatSlider
matplotlib.rcParams['figure.figsize'] = [12, 6] # Make plots bigger than default
# Default to read. After running this cell this is loaded.
N0 = 50
ArcPoints = vft.read_selig('FX77W153.dat')
# "Global" points, for later use
X=ArcPoints
# Widget function
def manipulateAirfoil(N,LEFAC,TEFAC,KAPFAC,REFTOPX0,REFTOPX1,REFBOTX0,REFBOTX1,REFVAL):
global X
X = vft.repanel(ArcPoints,int(N),LEFAC,TEFAC,KAPFAC,
[REFTOPX0,REFTOPX1,REFBOTX0,REFBOTX1],REFVAL)
plt.plot(X[0,:],X[1,:],"+",color="#AAAAAA")
plt.plot(X[0,:],X[1,:],"-k")
plt.axis('equal')
# Set up the sliders
paramdisc = widgets.HBox([widgets.VBox([widgets.HTML(value="<u>Weights</u>"),
N,KAPFAC,LEFAC,TEFAC,REFVAL]),
widgets.VBox([widgets.HTML(value="<u>Refinement</u>"),
REFTOPX0,REFTOPX1,REFBOTX0,REFBOTX1])])
ui = widgets.VBox([widgets.HTML(value="<b>Discretization Parameter</b>"),paramdisc])
# Again, very elegant.
out=widgets.interactive_output(manipulateAirfoil, {'N':N,'LEFAC':LEFAC,'TEFAC':TEFAC,'KAPFAC':KAPFAC,
'REFTOPX0':REFTOPX0,'REFTOPX1':REFTOPX1,
'REFBOTX0':REFBOTX0,'REFBOTX1':REFBOTX1,
'REFVAL':REFVAL})
display(ui, out)
VBox(children=(HTML(value='<b>Discretization Parameter</b>'), HBox(children=(VBox(children=(HTML(value='<u>Wei…
Output()
# Save discretized airfoil points, if you want
savePoints('HTR1555.dat',X,'HTR1555')