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
|
// base drag calculation
|
||||||
if (c instanceof SymmetricComponent) {
|
if (c instanceof SymmetricComponent) {
|
||||||
SymmetricComponent s = (SymmetricComponent) c;
|
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;
|
double radius = 0;
|
||||||
final SymmetricComponent prevComponent = s.getPreviousSymmetricComponent();
|
final SymmetricComponent prevComponent = s.getPreviousSymmetricComponent();
|
||||||
if (prevComponent != null && configuration.isComponentActive(prevComponent))
|
if (prevComponent != null && configuration.isComponentActive(prevComponent))
|
||||||
radius = prevComponent.getAftRadius();
|
radius = prevComponent.getAftRadius();
|
||||||
|
|
||||||
if (radius < s.getForeRadius()) {
|
if (radius < foreRadius) {
|
||||||
double area = Math.PI * (pow2(s.getForeRadius()) - pow2(radius));
|
double area = Math.PI * (pow2(foreRadius) - pow2(radius));
|
||||||
cd = stagnation * area / conditions.getRefArea();
|
cd = stagnation * area / conditions.getRefArea();
|
||||||
total += instanceCount * cd;
|
total += instanceCount * cd;
|
||||||
|
|
||||||
@ -685,6 +690,13 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SymmetricComponent s = (SymmetricComponent) c;
|
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();
|
int instanceCount = entry.getValue().size();
|
||||||
|
|
||||||
@ -701,8 +713,8 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
|
|||||||
radius = prevComponent.getAftRadius();
|
radius = prevComponent.getAftRadius();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (radius > s.getForeRadius()) {
|
if (radius > foreRadius) {
|
||||||
double area = Math.PI * (pow2(radius) - pow2(s.getForeRadius()));
|
double area = Math.PI * (pow2(radius) - pow2(foreRadius));
|
||||||
double cd = base * area / conditions.getRefArea();
|
double cd = base * area / conditions.getRefArea();
|
||||||
total += instanceCount * cd;
|
total += instanceCount * cd;
|
||||||
if ((forceMap != null) && (prevComponent != null)) {
|
if ((forceMap != null) && (prevComponent != null)) {
|
||||||
@ -712,10 +724,10 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
|
|||||||
|
|
||||||
// if I'm the last component, set my base CD
|
// if I'm the last component, set my base CD
|
||||||
// note: the iterator *should* serve up the next component.... buuuut ....
|
// 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();
|
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(aftRadius);
|
||||||
double cd = base * area / conditions.getRefArea();
|
double cd = base * area / conditions.getRefArea();
|
||||||
total += instanceCount * cd;
|
total += instanceCount * cd;
|
||||||
if (forceMap != null) {
|
if (forceMap != null) {
|
||||||
|
@ -56,8 +56,13 @@ public class SymmetricComponentCalc extends RocketComponentCalc {
|
|||||||
SymmetricComponent component = (SymmetricComponent) c;
|
SymmetricComponent component = (SymmetricComponent) c;
|
||||||
|
|
||||||
length = component.getLength();
|
length = component.getLength();
|
||||||
|
if (length > 0) {
|
||||||
foreRadius = component.getForeRadius();
|
foreRadius = component.getForeRadius();
|
||||||
aftRadius = component.getAftRadius();
|
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));
|
fineness = length / (2 * Math.abs(aftRadius - foreRadius));
|
||||||
fullVolume = component.getFullVolume();
|
fullVolume = component.getFullVolume();
|
||||||
|
@ -312,13 +312,15 @@ public abstract class SymmetricComponent extends BodyComponent implements BoxBou
|
|||||||
double x, r1, r2;
|
double x, r1, r2;
|
||||||
double cgx;
|
double cgx;
|
||||||
|
|
||||||
// Check length > 0
|
|
||||||
if (length <= 0) {
|
|
||||||
wetArea = 0;
|
wetArea = 0;
|
||||||
planArea = 0;
|
planArea = 0;
|
||||||
planCenter = 0;
|
planCenter = 0;
|
||||||
|
fullVolume = 0;
|
||||||
volume = 0;
|
volume = 0;
|
||||||
cg = Coordinate.NUL;
|
cg = Coordinate.NUL;
|
||||||
|
|
||||||
|
// Check length > 0
|
||||||
|
if (length <= 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -329,11 +331,6 @@ public abstract class SymmetricComponent extends BodyComponent implements BoxBou
|
|||||||
final double pi3 = Math.PI / 3.0;
|
final double pi3 = Math.PI / 3.0;
|
||||||
r1 = getRadius(0);
|
r1 = getRadius(0);
|
||||||
x = 0;
|
x = 0;
|
||||||
wetArea = 0;
|
|
||||||
planArea = 0;
|
|
||||||
planCenter = 0;
|
|
||||||
fullVolume = 0;
|
|
||||||
volume = 0;
|
|
||||||
cgx = 0;
|
cgx = 0;
|
||||||
|
|
||||||
for (int n = 1; n <= DIVISIONS; n++) {
|
for (int n = 1; n <= DIVISIONS; n++) {
|
||||||
@ -423,14 +420,17 @@ public abstract class SymmetricComponent extends BodyComponent implements BoxBou
|
|||||||
private void integrateInertiaVolume() {
|
private void integrateInertiaVolume() {
|
||||||
double x, r1, r2;
|
double x, r1, r2;
|
||||||
|
|
||||||
|
longitudinalInertia = 0;
|
||||||
|
rotationalInertia = 0;
|
||||||
|
|
||||||
|
if (length <= 0) return;
|
||||||
|
|
||||||
final double l = length / DIVISIONS;
|
final double l = length / DIVISIONS;
|
||||||
final double pil = Math.PI * l; // PI * l
|
final double pil = Math.PI * l; // PI * l
|
||||||
final double pil3 = Math.PI * l / 3; // PI * l/3
|
final double pil3 = Math.PI * l / 3; // PI * l/3
|
||||||
|
|
||||||
r1 = getRadius(0);
|
r1 = getRadius(0);
|
||||||
x = 0;
|
x = 0;
|
||||||
longitudinalInertia = 0;
|
|
||||||
rotationalInertia = 0;
|
|
||||||
|
|
||||||
double vol = 0;
|
double vol = 0;
|
||||||
|
|
||||||
@ -490,15 +490,16 @@ public abstract class SymmetricComponent extends BodyComponent implements BoxBou
|
|||||||
private void integrateInertiaSurface() {
|
private void integrateInertiaSurface() {
|
||||||
double x, r1, r2;
|
double x, r1, r2;
|
||||||
|
|
||||||
|
longitudinalInertia = 0;
|
||||||
|
rotationalInertia = 0;
|
||||||
|
|
||||||
|
if (length <= 0) return;
|
||||||
|
|
||||||
final double l = length / DIVISIONS;
|
final double l = length / DIVISIONS;
|
||||||
|
|
||||||
r1 = getRadius(0);
|
r1 = getRadius(0);
|
||||||
//System.out.println(r1);
|
|
||||||
x = 0;
|
x = 0;
|
||||||
|
|
||||||
longitudinalInertia = 0;
|
|
||||||
rotationalInertia = 0;
|
|
||||||
|
|
||||||
double surface = 0;
|
double surface = 0;
|
||||||
|
|
||||||
for (int n = 1; n <= DIVISIONS; n++) {
|
for (int n = 1; n <= DIVISIONS; n++) {
|
||||||
|
@ -479,7 +479,7 @@ public class Transition extends SymmetricComponent implements InsideColorCompone
|
|||||||
public double getRadius(double x) {
|
public double getRadius(double x) {
|
||||||
if ( x < 0 )
|
if ( x < 0 )
|
||||||
return getForeRadius();
|
return getForeRadius();
|
||||||
if ( x > length)
|
if ( x >= length)
|
||||||
return getAftRadius();
|
return getAftRadius();
|
||||||
|
|
||||||
double r1 = getForeRadius();
|
double r1 = getForeRadius();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user