import math as m
import numpy as np
# Ian B Zabel Barrowman Method Application
# Equations from:
# - ntrs.nasa.gov/archive/nasa/casi.ntrs.nasa.gov/20010047838.pdf
# - rocketmime.com/rockets/Barrowman
'''
Note for all references of Ar:
Ar is the reference area for the specific equation mentioned.
This means all functions with Ar must be redefined
with the proper reference area values.
Possibly make Cna1 a general function for all possible Ar?
'''
# Defined Parameters
# Assuming:
# - fin is clipped delta, swept
# - fin airfloil is symmetric hex
Ln = 0.5 # Nosecone length (m)
d = 0.27 # Outer diameter (m)
cr = 0.25 # Fin, root chord (m)
ct = 0.125 # Fin, tip chord (m)
b = 0.3 # Wing span (m)
S = (cr+ct)*b*0.5 # Fin area (m^2)
TR = 0 # Taper ratio
SMC = S/b # Standard mean chord (m)
#MAC =
LT = 5 # distance from nose to fin leading edge intersection with body (m)
O = 10 # Sweep Angle at root tip (deg.)
xr = 1 # Fin, root LE to tip LE (m)
xb = 1 # Rocket nose to fin tip LE (m)
N = 4 # Number of fins
Cnan = 2 # Normal force for nosecone
# Fin Center of Pressure
# pg. 7-10, ref. 1
# For fin geometry, note: Fig 3-2, pg 7
MAC = (2/3)*(cr+ct-cr*ct/(cr+ct)) # eq. 24, mean aero chord (MAC) (m)
MAY = (S/3)*(cr+2*ct)/(cr+ct) # eq. 27, MAC loc. from root (m)
MAX = LT + xt*MAY/S + MAC/4 # eq. 30, Longitudinal loc. of MAC (m)
# Roll Damping Coeff.
# pg. 11, ref. 1
# Note: for supersonic, ref. 1 in appendix A
Cna1 = 2*m.pi*AR*(Af/Ar)/(2+m.sqrt(4+(Beta*AR/m.cos(O))**2)) # eq. 6 (dimless)
Cld = N*Cna1*MAY/Lr # eq. 35 (dimless)
# Body Center of Pressure
# pg. 29, ref. 1
Cpb = 2/(Ar*Lr)*(lo*Alo-V) # eq. 87, body Cp as f(V) (dimless)
Xb = Cpb/Cna1 # eq. 88, Cp loc. from tip (m)
# Total Normal Coeff.
# pg. 37, ref. 1
Cn_total = CnaB+CnaTB + CnaBT # eq. 106
X_total = XB*CnaB+XTB*CnaTB+XBT*CnaBT # eq. 107
--------------------------------------------------------------------------- NameError Traceback (most recent call last) <ipython-input-2-a553b2f9f2c2> in <module>() 40 MAC = (2/3)*(cr+ct-cr*ct/(cr+ct)) # eq. 24, mean aero chord (MAC) (m) 41 MAY = (S/3)*(cr+2*ct)/(cr+ct) # eq. 27, MAC loc. from root (m) ---> 42 MAX = LT + xt*MAY/S + MAC/4 # eq. 30, Longitudinal loc. of MAC (m) 43 44 # Roll Damping Coeff. NameError: name 'xt' is not defined