Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Formatting and linting fixes #77

Merged
merged 19 commits into from
Apr 2, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 36 additions & 30 deletions examples/bwb/bwb.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,59 +6,65 @@
# Start of Script
# ==============================================================================
naf = 20
n0012 = 'naca0012.dat'
n0012 = "naca0012.dat"

airfoil_list = [n0012 for i in range(naf)]
for i in range(1,naf-1):
for i in range(1, naf - 1):
airfoil_list[i] = None

# Use the digitize it data for the planform:
le = numpy.array(numpy.loadtxt('bwb_le.out'))
te = numpy.array(numpy.loadtxt('bwb_te.out'))
front_up = numpy.array(numpy.loadtxt('bwb_front_up.out'))
front_low = numpy.array(numpy.loadtxt('bwb_front_low.out'))
le = numpy.array(numpy.loadtxt("bwb_le.out"))
te = numpy.array(numpy.loadtxt("bwb_te.out"))
front_up = numpy.array(numpy.loadtxt("bwb_front_up.out"))
front_low = numpy.array(numpy.loadtxt("bwb_front_low.out"))

le[0,:] = 0
te[0,0] = 0
front_up[0,0] = 0
front_low[0,0] = 0
le[0, :] = 0
te[0, 0] = 0
front_up[0, 0] = 0
front_low[0, 0] = 0

# Now make a ONE-DIMENSIONAL spline for each of the le and trailing edes
le_spline = pySpline.curve(X=le[:,1],s=le[:,0], nCtl=11, k=4)
te_spline = pySpline.curve(X=te[:,1],s=te[:,0], nCtl=11, k=4)
up_spline = pySpline.curve(X=front_up[:,1],s=front_up[:,0], nCtl=11, k=4)
low_spline = pySpline.curve(X=front_low[:,1],s=front_low[:,0], nCtl=11, k=4)
le_spline = pySpline.curve(X=le[:, 1], s=le[:, 0], nCtl=11, k=4)
te_spline = pySpline.curve(X=te[:, 1], s=te[:, 0], nCtl=11, k=4)
up_spline = pySpline.curve(X=front_up[:, 1], s=front_up[:, 0], nCtl=11, k=4)
low_spline = pySpline.curve(X=front_low[:, 1], s=front_low[:, 0], nCtl=11, k=4)

# Generate consistent equally spaced spline data
span = numpy.linspace(0,1,naf)
span = numpy.linspace(0, 1, naf)

le = le_spline(span)
te = te_spline(span)
up = up_spline(span)
low = low_spline(span)

ref_span = 138
chord = te-le
chord = te - le
x = le
z = span*ref_span
mid_y = (up[0]+low[0])/2.0
y = -(up+low)/2 + mid_y
z = span * ref_span
mid_y = (up[0] + low[0]) / 2.0
y = -(up + low) / 2 + mid_y

# Scale the thicknesses
toc = -(up-low)/chord
thickness = toc/0.12
toc = -(up - low) / chord
thickness = toc / 0.12

rot_x = numpy.zeros(naf)
rot_y = numpy.zeros(naf)
rot_z = numpy.zeros(naf)
offset = numpy.zeros((naf,2))
offset = numpy.zeros((naf, 2))

bwb = pyGeo('liftingSurface',
xsections=airfoil_list,
scale=chord, offset=offset,
thickness=thickness,
bluntTe=True, teHeight=0.05,
tip='rounded',
x=x,y=y,z=z)
bwb = pyGeo(
"liftingSurface",
xsections=airfoil_list,
scale=chord,
offset=offset,
thickness=thickness,
bluntTe=True,
teHeight=0.05,
tip="rounded",
x=x,
y=y,
z=z,
)

bwb.writeIGES('bwb.igs')
bwb.writeIGES("bwb.igs")
147 changes: 98 additions & 49 deletions examples/c172_wing/c172.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,52 +5,80 @@
# Start of Script
# ==============================================================================
naf = 3
airfoil_list = ['naca2412.dat','naca2412.dat','naca2412.dat']
chord = [1.67,1.67,1.18]
x = [0,0,.125*1.18]
y = [0,0,0]
z = [0,2.5,10.58/2]
rot_x = [0,0,0]
rot_y = [0,0,0]
rot_z = [0,0,2]
offset = numpy.zeros((naf,2))
airfoil_list = ["naca2412.dat", "naca2412.dat", "naca2412.dat"]
chord = [1.67, 1.67, 1.18]
x = [0, 0, 0.125 * 1.18]
y = [0, 0, 0]
z = [0, 2.5, 10.58 / 2]
rot_x = [0, 0, 0]
rot_y = [0, 0, 0]
rot_z = [0, 0, 2]
offset = numpy.zeros((naf, 2))

# There are several examples that follow showing many of the different
# combinations of tip/trailing edge options that are available.

# --------- Sharp Trailing Edge / Rounded Tip -------
wing = pyGeo('liftingSurface',
xsections=airfoil_list,
scale=chord, offset=offset, x=x, y=y, z=z,
rotX=rot_x, rotY=rot_y, rotZ=rot_z,
kSpan=2, tip='rounded')
wing = pyGeo(
"liftingSurface",
xsections=airfoil_list,
scale=chord,
offset=offset,
x=x,
y=y,
z=z,
rotX=rot_x,
rotY=rot_y,
rotZ=rot_z,
kSpan=2,
tip="rounded",
)

wing.writeTecplot('c172_sharp_te_rounded_tip.dat')
wing.writeIGES('c172_sharp_te_rounded_tip.igs')
wing.writeTecplot("c172_sharp_te_rounded_tip.dat")
wing.writeIGES("c172_sharp_te_rounded_tip.igs")

# --------- Sharp Trailing Edge / Pinched Tip -------
wing = pyGeo('liftingSurface',
xsections=airfoil_list,
scale=chord, offset=offset, x=x, y=y, z=z,
rotX=rot_x, rotY=rot_y, rotZ=rot_z,
kSpan=2, tip='pinched')
wing = pyGeo(
"liftingSurface",
xsections=airfoil_list,
scale=chord,
offset=offset,
x=x,
y=y,
z=z,
rotX=rot_x,
rotY=rot_y,
rotZ=rot_z,
kSpan=2,
tip="pinched",
)

wing.writeTecplot('c172_sharp_te_pinched_tip.dat')
wing.writeIGES('c172_sharp_te_pinched_tip.igs')
wing.writeTecplot("c172_sharp_te_pinched_tip.dat")
wing.writeIGES("c172_sharp_te_pinched_tip.igs")

# --------- Sharp Trailing Edge / Rounded Tip with Fitting -------
# This option shouldn't be used except to match previously generated
# geometries
wing = pyGeo('liftingSurface',
xsections=airfoil_list, nCtl=29,
scale=chord, offset=offset, x=x, y=y, z=z,
rotX=rot_x, rotY=rot_y, rotZ=rot_z,
kSpan=2, tip='rounded')
wing = pyGeo(
"liftingSurface",
xsections=airfoil_list,
nCtl=29,
scale=chord,
offset=offset,
x=x,
y=y,
z=z,
rotX=rot_x,
rotY=rot_y,
rotZ=rot_z,
kSpan=2,
tip="rounded",
)

wing.writeTecplot('c172_sharp_te_rounded_tip_fitted.dat')
wing.writeIGES('c172_sharp_te_rounded_tip_fitted.igs')
wing.writeTecplot("c172_sharp_te_rounded_tip_fitted.dat")
wing.writeIGES("c172_sharp_te_rounded_tip_fitted.igs")

# --------- Blunt Trailing (Flat) / Rounded Tip -------
# --------- Blunt Trailing (Flat) / Rounded Tip -------

# This is the normal way of producing blunt TE geometries. The
# thickness of the trailing edge is specified with 'te_height', either
Expand All @@ -59,26 +87,47 @@
# scaled thickness. This option is specified as a fraction of initial
# chord, so te_height_scaled=0.002 will give a 0.2% trailing edge
# thickness
wing = pyGeo('liftingSurface',
xsections=airfoil_list,
scale=chord, offset=offset, x=x, y=y, z=z,
rotX=rot_x, rotY=rot_y, rotZ=rot_z,
bluntTe=True, teHeightScaled=0.002,
kSpan=2, tip='rounded')
wing = pyGeo(
"liftingSurface",
xsections=airfoil_list,
scale=chord,
offset=offset,
x=x,
y=y,
z=z,
rotX=rot_x,
rotY=rot_y,
rotZ=rot_z,
bluntTe=True,
teHeightScaled=0.002,
kSpan=2,
tip="rounded",
)

wing.writeTecplot('c172_blunt_te_rounded_tip.dat')
wing.writeIGES('c172_blunt_te_rounded_tip.igs')
wing.writeTecplot("c172_blunt_te_rounded_tip.dat")
wing.writeIGES("c172_blunt_te_rounded_tip.igs")

# --------- Blunt Trailing (Rounded) / Rounded Tip -------
# --------- Blunt Trailing (Rounded) / Rounded Tip -------

# Alternative way of producing rounded trailing edges that can be easier
# to mesh and extrude with pyHyp.
wing = pyGeo('liftingSurface',
xsections=airfoil_list,
scale=chord, offset=offset, x=x, y=y, z=z,
rotX=rot_x, rotY=rot_y, rotZ=rot_z,
bluntTe=True, roundedTe=True, teHeightScaled=0.002,
kSpan=2, tip='rounded')
# to mesh and extrude with pyHyp.
wing = pyGeo(
"liftingSurface",
xsections=airfoil_list,
scale=chord,
offset=offset,
x=x,
y=y,
z=z,
rotX=rot_x,
rotY=rot_y,
rotZ=rot_z,
bluntTe=True,
roundedTe=True,
teHeightScaled=0.002,
kSpan=2,
tip="rounded",
)

wing.writeTecplot('c172_rounded_te_rounded_tip.dat')
wing.writeIGES('c172_rounded_te_rounded_tip.igs')
wing.writeTecplot("c172_rounded_te_rounded_tip.dat")
wing.writeIGES("c172_rounded_te_rounded_tip.igs")
Loading