001/*
002*   NACA6ASeries -- An arbitrary NACA 6*A series airfoil.
003*
004*   Copyright (C) 2010-2013 by Joseph A. Huwaldt
005*   All rights reserved.
006*   
007*   This library is free software; you can redistribute it and/or
008*   modify it under the terms of the GNU Lesser General Public
009*   License as published by the Free Software Foundation; either
010*   version 2.1 of the License, or (at your option) any later version.
011*   
012*   This library is distributed in the hope that it will be useful,
013*   but WITHOUT ANY WARRANTY; without even the implied warranty of
014*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
015*   Lesser General Public License for more details.
016*
017*   You should have received a copy of the GNU Lesser General Public License
018*   along with this program; if not, write to the Free Software
019*   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
020*   Or visit:  http://www.gnu.org/licenses/lgpl.html
021**/
022package jahuwaldt.aero.airfoils;
023
024
025/**
026*  <p> This class represents an arbitrary NACA 6*A series
027*      airfoil section such as a NACA 63A-020 airfoil.
028*  </p>
029*
030*  <p> Ported from FORTRAN "NACA6.FOR" to Java by:
031*                Joseph A. Huwaldt, June 3, 2010     </p>
032*
033*  <p> Original FORTRAN "NACA4" code had the following note:  </p>
034*
035*  <pre>
036*         AUTHORS - Charles L.Ladson and Cuyler W. Brooks, NASA Langley
037*                   Liam Hardy, NASA Ames
038*                   Ralph Carmichael, Public Domain Aeronautical Software
039*         Last FORTRAN version:  23Nov96  2.0   RLC
040*
041*         NOTES - This program has also been known as LADSON and SIXSERIES and
042*                 as SIXSERIE on systems with a 8-letter name limit.
043*         REFERENCES-  NASA Technical Memorandum TM X-3069 (September, 1974),
044*                      by Charles L. Ladson and Cuyler W. Brooks, Jr., NASA Langley Research Center.
045*
046*                      "Theory of Wing Sections", by Ira Abbott and Albert Von Doenhoff.
047*  </pre>
048*
049*  <p>  Modified by:  Joseph A. Huwaldt  </p>
050*
051*  @author  Joseph A. Huwaldt   Date:  June 5, 2010
052*  @version March 7, 2013
053**/
054public abstract class NACA6ASeries extends NACA6Series {
055        
056        /**
057        *  Create a NACA 6*A series airfoil with the specified parameters.
058        *
059        *  @param  CLi        Design lift coefficient (e.g.: 63A-206 has CLi = 0.2).
060        *  @param  thickness  The thickness to chord ratio (e.g.: 0.20 ==> 20% t/c).
061        *  @param  length     The chord length.
062        **/
063        public NACA6ASeries(double CLi, double thickness, double length) {
064                super(CLi, thickness, length);
065        }
066        
067        //-----------------------------------------------------------------------------------
068        
069        /**
070        *  Method used by 6*A series airfoils to modify the camber line.
071        *  The default implementation simply returns the inputs as outputs
072        *  and returns false.
073        *
074        *  @param x     The current x/c being calculated.
075        *  @param if6xa Flag indicating if 6*A specific calculations have been enabled.
076        *  @param ycmb  The y position of the camber line.
077        *  @param tanth The slope of the camber line.
078        *  @param ycp2  ?
079        *  @param cli   The design lift coefficient.
080        *  @param outputs  An existing 3-element array filled in with
081        *                  outputs: outputs[ycmb, tanth, ycp2].
082        *  @return true if this is a 6*A series airfoil, false if it is not.
083        **/
084    @Override
085        protected final boolean modCamberLine(double x, boolean if6xa, double ycmb, double tanth, double ycp2, double cli, double[] outputs) {
086                ycmb *= 0.97948;
087                tanth *= 0.97948;
088                if ( tanth <= -.24521*cli )     {
089                        ycmb = 0.24521*cli*(1.-x);
090                        ycp2 = 0.0;
091                        tanth = -0.24521*cli;
092                        if6xa = true;
093                }
094                outputs[0] = ycmb;
095                outputs[1] = tanth;
096                outputs[2] = ycp2;
097                return if6xa;
098        }
099        
100        
101        private transient double s1=0, s2=0, b1=0, b2=0;
102        /**
103        *  Method used by 6*A series airfoils to modify the airfoil trailing edge.
104        *  The default implementation simply returns the input yu and yl values.
105        *
106        *  @param x  The x/c location being calculated.
107        *  @param xu The x/c location of the upper surface ordinate.
108        *  @param yu The upper surface ordinate.
109        *  @param xl The x/c location of hte lower surface ordinate.
110        *  @param yl The lower surface ordinate.
111        *  @param outputs  An existing 2-element array filled in with
112        *                  outputs: outputs[yu, yl].
113        **/
114    @Override
115        protected final void modTrailingEdge(double x, double xu, double yu, double xl, double yl, double[] outputs) {
116                if ( x <= 0.825 ) {
117                        double x2 = 1.0;
118                        double x1 = xu;
119                        double y2 = 0.;
120                        double y1 = yu;
121                        s1 = (y2-y1)/(x2-x1);
122                        s2 = (y2-yl)/(x2-xl);
123                        b1 = y2 - s1*x2;
124                        b2 = y2 - s2*x2;
125                }
126                yu = s1*xu + b1;
127                yl = s2*xl + b2;
128                
129                outputs[0] = yu;
130                outputs[1] = yl;
131        }
132        
133        
134}
135
136