Merge pull request #2138 from JoePfeiffer/fix-2113

Fix 2113
This commit is contained in:
Joe Pfeiffer 2023-03-27 19:45:26 -06:00 committed by GitHub
commit 6084ba6512
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 50 additions and 4 deletions

View File

@ -235,9 +235,9 @@ public class FinSetCalc extends RocketComponentCalc {
finArea = component.getPlanformArea();
ar = 2 * pow2(span) / finArea;
// Check geometry; don't consider points along fin root for this
// (doing so will cause spurious jagged fin warnings)
Coordinate[] points = component.getFinPoints();
// Check geometry
geometryWarnings.clear();
boolean down = false;
for (int i = 1; i < points.length; i++) {
@ -259,8 +259,9 @@ public class FinSetCalc extends RocketComponentCalc {
geometryWarnings.add(Warning.THICK_FIN, component.toString());
}
// Calculate the chord lead and trail positions and length
// Calculate the chord lead and trail positions and length. We do need the points
// along the root for this
points = component.getFinPointsWithRoot();
Arrays.fill(chordLead, Double.POSITIVE_INFINITY);
Arrays.fill(chordTrail, Double.NEGATIVE_INFINITY);
Arrays.fill(chordLength, 0);

View File

@ -1557,4 +1557,49 @@ public class FreeformFinSetTest extends BaseTestCase {
}
}
/**
* Test that fins on transitions don't get NaN MAClength
*/
@Test
public void testFinsOnTransitions() {
// Rocket consisting of just a transition and a freeform fin set
final Rocket rocket = new Rocket();
final AxialStage stage = new AxialStage();
rocket.addChild(stage);
Transition trans = new Transition();
stage.addChild(trans);
FreeformFinSet fins = new FreeformFinSet();
trans.addChild(fins);
// set the finset at the beginning of the transition
fins.setAxialMethod(AxialMethod.TOP);
fins.setAxialOffset(0.0);
// Test 1: transition getting smaller
trans.setForeRadius(trans.getForeRadius()*2.0);
fins.setPoints(new Coordinate[] {
new Coordinate(0, 0),
new Coordinate(trans.getLength(), 0),
new Coordinate(trans.getLength(), trans.getAftRadius() - trans.getForeRadius())
});
FinSetCalc calc = new FinSetCalc(fins);
assertEquals(0.075, calc.getMACLength(), EPSILON);
// Test 2: transition getting larger
trans.setForeRadius(trans.getAftRadius());
trans.setAftRadius(trans.getAftRadius()*2.0);
fins.setPoints(new Coordinate[] {
new Coordinate(0, 0),
new Coordinate(0, trans.getAftRadius() - trans.getForeRadius()),
new Coordinate(trans.getLength(), trans.getAftRadius() - trans.getForeRadius())
});
calc = new FinSetCalc(fins);
assertEquals(0.05053191489361704, calc.getMACLength(), EPSILON);
}
}