001/*
002*   NACA63ASeries -- An arbitrary NACA 63A 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
023import java.util.List;
024import java.awt.geom.Point2D;
025import java.text.DecimalFormat;
026import java.text.NumberFormat;
027
028
029/**
030*  <p> This class represents an arbitrary NACA 63A series
031*      airfoil section such as a NACA 63A020 airfoil.
032*  </p>
033*
034*  <p> Ported from FORTRAN "NACA6.FOR" to Java by:
035*                Joseph A. Huwaldt, June 4, 2010     </p>
036*
037*  <p> Original FORTRAN "NACA4" code had the following note:  </p>
038*
039*  <pre>
040*         AUTHORS - Charles L.Ladson and Cuyler W. Brooks, NASA Langley
041*                   Liam Hardy, NASA Ames
042*                   Ralph Carmichael, Public Domain Aeronautical Software
043*         Last FORTRAN version:  23Nov96  2.0   RLC
044*
045*         NOTES - This program has also been known as LADSON and SIXSERIES and
046*                 as SIXSERIE on systems with a 8-letter name limit.
047*         REFERENCES-  NASA Technical Memorandum TM X-3069 (September, 1974),
048*                      by Charles L. Ladson and Cuyler W. Brooks, Jr., NASA Langley Research Center.
049*
050*                      "Theory of Wing Sections", by Ira Abbott and Albert Von Doenhoff.
051*  </pre>
052*
053*  <p>  Modified by:  Joseph A. Huwaldt  </p>
054*
055*  @author  Joseph A. Huwaldt   Date:  June 6, 2010
056*  @version February 22, 2025
057*/
058public class NACA63ASeries extends NACA6ASeries {
059        
060        //-----------------------------------------------------------------------------------
061        
062        /**
063        *  Create a NACA 63A series airfoil with the specified parameters.
064        *
065        *  @param  CLi        Design lift coefficient (e.g.: 63A206 has CLi = 0.2).
066        *  @param  thickness  The thickness to chord ratio (e.g.: 0.20 == 20% t/c).
067        *  @param  length     The chord length.
068        */
069        public NACA63ASeries(double CLi, double thickness, double length) {
070                super(CLi, thickness, length);
071        }
072        
073        /**
074        *  Returns a String that represents the profile type of this airfoil.
075        */
076    @Override
077        public String getProfile() {
078                return "63A";
079        }
080        
081        //      Phi & eps vectors for 63A series airfoil.
082    private static final double[] philde = {
083                0.,.01459,.02917,
084                .04376,.05835,.07294,.08754,.10213,
085                .11673,.13133,.14594,.14925,
086                .15256,.15587,.15919,.1625,.16581,
087                .16912,.17244,.17575,.17907,
088                .1842,.18933,.19447,.1996,.20474,
089                .20988,.21501,.22015,.22529,
090                .23043,.24002,.2496,.25918,.26877,
091                .27835,.28793,.29751,.30709,
092                .31667,.32626,.33981,.35335,.36691,
093                .38046,.39401,.40756,.42111,
094                .43466,.44821,.46176,.47241,.48306,
095                .49371,.50436,.51501,.52566,
096                .53631,.54696,.55761,.56826,.57741,
097                .58655,.5957,.60485,.61399,
098                .62314,.63229,.64143,.65058,.65973,
099                .67542,.69111,.7068,.72249,
100                .73818,.75386,.76955,.78524,.80093,
101                .81662,.83032,.84402,.85772,
102                .87143,.88513,.89883,.91253,.92623,
103                .93993,.95363,.96612,.9786,
104                .99109,1.00358,1.01607,1.02856,
105                1.04104,1.05353,1.06602,1.0785,
106                1.09023,1.10196,1.11369,1.12541,
107                1.13714,1.14887,1.1606,1.17232,
108                1.18405,1.19577,1.20699,1.21821,
109                1.22942,1.24064,1.25186,1.26307,
110                1.27429,1.28551,1.29672,1.30794,
111                1.31876,1.32958,1.34041,1.35123,
112                1.36205,1.37288,1.3837,1.39453,
113                1.40535,1.41617,1.42675,1.43732,
114                1.44789,1.45847,1.46904,1.47961,
115                1.49019,1.50076,1.51133,1.52191,
116                1.53232,1.54273,1.55315,1.56356,
117                1.57397,1.58439,1.5948,1.60522,
118                1.61563,1.62605,1.63637,1.64669,
119                1.65701,1.66733,1.67765,1.68797,
120                1.69829,1.70862,1.71894,1.72926,
121                1.73961,1.74996,1.76031,1.77066,
122                1.78101,1.79136,1.80171,1.81206,
123                1.82241,1.83276,1.84322,1.85368,
124                1.86414,1.87461,1.88507,1.89553,1.906,
125                1.91646,1.92692,1.93738,1.94807,
126                1.95875,1.96943,1.98011,1.9908,
127                2.00148,2.01216,2.02284,2.03353,
128                2.04421,2.05529,2.06637,2.07745,
129                2.08853,2.09961,2.11068,2.12176,
130                2.13284,2.14392,2.155,2.16671,2.17842,
131                2.19013,2.20184,2.21355,2.22526,
132                2.23697,2.24868,2.26038,2.27209,
133                2.28483,2.29758,2.31032,2.32306,
134                2.3358,2.34855,2.36129,2.37403,
135                2.38677,2.39951,2.41402,2.42853,
136                2.44304,2.45755,2.47205,2.48656,
137                2.50106,2.51556,2.53005,2.54455,
138                2.56243,2.58031,2.59819,2.61606,
139                2.63393,2.6518,2.66966,2.68753,
140                2.70539,2.72325,2.76507,2.8069,
141                2.84873,2.89056,2.9324,2.97423,
142                3.01607,3.05791,3.09975,3.14159 };
143                
144    private static final double[] epslde = {
145                0.,.00138,.00276,
146                .00413,.00548,.00683,.00815,.00945,
147                .01072,.01196,.01317,.01344,
148                .0137,.01396,.01421,.01445,.01469,
149                .0149,.0151,.01529,.01546,
150                .01568,.01585,.01599,.0161,.01617,
151                .01623,.01628,.01631,.01635,
152                .01638,.01647,.01657,.0167,.01684,
153                .01698,.01713,.01728,.01741,
154                .01754,.01764,.01775,.01781,.01785,
155                .01787,.01787,.01788,.01788,
156                .01791,.01796,.01804,.01814,.01826,
157                .01841,.01857,.01875,.01895,
158                .01917,.01939,.01963,.01987,.02009,
159                .02031,.02053,.02075,.02098,
160                .02121,.02144,.02168,.02192,.02216,
161                .02257,.02299,.02342,.02385,
162                .02429,.02475,.02521,.02569,.02618,
163                .02669,.02715,.02762,.0281,
164                .02859,.02909,.0296,.03011,.03063,
165                .03115,.03168,.03216,.03265,
166                .03314,.03363,.03412,.03462,.03513,
167                .03564,.03616,.03669,.03719,
168                .03769,.03821,.03873,.03925,.03979,
169                .04033,.04087,.04143,.04198,
170                .04253,.04307,.04362,.04418,.04473,
171                .04528,.04584,.04639,.04694,
172                .04749,.04801,.04853,.04904,.04955,
173                .05005,.05056,.05106,.05155,
174                .05205,.05254,.05302,.0535,.05398,
175                .05445,.05492,.05538,.05585,
176                .0563,.05676,.05721,.05764,.05807,
177                .0585,.05892,.05933,.05973,
178                .06012,.0605,.06088,.06124,.06158,
179                .06192,.06224,.06255,.06286,
180                .06315,.06344,.06372,.06399,.06425,
181                .06451,.06476,.065,.06523,
182                .06546,.06567,.06588,.06608,.06626,
183                .06643,.0666,.06675,.06689,
184                .06702,.06714,.06724,.06733,.0674,
185                .06746,.06751,.06754,.06755,
186                .06756,.06754,.06752,.06748,.06742,
187                .06736,.06728,.06718,.06707,
188                .06695,.06681,.06667,.0665,.06632,
189                .06613,.06593,.06571,.06548,
190                .06522,.06494,.06464,.06434,.06401,
191                .06367,.06332,.06295,.06257,
192                .06217,.06173,.06126,.06078,.06029,
193                .05979,.05927,.05875,.05821,
194                .05767,.05712,.05648,.05583,.05517,
195                .05448,.05376,.053,.05222,
196                .05138,.0505,.04957,.04834,.04703,
197                .04565,.04421,.04273,.0412,
198                .03965,.03807,.03649,.03491,.03125,
199                .02764,.02408,.02056,.01708,
200                .01363,.0102,.00679,.00339,0. };
201        
202        /**
203        *  Fill in phi, eps vectors for 63A series airfoil.
204        *
205        *  @param phi  An existing array with 201 elements to be filled in
206        *              by this method.
207        *  @param eps  An existing array with 201 elements to be filled in
208        *              by this method.
209        */
210    @Override
211        protected final void phep(double[] phi, double[] eps) {
212                double[] bb = new double[251];
213                double[] cc = new double[251];
214                double[] dd = new double[251];
215                
216                spline(251,philde,epslde,bb,cc,dd);
217                for (int i=0; i < 201; ++i) {
218                        phi[i] = i*Math.PI/200.;
219                        eps[i] = seval(251,phi[i],philde,epslde,bb,cc,dd);
220                }
221        }
222        
223        
224        //      Phi & eps vectors for 63A series airfoil.
225    private static final double[] philds = {
226                0.,.01461,.02922,
227                .04383,.05843,.07303,.08763,.10222,
228                .1168,.13138,.14594,.14925,
229                .15257,.15588,.15919,.1625,.16582,
230                .16913,.17244,.17576,.17907,
231                .1842,.18933,.19447,.1996,.20474,
232                .20987,.21501,.22015,.22529,
233                .23043,.24001,.24958,.25916,.26875,
234                .27833,.28791,.2975,.30708,
235                .31667,.32626,.3398,.35335,.3669,
236                .38045,.39401,.40756,.42111,
237                .43466,.44821,.46176,.47241,.48306,
238                .49371,.50436,.51501,.52566,
239                .53631,.54696,.55761,.56826,.57741,
240                .58655,.5957,.60485,.61399,
241                .62314,.63229,.64143,.65058,.65973,
242                .67541,.6911,.70679,.72248,
243                .73817,.75386,.76955,.78524,.80093,
244                .81662,.83032,.84402,.85772,
245                .87142,.88512,.89882,.91253,.92623,
246                .93993,.95363,.96612,.9786,
247                .99109,1.00358,1.01607,1.02855,
248                1.04104,1.05353,1.06602,1.0785,
249                1.09023,1.10196,1.11369,1.12541,
250                1.13714,1.14887,1.16059,1.17232,
251                1.18405,1.19577,1.20699,1.21821,
252                1.22943,1.24064,1.25186,1.26308,
253                1.27429,1.28551,1.29672,1.30794,
254                1.31876,1.32959,1.34041,1.35124,
255                1.36206,1.37289,1.38371,1.39453,
256                1.40535,1.41617,1.42675,1.43733,
257                1.4479,1.45847,1.46905,1.47962,
258                1.49019,1.50077,1.51134,1.52191,
259                1.53232,1.54274,1.55316,1.56357,
260                1.57399,1.5844,1.59481,1.60523,
261                1.61564,1.62605,1.63637,1.6467,
262                1.65702,1.66734,1.67766,1.68798,
263                1.6983,1.70862,1.71894,1.72926,
264                1.73961,1.74996,1.76031,1.77067,
265                1.78101,1.79136,1.80171,1.81206,
266                1.82241,1.83276,1.84322,1.85369,
267                1.86415,1.87461,1.88508,1.89554,1.906,
268                1.91646,1.92692,1.93738,1.94807,
269                1.95875,1.96943,1.98012,1.9908,
270                2.00148,2.01216,2.02284,2.03353,
271                2.04421,2.05529,2.06637,2.07744,
272                2.08852,2.0996,2.11068,2.12176,
273                2.13284,2.14392,2.155,2.16671,2.17841,
274                2.19012,2.20183,2.21354,2.22525,
275                2.23696,2.24867,2.26038,2.27209,
276                2.28483,2.29757,2.31031,2.32305,
277                2.33579,2.34854,2.36128,2.37402,
278                2.38676,2.39951,2.41401,2.42851,
279                2.44302,2.45752,2.47203,2.48653,
280                2.50103,2.51554,2.53004,2.54455,
281                2.56241,2.58028,2.59814,2.61601,
282                2.63388,2.65175,2.66962,2.6875,
283                2.70537,2.72325,2.76503,2.80682,
284                2.84864,2.89046,2.9323,2.97414,3.016,
285                3.05786,3.09973,3.14159 };
286                
287    private static final double[] psilds = {
288                .15517,.15507,.15478,
289                .15431,.15368,.1529,.15199,
290                .15097,.14984,.14863,.14735,.14705,
291                .14675,.14645,.14615,.14585,
292                .14555,.14525,.14496,.14468,.1444,
293                .14397,.14357,.14318,.14281,
294                .14245,.1421,.14177,.14145,.14115,
295                .14086,.14035,.13987,.13944,
296                .13904,.13867,.13833,.13802,.13773,
297                .13746,.13722,.1369,.13662,
298                .13637,.13614,.13594,.13577,.13562,
299                .13548,.13537,.13527,.1352,
300                .13514,.13509,.13504,.135,.13496,
301                .13492,.13489,.13486,.13483,
302                .13481,.13478,.13476,.13474,.13471,
303                .13469,.13467,.13464,.13462,
304                .1346,.13456,.13452,.13447,.13442,
305                .13438,.13432,.13427,.1342,
306                .13414,.13406,.134,.13392,.13384,
307                .13376,.13367,.13357,.13347,
308                .13336,.13324,.13312,.13299,.13287,
309                .13274,.1326,.13245,.1323,
310                .13214,.13197,.1318,.13162,.13145,
311                .13127,.13108,.13089,.13068,
312                .13047,.13024,.13001,.12976,.1295,
313                .12923,.12896,.12867,.12837,
314                .12806,.12774,.12741,.12706,.1267,
315                .12634,.12597,.1256,.12521,
316                .12481,.1244,.12398,.12355,.1231,
317                .12264,.12217,.1217,.12121,
318                .12072,.12021,.11969,.11916,.11862,
319                .11807,.1175,.11693,.11636,
320                .11577,.11518,.11458,.11397,.11335,
321                .11272,.11208,.11143,.11078,
322                .11012,.10945,.10878,.1081,.10741,
323                .10671,.10601,.1053,.10458,
324                .10385,.10312,.10238,.10164,.10089,
325                .10013,.09936,.0986,.09782,
326                .09704,.09625,.09545,.09465,.09384,
327                .09302,.0922,.09137,.09054,
328                .08971,.08887,.08802,.08716,.08629,
329                .08541,.08454,.08366,.08278,
330                .08189,.081,.08012,.07923,.0783,
331                .07738,.07646,.07553,.07461,
332                .07369,.07278,.07186,.07095,.07005,
333                .0691,.06815,.06721,.06628,
334                .06535,.06443,.06351,.06259,.06168,
335                .06078,.0598,.05882,.05785,
336                .05688,.05593,.05497,.05403,.05309,
337                .05216,.05123,.05019,.04916,
338                .04813,.04711,.04608,.04506,.04403,
339                .04299,.04195,.0409,.03958,
340                .03826,.03694,.03563,.03435,.03311,
341                .03191,.03077,.0297,.02871,
342                .02675,.02524,.02412,.02333,.02282,
343                .02253,.0224,.02238,.02241,
344                .02243 };
345        
346        /**
347        *  Fill in the psi vector for a 63A series airfoil.
348        *
349        *  @param phi  An array filled in by phep().
350        *  @param psi  An existing array with 201 elements to be filled in
351        *              by this method.
352        */
353    @Override
354        protected final void phps(double[] phi, double[] psi) {
355                double[] bb = new double[251];
356                double[] cc = new double[251];
357                double[] dd = new double[251];
358                spline(251, philds, psilds, bb, cc, dd);
359                for (int i=0; i < 201; ++i) {
360                        psi[i] = seval(251, phi[i], philds, psilds, bb, cc, dd); 
361                }
362        }
363        
364        /**
365        *  Simple method to test this class.
366        *
367        * @param args the command-line arguments.
368        */
369        public static void main(String[] args) {
370        
371                DecimalFormat nf = (DecimalFormat)NumberFormat.getInstance();
372                nf.setMaximumFractionDigits(5);
373                nf.setMinimumFractionDigits(5);
374                
375                System.out.println("Start NACA63ASeries...");
376                
377                System.out.println("Creating a NACA 63A206 airfoil...");
378                Airfoil af = new NACA63ASeries(0.2, 0.06, 1);
379                
380                System.out.println("Airfoil = " + af.toString());
381                
382                //      Output the upper surface of the airfoil.
383                List<Point2D> upper = af.getUpper();
384                List<Double> ypArr = af.getUpperYp();
385                System.out.println("upper.size() = " + upper.size() + ", ypArr.size() = " + ypArr.size());
386                
387                System.out.println("        X    \t    Y    \t    dy/dx");
388                int length = upper.size();
389                for (int i=0; i < length; ++i) {
390                        Point2D o = upper.get(i);
391                        System.out.println("    " + nf.format(o.getX()) + "\t" + nf.format(o.getY()) +
392                                                                        "\t" + nf.format(ypArr.get(i)));
393                }
394                
395                System.out.println("# ordinates = " + length);
396                System.out.println("Done!");
397        }
398}
399
400