cape.convert
: Unit and angle conversion utilities¶
Perform conversions such as (alpha total, phi) to (alpha, beta). It also contains various utilities such as calculating Sutherland’s law for estimating viscosity with the standard parameters, which are commonly needed tools for CFD solvers.
- cape.convert.AlphaBeta2AlphaMPhi(alpha, beta)¶
Convert angle of attack and sideslip to maneuver axis
- Call:
>>> alpha_m, phi_m = cape.AlphaBeta2AlphaMPhi(alpha, beta)
- Inputs:
- alpha:
float
|numpy.array
Angle of attack
- beta:
float
|numpy.array
Sideslip angle
- alpha:
- Outputs:
- alpha_m:
float
|numpy.array
Signed total angle of attack [deg]
- phi_m:
float
|numpy.array
Total roll angle
- alpha_m:
- Versions:
2017-06-26
@ddalle
: Version 1.0
- cape.convert.AlphaBeta2AlphaTPhi(alpha, beta)¶
Convert angle of attack and sideslip to missile axis angles
- Call:
>>> alpha_t, phi = cape.AlphaBeta2AlphaTPhi(alpha, beta)
- Inputs:
- alpha:
float
|numpy.array
Angle of attack
- beta:
float
|numpy.array
Sideslip angle
- alpha:
- Outputs:
- alpha_t:
float
|numpy.array
Total angle of attack
- phi:
float
|numpy.array
Total roll angle
- alpha_t:
- Versions:
2014-06-02
@ddalle
: Version 1.02014-11-05
@ddalle
: Version 1.1, transpose w formula
- cape.convert.AlphaBeta2DirectionCosines(alpha, beta)¶
Convert angle of attack and sideslip to direction cosines
- Call:
>>> u, v, w = cape.AlphaBeta2DirectionCosines(alpha, beta)
- Inputs:
- alpha:
float
|numpy.array
Angle of attack
- beta:
float
|numpy.array
Sideslip angle
- alpha:
- Outputs:
- u:
float
|numpy.array
x-component of body-frame velocity unit vector
- v:
float
|numpy.array
y-component of body-frame velocity unit vector
- w:
float
|numpy.array
z-component of body-frame velocity unit vector
- u:
- Versions:
2019-06-19
@ddalle
: Version 1.0
- cape.convert.AlphaMPhi2AlphaTPhi(alpha_m, phi_m)¶
Convert maneuver axis to missile axis angles
- Call:
>>> alpha_t, phi = cape.AlphaTPhi2AlphaMPhi(alpha_m, phi_m)
- Inputs:
- alpha_m:
float
|numpy.array
Signed total angle of attack [deg]
- phi_m:
float
|numpy.array
Total roll angle
- alpha_m:
- Outputs:
- alpha_t:
float
|numpy.array
Total angle of attack
- phi:
float
|numpy.array
Total roll angle
- alpha_t:
- Versions:
2017-06-27
@ddalle
: Version 1.0
- cape.convert.AlphaTPhi2AlphaBeta(alpha_t, phi)¶
Convert total angle of attack and roll to alpha, beta
- Call:
>>> alpha, beta = cape.AlphaTPhi2AlphaBeta(alpha_t, beta)
- Inputs:
- alpha_t:
float
|numpy.array
Total angle of attack
- phi:
float
|numpy.array
Total roll angle
- alpha_t:
- Outputs:
- alpha:
float
|numpy.array
Angle of attack
- beta:
float
|numpy.array
Sideslip angle
- alpha:
- Versions:
2014-06-02
@ddalle
: Version 1.0
- cape.convert.AlphaTPhi2AlphaMPhi(alpha_t, phi)¶
Convert missile-axis to maneuver-axis angles
- Call:
>>> alpha_m, phi_m = cape.AlphaTPhi2AlphaMPhi(alpha_t, phi)
- Inputs:
- alpha_t:
float
|numpy.array
Total angle of attack
- phi:
float
|numpy.array
Total roll angle
- alpha_t:
- Outputs:
- alpha_m:
float
|numpy.array
Signed total angle of attack [deg]
- phi_m:
float
|numpy.array
Total roll angle
- alpha_m:
- Versions:
2017-06-27
@ddalle
: Version 1.0
- cape.convert.AlphaTPhi2DirectionCosines(aoap, phip)¶
Convert total angle of attack and roll to direction cosines
- Call:
>>> u, v, w = cape.AlphaTPhi2DirectionCosines(aoap, phip)
- Inputs:
- aoap:
float
|numpy.array
Total angle of attack
- phip:
float
|numpy.array
Missile-axis to body-z roll angle
- aoap:
- Outputs:
- u:
float
|numpy.array
x-component of body-frame velocity unit vector
- v:
float
|numpy.array
y-component of body-frame velocity unit vector
- w:
float
|numpy.array
z-component of body-frame velocity unit vector
- u:
- Versions:
2019-06-19
@ddalle
: Version 1.0
- cape.convert.CriticalAreaRatio(M, gamma=1.4)¶
Get the area ratio to a Mach 1 area
- Call:
>>> AR = CriticalAreaRatio(M, gamma=1.4)
- Inputs:
- M:
float
Mach number
- gamma: {
1.4
} |float
Ratio of specific heats
- M:
- Outputs:
- AR:
float
Nozzle area ratio
- AR:
- Versions:
2016-04-13
@ddalle
: Version 1.0
- cape.convert.DirectionCosines2AlphaBeta(u, v, w)¶
Convert direction cosines to angle of attack and sideslip
- Call:
>>> alpha, beta = cape.DirectionCosines2AlphaBeta(u, v, w)
- Inputs:
- u:
float
|numpy.array
x-component of body-frame velocity unit vector
- v:
float
|numpy.array
y-component of body-frame velocity unit vector
- w:
float
|numpy.array
z-component of body-frame velocity unit vector
- u:
- Outputs:
- alpha:
float
|numpy.array
Angle of attack
- beta:
float
|numpy.array
Sideslip angle
- alpha:
- Versions:
2019-06-19
@ddalle
: Version 1.0
- cape.convert.DirectionCosines2AlphaTPhi(u, v, w)¶
Convert direction cosines to total angle of attack and roll
- Call:
>>> aoap, phip = cape.DirectionCosines2AlphaBeta(u, v, w)
- Inputs:
- u:
float
|numpy.array
x-component of body-frame velocity unit vector
- v:
float
|numpy.array
y-component of body-frame velocity unit vector
- w:
float
|numpy.array
z-component of body-frame velocity unit vector
- u:
- Outputs:
- aoap:
float
|numpy.array
Total angle of attack
- phip:
float
|numpy.array
Missile-axis to body-z roll angle
- aoap:
- Versions:
2019-06-19
@ddalle
: Version 1.0
- cape.convert.ExitMachFromAreaRatio(AR, M1, gamma=1.4, subsonic=False)¶
Calculate 1D nozzle Mach number from input Mach and area ratio
- Call:
>>> M2 = ExitMachFromAreaRatio(AR,M1, gamma=1.4, subsonic=False)
- Inputs:
- AR:
float
Nozzle area ratio
- M1:
float
Input Mach number
- gamma: {
1.4
} |float
Ratio of specific heats
- subsonic:
True
| {False
} Whether or not M2 should be less than 1.0
- AR:
- Outputs:
- M2:
float
Exit Mach number
- M2:
- Versions:
2016-04-13
@ddalle
: Version 1.0
- cape.convert.PressureFPSFromRe(Re, T, M, R=None, gam=None, mu0=None, T0=None, C=None)¶
Calculate pressure from Reynolds number
- Call:
>>> p = PressureFPSFromRe(Re, T, M) >>> p = PressureFPSFromRe(Re, T, M, R=None, gam=None, **kw)
- Inputs:
- Re:
float
Reynolds number per foot
- T:
float
Static temperature [R]
- M:
float
Mach number
- R:
float
Gas constant [ft^2/s^2*R]
- gam:
float
Ratio of specific heats
- mu0:
float
Reference viscosity [slug/ft*s]
- T0:
float
Reference temperature [K]
- C:
float
Reference temperature [K]
- Re:
- Outputs:
- p:
float
Static pressure [psf]
- p:
- See also:
- Versions:
2016-03-24
@ddalle
: Version 1.0
- cape.convert.PressureMKSFromRe(Re, T, M, R=None, gam=None, mu0=None, T0=None, C=None)¶
Calculate pressure from Reynolds number
- Call:
>>> p = PressureMKSFromRe(Re, T, M) >>> p = PressureMKSFromRe(Re, T, M, R=None, gam=None, **kw)
- Inputs:
- Re:
float
Reynolds number per foot
- T:
float
Static temperature [K]
- M:
float
Mach number
- R:
float
Gas constant [m^2/s^2*R]
- gam:
float
Ratio of specific heats
- mu0:
float
Reference viscosity [kg/m*s]
- T0:
float
Reference temperature [K]
- C:
float
Reference temperature [K]
- Re:
- Outputs:
- p:
float
Static pressure [Pa]
- p:
- See also:
- Versions:
2016-03-24
@ddalle
: Version 1.0
- cape.convert.ReynoldsPerFoot(p, T, M, R=None, gam=None, mu0=None, T0=None, C=None)¶
Calculate Reynolds number per foot using Sutherland’s Law
- Call:
>>> Re = ReynoldsPerFoot(p, T, M) >>> Re = ReynoldsPerFoot(p, T, M, **kw)
- Inputs:
- p:
float
Static pressure [psf]
- T:
float
Static temperature [R]
- M:
float
Mach number
- R:
float
Gas constant [ft^2/s^2*R]
- gam:
float
Ratio of specific heats
- mu0:
float
Reference viscosity [slug/ft*s]
- T0:
float
Reference temperature [R]
- C:
float
Reference temperature [R]
- p:
- Outputs:
- Re:
float
Reynolds number per foot
- Re:
- See also:
- Versions:
2016-03-23
@ddalle
: Version 1.0
- cape.convert.ReynoldsPerMeter(p, T, M, R=None, gam=None, mu0=None, T0=None, C=None)¶
Calculate Reynolds number per meter using Sutherland’s Law
- Call:
>>> Re = ReynoldsPerMeter(p, T, M) >>> Re = ReynoldsPerMeter(p, T, M, **kw)
- Inputs:
- p:
float
Static pressure [Pa]
- T:
float
Static temperature [K]
- M:
float
Mach number
- R:
float
Gas constant [m^2/s^2*R]
- gam:
float
Ratio of specific heats
- mu0:
float
Reference viscosity [kg/m*s]
- T0:
float
Reference temperature [K]
- C:
float
Reference temperature [K]
- p:
- Outputs:
- Re:
float
Reynolds number per foot
- Re:
- See also:
- Versions:
2016-03-24
@ddalle
: Version 1.0
- cape.convert.SutherlandFPS(T, mu0=None, T0=None, C=None)¶
Calculate viscosity using Sutherland’s law using imperial units
This returns
\[\mu = \mu_0 \frac{T_0+C}{T+C} \left(\frac{T}{T_0}\right)^{3/2}\]- Call:
>>> mu = SutherlandFPS(T) >>> mu = SutherlandFPS(T, mu0=None, T0=None, C=None)
- Inputs:
- T:
float
Static temperature in degrees Rankine
- mu0: {
3.58394e-7
} |float
Reference viscosity [slug/ft*s]
- T0: {
491.67
} |float
Reference temperature [R]
- C: {
198.6
} |float
Reference temperature [R]
- T:
- Outputs:
- mu:
float
Dynamic viscosity [slug/ft*s]
- mu:
- Versions:
2016-03-23
@ddalle
: Version 1.0
- cape.convert.SutherlandMKS(T, mu0=None, T0=None, C=None)¶
Calculate viscosity using Sutherland’s law using SI units
This returns
\[\begin{split}\mu = \mu_0 \\frac{T_0+C}{T+C} \left(\frac{T}{T_0}\right)^{3/2}\end{split}\]- Call:
>>> mu = SutherlandMKS(T) >>> mu = SutherlandMKS(T, mu0=None, T0=None, C=None)
- Inputs:
- T:
float
Static temperature in degrees Rankine
- mu0: {
1.716e-5
} |float
Reference viscosity [kg/m*s]
- T0: {
273.15
} |float
Reference temperature [K]
- C: {
110.33333
} |float
Reference temperature [K]
- T:
- Outputs:
- mu:
float
Dynamic viscosity [kg/m*s]
- mu:
- Versions:
2016-03-23
@ddalle
: Version 1.0
- cape.convert.fstep(x)¶
Return -1 for negative numbers and +1 for nonnegative numbers
- Call:
>>> y = fstep(x)
- Inputs:
- x:
float
|np.ndarray
Input or array of inputs
- x:
- Outputs:
- y:
-1.0
|1.0
|np.ndarray
Output step function or array of outputs
- y:
- Versions:
2017-06-27
@ddalle
: Version 1.0
- cape.convert.fstep1(x)¶
Return -1 for nonpositive numbers and +1 for positive inputs
- Call:
>>> y = fstep1(x)
- Inputs:
- x:
float
|np.ndarray
Input or array of inputs
- x:
- Outputs:
- y:
-1.0
|1.0
|np.ndarray
Output step function or array of outputs
- y:
- Versions:
2017-06-27
@ddalle
: Version 1.0