Correct calculateFrictionDrag() to iterate through all instances of components
This commit is contained in:
parent
af3d226b2b
commit
5483c3e659
@ -393,13 +393,19 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
|
||||
double[] roughnessLimited = new double[Finish.values().length];
|
||||
Arrays.fill(roughnessLimited, Double.NaN);
|
||||
|
||||
for (RocketComponent c : configuration.getActiveComponents()) {
|
||||
final InstanceMap imap = configuration.getActiveInstances();
|
||||
for(Map.Entry<RocketComponent, ArrayList<InstanceContext>> entry: imap.entrySet() ) {
|
||||
final RocketComponent c = entry.getKey();
|
||||
|
||||
// Consider only SymmetricComponents and FinSets:
|
||||
if (!(c instanceof SymmetricComponent) &&
|
||||
!(c instanceof FinSet))
|
||||
continue;
|
||||
|
||||
// iterate across component instances
|
||||
final ArrayList<InstanceContext> contextList = entry.getValue();
|
||||
for(InstanceContext context: contextList ) {
|
||||
|
||||
// Calculate the roughness-limited friction coefficient
|
||||
Finish finish = ((ExternalComponent) c).getFinish();
|
||||
if (Double.isNaN(roughnessLimited[finish.ordinal()])) {
|
||||
@ -458,7 +464,7 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
|
||||
FinSet f = (FinSet) c;
|
||||
double mac = ((FinSetCalc) calcMap.get(c)).getMACLength();
|
||||
double cd = componentCf * (1 + 2 * f.getThickness() / mac) *
|
||||
2 * f.getFinCount() * f.getPlanformArea();
|
||||
2 * f.getPlanformArea();
|
||||
finFriction += cd;
|
||||
|
||||
if (map != null) {
|
||||
@ -467,9 +473,9 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// fB may be POSITIVE_INFINITY, but that's ok for us
|
||||
double fB = (len + 0.0001) / maxR;
|
||||
double correction = (1 + 1.0 / (2 * fB));
|
||||
@ -483,8 +489,6 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
return (finFriction + correction * bodyFriction) / conditions.getRefArea();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user