Correct calculatePressureDrag() to iterate through all instances.
This commit is contained in:
parent
5483c3e659
commit
05185ff3d6
@ -402,7 +402,7 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
|
|||||||
!(c instanceof FinSet))
|
!(c instanceof FinSet))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// iterate across component instances
|
// iterate across component instances
|
||||||
final ArrayList<InstanceContext> contextList = entry.getValue();
|
final ArrayList<InstanceContext> contextList = entry.getValue();
|
||||||
for(InstanceContext context: contextList ) {
|
for(InstanceContext context: contextList ) {
|
||||||
|
|
||||||
@ -515,39 +515,46 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
|
|||||||
base = calculateBaseCD(conditions.getMach());
|
base = calculateBaseCD(conditions.getMach());
|
||||||
|
|
||||||
total = 0;
|
total = 0;
|
||||||
for (RocketComponent c : configuration.getActiveComponents()) {
|
final InstanceMap imap = configuration.getActiveInstances();
|
||||||
|
for(Map.Entry<RocketComponent, ArrayList<InstanceContext>> entry: imap.entrySet() ) {
|
||||||
|
final RocketComponent c = entry.getKey();
|
||||||
if (!c.isAerodynamic())
|
if (!c.isAerodynamic())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Pressure fore drag
|
|
||||||
double cd = calcMap.get(c).calculatePressureDragForce(conditions, stagnation, base,
|
|
||||||
warnings);
|
|
||||||
total += cd;
|
|
||||||
|
|
||||||
if (map != null) {
|
|
||||||
map.get(c).setPressureCD(cd);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(c.isCDOverridden()) continue;
|
|
||||||
|
|
||||||
|
// iterate across component instances
|
||||||
// Stagnation drag
|
final ArrayList<InstanceContext> contextList = entry.getValue();
|
||||||
if (c instanceof SymmetricComponent) {
|
for(InstanceContext context: contextList ) {
|
||||||
SymmetricComponent s = (SymmetricComponent) c;
|
|
||||||
|
|
||||||
if (radius < s.getForeRadius()) {
|
// Pressure fore drag
|
||||||
double area = Math.PI * (pow2(s.getForeRadius()) - pow2(radius));
|
double cd = calcMap.get(c).calculatePressureDragForce(conditions, stagnation, base,
|
||||||
cd = stagnation * area / conditions.getRefArea();
|
warnings);
|
||||||
total += cd;
|
total += cd;
|
||||||
if (map != null) {
|
|
||||||
map.get(c).setPressureCD(map.get(c).getPressureCD() + cd);
|
if (map != null) {
|
||||||
}
|
map.get(c).setPressureCD(cd);
|
||||||
}
|
}
|
||||||
|
|
||||||
radius = s.getAftRadius();
|
if(c.isCDOverridden()) continue;
|
||||||
|
|
||||||
|
|
||||||
|
// Stagnation drag
|
||||||
|
if (c instanceof SymmetricComponent) {
|
||||||
|
SymmetricComponent s = (SymmetricComponent) c;
|
||||||
|
|
||||||
|
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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return total;
|
return total;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -645,7 +645,7 @@ public class FinSetCalc extends RocketComponentCalc {
|
|||||||
// Airfoil assumed to have zero base drag
|
// Airfoil assumed to have zero base drag
|
||||||
|
|
||||||
// Scale to correct reference area
|
// Scale to correct reference area
|
||||||
drag *= finCount * span * thickness / conditions.getRefArea();
|
drag *= span * thickness / conditions.getRefArea();
|
||||||
|
|
||||||
return drag;
|
return drag;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user