From 54f954fd02476d3492fe2d1e30e72dddaf5eac2a Mon Sep 17 00:00:00 2001 From: Colin Douglas Howell Date: Mon, 12 May 2014 19:07:10 -0700 Subject: [PATCH] Fix for issue 1463 (YASim underestimates off-axis aerodynamic forces on fuselages) Change the drag coefficient for fuselages along the Y and Z axes (i.e. perpendicular to the fuselage's main axis) to use a fixed value of 0.5. (The value can still be adjusted using the fuselage's "cy" and "cz" XML attributes.) For the Y-axis and Z-axis drag on fuselages, YASim originally used a drag coefficient equal to: (solver drag factor) * (fuselage length/width ratio) This value turns out to be way too small for well-streamlined aircraft, even those with long, narrow fuselages, and especially so for those with short, stubby fuselages. Such fuselages are streamlined in the X direction, but not along Y or Z. 0.5 is only a ballpark estimate, but it's reasonably close for the common case of a fairly long fuselage with a round cross section. For flat-sided fuselages, a larger value should be used, up to a maximum of 2 for a slab-sided block. For short fuselages, the value should be reduced to account for end effects. The fuselage's "cy" and "cz" XML attributes can be modified to make such adjustments. This fix won't affect straight flight much, but it should have a strong impact on some maneuvers. For example, it will make slips more effective and may make knife-edge flight easier on aerobatic aircraft which should be capable of it. Only aircraft which specify version="YASIM_VERSION_32" or newer are affected. --- src/FDM/YASim/Airplane.cpp | 40 +++++++++++++++++++++++++++++++++++++- src/FDM/YASim/Surface.cpp | 5 +++++ src/FDM/YASim/Surface.hpp | 1 + 3 files changed, 45 insertions(+), 1 deletion(-) diff --git a/src/FDM/YASim/Airplane.cpp b/src/FDM/YASim/Airplane.cpp index 3371fa7dc..2665eb1f9 100644 --- a/src/FDM/YASim/Airplane.cpp +++ b/src/FDM/YASim/Airplane.cpp @@ -553,7 +553,31 @@ float Airplane::compileFuselage(Fuselage* f) // Make a Surface too Surface* s = new Surface(this); s->setPosition(pos); + + // The following is the original YASim value for sideDrag. + // Originally YASim calculated the fuselage's lateral drag + // coefficient as (solver drag factor) * (len/wid). + // However, this greatly underestimates a fuselage's lateral drag. float sideDrag = len/wid; + + if ( isVersionOrNewer( YASIM_VERSION_32 ) ) { + // New YASim assumes a fixed lateral drag coefficient of 0.5. + // This will not be multiplied by the solver drag factor, because + // that factor is tuned to match the drag in the direction of + // flight, which is completely independent of lateral drag. + // The value of 0.5 is only a ballpark estimate, roughly matching + // the side-on drag for a long cylinder at the higher Reynolds + // numbers typical for an aircraft's lateral drag. + // This fits if the fuselage is long and has a round cross section. + // For flat-sided fuselages, the value should be increased, up to + // a limit of around 2 for a long rectangular prism. + // For very short fuselages, in which the end effects are strong, + // the value should be reduced. + // Such adjustments can be made using the fuselage's "cy" and "cz" + // XML parameters: "cy" for the sides, "cz" for top and bottom. + sideDrag = 0.5; + } + if( isVersionOrNewer( YASIM_VERSION_32 ) ) { s->setXDrag(f->_cx); } @@ -920,7 +944,21 @@ void Airplane::applyDragFactor(float factor) int j; for(j=0; jsurfs.size(); j++) { Surface* s = (Surface*)f->surfs.get(j); - s->setTotalDrag(s->getTotalDrag() * applied); + if( isVersionOrNewer( YASIM_VERSION_32 ) ) { + // For new YASim, the solver drag factor is only applied to + // the X axis for Fuselage Surfaces. + // The solver is tuning the coefficient for longitudinal drag, + // along the direction of flight. A fuselage's lateral drag + // is completely independent and is normally much higher; + // it won't be affected by the streamlining done to reduce + // longitudinal drag. So the solver should only adjust the + // fuselage's longitudinal (X axis) drag coefficient. + s->setXDrag(s->getXDrag() * applied); + } else { + // Originally YASim applied the drag factor to all axes + // for Fuselage Surfaces. + s->setTotalDrag(s->getTotalDrag() * applied); + } } } for(i=0; i<_weights.size(); i++) { diff --git a/src/FDM/YASim/Surface.cpp b/src/FDM/YASim/Surface.cpp index df5fcf247..88e4a07a8 100644 --- a/src/FDM/YASim/Surface.cpp +++ b/src/FDM/YASim/Surface.cpp @@ -74,6 +74,11 @@ void Surface::setZDrag(float cz) _cz = cz; } +float Surface::getXDrag() +{ + return _cx; +} + void Surface::setBaseZDrag(float cz0) { _cz0 = cz0; diff --git a/src/FDM/YASim/Surface.hpp b/src/FDM/YASim/Surface.hpp index 4f128f374..3679ab4ce 100644 --- a/src/FDM/YASim/Surface.hpp +++ b/src/FDM/YASim/Surface.hpp @@ -57,6 +57,7 @@ public: void setXDrag(float cx); void setYDrag(float cy); void setZDrag(float cz); + float getXDrag(); // zero-alpha Z drag ("camber") specified as a fraction of cz void setBaseZDrag(float cz0); -- 2.39.5