diff --git a/core/src/net/sf/openrocket/aerodynamics/barrowman/TubeCalc.java b/core/src/net/sf/openrocket/aerodynamics/barrowman/TubeCalc.java index 60117d808..a4cbc5d78 100644 --- a/core/src/net/sf/openrocket/aerodynamics/barrowman/TubeCalc.java +++ b/core/src/net/sf/openrocket/aerodynamics/barrowman/TubeCalc.java @@ -10,7 +10,9 @@ public abstract class TubeCalc extends RocketComponentCalc { private final double diameter; private final double length; - protected double refArea; + protected final double innerArea; + private final double totalArea; + private final double frontalArea; public TubeCalc(RocketComponent component) { super(component); @@ -19,27 +21,37 @@ public abstract class TubeCalc extends RocketComponentCalc { length = tube.getLength(); diameter = 2 * tube.getInnerRadius(); - refArea = Math.PI * MathUtil.pow2(tube.getInnerRadius()); + innerArea = Math.PI * MathUtil.pow2(tube.getInnerRadius()); + totalArea = Math.PI * MathUtil.pow2(tube.getOuterRadius()); + frontalArea = totalArea - innerArea; } @Override public double calculatePressureCD(FlightConditions conditions, double stagnationCD, double baseCD, WarningSet warnings) { - // calculation of pressure drop through pipe from "Atlas Copco Air Compendium", 1975, - // quoted as equation 14 in Carello, Ivanov, and Mazza, "Pressure drop in pipe - // lines for compressed air: comparison between experimental and theoretical analysis", - // Transactions on Engineering Sciences vol 18, ISSN 1743-35331998, 1998. - - // Volume flow rate - final double Q = conditions.getVelocity() * refArea; - - // pressure drop - final double deltap = 1.6 * Math.pow(Q, 1.85) * length / - (Math.pow(diameter, 5) * conditions.getAtmosphericConditions().getPressure()); + // Need to check for tube inner area 0 in case of rockets using launch lugs with + // an inner radius of 0 to emulate rail buttons (or just weird rockets, of course) + final double deltap; + if (innerArea > MathUtil.EPSILON) { + // calculation of pressure drop through pipe from "Atlas Copco Air Compendium", + // 1975, quoted as equation 14 in Carello, Ivanov, and Mazza, "Pressure drop + // in pipe lines for compressed air: comparison between experimental and + // theoretical analysis", Transactions on Engineering Sciences vol 18, + // ISSN 1743-35331998, 1998. + // Volume flow rate + final double Q = conditions.getVelocity() * innerArea; + + // pressure drop + deltap = 1.6 * Math.pow(Q, 1.85) * length / + (Math.pow(diameter, 5) * conditions.getAtmosphericConditions().getPressure()); + } else { + deltap = 0.0; + } + // convert to CD and return - return deltap * refArea / conditions.getRefArea(); + return (deltap * innerArea + stagnationCD * frontalArea) / conditions.getRefArea(); } } diff --git a/core/src/net/sf/openrocket/aerodynamics/barrowman/TubeFinSetCalc.java b/core/src/net/sf/openrocket/aerodynamics/barrowman/TubeFinSetCalc.java index b4e9524f1..3b0c50624 100644 --- a/core/src/net/sf/openrocket/aerodynamics/barrowman/TubeFinSetCalc.java +++ b/core/src/net/sf/openrocket/aerodynamics/barrowman/TubeFinSetCalc.java @@ -114,15 +114,15 @@ public class TubeFinSetCalc extends TubeCalc { // area of disk passing through tube fin centers final double tubeDiskArea = Math.PI * MathUtil.pow2(bodyRadius + tubes.getOuterRadius()); - // half of combined area of tube fin interiors. - final double tubeInnerArea = tubes.getFinCount() * Math.PI * MathUtil.pow2(tubes.getInnerRadius()) / 2.0; + // half of combined area of tube fin exteriors. Deliberately using the outer radius here since we + // calculate pressure drag from the tube walls in TubeCalc + final double tubeOuterArea = tubes.getFinCount() * Math.PI * MathUtil.pow2(tubes.getOuterRadius()) / 2.0; // body tube area final double bodyTubeArea = Math.PI * MathUtil.pow2(bodyRadius); // area of an interstice - intersticeArea = (tubeDiskArea - tubeInnerArea - bodyTubeArea) / tubes.getFinCount(); - log.debug("interstice area " + intersticeArea); + intersticeArea = (tubeDiskArea - tubeOuterArea - bodyTubeArea) / tubes.getFinCount(); thickness = fin.getThickness(); finCount = 3 * fin.getFinCount();