Check for inner radius of tube == 0 to avoid NaN in pressure drop

calculation
This commit is contained in:
JoePfeiffer 2022-05-04 15:10:32 -06:00
parent 05ce7cb1f5
commit 359e97108c
2 changed files with 30 additions and 18 deletions

View File

@ -10,7 +10,9 @@ public abstract class TubeCalc extends RocketComponentCalc {
private final double diameter; private final double diameter;
private final double length; private final double length;
protected double refArea; protected final double innerArea;
private final double totalArea;
private final double frontalArea;
public TubeCalc(RocketComponent component) { public TubeCalc(RocketComponent component) {
super(component); super(component);
@ -19,27 +21,37 @@ public abstract class TubeCalc extends RocketComponentCalc {
length = tube.getLength(); length = tube.getLength();
diameter = 2 * tube.getInnerRadius(); 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 @Override
public double calculatePressureCD(FlightConditions conditions, public double calculatePressureCD(FlightConditions conditions,
double stagnationCD, double baseCD, WarningSet warnings) { double stagnationCD, double baseCD, WarningSet warnings) {
// calculation of pressure drop through pipe from "Atlas Copco Air Compendium", 1975, // Need to check for tube inner area 0 in case of rockets using launch lugs with
// quoted as equation 14 in Carello, Ivanov, and Mazza, "Pressure drop in pipe // an inner radius of 0 to emulate rail buttons (or just weird rockets, of course)
// lines for compressed air: comparison between experimental and theoretical analysis", final double deltap;
// Transactions on Engineering Sciences vol 18, ISSN 1743-35331998, 1998. if (innerArea > MathUtil.EPSILON) {
// calculation of pressure drop through pipe from "Atlas Copco Air Compendium",
// Volume flow rate // 1975, quoted as equation 14 in Carello, Ivanov, and Mazza, "Pressure drop
final double Q = conditions.getVelocity() * refArea; // in pipe lines for compressed air: comparison between experimental and
// theoretical analysis", Transactions on Engineering Sciences vol 18,
// pressure drop // ISSN 1743-35331998, 1998.
final double deltap = 1.6 * Math.pow(Q, 1.85) * length /
(Math.pow(diameter, 5) * conditions.getAtmosphericConditions().getPressure());
// 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 // convert to CD and return
return deltap * refArea / conditions.getRefArea(); return (deltap * innerArea + stagnationCD * frontalArea) / conditions.getRefArea();
} }
} }

View File

@ -114,15 +114,15 @@ public class TubeFinSetCalc extends TubeCalc {
// area of disk passing through tube fin centers // area of disk passing through tube fin centers
final double tubeDiskArea = Math.PI * MathUtil.pow2(bodyRadius + tubes.getOuterRadius()); final double tubeDiskArea = Math.PI * MathUtil.pow2(bodyRadius + tubes.getOuterRadius());
// half of combined area of tube fin interiors. // half of combined area of tube fin exteriors. Deliberately using the outer radius here since we
final double tubeInnerArea = tubes.getFinCount() * Math.PI * MathUtil.pow2(tubes.getInnerRadius()) / 2.0; // 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 // body tube area
final double bodyTubeArea = Math.PI * MathUtil.pow2(bodyRadius); final double bodyTubeArea = Math.PI * MathUtil.pow2(bodyRadius);
// area of an interstice // area of an interstice
intersticeArea = (tubeDiskArea - tubeInnerArea - bodyTubeArea) / tubes.getFinCount(); intersticeArea = (tubeDiskArea - tubeOuterArea - bodyTubeArea) / tubes.getFinCount();
log.debug("interstice area " + intersticeArea);
thickness = fin.getThickness(); thickness = fin.getThickness();
finCount = 3 * fin.getFinCount(); finCount = 3 * fin.getFinCount();