npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

naca-four-digit-airfoil

v1.0.4

Published

The equations for a NACA four-digit series airfoil

Downloads

22

Readme

naca-four-digit-airfoil

Build Status js-standard-style npm version

The equations for a NACA four-digit series airfoil

Introduction

NACA airfoils map a four digit code to an airfoil shape. For example, a '2412' airfoil is parsed to mean:

  • The leading '2' indicates maximum camber is 2% of chord length
  • The '4' indicates maximum camber is at 40% of the chord length
  • The '12' indicates maximum thickness is 12% of the chord length

NACA 2412

Live examples (change the query string to create your own):

Example

The code below calculates the x- and y-coordinates of the upper and lower surfaces, respectively, at 50% of the chord length.

var naca = require('naca-four-digit-airfoil')

naca('2412').evaluate(0.5)
// => [ 0.5005881887154037, 0.07238142883077964, 0.4994118112845963, -0.03349253994189075 ]

Installation

$ npm install naca-four-digit-airfoil

API

Based on NACA Code

require('naca-four-digit-airfoil')(nacaAirfoilCode[, chordLength = 1])

Parses the airfoil code and returns an object with functions that evaluate the shape of the airfoil for a unit chord length. Arguments are:

  • nacaAirfoilCode: A four-digit string containing the NACA airfoil code. The first digit is the amount of camber in units of 1% of the chord length. The second digit is the location of maximum camber measured from the leading edge in units of 10% of the chord length. The final two digits are the thickness of the airfoil in units of 1% of the chord length.
  • chordLength (optional, default = 1): The chord length of the airfoil.

The object returned contains the following functions:

  • thickness: function(x): The half-thickness of the airfoil above or below the camber line at position x.
  • camberLine: function(x): The height of the camber line above the centerline at position x.
  • camberLineSlope: function(x): The slope of the camber line at position x.
  • leadingEdgeRadius: function(): The radius of curvature of the leading edge.
  • evaluate: function(x): The coordinates of the surface at position x. Returned in a four-element array containing coordinates [xUpper, yUpper, xLower, yLower]. The coordinates are calculated perpendicular to the line of camber. So that the x-coordinate of the surface at chord position x is slightly perturbed.
  • xUpper: function(x): The x-coordinate of the upper surface of the airfoil.
  • yUpper: function(x): The y-coordinate of the upper surface of the airfoil.
  • xLower: function(x): The x-coordinate of the lower surface of the airfoil.
  • yLower: function(x): The y-coordinate of the lower surface of the airfoil.

As Plain Functions

The functions are also available as unadorned functions accessible on the plain module. Using the variables defined above, they are:

  • parse: function(code): Parse the four-character String airfoil code, returning m (the amount of camber as a fraction of chord length), p (the location of maximum camber as a fraction of chord length), and t (thickness as a fraction of chord length).
  • thickness: function(x, c, t)
  • camberLine: function(x, c, m, p)
  • camberLineSlope: function(x, c, m, p)
  • leadingEdgeRadius: function(t, c)
  • xLower: function(x, c, m, p, t)
  • xUpper: function(x, c, m, p, t)
  • yLower: function(x, c, m, p, t)
  • yUpper: function(x, c, m, p, t)
  • evaluate: function(x, c, m, p, t)

License

© 2016 Ricky Reusser. MIT License.