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