Skip to content

Commit

Permalink
black format
Browse files Browse the repository at this point in the history
  • Loading branch information
ewu63 committed Mar 30, 2022
1 parent 1f33c41 commit 25b5dfa
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 41 deletions.
10 changes: 5 additions & 5 deletions adflow/pyDynamicPerformance.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,13 @@ def calculateFrequencyAndDamping(Cmq, Clalpha, Cd, Cmalpha, Cmalphadot, mass, Iy
"""

# Normalization of derivatives
Mq = Cmq * rho * Area * U * c ** 2 / (4 * Iy)
Mq = Cmq * rho * Area * U * c**2 / (4 * Iy)

Zw = (-Clalpha - Cd) * rho * Area * U / (2 * mass)

Malpha = Cmalpha * rho * Area * U ** 2 * c / (2 * Iy)
Malpha = Cmalpha * rho * Area * U**2 * c / (2 * Iy)

Malphadot = Cmalphadot * rho * Area * U * c ** 2 / (4 * Iy)
Malphadot = Cmalphadot * rho * Area * U * c**2 / (4 * Iy)
# print 'mq',Mq,Zw,Malpha
# Short period approximation
Wsp = numpy.sqrt(Mq * Zw - Malpha)
Expand All @@ -95,7 +95,7 @@ def calculateNAlpha(Clalpha, rho, Area, U, mass, g):
calculate the g normalized lift derivative
"""

nalpha = rho * U ** 2 * Area * Clalpha / (2 * mass * g)
nalpha = rho * U**2 * Area * Clalpha / (2 * mass * g)

return nalpha

Expand All @@ -106,6 +106,6 @@ def calculateCAP(Wsp, nalpha):
interpretation.
"""

CAP = Wsp ** 2 / nalpha
CAP = Wsp**2 / nalpha

return CAP
10 changes: 5 additions & 5 deletions adflow/pyPerformanceClass.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,13 @@ def calculateFrequencyAndDamping(self, Cmq, Clalpha, Cd, Cmalpha, Cmalphadot, ma
second order 2 dof approximation from pg 309 of McRuer et al. 1973
"""
# Normalization of derivatives
Mq = Cmq * rho * Area * U * c ** 2 / (4 * Iy)
Mq = Cmq * rho * Area * U * c**2 / (4 * Iy)

Zw = (-Clalpha - Cd) * rho * Area * U / (2 * mass)

Malpha = Cmalpha * rho * Area * U ** 2 * c / (2 * Iy)
Malpha = Cmalpha * rho * Area * U**2 * c / (2 * Iy)

Malphadot = Cmalphadot * rho * Area * U * c ** 2 / (4 * Iy)
Malphadot = Cmalphadot * rho * Area * U * c**2 / (4 * Iy)

# Short period approximation
Wsp = numpy.sqrt(Mq * Zw - Malpha)
Expand All @@ -137,7 +137,7 @@ def calculateNAlpha(self, Clalpha, rho, Area, U, mass, g):
calculate the g normalized lift derivative
"""

nalpha = rho * U ** 2 * Area * Clalpha / (2 * mass * g)
nalpha = rho * U**2 * Area * Clalpha / (2 * mass * g)

return nalpha

Expand All @@ -159,7 +159,7 @@ def calculateCAP(self, Wsp, nalpha):
interpretation.
"""

CAP = Wsp ** 2 / nalpha
CAP = Wsp**2 / nalpha

return CAP

Expand Down
36 changes: 18 additions & 18 deletions adflow/pyWeightAndBalance.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def calculateWingMAC(self, acg):

sweepsum = sweepsum + ((ytLE - yrLE) / sumSpan) * numpy.tan(SweepLE)
# new computation...
numerator = C_root ** 2 * (1 + Taper + Taper ** 2) * (ytLE - yrLE) / sumSpan
numerator = C_root**2 * (1 + Taper + Taper**2) * (ytLE - yrLE) / sumSpan
# print 'numpart',C_root,C_root**2,(1+Taper+Taper**2),(ytLE-yrLE)/sumSpan
denomenator = C_root * (1 + Taper) * (ytLE - yrLE) / sumSpan
SumNumerator = SumNumerator + numerator
Expand Down Expand Up @@ -272,7 +272,7 @@ def calculateWingInertias(self, acg, xcg):
Dihedral = acg[i][j].Dihedral * (numpy.pi / 180)
Area = acg[i][j].Area
Taper = acg[i][j].Taper
AR = Span ** 2 / Area # Aspect Ratio
AR = Span**2 / Area # Aspect Ratio
SweepLE = acg[i][j].SweepLE * (numpy.pi / 180)
SweepTE = catan(
numpy.tan(SweepLE) - ((4.0 * (1.0 / 1.0)) / (2.0 * AR)) * ((1.0 - Taper) / (1.0 + Taper))
Expand Down Expand Up @@ -314,7 +314,7 @@ def calculateWingInertias(self, acg, xcg):
# print 'I1x1',I1x
# I1x =(t_root*(C_root/3.0+(Span*tan(SweepTE)/4.0)-Span*tan(SweepLE)/4.0))
# print 'I1x2',I1x
I1x = (W * Span ** 3 / (3 * V)) * (
I1x = (W * Span**3 / (3 * V)) * (
(
(t_root - t_tip)
* (C_root / 4.0 + (Span * numpy.tan(SweepTE) / 5.0) - Span * numpy.tan(SweepLE) / 5.0)
Expand All @@ -334,23 +334,23 @@ def calculateWingInertias(self, acg, xcg):
(
t_root
* (
(C_root ** 3 / 3.0)
(C_root**3 / 3.0)
+ Span
* C_root
* numpy.tan(SweepTE)
* ((C_root / 2.0) + (Span * numpy.tan(SweepTE)) / 3.0)
+ (Span ** 3 / 12.0) * (numpy.tan(SweepTE) ** 3 - numpy.tan(SweepLE) ** 3)
+ (Span**3 / 12.0) * (numpy.tan(SweepTE) ** 3 - numpy.tan(SweepLE) ** 3)
)
)
- (
(t_root - t_tip)
* (
(C_root ** 3 / 6.0)
(C_root**3 / 6.0)
+ Span
* C_root
* numpy.tan(SweepTE)
* ((C_root / 3.0) + (Span * numpy.tan(SweepTE) / 4.0))
+ (Span ** 3 / 15.0) * (numpy.tan(SweepTE) ** 3 - numpy.tan(SweepLE) ** 3)
+ (Span**3 / 15.0) * (numpy.tan(SweepTE) ** 3 - numpy.tan(SweepLE) ** 3)
)
)
)
Expand All @@ -377,10 +377,10 @@ def calculateWingInertias(self, acg, xcg):
# print 'cb',Cb
K_o = 0.703 # (for a wing....)
acg[i][j].x_Centroid = (
(-(Ca ** 2) + Cb ** 2 + Cc * Cb + Cc ** 2) / (3 * (Cb + Cc - Ca))
(-(Ca**2) + Cb**2 + Cc * Cb + Cc**2) / (3 * (Cb + Cc - Ca))
) * K_o ** (1.0 / 2.0)
# print 'xs1', acg[i][j].x_Centroid
acg[i][j].y_Centroid = (Span ** 2 / V) * (
acg[i][j].y_Centroid = (Span**2 / V) * (
(
t_root * ((C_root / 2.0) + (Span / 3.0) * (numpy.tan(SweepTE) - numpy.tan(SweepLE)))
- (t_root - t_tip)
Expand Down Expand Up @@ -408,17 +408,17 @@ def calculateWingInertias(self, acg, xcg):
Ix = (
Ix
+ I1x
- W * (Ys_dot ** 2)
- W * (Zs3 ** 2)
- W * (Ys_dot**2)
- W * (Zs3**2)
+ W * (Ys_dot + Ysoff) ** 2
+ W * (Zs3 + Zs1) ** 2
)
# print 'w',W,(Ys_dot),W*(Ys_dot**2)
# Ix = Ix-W*(Ys_dot**2)#-W*(Zs3**2)+W*(Ys_dot+Ysoff)**2 + W*(Zs3+Zs1)**2
# print 'ix',Ix,I1x
Iy = Iy + I1y - W * (Xs ** 2) - W * (Zs3 ** 2) + W * (Xs + Xs4) ** 2 + W * (Zs3 + Zs1) ** 2
Iy = Iy + I1y - W * (Xs**2) - W * (Zs3**2) + W * (Xs + Xs4) ** 2 + W * (Zs3 + Zs1) ** 2

Iz = Iz + I1z - W * (Xs ** 2 + Ys_dot ** 2) + W * (Xs + Xs4) ** 2 + W * (Ys_dot + Ysoff) ** 2
Iz = Iz + I1z - W * (Xs**2 + Ys_dot**2) + W * (Xs + Xs4) ** 2 + W * (Ys_dot + Ysoff) ** 2
# Ixz = ...

# endfor
Expand Down Expand Up @@ -505,9 +505,9 @@ def calculateWingInertiaspyGeo(self, surface, xcg):
dy = tempXc[j, k, 1] - Xcg[1]
dz = tempXc[j, k, 2] - Xcg[2]
# print 'dist.',dx,dy,dz
r2[j, k, 0] = dy ** 2 + dz ** 2 # aboutx axis
r2[j, k, 1] = dx ** 2 + dz ** 2 # about y axis
r2[j, k, 2] = dy ** 2 + dx ** 2 # about z axis
r2[j, k, 0] = dy**2 + dz**2 # aboutx axis
r2[j, k, 1] = dx**2 + dz**2 # about y axis
r2[j, k, 2] = dy**2 + dx**2 # about z axis
# print 'r2',r2[j,k,:]
inertia[j, k, 0] = mass[j, k] * r2[j, k, 0] # Ixx
inertia[j, k, 1] = mass[j, k] * r2[j, k, 1] # Iyy
Expand Down Expand Up @@ -548,14 +548,14 @@ def computeRootBendingMoment(self, sol, ref, geom, liftIndex):
elasticMomentx = momx + fy * (geom.zRootec - ref.zref) - fz * (geom.yRootec - ref.yref)
elasticMomentz = momz - fy * (geom.xRootec - ref.xref) + fx * (geom.yRootec - ref.yref)

BendingMoment = numpy.sqrt(elasticMomentx ** 2 + elasticMomentz ** 2)
BendingMoment = numpy.sqrt(elasticMomentx**2 + elasticMomentz**2)

elif liftIndex == 3:
# y out wing sum momentx,momenty
elasticMomentx = momx + fz * (geom.yRootec - ref.yref) + fy * (geom.zRootec - ref.zref)
elasticMomenty = momy + fz * (geom.xRootec - ref.xref) + fx * (geom.zRootec - ref.zref)

BendingMoment = numpy.sqrt(elasticMomentx ** 2 + elasticMomenty ** 2)
BendingMoment = numpy.sqrt(elasticMomentx**2 + elasticMomenty**2)

return BendingMoment

Expand Down
24 changes: 12 additions & 12 deletions adflow/pyWingCG.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def calculateWingMAC(acg):
sweepsum = sweepsum + ((ytLE - yrLE) / sumSpan) * numpy.tan(SweepLE)

# new computation...
numerator = C_root ** 2 * (1 + Taper + Taper ** 2) * (ytLE - yrLE) / sumSpan
numerator = C_root**2 * (1 + Taper + Taper**2) * (ytLE - yrLE) / sumSpan
denomenator = C_root * (1 + Taper) * (ytLE - yrLE) / sumSpan
SumNumerator = SumNumerator + numerator
SumDenomenator = SumDenomenator + denomenator
Expand Down Expand Up @@ -247,7 +247,7 @@ def calculateWingInertias(acg):
Dihedral = acg[i][j].Dihedral * (numpy.pi / 180)
Area = acg[i][j].Area
Taper = acg[i][j].Taper
AR = Span ** 2 / Area # Aspect Ratio
AR = Span**2 / Area # Aspect Ratio
SweepLE = acg[i][j].SweepLE * (numpy.pi / 180)
SweepTE = numpy.arctan(
numpy.tan(SweepLE) - ((4.0 * (1.0 / 1.0)) / (2.0 * AR)) * ((1.0 - Taper) / (1.0 + Taper))
Expand Down Expand Up @@ -283,7 +283,7 @@ def calculateWingInertias(acg):
# print 'I1x1',I1x
# I1x =(t_root*(C_root/3.0+(Span*tan(SweepTE)/4.0)-Span*tan(SweepLE)/4.0))
# print 'I1x2',I1x
I1x = (W * Span ** 3 / V) * (
I1x = (W * Span**3 / V) * (
(
(t_root - t_tip)
* (C_root / 4.0 + (Span * numpy.tan(SweepTE) / 5.0) - Span * numpy.tan(SweepLE) / 5.0)
Expand All @@ -300,23 +300,23 @@ def calculateWingInertias(acg):
(
t_root
* (
(C_root ** 3 / 3.0)
(C_root**3 / 3.0)
+ Span
* C_root
* numpy.tan(SweepTE)
* ((C_root / 2.0) + (Span * numpy.tan(SweepTE)) / 3.0)
+ (Span ** 3 / 12.0) * (numpy.tan(SweepTE) ** 3 - numpy.tan(SweepLE) ** 3)
+ (Span**3 / 12.0) * (numpy.tan(SweepTE) ** 3 - numpy.tan(SweepLE) ** 3)
)
)
- (
(t_root - t_tip)
* (
(C_root ** 3 / 6.0)
(C_root**3 / 6.0)
+ Span
* C_root
* numpy.tan(SweepTE)
* ((C_root / 3.0) + (Span * numpy.tan(SweepTE) / 4.0))
+ (Span ** 3 / 15.0) * (numpy.tan(SweepTE) ** 3 - numpy.tan(SweepLE) ** 3)
+ (Span**3 / 15.0) * (numpy.tan(SweepTE) ** 3 - numpy.tan(SweepLE) ** 3)
)
)
)
Expand All @@ -342,10 +342,10 @@ def calculateWingInertias(acg):
# print 'cb',Cb
K_o = 0.703 # (for a wing....)
acg[i][j].x_Centroid = (
(-(Ca ** 2) + Cb ** 2 + Cc * Cb + Cc ** 2) / (3 * (Cb + Cc - Ca))
(-(Ca**2) + Cb**2 + Cc * Cb + Cc**2) / (3 * (Cb + Cc - Ca))
) * K_o ** (1.0 / 2.0)
# print 'xs1', acg[i][j].x_Centroid
acg[i][j].y_Centroid = (Span ** 2 / V) * (
acg[i][j].y_Centroid = (Span**2 / V) * (
(
t_root * ((C_root / 2.0) + (Span / 3.0) * (numpy.tan(SweepTE) - numpy.tan(SweepLE)))
- (t_root - t_tip)
Expand All @@ -369,10 +369,10 @@ def calculateWingInertias(acg):
Zs4 = acg[i][j].z_Centroid

Ix = (
Ix + I1x - W * (Ys_dot ** 2) - W * (Zs3 ** 2) + W * (Ys_dot + Ysoff) ** 2 + W * (Zs3 + Zs1) ** 2
Ix + I1x - W * (Ys_dot**2) - W * (Zs3**2) + W * (Ys_dot + Ysoff) ** 2 + W * (Zs3 + Zs1) ** 2
)
Iy = Iy + I1y - W * (Xs ** 2) - W * (Zs3 ** 2) + W * (Xs + Xs4) ** 2 + W * (Zs3 + Zs1) ** 2
Iz = Iz + I1z - W * (Xs ** 2 + Ys_dot ** 2) + W * (Xs + Xs4) ** 2 + W * (Ys_dot + Ysoff) ** 2
Iy = Iy + I1y - W * (Xs**2) - W * (Zs3**2) + W * (Xs + Xs4) ** 2 + W * (Zs3 + Zs1) ** 2
Iz = Iz + I1z - W * (Xs**2 + Ys_dot**2) + W * (Xs + Xs4) ** 2 + W * (Ys_dot + Ysoff) ** 2
# Ixz = ...

# endfor
Expand Down
2 changes: 1 addition & 1 deletion tests/reg_tests/test_conic_conv_nozzle.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ def test_solve(self):
totalR0 = self.CFDSolver.getFreeStreamResidual(self.ap)
res /= totalR0

reducedSum = self.CFDSolver.comm.reduce(np.sum(res ** 2))
reducedSum = self.CFDSolver.comm.reduce(np.sum(res**2))
if self.CFDSolver.comm.rank == 0:
self.assertLessEqual(np.sqrt(reducedSum), self.options["L2Convergence"])

Expand Down

0 comments on commit 25b5dfa

Please sign in to comment.