void CalculateNozzleCurveParameters() { double sqrtArea = Math.Sqrt(areaRatio); E.y = sqrtArea; E.x = relLength * (sqrtArea - 1) / NozzleUtils.GetConical15DegConstant(); N.x = 0.382 * Math.Cos(inflectionAngle - Math.PI / 180.0); N.y = 0.382 * Math.Sin(inflectionAngle - Math.PI / 180.0) + 1.382; if (shapeType == NozzleShapeType.CONICAL) { Q = 0.5 * (N + E); return; } double slope1, slope2; slope1 = Math.Tan(inflectionAngle); slope2 = Math.Tan(exitAngle); double intercept1, intercept2; intercept1 = N.y - slope1 * N.x; intercept2 = E.y - slope2 * E.x; Q.x = (intercept2 - intercept1) / (slope1 - slope2); Q.y = (intercept2 * slope1 - intercept1 * slope1) / (slope1 - slope2) + intercept1; }
void CalcTurbineExhaustThrust() { double nozzleInletTemp = turbopump.GetTurbineExitTemp(); if (turbineExhaustType == TurbineExhaustEnum.DIRECT) { //Calc exit area, which is the throat area since this is a choked converging nozzle exhaustArea = (gasGenPrefab.nozzleGamma + 1.0) / (gasGenPrefab.nozzleGamma - 1.0); exhaustArea = Math.Pow(2.0 / (gasGenPrefab.nozzleGamma + 1.0), exhaustArea); exhaustArea *= gasGenPrefab.nozzleGamma * enginePrefab.nozzleMWgMol; exhaustArea /= (GAS_CONSTANT * nozzleInletTemp); exhaustArea = Math.Sqrt(exhaustArea); exhaustArea *= turbineBackPresMPa; exhaustArea = turbineMassFlow / exhaustArea; exhaustArea *= 0.001; double exhaustExitTemp = nozzleInletTemp / (1.0 + (gasGenPrefab.nozzleGamma - 1.0) * 0.5); double exhaustExitVel = Math.Sqrt(gasGenPrefab.nozzleGamma * exhaustExitTemp * GAS_CONSTANT / gasGenPrefab.nozzleMWgMol); double exhaustThrustMomentum = exhaustExitVel * turbineMassFlow; thrustVacAux += exhaustThrustMomentum; thrustSLAux += exhaustThrustMomentum; double exhaustExitPres = turbineBackPresMPa / Math.Pow((1.0 + (gasGenPrefab.nozzleGamma - 1.0) * 0.5), gasGenPrefab.nozzleGamma / (gasGenPrefab.nozzleGamma - 1.0)); thrustVacAux += exhaustExitPres * exhaustArea * 1000.0; thrustSLAux += (exhaustExitPres - 0.1013) * exhaustArea * 1000.0; } else if (turbineExhaustType == TurbineExhaustEnum.INTO_NOZZLE) { double exhaustExpansionRatio = areaRatio / nozzleExhaustArea; double machThroughExpansion = exhaustExpansionRatio <= 1.0 ? 1.0 : NozzleUtils.MachFromAreaRatio(exhaustExpansionRatio, gasGenPrefab.nozzleGamma); double exhaustExitTemp = nozzleInletTemp / (1.0 + (gasGenPrefab.nozzleGamma - 1.0) * 0.5 * machThroughExpansion * machThroughExpansion); double exhaustExitVel = Math.Sqrt(gasGenPrefab.nozzleGamma * exhaustExitTemp * GAS_CONSTANT / gasGenPrefab.nozzleMWgMol) * machThroughExpansion; double exhaustThrustMomentum = exhaustExitVel * turbineMassFlow; exhaustThrustMomentum *= nozzleDivEfficiency; double relDistanceDownNozzle = nozzle.GetFracLengthAtArea(nozzleExhaustArea); exhaustThrustMomentum *= (1.0 * relDistanceDownNozzle + nozzleFrictionEfficiency * (1.0 - relDistanceDownNozzle)); thrustVacAux += exhaustThrustMomentum; thrustSLAux += exhaustThrustMomentum; } }
void CalculateExitInflectionAngles() { switch (shapeType) { case NozzleShapeType.CONICAL: exitAngle = NozzleUtils.GetConicalExitAngle(relLength); inflectionAngle = exitAngle; break; case NozzleShapeType.BELL: Vector2d angles = NozzleUtils.GetBellExitInflectionAngles(relLength, areaRatio); exitAngle = angles.x; inflectionAngle = angles.y; break; } exitAngleString = (exitAngle * 180.0 / Math.PI).ToString("F1"); }
void CalcTurbineExhaustBackPressure() { double exhaustPresMPa = 0.1013 * 1.5; //1.5 atm if (turbineExhaustType == TurbineExhaustEnum.INTO_NOZZLE) { double machAtArea = NozzleUtils.MachFromAreaRatio(nozzleExhaustArea, modGamma); double isentropicRatio = 0.5 * (modGamma - 1.0); isentropicRatio = (1.0 + isentropicRatio * enginePrefab.nozzleMach * enginePrefab.nozzleMach) / (1.0 + isentropicRatio * machAtArea * machAtArea); exhaustPresMPa = Math.Max(Math.Pow(isentropicRatio, modGamma / (modGamma - 1.0)) * enginePrefab.nozzlePresMPa * 1.05, exhaustPresMPa); //gets the pressure in the nozzle at this area ratio, but only if it's higher than this } turbineBackPresMPa = (gasGenPrefab.nozzleGamma - 1.0) * 0.5 + 1.0; turbineBackPresMPa = Math.Pow(turbineBackPresMPa, gasGenPrefab.nozzleGamma / (gasGenPrefab.nozzleGamma - 1.0)); turbineBackPresMPa *= exhaustPresMPa; turbineBackPresMPa = Math.Max(turbineBackPresMPa, gasGenPrefab.chamberPresMPa / 24.0); }
protected void CalculateEngineAndNozzlePerformanceProperties() { effectiveFrozenAreaRatio = NozzleUtils.AreaRatioFromMach(enginePrefab.nozzleMach, enginePrefab.nozzleGamma); effectiveExitAreaRatio = areaRatio * enginePrefab.frozenAreaRatio / effectiveFrozenAreaRatio; modGamma = CalculateGammaModified(effectiveExitAreaRatio); //avg gamma, modified for expansion ratio double exitMach = NozzleUtils.MachFromAreaRatio(effectiveExitAreaRatio, modGamma); double isentropicRatio = 0.5 * (modGamma - 1.0); isentropicRatio = (1.0 + isentropicRatio * enginePrefab.nozzleMach * enginePrefab.nozzleMach) / (1.0 + isentropicRatio * exitMach * exitMach); double exitTemp = isentropicRatio * enginePrefab.nozzleTempK; double exitSonicVelocity = Math.Sqrt(modGamma * GAS_CONSTANT / enginePrefab.nozzleMWgMol * exitTemp); exhaustVelocityOpt = exitSonicVelocity * exitMach; exitPressureMPa = Math.Pow(isentropicRatio, modGamma / (modGamma - 1.0)) * enginePrefab.nozzlePresMPa; nozzle.UpdateNozzleStatus(areaRatio); nozzleDivEfficiency = nozzle.GetDivergenceEff(); nozzleFrictionEfficiency = nozzle.GetFrictionEff(exhaustVelocityOpt, massFlowChamber, chamberPresMPa, enginePrefab.chamberTempK, enginePrefab.nozzleMWgMol, modGamma, throatDiameter * 0.5); thrustVac = exhaustVelocityOpt * massFlowChamber * nozzleDivEfficiency * nozzleFrictionEfficiency * reactionEfficiency; thrustSL = thrustVac; thrustVac += exitPressureMPa * nozzleDivEfficiency * nozzleArea * 1000.0; thrustSL += (exitPressureMPa * nozzleDivEfficiency - 0.1013) * nozzleArea * 1000.0; minThrustVac = thrustVac * minThrottle; thrustVac += thrustVacAux; thrustSL += thrustSLAux; specImpulseVac = thrustVac / (massFlowTotal * G0); specImpulseSL = thrustSL / (massFlowTotal * G0); }
double CalcExhaustVelChangeFromFriction(double massFlow, double chamberPresMPa, double chamberTempK, double molWeightGMol, double gamma, double throatRadius) { double delV = 0; double gammaFactor = gamma - 1.0; gammaFactor *= 0.5; double gammaExp = -gamma / (gamma - 1.0); double cumulativeDistance = throatRadius * 0.001; Vector2d point1 = nozzlePoints[0]; double areaRat1 = point1.y * point1.y; double mach1 = NozzleUtils.MachFromAreaRatioSubsonic(areaRat1, gamma); //should be Mach 1 here double drag1 = mach1 * mach1 * gammaFactor + 1.0; drag1 = Math.Pow(drag1, gammaExp); double temp1 = chamberTempK / CalcStagTempFactor(mach1, gamma); double visc1 = CalcApproxDynVisc(molWeightGMol, temp1); double reynoldsScalingFactor1 = ReynoldsCalcScalingFactor(chamberPresMPa, chamberTempK, molWeightGMol, gamma); double reynolds1 = CalcReynoldsNumber(mach1, gamma, cumulativeDistance, visc1, reynoldsScalingFactor1); drag1 *= mach1 * mach1 * CalcCompressFriction(reynolds1); drag1 *= point1.y; for (int i = 1; i < nozzlePoints.Length; ++i) { Vector2d point2 = nozzlePoints[i]; double areaRat2 = point2.y * point2.y; double mach2; if (i > POINTS_CONVERGING_ARC) { mach2 = NozzleUtils.MachFromAreaRatio(areaRat2, gamma); } else if (i < POINTS_CONVERGING_ARC) { mach2 = NozzleUtils.MachFromAreaRatioSubsonic(areaRat2, gamma); } else { mach2 = 1.0; } double distanceX = point2.x - point1.x; double distanceY = point2.y - point1.y; double distance = Math.Sqrt(distanceX * distanceX + distanceY * distanceY); cumulativeDistance += distance * throatRadius; double drag2 = mach2 * mach2 * gammaFactor + 1.0; drag2 = Math.Pow(drag2, gammaExp); double temp2 = chamberTempK / CalcStagTempFactor(mach2, gamma); double visc2 = CalcApproxDynVisc(molWeightGMol, temp2); double reynoldsScalingFactor2 = ReynoldsCalcScalingFactor(chamberPresMPa, chamberTempK, molWeightGMol, gamma); double reynolds2 = CalcReynoldsNumber(mach2, gamma, cumulativeDistance, visc2, reynoldsScalingFactor2); drag2 *= mach2 * mach2 * CalcCompressFriction(reynolds2); drag2 *= point2.y; delV += (drag2 + drag1) * 0.5 * distance; //trapezoid method point1 = point2; drag1 = drag2; } delV *= chamberPresMPa; delV *= gamma; delV /= massFlow; delV *= 1000.0; delV *= throatRadius * Math.PI; return(delV); }