Change BarrowmanCalculator to compute base drag for current component, not previous component
This commit is contained in:
parent
14db274d42
commit
4f4a55b8d2
@ -755,11 +755,17 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
|
|||||||
final InstanceMap imap = configuration.getActiveInstances();
|
final InstanceMap imap = configuration.getActiveInstances();
|
||||||
for(Map.Entry<RocketComponent, ArrayList<InstanceContext>> entry: imap.entrySet() ) {
|
for(Map.Entry<RocketComponent, ArrayList<InstanceContext>> entry: imap.entrySet() ) {
|
||||||
final RocketComponent c = entry.getKey();
|
final RocketComponent c = entry.getKey();
|
||||||
|
|
||||||
if (!(c instanceof SymmetricComponent)) {
|
if (!(c instanceof SymmetricComponent)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (c.isCDOverridden() ||
|
||||||
|
c.isCDOverriddenByAncestor()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
SymmetricComponent s = (SymmetricComponent) c;
|
SymmetricComponent s = (SymmetricComponent) c;
|
||||||
double foreRadius = s.getForeRadius();
|
double foreRadius = s.getForeRadius();
|
||||||
double aftRadius = s.getAftRadius();
|
double aftRadius = s.getAftRadius();
|
||||||
@ -770,35 +776,20 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int instanceCount = entry.getValue().size();
|
int instanceCount = entry.getValue().size();
|
||||||
|
|
||||||
if (c.isCDOverridden() ||
|
// get forward radius of next component
|
||||||
c.isCDOverriddenByAncestor()) {
|
final SymmetricComponent nextComponent = s.getNextSymmetricComponent();
|
||||||
continue;
|
double nextRadius;
|
||||||
|
if ((nextComponent != null) && configuration.isComponentActive(nextComponent)) {
|
||||||
|
nextRadius = nextComponent.getForeRadius();
|
||||||
|
} else {
|
||||||
|
nextRadius = 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if aft radius of previous component is greater than my forward radius, set
|
// if fore radius of next component is less than my aft radius, set my
|
||||||
// its aft CD
|
// base CD
|
||||||
double radius = 0;
|
if (nextRadius < aftRadius) {
|
||||||
final SymmetricComponent prevComponent = s.getPreviousSymmetricComponent();
|
double area = Math.PI * (pow2(aftRadius) - pow2(nextRadius));
|
||||||
if (prevComponent != null && configuration.isComponentActive(prevComponent)) {
|
|
||||||
radius = prevComponent.getAftRadius();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (radius > foreRadius) {
|
|
||||||
double area = Math.PI * (pow2(radius) - pow2(foreRadius));
|
|
||||||
double cd = base * area / conditions.getRefArea();
|
|
||||||
total += instanceCount * cd;
|
|
||||||
if ((forceMap != null) && (prevComponent != null)) {
|
|
||||||
forceMap.get(prevComponent).setBaseCD(cd);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// if I'm the last component, set my base CD
|
|
||||||
// note: the iterator *should* serve up the next component.... buuuut ....
|
|
||||||
// this code is tested, and there's no compelling reason to change.
|
|
||||||
final SymmetricComponent n = s.getNextSymmetricComponent();
|
|
||||||
if ((n == null) || !configuration.isStageActive(n.getStageNumber())) {
|
|
||||||
double area = Math.PI * pow2(aftRadius);
|
|
||||||
double cd = base * area / conditions.getRefArea();
|
double cd = base * area / conditions.getRefArea();
|
||||||
total += instanceCount * cd;
|
total += instanceCount * cd;
|
||||||
if (forceMap != null) {
|
if (forceMap != null) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user