//Calculates Oswald's Efficiency e using Shevell's Method // ReSharper disable once UnusedMember.Global public static double CalculateOswaldsEfficiency(double AR, double CosSweepAngle, double Cd0) { double e = 1 - 0.02 * FARMathUtil.PowApprox(AR, 0.7) * FARMathUtil.PowApprox(Math.Acos(CosSweepAngle), 2.2); double tmp = AR * Cd0 * Mathf.PI + 1; e /= tmp; return(e); }
public double BrentSolve(string dbgmsg) { if (tols.allowbrent) { Debug.Log("[Rodhern][FAR] MirroredFunction (mirrored= " + mirror + ") reverting to BrentsMethod: " + dbgmsg); return(FARMathUtil.BrentsMethod(this.F, tols.leftedge, tols.rightedge, tols.tol_brent, tols.iterlim)); } else { Debug.Log("[Rodhern][FAR] MirroredFunction (mirrored= " + mirror + ") abandoned search: " + dbgmsg); return(Double.NaN); } }
//Based on NASA Contractor Report 187173, Exact and Approximate Oblique Shock Equations for Real-Time Applications public static double CalculateSinWeakObliqueShockAngle(double MachNumber, double gamma, double deflectionAngle) { double M2 = MachNumber * MachNumber; double recipM2 = 1 / M2; double sin2def = Math.Sin(deflectionAngle); sin2def *= sin2def; double b = M2 + 2; b *= recipM2; b += gamma * sin2def; b = -b; double c = gamma + 1; c *= c * 0.25f; c += (gamma - 1) * recipM2; c *= sin2def; c += (2 * M2 + 1) * recipM2 * recipM2; double d = sin2def - 1; d *= recipM2 * recipM2; double Q = c * 0.33333333 - b * b * 0.111111111; double R = 0.16666667 * b * c - 0.5f * d - 0.037037037 * b * b * b; double D = Q * Q * Q + R * R; if (D > 0.001) { return(double.NaN); } double phi = Math.Atan(Math.Sqrt(FARMathUtil.Clamp(-D, 0, double.PositiveInfinity)) / R); if (R < 0) { phi += Math.PI; } phi *= 0.33333333; double chiW = -0.33333333 * b - Math.Sqrt(FARMathUtil.Clamp(-Q, 0, double.PositiveInfinity)) * (Math.Cos(phi) - 1.7320508f * Math.Sin(phi)); double betaW = Math.Sqrt(FARMathUtil.Clamp(chiW, 0, double.PositiveInfinity)); return(betaW); }
public static double CalculateSinMaxShockAngle(double MachNumber, double gamma) { double M2 = MachNumber * MachNumber; double gamP1_2_M2 = (gamma + 1) * 0.5 * M2; double b = gamP1_2_M2; b = 2 - b; b *= M2; double a = gamma * M2 * M2; double c = gamP1_2_M2 + 1; c = -c; double tmp = b * b - 4 * a * c; double sin2def = -b + Math.Sqrt(FARMathUtil.Clamp(tmp, 0, double.PositiveInfinity)); sin2def /= (2 * a); return(Math.Sqrt(sin2def)); }
public double BrentSolve(string dbgmsg) { FARLogger.Info("MirroredFunction (mirrored= " + mirror + ") reverting to BrentsMethod: " + dbgmsg); return(FARMathUtil.BrentsMethod(this.F, leftedge, rightedge, tol_brent, iterlim)); }