AVL Analysis Interface Module (AIM)
AVL Analysis Interface Module (AIM)
Loading...
Searching...
No Matches
AVL AIM Examples

This example contains a set of *.csm and pyCAPS (*.py) inputs that uses the AVL AIM. A user should have knowledge on the generation of parametric geometry in Engineering Sketch Pad (ESP) before attempting to integrate with any AIM. Specifically, this example makes use of Design Parameters, Set Parameters, User Defined Primitive (UDP) and attributes in ESP.

The follow code details the process in a *.csm file that generates three airfoil sections to create a wing. Note to execute in serveESP a dictionary file must be included "serveESP $ESP_ROOT/CAPSexamples/csmData/avlWing.csm"

The CSM script generates Bodies which are designed to be used by specific AIMs. The AIMs that the Body is designed for is communicated to the CAPS framework via the capsAIM string attribute. This is a semicolon-separated string with the list of AIM names. Thus, the CSM author can give a clear indication to which AIMs should use the Body. In this example, the list contains only the avlAIM:

attribute capsAIM $avlAIM;flightstreamAIM

Next we will define the design parameters to define the wing cross section and planform.

despmtr thick 0.12 frac of local chord
despmtr camber 0.04 frac of loacl 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
despmtr sweep 20.0 1/4 Chord Sweep
despmtr washout -5.00 deg (negative is down at tip)
despmtr dihedral 4.00 deg

The design parameters will then be used to set parameters for use internally to create geometry.

set span sqrt(aspect*area)
set croot 2*area/span/(1+taper)
set ctip croot*taper
set dxtip (croot-ctip)/4+span/2*tand(sweep)
set dztip span/2*tand(dihedral)

Finally, the airfoils are created using the User Defined Primitive (UDP) naca. The inputs used for this example to the UDP are Thickness and Camber. Cross sections are in the X-Y plane and are rotated to the X-Z plane. Reference quantities must exist on any body, otherwise AVL defaults to 1.0 for Area, Span, Chord and 0.0 for X,Y,Z moment References

# left tip
udprim naca Thickness thick Camber camber
attribute capsGroup $Wing
attribute capsReferenceArea area
attribute capsReferenceSpan span
attribute capsReferenceChord croot
attribute capsReferenceX croot/4
attribute capsReferenceY 0
attribute capsReferenceZ 0
scale ctip
rotatex 90 0 0
rotatey washout 0 ctip/4
translate dxtip -span/2 dztip
# root
udprim naca Thickness thick Camber camber
attribute capsGroup $Wing
rotatex 90 0 0
scale croot
# right tip
udprim naca Thickness thick Camber camber
attribute capsGroup $Wing
scale ctip
rotatex 90 0 0
rotatey washout 0 ctip/4
translate dxtip span/2 dztip

An example pyCAPS script that uses the above csm file to run AVL is as follows.

First the pyCAPS and os module needs to be imported.

import pyCAPS
import os

Next the *.csm file is loaded and design parameter is changed - area in the geometry. Any despmtr from the avlWing.csm file is available inside the pyCAPS script. They are: thick, camber, area, aspect, taper, sweep, washout, dihedral...

geometryScript = os.path.join("..","csmData","avlWing.csm")
myProblem = pyCAPS.Problem(problemName=workDir,
capsFile=geometryScript,
outLevel=args.outLevel)
myProblem.geometry.despmtr.area = 10.0

The AVL AIM is then loaded with:

myAnalysis = myProblem.analysis.create(aim = "avlAIM", name = "avl")

After the AIM is loaded the Mach number and angle of attack are set, though all AIM Inputs are available.

myAnalysis.input.Mach = 0.5
myAnalysis.input.Alpha = 1.0
myAnalysis.input.Beta = 0.0
wing = {"groupName" : "Wing", # Notice Wing is the value for the capsGroup attribute
"numChord" : 8,
"spaceChord" : 1.0,
"numSpanTotal" : 24}
myAnalysis.input.AVL_Surface = {"Wing": wing}

Once all the inputs have been set, outputs can be directly requested. The avl analysis will be automatically executed just-in-time (AIM Execution).

Any of the AIM's output variables (AIM Outputs) are readily available; for example,

print ("CXtot ", myAnalysis.output["CXtot" ].value)
print ("CYtot ", myAnalysis.output["CYtot" ].value)
print ("CZtot ", myAnalysis.output["CZtot" ].value)
print ("Cltot ", myAnalysis.output["Cltot" ].value)
print ("Cmtot ", myAnalysis.output["Cmtot" ].value)
print ("Cntot ", myAnalysis.output["Cntot" ].value)
print ("Cl'tot ", myAnalysis.output["Cl'tot"].value)
print ("Cn'tot ", myAnalysis.output["Cn'tot"].value)
print ("CLtot ", myAnalysis.output["CLtot" ].value)
print ("CDtot ", myAnalysis.output["CDtot" ].value)
print ("CDvis ", myAnalysis.output["CDvis" ].value)
print ("CLff ", myAnalysis.output["CLff" ].value)
print ("CYff ", myAnalysis.output["CYff" ].value)
print ("CDind ", myAnalysis.output["CDind" ].value)
print ("CDff ", myAnalysis.output["CDff" ].value)
print ("e ", myAnalysis.output["e" ].value)

results in

CXtot 0.00061
CYtot -0.0
CZtot -0.30129
Cltot -0.0
Cmtot -0.19449
Cntot -0.0
Cl'tot -0.0
Cn'tot -0.0
CLtot 0.30126
CDtot 0.00465
CDvis 0.0
CLff 0.30096
CYff -0.0
CDind 0.0046467
CDff 0.0049692
e 0.967

Additionally, besides making a call to the AIM outputs, sensitivity values may be obtained in the following manner,

#sensitivity = myAnalysis.output["CLtot"].deriv("Alpha")

The avlAIM supports the control surface modeling functionality inside AVL. Trailing edge control surfaces can be added to the above example by making use of the vlmControlName attribute (see AIM Attributes regarding the attribution specifics). To add a RightFlap and LeftFlap to the previous example *.csm file the naca UDP entries are augmented with the following attributes.

# left tip
udprim naca Thickness thick Camber camber
attribute vlmControl_LeftFlap 80 # Hinge line is at 80% of the chord (control surface between hinge and trailing edge)
...
# root
udprim naca Thickness thick Camber camber
attribute vlmControl_LeftFlap 80 # Hinge line is at 80% of the chord (control surface between hinge and trailing edge)
attribute vlmControl_RightFlap 80 # Hinge line is at 80% of the chord (control surface between hinge and trailing edge)
...
# right tip
udprim naca Thickness thick Camber camber
attribute vlmControl_RightFlap 80 # Hinge line is at 80% of the chord (control surface between hinge and trailing edge)
...

Note how the root airfoil contains two attributes for both the left and right flaps.

In the pyCAPS script the AIM Inputs, AVL_Control, must be defined.

flap = {"controlGain" : 0.5,
"deflectionAngle" : 10.0}
myAnalysis.input.AVL_Control = {"LeftFlap": flap, "RightFlap": flap}

Notice how the information defined in the flap variable is assigned to the vlmControlName portion of the attributes added to the *.csm file.