libsurf
Programmer's Documentation

airfoil.h (r6227/r5385)
1 
2 /* Copyright (C) 2015 David Eller <david@larosterna.com>
3  *
4  * Commercial License Usage
5  * Licensees holding valid commercial licenses may use this file in accordance
6  * with the terms contained in their respective non-exclusive license agreement.
7  * For further information contact david@larosterna.com .
8  *
9  * GNU General Public License Usage
10  * Alternatively, this file may be used under the terms of the GNU General
11  * Public License version 3.0 as published by the Free Software Foundation and
12  * appearing in the file gpl.txt included in the packaging of this file.
13  */
14 
15 #ifndef SURF_AIRFOIL_H
16 #define SURF_AIRFOIL_H
17 
18 #include <iosfwd>
19 #include "openframe.h"
20 
33 class Airfoil : public OpenFrame
34 {
35  public:
36 
38  Airfoil() : OpenFrame("UnknownAirfoil"), napx(-1) {}
39 
41  Airfoil(const std::string & s, int nap = -1) : OpenFrame(s), napx(nap) {}
42 
44  Airfoil(const std::string & s, const PointList<2> & c, int nap = -1)
45  : OpenFrame(s), crd(c), napx(nap) {rebuild();}
46 
48  void read(std::istream & is, int nap = -1);
49 
51  void read(const std::string & fname, int nap = -1);
52 
54  void write(std::ostream & os, std::string hdr = "") const;
55 
57  void renormalize();
58 
60  void naca(int code, bool closed = true);
61 
63  void naca4(Real camber, Real cpos, Real thick, bool closed=true);
64 
66  void naca5(int iMeanLine, Real dcl, Real thick, bool closed=true);
67 
69  void naca16(Real tc, Real xtcmax, Real cli, bool closed=true);
70 
72  int naca(int ifamily, int icamber, Real toc, Real cli, Real a = 1.0);
73 
75  int naca(int ifamily, int icamber, Real toc,
76  const Vector & vcli, const Vector & va);
77 
79  void flatPlate(Real thick, int nap = -1);
80 
82  void closeTrailingEdge(Real gap = 0.0);
83 
85  void extend(Real dxNose, Real dyNose=0, Real dxTail=0, Real dyTail=0);
86 
88  void chop(Real xcut);
89 
91  Real findLeadingEdge(Real tol = 1e-4) const;
92 
97  void xpattern(uint nps, Real xle, Real xte, Vector & t) const;
98 
100  void reparametrize(const Vector & t);
101 
103  void approximate(int n);
104 
106  void adaptiveParam(size_t na, Vector &ua) const;
107 
109  virtual XmlElement toXml(bool share = false) const;
110 
112  virtual void fromXml(const XmlElement & xe);
113 
115  virtual Airfoil *clone() const;
116 
118  const PointList<2> & sectionCoordinates() const {return crd;}
119 
121  static std::string naca4name(Real camber, Real cpos, Real thick);
122 
124  static std::string naca5name(int iMeanLine, Real dcl, Real thick);
125 
127  static std::string naca6name(int ifamily, Real toc, Real cli);
128 
130  static std::string searchCoordName(const std::string & fname);
131 
132  private:
133 
135  void sortCoords();
136 
138  void rebuild();
139 
141  Real parameter(Real x, Real start) const;
142 
143  private:
144 
147 
149  int napx;
150 };
151 
152 #endif
Airfoil(const std::string &s, const PointList< 2 > &c, int nap=-1)
construction
Definition: airfoil.h:44
void write(std::ostream &os, std::string hdr="") const
write, with optional header string
Definition: airfoil.cpp:697
void closeTrailingEdge(Real gap=0.0)
close trailing edge gap if necessary
Definition: airfoil.cpp:480
Open spline curve.
Definition: openframe.h:27
Airfoil(const std::string &s, int nap=-1)
construction
Definition: airfoil.h:41
Airfoil()
default construction
Definition: airfoil.h:38
virtual XmlElement toXml(bool share=false) const
xml representation stores 2D airfoil points
Definition: airfoil.cpp:709
virtual Airfoil * clone() const
clone an airfoil object
Definition: airfoil.cpp:819
void adaptiveParam(size_t na, Vector &ua) const
find a reasonable parametrization with n points (evaluates!)
Definition: airfoil.cpp:614
void flatPlate(Real thick, int nap=-1)
approximate flat-plate section
Definition: airfoil.cpp:319
void naca16(Real tc, Real xtcmax, Real cli, bool closed=true)
create a NACA-16 series airfoil
Definition: airfoil.cpp:220
Real findLeadingEdge(Real tol=1e-4) const
locate leading edge parameter
Definition: airfoil.cpp:79
void renormalize()
normalize coordinates to range [0,1]
Definition: airfoil.cpp:95
void naca5(int iMeanLine, Real dcl, Real thick, bool closed=true)
create NACA 5-digit wing section from spec
Definition: airfoil.cpp:165
Airfoil as spline.
Definition: airfoil.h:33
static std::string naca5name(int iMeanLine, Real dcl, Real thick)
construct name of NACA5 section from spec
Definition: airfoil.cpp:855
void naca(int code, bool closed=true)
create NACA 4-digit wing section
Definition: airfoil.cpp:111
PointList< 2 > crd
the original coordinates
Definition: airfoil.h:146
static std::string searchCoordName(const std::string &fname)
try to identify airfoil name in coordinate file
Definition: airfoil.cpp:885
void chop(Real xcut)
chop off points at the trailing edge (for structural modeling)
Definition: airfoil.cpp:547
void sortCoords()
set coordinates in right order
Definition: airfoil.cpp:367
const PointList< 2 > & sectionCoordinates() const
access 2D section coordinates
Definition: airfoil.h:118
Real parameter(Real x, Real start) const
search for curve parameter corresponding to x/c value
Definition: airfoil.cpp:577
void approximate(int n)
approximate using n points
Definition: airfoil.cpp:691
virtual void fromXml(const XmlElement &xe)
construct from xml definition
Definition: airfoil.cpp:732
void rebuild()
rebuild default spline representation from crd
Definition: airfoil.cpp:418
void extend(Real dxNose, Real dyNose=0, Real dxTail=0, Real dyTail=0)
extend the nose by dx, used to create intermediate fairing airfoils
Definition: airfoil.cpp:512
void xpattern(uint nps, Real xle, Real xte, Vector &t) const
Generate new point locations.
Definition: airfoil.cpp:673
int napx
interpolate or approximate
Definition: airfoil.h:149
static std::string naca4name(Real camber, Real cpos, Real thick)
construct name of NACA4 section from spec
Definition: airfoil.cpp:865
static std::string naca6name(int ifamily, Real toc, Real cli)
construct name of NACA6 airfoil section
Definition: airfoil.cpp:824
void naca4(Real camber, Real cpos, Real thick, bool closed=true)
create NACA 4-digit wing section from spec
Definition: airfoil.cpp:124
void reparametrize(const Vector &t)
interpolate from recomputed points
Definition: airfoil.cpp:678
void read(std::istream &is, int nap=-1)
read from text stream
Generated on Mon Jan 24 2022 03:03:15 for libsurf by   doxygen 1.8.5