Skip to content

Commit

Permalink
Formatting and linting fixes (#77)
Browse files Browse the repository at this point in the history
  • Loading branch information
ewu63 authored Apr 2, 2021
1 parent 3ad60b7 commit 026f579
Show file tree
Hide file tree
Showing 26 changed files with 6,831 additions and 6,124 deletions.
2 changes: 2 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
8ebf48deefbee52560197721d02d7f2cc8408c15
b192604451ac9427ddccfc2ca24a6796a22e4cc1
1 change: 0 additions & 1 deletion .github/azure-pipelines.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,4 @@ extends:
template: azure/azure_template.yaml@azure_template
parameters:
REPO_NAME: pygeo
IGNORE_STYLE: true
IMAGE: auto
74 changes: 40 additions & 34 deletions examples/bwb/bwb.py
Original file line number Diff line number Diff line change
@@ -1,64 +1,70 @@
import numpy
import numpy as np
from pygeo import pyGeo
from pyspline import pySpline

# ==============================================================================
# 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 = np.array(np.loadtxt("bwb_le.out"))
te = np.array(np.loadtxt("bwb_te.out"))
front_up = np.array(np.loadtxt("bwb_front_up.out"))
front_low = np.array(np.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 = np.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))
rot_x = np.zeros(naf)
rot_y = np.zeros(naf)
rot_z = np.zeros(naf)
offset = np.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")
149 changes: 99 additions & 50 deletions examples/c172_wing/c172.py
Original file line number Diff line number Diff line change
@@ -1,56 +1,84 @@
import numpy
import numpy as np
from pygeo import pyGeo

# ==============================================================================
# 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 = np.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

0 comments on commit 026f579

Please sign in to comment.