From 910ef69b79c140d481edd64dc4db48f2743f2b4d Mon Sep 17 00:00:00 2001 From: JoePfeiffer Date: Tue, 7 Jun 2022 10:52:34 -0600 Subject: [PATCH] Remove tube fin stability warning --- core/resources/l10n/messages.properties | 1 - .../sf/openrocket/aerodynamics/Warning.java | 1 - .../barrowman/TubeFinSetCalc.java | 24 +++++++++++++------ 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/core/resources/l10n/messages.properties b/core/resources/l10n/messages.properties index 8fbf01f50..95b8960d0 100644 --- a/core/resources/l10n/messages.properties +++ b/core/resources/l10n/messages.properties @@ -1789,7 +1789,6 @@ Warning.TUMBLE_UNDER_THRUST = Stage began to tumble under thrust. Warning.EVENT_AFTER_LANDING = Flight Event occurred after landing: Warning.ZERO_LENGTH_BODY = Zero length bodies may not result in accurate simulations. Warning.ZERO_RADIUS_BODY = Zero length bodies may not result in accurate simulations. -Warning.TUBE_STABILITY = Tube fin stability calculations may not be accurate. Warning.TUBE_SEPARATION = Space between tube fins may not result in accurate simulations. Warning.TUBE_OVERLAP = Overlapping tube fins may not result in accurate simulations. diff --git a/core/src/net/sf/openrocket/aerodynamics/Warning.java b/core/src/net/sf/openrocket/aerodynamics/Warning.java index 0653b1a3e..bda67ed61 100644 --- a/core/src/net/sf/openrocket/aerodynamics/Warning.java +++ b/core/src/net/sf/openrocket/aerodynamics/Warning.java @@ -392,7 +392,6 @@ public abstract class Warning { public static final Warning ZERO_LENGTH_BODY = new Other(trans.get("Warning.ZERO_LENGTH_BODY")); public static final Warning ZERO_RADIUS_BODY = new Other(trans.get("Warning.ZERO_RADIUS_BODY")); - public static final Warning TUBE_STABILITY = new Other(trans.get("Warning.TUBE_STABILITY")); public static final Warning TUBE_SEPARATION = new Other(trans.get("Warning.TUBE_SEPARATION")); public static final Warning TUBE_OVERLAP = new Other(trans.get("Warning.TUBE_OVERLAP")); } diff --git a/core/src/net/sf/openrocket/aerodynamics/barrowman/TubeFinSetCalc.java b/core/src/net/sf/openrocket/aerodynamics/barrowman/TubeFinSetCalc.java index b5eb8e9b6..88e402f1d 100644 --- a/core/src/net/sf/openrocket/aerodynamics/barrowman/TubeFinSetCalc.java +++ b/core/src/net/sf/openrocket/aerodynamics/barrowman/TubeFinSetCalc.java @@ -41,14 +41,14 @@ public class TubeFinSetCalc extends TubeCalc { private final double outerRadius; private final int tubeCount; private final double baseRotation; + // at present tubes are only allowed a cant angle of 0 + private final double cantAngle; // values we can precompute once private final double ar; private final double intersticeArea; private final double wettedArea; private final double cnaconst; - - protected double rollSum = Double.NaN; // Roll damping sum term protected final WarningSet geometryWarnings = new WarningSet(); @@ -60,7 +60,6 @@ public class TubeFinSetCalc extends TubeCalc { final TubeFinSet tubes = (TubeFinSet) component; - geometryWarnings.add(Warning.TUBE_STABILITY); if (tubes.getTubeSeparation() > MathUtil.EPSILON) { geometryWarnings.add(Warning.TUBE_SEPARATION); } else if (tubes.getTubeSeparation() < -MathUtil.EPSILON) { @@ -73,6 +72,9 @@ public class TubeFinSetCalc extends TubeCalc { outerRadius = tubes.getOuterRadius(); tubeCount = tubes.getFinCount(); baseRotation = tubes.getBaseRotation(); + // at present, tube cant angle can only be 0 + cantAngle = 0; + // cantAngle = tubes.getCantAngle(); // precompute geometry. This will be the geometry of a single tube, since BarrowmanCalculator // iterates across them. Doesn't consider interference between them; that should only be relevant for @@ -149,11 +151,19 @@ public class TubeFinSetCalc extends TubeCalc { double x = calculateCPPos(conditions) * chord; // log.debug("CP position " + x); - // We aren't allowing tube fins to have any cant angle at present, so no roll force - forces.setCrollForce(0); + // Roll forces + // This isn't really tested, since the cant angle is required to be 0. + forces.setCrollForce((bodyRadius + outerRadius) * cna * cantAngle / + conditions.getRefLength()); + + if (conditions.getAOA() > STALL_ANGLE) { + // log.debug("Tube stalling in roll"); + forces.setCrollForce(forces.getCrollForce() * + MathUtil.clamp(1 - (conditions.getAOA() - STALL_ANGLE) / (STALL_ANGLE / 2), 0, 1)); + } - // Worry about roll damping later - forces.setCrollDamp(0); + forces.setCrollDamp((bodyRadius + outerRadius) * conditions.getRollRate()/conditions.getVelocity() * cna / conditions.getRefLength()); + forces.setCroll(forces.getCrollForce() - forces.getCrollDamp()); forces.setCNa(cna);