[#1440] Add all context drags to component drag

This commit is contained in:
SiboVG 2022-06-30 14:45:53 +02:00
parent 54f8276c53
commit 5dee382961

View File

@ -390,6 +390,7 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
} }
// iterate across component instances // iterate across component instances
double componentFrictionCDTotal = 0; // Total friction drag of the component
final ArrayList<InstanceContext> contextList = entry.getValue(); final ArrayList<InstanceContext> contextList = entry.getValue();
for(InstanceContext context: contextList ) { for(InstanceContext context: contextList ) {
double componentFrictionCD = calcMap.get(c).calculateFrictionCD(conditions, componentCf, warningSet); double componentFrictionCD = calcMap.get(c).calculateFrictionCD(conditions, componentCf, warningSet);
@ -411,9 +412,11 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
otherFrictionCD += componentFrictionCD; otherFrictionCD += componentFrictionCD;
} }
if (map != null) { componentFrictionCDTotal += componentFrictionCD;
map.get(c).setFrictionCD(componentFrictionCD); }
}
if (map != null) {
map.get(c).setFrictionCD(componentFrictionCDTotal);
} }
} }
@ -590,17 +593,17 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
continue; continue;
// iterate across component instances // iterate across component instances
double pressureCDTotal = 0; // Total pressure drag for this component
final ArrayList<InstanceContext> contextList = entry.getValue(); final ArrayList<InstanceContext> contextList = entry.getValue();
for(InstanceContext context: contextList ) { for(InstanceContext context: contextList ) {
// Pressure drag // Pressure drag
double cd = calcMap.get(c).calculatePressureCD(conditions, stagnation, base, double pressureCD = calcMap.get(c).calculatePressureCD(conditions, stagnation, base,
warningSet); warningSet);
total += cd; pressureCDTotal += pressureCD;
if (forceMap != null) { // Total pressure drag of the rocket
forceMap.get(c).setPressureCD(cd); total += pressureCD;
}
if(c.isCDOverridden()) if(c.isCDOverridden())
continue; continue;
@ -616,15 +619,16 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
if (radius < s.getForeRadius()) { if (radius < s.getForeRadius()) {
double area = Math.PI * (pow2(s.getForeRadius()) - pow2(radius)); double area = Math.PI * (pow2(s.getForeRadius()) - pow2(radius));
cd = stagnation * area / conditions.getRefArea(); pressureCD = stagnation * area / conditions.getRefArea();
total += cd; pressureCDTotal += pressureCD;
total += pressureCD;
if (forceMap != null) {
forceMap.get(c).setPressureCD(forceMap.get(c).getPressureCD() + cd);
}
} }
} }
} }
if (forceMap != null) {
forceMap.get(c).setPressureCD(pressureCDTotal);
}
} }
return total; return total;
@ -678,10 +682,10 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
if (radius > s.getForeRadius()) { if (radius > s.getForeRadius()) {
double area = Math.PI * (pow2(radius) - pow2(s.getForeRadius())); double area = Math.PI * (pow2(radius) - pow2(s.getForeRadius()));
double cd = base * area / conditions.getRefArea(); double baseCD = base * area / conditions.getRefArea();
total += cd; total += baseCD;
if ((map != null) && (prevComponent != null)) { if ((map != null) && (prevComponent != null)) {
map.get(prevComponent).setBaseCD(cd); map.get(prevComponent).setBaseCD(baseCD);
} }
} }
@ -691,10 +695,10 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
final SymmetricComponent n = s.getNextSymmetricComponent(); final SymmetricComponent n = s.getNextSymmetricComponent();
if ((n == null) || !configuration.isStageActive(n.getStageNumber())) { if ((n == null) || !configuration.isStageActive(n.getStageNumber())) {
double area = Math.PI * pow2(s.getAftRadius()); double area = Math.PI * pow2(s.getAftRadius());
double cd = base * area / conditions.getRefArea(); double baseCD = base * area / conditions.getRefArea();
total += cd; total += baseCD;
if (map != null) { if (map != null) {
map.get(s).setBaseCD(cd); map.get(s).setBaseCD(baseCD);
} }
} }
} }