Convert BasicTumbleStepper and BasicTumbleStatus to use CD instead of drag

(for consistency with everywhere else)
This commit is contained in:
JoePfeiffer 2023-04-21 11:13:11 -06:00
parent 905f79dfe1
commit b6aaa3857a
2 changed files with 10 additions and 10 deletions

View File

@ -21,29 +21,29 @@ public class BasicTumbleStatus extends SimulationStatus {
// offset the indexes so finEff[1] is the coefficient for one fin from the table in techdoc.pdf // offset the indexes so finEff[1] is the coefficient for one fin from the table in techdoc.pdf
private final static double[] finEff = { 0.0, 0.5, 1.0, 1.41, 1.81, 1.73, 1.90, 1.85 }; private final static double[] finEff = { 0.0, 0.5, 1.0, 1.41, 1.81, 1.73, 1.90, 1.85 };
private final double drag; private final double cd;
public BasicTumbleStatus(FlightConfiguration configuration, public BasicTumbleStatus(FlightConfiguration configuration,
SimulationConditions simulationConditions) { SimulationConditions simulationConditions) {
super(configuration, simulationConditions); super(configuration, simulationConditions);
this.drag = computeTumbleDrag(); this.cd = computeTumbleCD();
} }
public BasicTumbleStatus(SimulationStatus orig) { public BasicTumbleStatus(SimulationStatus orig) {
super(orig); super(orig);
if (orig instanceof BasicTumbleStatus) { if (orig instanceof BasicTumbleStatus) {
this.drag = ((BasicTumbleStatus) orig).drag; this.cd = ((BasicTumbleStatus) orig).cd;
} else { } else {
this.drag = computeTumbleDrag(); this.cd = computeTumbleCD();
} }
} }
public double getTumbleDrag() { public double getCD() {
return drag; return cd;
} }
private double computeTumbleDrag() { private double computeTumbleCD() {
// Computed based on Sampo's experimentation as documented in the pdf. // Computed based on Sampo's experimentation as documented in the pdf.
@ -80,6 +80,6 @@ public class BasicTumbleStatus extends SimulationStatus {
} }
} }
return (cDFin * aFins + cDBt * aBt); return (cDFin * aFins + cDBt * aBt)/getConfiguration().getReferenceArea();
} }
} }

View File

@ -33,11 +33,11 @@ public class BasicTumbleStepper extends AbstractSimulationStepper {
// Get total CD // Get total CD
double mach = airSpeed.length() / atmosphere.getMachSpeed(); double mach = airSpeed.length() / atmosphere.getMachSpeed();
double tumbleDrag = ((BasicTumbleStatus)status).getTumbleDrag(); double tumbleCD = ((BasicTumbleStatus)status).getCD();
// Compute drag force // Compute drag force
double dynP = (0.5 * atmosphere.getDensity() * airSpeed.length2()); double dynP = (0.5 * atmosphere.getDensity() * airSpeed.length2());
double dragForce = tumbleDrag * dynP; double dragForce = status.getConfiguration().getReferenceArea() * tumbleCD * dynP;
// n.b. this is constant, and could be calculated once at the beginning of this simulation branch... // n.b. this is constant, and could be calculated once at the beginning of this simulation branch...
double rocketMass = calculateStructureMass(status).getMass(); double rocketMass = calculateStructureMass(status).getMass();