Corrected calculatePressureDrag() to iterate through all instances.

Note this required modifying the function to explicitly get the radius
of the forward symmetric component rather than simply iterating
and assuming components would appear in order (as was the case with
iterating through getActiveComponents()).
The getPreviousSymmetricComponent() method contains a warning that it
doesn't account for external pods, so this will probably need to be
revisited and that method modified.
This commit is contained in:
JoePfeiffer 2020-03-20 14:53:39 -06:00
parent 05185ff3d6
commit dd3bda8d7e
2 changed files with 10 additions and 8 deletions

View File

@ -506,7 +506,6 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
Map<RocketComponent, AerodynamicForces> map, WarningSet warnings) {
double stagnation, base, total;
double radius = 0;
if (calcMap == null)
buildCalcMap(configuration);
@ -536,21 +535,24 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
if(c.isCDOverridden()) continue;
// Stagnation drag
if (c instanceof SymmetricComponent) {
SymmetricComponent s = (SymmetricComponent) c;
double radius = 0;
final SymmetricComponent prevComponent = s.getPreviousSymmetricComponent();
if (prevComponent != null)
radius = prevComponent.getAftRadius();
if (radius < s.getForeRadius()) {
double area = Math.PI * (pow2(s.getForeRadius()) - pow2(radius));
cd = stagnation * area / conditions.getRefArea();
total += cd;
if (map != null) {
map.get(c).setPressureCD(map.get(c).getPressureCD() + cd);
}
}
radius = s.getAftRadius();
}
}
}

View File

@ -566,7 +566,7 @@ public abstract class SymmetricComponent extends BodyComponent implements Radial
*
* @return the previous SymmetricComponent, or null.
*/
protected final SymmetricComponent getPreviousSymmetricComponent() {
public final SymmetricComponent getPreviousSymmetricComponent() {
RocketComponent c;
for (c = this.getPreviousComponent(); c != null; c = c.getPreviousComponent()) {
if (c instanceof SymmetricComponent) {