コード例 #1
0
        /// <summary>
        /// Compute the Aerodynamic Influence Coefficienf matrix element w_ij, representing the influence a wing tile j is exerting on the location i.
        /// </summary>
        /// <param name="ri">The position vector of the point being influenced by tile j.</param>
        /// <param name="j">The tile whose horse-shoe vortex is influencing point i.</param>
        /// <returns>The vector indicating in which direction a given horse-shoe vortex is contributing velocity.</returns>
        public static Vector Wij(Vector ri, WingTile j)
        {
            Vector xHat = new Vector(new double[] { 1, 0, 0 });
            Vector a    = ri - j.RA;
            Vector b    = ri - j.RB;

            return((Vector.Cross(a, b) * (1 / a.Mag + 1 / b.Mag) / (a.Mag * b.Mag + a * b) + Vector.Cross(a, xHat) / ((a.Mag - a * xHat) * a.Mag) - Vector.Cross(b, xHat) / ((b.Mag - b * xHat) * b.Mag)) / (4 * Math.PI));
        }
コード例 #2
0
        /// <summary>
        /// Generates an array of wingtiles.
        /// </summary>
        /// <param name="camberLine">The camber line represented by a 2-dimensional array of points.</param>
        /// <param name="chord">The wing chord length.</param>
        /// <param name="wingSpan">The wingspan.</param>
        /// <param name="numOfTilesSpanwise">Number of tiles spanwise.</param>
        /// <returns>The generated array of wingtiles.</returns>
        public static WingTile[] GetWingTiles(double[,] camberLine, double chord, double wingSpan, int numOfTilesSpanwise)
        {
            double tileWidth = wingSpan / numOfTilesSpanwise;

            WingTile[] wingTiles = new WingTile[numOfTilesSpanwise * (camberLine.GetLength(0) - 1)];
            int        index     = 0;

            for (int i = 0; i < numOfTilesSpanwise; i++)
            {
                // camberLine already has the desired amount of points
                for (int j = 0; j < camberLine.GetLength(0) - 1; j++)
                {
                    // x - chordwise (backwards)
                    // y - spanwise (to the right)
                    // z - normal (upwards)

                    wingTiles[index++] = new WingTile(new Vector(new double[] {
                        chord *camberLine[j, 0],
                        i *tileWidth,
                        chord *camberLine[j, 1]
                    }),
                                                      new Vector(new double[] {
                        chord *camberLine[j, 0],
                        (i + 1) * tileWidth,
                        chord * camberLine[j, 1]
                    }),
                                                      new Vector(new double[] {
                        chord *camberLine[j + 1, 0],
                        i *tileWidth,
                        chord *camberLine[j + 1, 1]
                    })
                                                      );
                }
            }
            return(wingTiles);
        }