xFoil Analysis Interface Module (AIM)
xFoil Analysis Interface Module (AIM)
Loading...
Searching...
No Matches
xFoil AIM Example

This is a walkthrough for using xFoil AIM to analyze a single airfoil cross-section.

Prerequisites

It is presumed that ESP and CAPS have been already installed, as well as xFoil.

Script files

Two scripts are used for this illustration:

  1. airfoilSection.csm: Creates geometry, as described in [Part 1] of the next section.
  2. xfoil_PyTest.py: pyCAPS script for performing analysis, as described in the [Part 2] of the next section.

Creating Geometry using ESP

In our example *.csm file setting up the CAPS fidelity is the first step. If multiple bodies exist in the *.csm file the tag, capsIntent, can be used to distinguish what type of analysis the body may be used for. In this example, the geometry model generated can be used for CFD analysis, as shown:

attribute capsIntent $LINEARAERO
attribute capsAIM $xfoilAIM;tsfoilAIM;msesAIM

A typical geometry model can be created and interactively modified using design parameters. These design parameters are either design- or geometry- based. In this example, a single airfoil cross-section is created using the following design parameters.

despmtr thick 0.12 frac of local chord
despmtr camber 0.00 frac of local chord
despmtr area 10.0 Planform area of the full span wing
despmtr aspect 6.00 Span^2/Area
despmtr taper 0.60 TipChord/RootChord

After our design parameters are defined they are used to setup other local variables (analytically) for the wing.

set span sqrt(aspect*area)
set croot 2*area/span/(1+taper)
set ctip croot*taper

Once all design and locale variables are defined, a single airfoil cross-section is created using the NACA series airfoils (following a scale).

udprim naca Thickness thick Camber camber sharpte 1
scale ctip

Performing analysis using pyCAPS

The first step in the pyCAPS script is to import the required modules. For this example, the following modules are used,

# Import pyCAPS module
import pyCAPS
import os
import argparse

Similarly, local variables used throughout the script may be defined.

# Create working directory variable
workDir = "xFoilAnalysisTest"
workDir = os.path.join(str(args.workDir[0]), workDir)

Once the required modules have been loaded, a pyCAPS.Problem can be instantiated with the desired geometry file.

geometryScript = os.path.join("..","csmData","airfoilSection.csm")
myProblem = pyCAPS.Problem(problemName=workDir,
capsFile=geometryScript,
outLevel=args.outLevel)

Any design parameters available in *.csm file are also available within the pyCAPS script. The following snippet changes the despmtr "camber" which will force a rebuild of the geometry that xFoil will now use.

# Change a design parameter - area in the geometry
myProblem.geometry.despmtr.camber = 0.1

Next the xFoil AIM needs to be loaded.

# Load xfoil aim
xfoil = myProblem.analysis.create(aim = "xfoilAIM")

Once loaded analysis parameters specific to xFoil need to be set (see AIM Inputs). These parameters are automatically converted into xFoil specific format and transferred into the xFoil configuration file.

# Set Mach number, Reynolds number
xfoil.input.Mach = 0.5
xfoil.input.Re = 1.0e6
# Set custom AoA
xfoil.input.Alpha = [0.0, 3.0, 5.0, 7.0, 9.0, 11, 13, 14, 15.0]
# Set AoA seq
#xfoil.input.Alpha_Increment = [1.0, 2.0, 0.10]
# Set custom Cl
#xfoil.input.CL = 0.1
# Set Cl seq
#xfoil.input.CL_Increment = [0.8, 3, .25]
# Append the polar file if it already exists - otherwise the AIM will delete the file
xfoil.input.Append_PolarFile = True

The xFoil AIM auto executes xfoil just-in-time when oututs are requested (AIM Execution).

Finally, available AIM outputs (see AIM Outputs) may be retrieved, for example:

# Retrieve Cl and Cd
Cl = xfoil.output.CL
print("Cl = ", Cl)
Cd = xfoil.output.CD
print("Cd = ", Cd)
# Angle of attack
Alpha = xfoil.output.Alpha
print("Alpha = ", Alpha)
# Transition location
TranX = xfoil.output.Transition_Top
print("Transition location = ", TranX)

results in,

Cl = [0.951, 1.2403, 1.4266, 1.6214, 1.7724, 1.8756, 1.8507, 1.7748, 1.6766, 1.0562,
1.0665, 1.0767, 1.0869, 1.0969, 1.107, 1.1168, 1.1264, 1.1356, 1.1448, 1.05,
1.3, 1.55, 1.55, 1.55, 1.55, 1.55, 1.55, 1.55, 1.55, 1.55, 1.55, 1.55]
Cd = [0.01293, 0.016, 0.01916, 0.02326, 0.03022, 0.04169, 0.06602, 0.08659, 0.11208,
0.01387, 0.01394, 0.01403, 0.01412, 0.01422, 0.01429, 0.01439, 0.0145, 0.01462,
0.01476, 0.0139, 0.01704, 0.02139, 0.02139, 0.02139, 0.02139, 0.02139, 0.02139,
0.02139, 0.02139, 0.02139, 0.02139, 0.02139]
Alpha = [0.0, 3.0, 5.0, 7.0, 9.0, 11.0, 13.0, 14.0, 15.0, 1.1, 1.2, 1.3, 1.4, 1.5,
1.6, 1.7, 1.8, 1.9, 2.0, 1.055, 3.66, 6.227, 6.227, 6.227, 6.227, 6.227,
6.227, 6.227, 6.227, 6.227, 6.227, 6.227]

Executing pyCAPS script

Issuing the following command executes the script:

python xfoil_PyTest.py

Below is a representative image obtained by plotting the data presented above:

xFoil generated lift and drag coefficients for various angles of attack