Merge pull request #1677 from SiboVG/issue-1676
[#1676] Treat zero-length SymmetricComponent as tube/disk
This commit is contained in:
commit
77e49bbc87
@ -634,14 +634,19 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
|
||||
// base drag calculation
|
||||
if (c instanceof SymmetricComponent) {
|
||||
SymmetricComponent s = (SymmetricComponent) c;
|
||||
|
||||
double foreRadius = s.getForeRadius();
|
||||
double aftRadius = s.getAftRadius();
|
||||
// If length is zero, the component is a disk, i.e. a zero-length tube, so match the fore and aft diameter
|
||||
if (s.getLength() == 0) {
|
||||
foreRadius = Math.max(foreRadius, aftRadius);
|
||||
}
|
||||
double radius = 0;
|
||||
final SymmetricComponent prevComponent = s.getPreviousSymmetricComponent();
|
||||
if (prevComponent != null && configuration.isComponentActive(prevComponent))
|
||||
radius = prevComponent.getAftRadius();
|
||||
|
||||
if (radius < s.getForeRadius()) {
|
||||
double area = Math.PI * (pow2(s.getForeRadius()) - pow2(radius));
|
||||
if (radius < foreRadius) {
|
||||
double area = Math.PI * (pow2(foreRadius) - pow2(radius));
|
||||
cd = stagnation * area / conditions.getRefArea();
|
||||
total += instanceCount * cd;
|
||||
|
||||
@ -685,6 +690,13 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
|
||||
}
|
||||
|
||||
SymmetricComponent s = (SymmetricComponent) c;
|
||||
double foreRadius = s.getForeRadius();
|
||||
double aftRadius = s.getAftRadius();
|
||||
// If length is zero, the component is a disk, i.e. a zero-length tube, so match the fore and aft diameter
|
||||
if (s.getLength() == 0) {
|
||||
final double componentMaxR = Math.max(foreRadius, aftRadius);
|
||||
foreRadius = aftRadius = componentMaxR;
|
||||
}
|
||||
|
||||
int instanceCount = entry.getValue().size();
|
||||
|
||||
@ -701,8 +713,8 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
|
||||
radius = prevComponent.getAftRadius();
|
||||
}
|
||||
|
||||
if (radius > s.getForeRadius()) {
|
||||
double area = Math.PI * (pow2(radius) - pow2(s.getForeRadius()));
|
||||
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)) {
|
||||
@ -712,10 +724,10 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
|
||||
|
||||
// if I'm the last component, set my base CD
|
||||
// note: the iterator *should* serve up the next component.... buuuut ....
|
||||
// this code has is tested, and there's no compelling reason to change.
|
||||
// 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(s.getAftRadius());
|
||||
double area = Math.PI * pow2(aftRadius);
|
||||
double cd = base * area / conditions.getRefArea();
|
||||
total += instanceCount * cd;
|
||||
if (forceMap != null) {
|
||||
|
@ -56,8 +56,13 @@ public class SymmetricComponentCalc extends RocketComponentCalc {
|
||||
SymmetricComponent component = (SymmetricComponent) c;
|
||||
|
||||
length = component.getLength();
|
||||
foreRadius = component.getForeRadius();
|
||||
aftRadius = component.getAftRadius();
|
||||
if (length > 0) {
|
||||
foreRadius = component.getForeRadius();
|
||||
aftRadius = component.getAftRadius();
|
||||
} else { // If length is zero, the component is a disk, i.e. a zero-length tube, so match the fore and aft diameter
|
||||
final double componentMaxR = Math.max(component.getForeRadius(), component.getAftRadius());
|
||||
foreRadius = aftRadius = componentMaxR;
|
||||
}
|
||||
|
||||
fineness = length / (2 * Math.abs(aftRadius - foreRadius));
|
||||
fullVolume = component.getFullVolume();
|
||||
|
@ -311,14 +311,16 @@ public abstract class SymmetricComponent extends BodyComponent implements BoxBou
|
||||
private void integrate() {
|
||||
double x, r1, r2;
|
||||
double cgx;
|
||||
|
||||
|
||||
wetArea = 0;
|
||||
planArea = 0;
|
||||
planCenter = 0;
|
||||
fullVolume = 0;
|
||||
volume = 0;
|
||||
cg = Coordinate.NUL;
|
||||
|
||||
// Check length > 0
|
||||
if (length <= 0) {
|
||||
wetArea = 0;
|
||||
planArea = 0;
|
||||
planCenter = 0;
|
||||
volume = 0;
|
||||
cg = Coordinate.NUL;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -329,11 +331,6 @@ public abstract class SymmetricComponent extends BodyComponent implements BoxBou
|
||||
final double pi3 = Math.PI / 3.0;
|
||||
r1 = getRadius(0);
|
||||
x = 0;
|
||||
wetArea = 0;
|
||||
planArea = 0;
|
||||
planCenter = 0;
|
||||
fullVolume = 0;
|
||||
volume = 0;
|
||||
cgx = 0;
|
||||
|
||||
for (int n = 1; n <= DIVISIONS; n++) {
|
||||
@ -422,15 +419,18 @@ public abstract class SymmetricComponent extends BodyComponent implements BoxBou
|
||||
*/
|
||||
private void integrateInertiaVolume() {
|
||||
double x, r1, r2;
|
||||
|
||||
|
||||
longitudinalInertia = 0;
|
||||
rotationalInertia = 0;
|
||||
|
||||
if (length <= 0) return;
|
||||
|
||||
final double l = length / DIVISIONS;
|
||||
final double pil = Math.PI * l; // PI * l
|
||||
final double pil3 = Math.PI * l / 3; // PI * l/3
|
||||
|
||||
r1 = getRadius(0);
|
||||
x = 0;
|
||||
longitudinalInertia = 0;
|
||||
rotationalInertia = 0;
|
||||
|
||||
double vol = 0;
|
||||
|
||||
@ -489,16 +489,17 @@ public abstract class SymmetricComponent extends BodyComponent implements BoxBou
|
||||
*/
|
||||
private void integrateInertiaSurface() {
|
||||
double x, r1, r2;
|
||||
|
||||
|
||||
longitudinalInertia = 0;
|
||||
rotationalInertia = 0;
|
||||
|
||||
if (length <= 0) return;
|
||||
|
||||
final double l = length / DIVISIONS;
|
||||
|
||||
r1 = getRadius(0);
|
||||
//System.out.println(r1);
|
||||
x = 0;
|
||||
|
||||
longitudinalInertia = 0;
|
||||
rotationalInertia = 0;
|
||||
|
||||
double surface = 0;
|
||||
|
||||
for (int n = 1; n <= DIVISIONS; n++) {
|
||||
|
@ -479,7 +479,7 @@ public class Transition extends SymmetricComponent implements InsideColorCompone
|
||||
public double getRadius(double x) {
|
||||
if ( x < 0 )
|
||||
return getForeRadius();
|
||||
if ( x > length)
|
||||
if ( x >= length)
|
||||
return getAftRadius();
|
||||
|
||||
double r1 = getForeRadius();
|
||||
|
Loading…
x
Reference in New Issue
Block a user