Create RocketComponentCalc::calculateFrictionCD()

Move actual friction CD calculation code into subclasses of RocketComponentCalc()

LaunchLugCalc adds so little wetted area it isn't worth bothering with, so isn't calculated (wasn't calculated before, either)

TubeFinSetCalc also doesn't calculate it; that's coming next.
This commit is contained in:
JoePfeiffer 2022-04-05 19:30:10 -06:00
parent 56949560c4
commit 632b48f8df
6 changed files with 53 additions and 31 deletions

View File

@ -323,7 +323,7 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
* @return friction drag for entire rocket * @return friction drag for entire rocket
*/ */
private double calculateFrictionCD(FlightConfiguration configuration, FlightConditions conditions, private double calculateFrictionCD(FlightConfiguration configuration, FlightConditions conditions,
Map<RocketComponent, AerodynamicForces> map, WarningSet set) { Map<RocketComponent, AerodynamicForces> map, WarningSet warningSet) {
double mach = conditions.getMach(); double mach = conditions.getMach();
double Re = calculateReynoldsNumber(configuration, conditions); double Re = calculateReynoldsNumber(configuration, conditions);
@ -341,8 +341,8 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
* for thickness as we go on. * for thickness as we go on.
*/ */
double finFriction = 0; double finFrictionCD = 0;
double bodyFriction = 0; double bodyFrictionCD = 0;
double maxR = 0, minX = Double.MAX_VALUE, maxX = 0; double maxR = 0, minX = Double.MAX_VALUE, maxX = 0;
double[] roughnessLimited = new double[Finish.values().length]; double[] roughnessLimited = new double[Finish.values().length];
@ -352,7 +352,10 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
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();
//Handle Overriden CD for Whole Rocket if (!c.isAerodynamic())
continue;
// Handle Overriden CD for Whole Rocket
if(c.isCDOverridden()) { if(c.isCDOverridden()) {
continue; continue;
} }
@ -389,20 +392,11 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
// 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 ) {
double componentFrictionCD = calcMap.get(c).calculateFrictionCD(conditions, componentCf, warningSet);
// Calculate the friction drag:
if (c instanceof SymmetricComponent) { if (c instanceof SymmetricComponent) {
SymmetricComponent s = (SymmetricComponent) c; SymmetricComponent s = (SymmetricComponent) c;
bodyFrictionCD += componentFrictionCD;
bodyFriction += componentCf * s.getComponentWetArea();
if (map != null) {
// Corrected later
map.get(c).setFrictionCD(componentCf * s.getComponentWetArea()
/ conditions.getRefArea());
}
final double componentMinX = context.getLocation().x; final double componentMinX = context.getLocation().x;
minX = Math.min(minX, componentMinX); minX = Math.min(minX, componentMinX);
@ -414,16 +408,11 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
maxR = Math.max(maxR, componentMaxR); maxR = Math.max(maxR, componentMaxR);
} else if (c instanceof FinSet) { } else if (c instanceof FinSet) {
finFrictionCD += componentFrictionCD;
}
FinSet f = (FinSet) c; if (map != null) {
double mac = ((FinSetCalc) calcMap.get(c)).getMACLength(); map.get(c).setFrictionCD(componentFrictionCD);
double cd = componentCf * (1 + 2 * f.getThickness() / mac) *
2 * f.getPlanformArea();
finFriction += cd;
if (map != null) {
map.get(c).setFrictionCD(cd / conditions.getRefArea());
}
} }
} }
} }
@ -441,7 +430,7 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
} }
} }
return (finFriction + correction * bodyFriction) / conditions.getRefArea(); return finFrictionCD + correction * bodyFrictionCD;
} }

View File

@ -622,6 +622,12 @@ public class FinSetCalc extends RocketComponentCalc {
// //
// } // }
@Override
public double calculateFrictionCD(FlightConditions conditions, double componentCf, WarningSet warnings) {
double cd = componentCf * (1 + 2 * thickness / macLength) * 2;
return cd;
}
@Override @Override
public double calculatePressureCD(FlightConditions conditions, public double calculatePressureCD(FlightConditions conditions,
double stagnationCD, double baseCD, WarningSet warnings) { double stagnationCD, double baseCD, WarningSet warnings) {

View File

@ -30,6 +30,12 @@ public class LaunchLugCalc extends RocketComponentCalc {
// Nothing to be done // Nothing to be done
} }
@Override
public double calculateFrictionCD(FlightConditions conditions, double componentCf, WarningSet warnings) {
// launch lug doesn't add enough area to worry about
return 0;
}
@Override @Override
public double calculatePressureCD(FlightConditions conditions, public double calculatePressureCD(FlightConditions conditions,
double stagnationCD, double baseCD, WarningSet warnings) { double stagnationCD, double baseCD, WarningSet warnings) {

View File

@ -29,6 +29,16 @@ public abstract class RocketComponentCalc {
AerodynamicForces forces, WarningSet warnings); AerodynamicForces forces, WarningSet warnings);
/**
* Calculates the friction drag of the component.
*
* @param conditions the flight conditions
* @param componentCF component coefficient of friction, calculated in BarrowmanCalculator
* @param warnings set in which to to store possible warnings
* @return the friction drag coefficient of the component
*/
public abstract double calculateFrictionCD(FlightConditions conditions, double componentCf, WarningSet warnings);
/** /**
* Calculates the pressure drag of the component. This component does NOT include * Calculates the pressure drag of the component. This component does NOT include
* the effect of discontinuities in the rocket body. * the effect of discontinuities in the rocket body.
@ -37,7 +47,7 @@ public abstract class RocketComponentCalc {
* @param stagnationCD the current stagnation drag coefficient * @param stagnationCD the current stagnation drag coefficient
* @param baseCD the current base drag coefficient * @param baseCD the current base drag coefficient
* @param warnings set in which to store possible warnings * @param warnings set in which to store possible warnings
* @return the pressure drag of the component * @return the pressure drag coefficient of the component
*/ */
public abstract double calculatePressureCD(FlightConditions conditions, public abstract double calculatePressureCD(FlightConditions conditions,
double stagnationCD, double baseCD, WarningSet warnings); double stagnationCD, double baseCD, WarningSet warnings);

View File

@ -45,6 +45,7 @@ public class SymmetricComponentCalc extends RocketComponentCalc {
private final double frontalArea; private final double frontalArea;
private final double fullVolume; private final double fullVolume;
private final double planformArea, planformCenter; private final double planformArea, planformCenter;
private final double wetArea;
private final double sinphi; private final double sinphi;
public SymmetricComponentCalc(RocketComponent c) { public SymmetricComponentCalc(RocketComponent c) {
@ -54,7 +55,6 @@ public class SymmetricComponentCalc extends RocketComponentCalc {
} }
SymmetricComponent component = (SymmetricComponent) c; SymmetricComponent component = (SymmetricComponent) c;
length = component.getLength(); length = component.getLength();
foreRadius = component.getForeRadius(); foreRadius = component.getForeRadius();
aftRadius = component.getAftRadius(); aftRadius = component.getAftRadius();
@ -64,6 +64,8 @@ public class SymmetricComponentCalc extends RocketComponentCalc {
planformArea = component.getComponentPlanformArea(); planformArea = component.getComponentPlanformArea();
planformCenter = component.getComponentPlanformCenter(); planformCenter = component.getComponentPlanformCenter();
wetArea = component.getComponentWetArea();
if (component instanceof BodyTube) { if (component instanceof BodyTube) {
shape = null; shape = null;
param = 0; param = 0;
@ -174,7 +176,10 @@ public class SymmetricComponentCalc extends RocketComponentCalc {
conditions.getSinAOA() * conditions.getSincAOA()); // sin(aoa)^2 / aoa conditions.getSinAOA() * conditions.getSincAOA()); // sin(aoa)^2 / aoa
} }
@Override
public double calculateFrictionCD(FlightConditions conditions, double componentCf, WarningSet warningSet) {
return componentCf * wetArea / conditions.getRefArea();
}
private LinearInterpolator interpolator = null; private LinearInterpolator interpolator = null;

View File

@ -673,4 +673,10 @@ public class TubeFinSetCalc extends RocketComponentCalc {
return 3 * component.getFinCount(); return 3 * component.getFinCount();
} }
@Override
public double calculateFrictionCD(FlightConditions conditions, double componentCf, WarningSet warnings) {
// launch lug doesn't add enough area to worry about
return 0;
}
} }