====== Numerical simulation of turbulent flow over airfoil (2D) using OpenFOAM ====== ===== Generating NACA profiles ====== Given a 4- or 5-digit NACA number, a corresponding profile can be generated using a [[oscae:programming:python|Python]] script available at [[oscae:resource:github:gorissen.naca_profile| https://github.com/dgorissen/naca]]. The profile can be used to guide mesh generation. ===== Mesh generation ===== Typical to other external flow cases, the goal is to have a fine mesh size near the solid surface, intermediate mesh size in the wake region, and the mesh become coarser farther from the surface. Possible approaches to generate the mesh are described as follows, but not limited to: ==== Subtracting the airfoil region from a mesh block ====== Briefly, a mesh block is generated using the ''blockMesh'' utility. of OpenFOAM, followed by snapping an airfoil profile (prepared as STL file) using the ''snappyHexMesh'' utility. This results in unstructured mesh. An example is provided in an OpenFOAM tutorial case: [[https://develop.openfoam.com/Development/openfoam/-/tree/master/tutorials/incompressible/pimpleFoam/RAS/wingMotion |''$FOAM_TUTORIALS/incompressible/pimpleFoam/RAS/wingMotion/'']]. ==== Automated mesh generation using Gmsh ====== An automated meshing script can be written using [[oscae:programming:python|Python]] API of [[oscae:software:gmsh|Gmsh]]. This can be combined with NACA profile generator to provide control points to construct the surface, e.g. [[oscae:resource:github:gorissen.naca_profile|github.com/dgorissen/naca]]. One implementation can be found at [[https://github.com/EdgarAMO/airfoil2D]], where a mesh for any NACA number can be created by a single line of command, e.g., ''python3 makeBlockMesh.py "0012" 200''. Similar implementation is also given [[oscae:software:mesh.naca|here]] by [[oscae:people:hazmilazis]] with additional user specifications, including domain size, angle of attack, mesh size progression, boundary layer thickness and other important parameters. ===== Solving flow using OpenFOAM ====== ==== OpenFOAM's verification and validation case ====== OpenFOAM provides case files that is used for verification and validation of turbulent flow over NACA0012 airfoil (2D). The case files can be found for a locally installed version at ''$FOAM_TUTORIALS/incompressible/simpleFoam/airFoil2D'', or downloaded from [[https://www.openfoam.com/documentation/guides/latest/doc/verification-validation-naca0012-airfoil-2d.html | here]] for the most recent version. The details of the setup are described in the [[https://www.openfoam.com/documentation/guides/latest/doc/verification-validation-naca0012-airfoil-2d.html | online user guide]].