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 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();
}
}

View File

@ -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();