NACA Airfoil Mesh

The dream.mesh module also provides helpers to construct NACA 4-digit airfoil profiles, which can then be meshed using netgen.occ. Here, get_2d_naca_occ_profile returns the 2D OCC profile of a NACA airfoil, which we cut out of a surrounding farfield circle before meshing.

[1]:
import netgen.occ as occ
import ngsolve as ngs
from ngsolve.webgui import Draw
from dream.mesh import get_2d_naca_occ_profile
[2]:
# Generate the farfield region and cut out the airfoil profile.
AoA = 5
LE = (-0.5, 0)

air = occ.WorkPlane().Circle(0, 0, 2).Face()
for edge in air.edges:
    edge.name = "farfield"

airfoil = get_2d_naca_occ_profile('0012', AoA, LE=LE, n=200)
for edge in airfoil.edges:
    edge.name = "airfoil"
    edge.maxh = 0.025

air -= airfoil
air.faces[0].name = "air"

geo = occ.OCCGeometry(air, dim=2)
mesh = ngs.Mesh(geo.GenerateMesh(maxh=0.5, grading=0.2))
mesh.Curve(3)

print("Materials:", mesh.GetMaterials())
print("Boundaries:", mesh.GetBoundaries())

Draw(mesh)
Materials: ('air',)
Boundaries: ('farfield', 'airfoil')
[2]:
WebGLScene