Cost Functions
ADflow works in three dimensions (\(x, y, z\)) and application of angles such as alpha and beta change the inflow angle, not the mesh itself.
For example, a high lift airfoil at \(\alpha=20^{\circ}\) has the same mesh as that same airfoil at \(\alpha=0^{\circ}\).
Similarly, a moth T-foil at a \(\beta=5^{\circ}\) leeway angle has the same mesh at \(\beta=0^{\circ}\).
The relevant subroutines for the evaluation of cost functions are located in surfaceIntegrations.F90 and zipperIntegrations.F90.
The primary cost functions that are computed in the Fortran code are defined in the adflowCostFunctions dictionary in pyADflow.py.
The following list describes each primary cost function and specifies its units.
- lift
 Surface stresses (this includes shear/viscous, normal/pressure, and momentum/unsteady stresses) integrated in the direction of the
liftIndexbut perpendicular to the streamwise direction (i.e., dot product in this direction). To clarify, the angle of attackalphadoes affect the direction of the force projection. Units:Newton
- drag
 Surface stresses (this includes shear/viscous, normal/pressure, and momentum/unsteady stresses) integrated in the streamwise direction (i.e., dot product in this direction). Units:
Newton
- cl
 Lift coefficient computed as \(\frac{L}{qA}\) where \(A\) is
areaRefdeclared inAeroProblem()and \(q\) is dynamic pressure. Units:None
- cd
 Drag coefficient computed as \(\frac{D}{qA}\) where \(A\) is
areaRefdeclared inAeroProblem()and \(q\) is dynamic pressure. Units:None
- clp
 Component of the lift coefficient
clfrom pressure / normal stresses. Units:None
- clv
 Component of the lift coefficient
clfrom viscous / shear stresses. Units:None
- clm
 Momentum component of the lift coefficient
clthat stems from time rate of change of velocity (unsteady simulation). Units:None
- cdp
 Component of the drag coefficient
cdfrom pressure / normal stresses. Units:None
- cdv
 Component of the drag coefficient
cdfrom viscous / shear stresses. Units:None
- cdm
 Momentum component of the drag coefficient
cdthat stems from time rate of change of velocity (unsteady simulation). Units:None
- fx
 Force from surface stresses (this includes shear/viscous, normal/pressure, and momentum/unsteady stresses) integrated in the global \(x\) direction. This direction does not change based on angle of attack and side slip angle. Units:
Newton
- fy
 Like
fxbut in the global \(y\) direction Units:Newton
- fz
 Like
fxbut in the global \(z\) direction Units:Newton
- cfx
 Force coefficient in the global \(x\) direction computed as \(\frac{F_x}{qA}\) where \(A\) is
areaRef. Units:None
- cfxp
 Components of the fx coefficient
cfxfrom pressure / normal stresses. Units:None
- cfxv
 Components of the fx coefficient
cfxfrom viscous / shear stresses. Units:None
- cfxm
 Momentum component of the fx coefficient
cfxthat stems from time rate of change of velocity (unsteady simulation). Units:None
- cfy
 Like
cfxbut in the global \(y\) direction.
- cfyp
 Like
cfxpbut in the global \(y\) direction.
- cfyv
 Like
cfxvbut in the global \(y\) direction.
- cfym
 Like
cfxmbut in the global \(y\) direction.
- cfz
 Like
cfxbut in the global \(z\) direction.
- cfzp
 Like
cfxpbut in the global \(z\) direction.
- cfzv
 Like
cfxvbut in the global \(z\) direction.
- cfzm
 Like
cfxmbut in the global \(z\) direction.
- mx
 Moment about \(x\) axis, computed at the location (
xRef,yRef,zRef) as defined inAeroProblem. Units:Newton * meter
- my
 Moment about \(y\) axis, computed at the location (
xRef,yRef,zRef) as defined inAeroProblem. Units:Newton * meter
- mz
 Moment about \(z\) axis, computed at the location (
xRef,yRef,zRef) as defined inAeroProblem. Units:Newton * meter
- cmx
 Moment coefficient about \(x\) axis computed as \(\frac{M_x}{qAc_{ref}}\) where \(A\) is
areaRefand \(c_{ref}\) is a reference length (AeroProblem.chordRef). Units:None
- cmy
 Moment coefficient about \(y\) axis computed as \(\frac{M_y}{qAc_{ref}}\) where \(A\) is
areaRefand \(c_{ref}\) is a reference length (AeroProblem.chordRef). Units:None
- cmz
 Moment coefficient about \(z\) axis computed as \(\frac{M_z}{qAc_{ref}}\) where \(A\) is
areaRefand \(c_{ref}\) is a reference length (AeroProblem.chordRef). Units:None
- cm0
 NOTE: Time spectral stability derivatives are broken as of 2023. Moment coefficient about the \(z\) axis at the zero value of the time spectral motion perturbation.
- cmzalpha
 NOTE: Time spectral stability derivatives are broken as of 2023. Derivative of the moment coefficient about the \(z\) axis with respect to angle of attack.
- cmzalphadot
 NOTE: Time spectral stability derivatives are broken as of 2023. Derivative of the moment coefficient about the \(z\) axis with respect to the time derivative of angle of attack.
- cl0
 NOTE: Time spectral stability derivatives are broken as of 2023. Lift coefficient at the zero value of the time spectral motion perturbation.
- clalpha
 NOTE: Time spectral stability derivatives are broken as of 2023. Derivative of the lift coefficient with respect to angle of attack.
- clalphadot
 NOTE: Time spectral stability derivatives are broken as of 2023. Derivative of the lift coefficient with respect to the time derivative of angle of attack.
- cfy0
 NOTE: Time spectral stability derivatives are broken as of 2023. Force coefficient in the \(y\) axis direction at the zero value of the time spectral motion perturbation.
- cfyalpha
 NOTE: Time spectral stability derivatives are broken as of 2023. Derivative of the force coefficient in the \(y\) axis direction with respect to angle of attack.
- cfyalphadot
 NOTE: Time spectral stability derivatives are broken as of 2023. Derivative of the force coefficient in the \(y\) axis direction with respect to the time derivative of angle of attack.
- cd0
 NOTE: Time spectral stability derivatives are broken as of 2023. Drag coefficient at the zero value of the time spectral motion perturbation.
- cdalpha
 NOTE: Time spectral stability derivatives are broken as of 2023. Derivative of the drag coefficient with respect to angle of attack.
- cdalphadot
 NOTE: Time spectral stability derivatives are broken as of 2023. Derivative of the drag coefficient with respect to the time derivative of angle of attack.
- cmzq
 NOTE: Time spectral stability derivatives are broken as of 2023. Derivative of the moment coefficient about the \(z\) axis with respect to pitch rate.
- cmzqdot
 NOTE: Time spectral stability derivatives are broken as of 2023. Derivative of the moment coefficient about the \(z\) axis with respect to the time derivative of pitch rate.
- clq
 NOTE: Time spectral stability derivatives are broken as of 2023. Derivative of the lift coefficient with respect to pitch rate.
- clqdot
 NOTE: Time spectral stability derivatives are broken as of 2023. Derivative of the lift coefficient with respect to the time derivative of pitch rate.
- cbend
 NOTE: Broken as of 2023. Root bending moment coefficient.
- sepsensor
 The separation values for the given surface is provided by this cost function. See Kenway and Martins [1] for more details.
- sepsensorks
 The separation sensor value based on the KS aggregation for the given surface is provided by this cost function. We first compute the deviation of the local velocity from the projected freestream on the desired surface. Then, we use a trigonometric function to compute the sensor by providing an allowable flow deviation angle from this projected vector. As a result, the sensor provides values ranging from
-1to a positive number, which depends on sepSensorKsPhi angle selection. Any values that are greater than0are out of the allowable flow deviation. Thus, to constraint the separation, we use KS aggregation to find the maximum value in the sensor and can constraint it to be less than or equal to0. See Abdul-Kaiyoom et al. [2] and Abdul-Kaiyoom [3] for more details.
- sepsensorksarea
 The area separated based on the KS aggregation approach. This sensor provides the total area of the cells, where sepsensorks is greater than
0in those cells. This area is computed by considering two heaviside smoothing function with KS aggregation approach. It is recommended to start the initial angle of attack in the separated region to compute this value because of the sensor’s highly nonlinear behaviour. See Abdul-Kaiyoom et al. [2] and Abdul-Kaiyoom [3] for more details.
- sepsensoravgx
 The separation sensor average in x direction. The sensor times the distance in x direction value is computed here.
- sepsensoravgy
 The separation sensor average in y direction. The sensor times the distance in y direction value is computed here.
- sepsensoravgz
 The separation sensor average in z direction. The sensor times the distance in z direction value is computed here.
- cavitation
 Cavitation sensor, not to be confused with the cavitation number. It is a modified Heaviside function accounting for how much \(-C_p\) exceeds the cavitation number over the given surface family. The
computeCavitationflag must be set to True because this introduces additional computations. The most common use case of this cost function involves constraining it over a specific surface family, not all walls. See Liao et al. [4] for more details. Units:None
- cpmin
 Minimum coefficient of pressure (\(C_p\)) over the given surface family. This function is computed with Kreisselmeier-Steinhauser (KS) function aggregation resulting in a conservative constraint because the
cpminoutputted will always be more negative than the true \(C_{p,min}\). ThecomputeCavitationflag must be set toTruebecause this introduces additional computations involving global communications across processors. IfFalse, the returned value is zero. Units:None
- mdot
 Mass flow rate through the integration surface. Units:
kg / s
- mavgptot
 Mass flow rate averaged total pressure. Units:
Pascal
- aavgptot
 Area averaged total pressure. Units:
Pascal
- aavgps
 Area averaged static pressure. Units:
Pascal
- mavgttot
 Mass flow rate averaged total temperature. Units:
Kelvin
- mavgps
 Mass flow rate averaged static pressure. Units:
Pascal
- mavgmn
 Mass flow rate averaged Mach number. Units:
None
- area
 The area of the integrated surface. Units:
meter^2
- axismoment
 Moments about the axis given by
momentAxisdefined in theAeroProblem(). Units:Newton * meter
- flowpower
 Added power by actuator region to the flow volume computed from volume integration. Units:
Watt
- forcexpressure
 Pressure component of force in the global \(x\) direction. The pressure is calcualted as the difference of the pressure on the wall and the free stream pressure. For closed surfaces, the free stream pressure delta will cancel and the resulting force calculation is correct. However, integrating the force on open surfaces will not result in the free stream static pressure contribution cancelling out. Dimensional
cfxpUnits:Newton
- forceypressure
 Like
forcexpressurebut in the global \(y\) direction. Units:Newton
- forcezpressure
 Like
forcexpressurebut in the global \(z\) direction. Units:Newton
- forcexviscous
 Viscous component of force in x direction. Dimensional version of
cfxv. Units:Newton
- forceyviscous
 Viscous component of force in y direction. Units:
Newton
- forcezviscous
 Viscous component of force in z direction. Units:
Newton
- forcexmomentum
 Momentum component of force in x direction. Units:
Newton
- forceymomentum
 Momentum component of force in y direction. Units:
Newton
- forcezmomentum
 Momentum component of force in z direction. Units:
Newton
- dragpressure
 Pressure drag. Units:
Newton
- dragviscous
 Viscous drag. Units:
Newton
- dragmomentum
 Momentum drag from time rate of change of velocity (unsteady simulations). Dimensional
cdmUnits:Newton
- liftpressure
 Pressure component of lift. Units:
Newton
- liftviscous
 Viscous component of lift. Units:
Newton
- liftmomentum
 Momentum lift (due to changing momentum of flow in unsteady simulation). Units:
Newton
- mavgvx
 Mass-averaged \(x\) velocity (i.e., \(\Sigma \dot{m}_x / \Sigma \dot{m}\)). Units:
m / s
- mavgvy
 Mass-averaged \(y\) velocity. Units:
m / s
- mavgvz
 Mass-averaged \(z\) velocity. Units:
m / s
- mavgvi
 A derived velocity average.
- cperror2
 The square of the difference between computed cp and target cp* for inverse design. See
setTargetCp()call.
- cofxx
 The following center of force cost functions first list the force component (e.g., Fx) and then the coordinate (e.g., x coordinate). These cost functions look at the sum of all forces. Center of
xforce,xcoordinate. Units:Meter
- cofxy
 Center of
xforce,ycoordinate. Seecofxxdescription for more details. Units:Meter
- cofxz
 Center of
xforce,zcoordinate. Seecofxxdescription for more details. Units:Meter
- cofyx
 Center of
yforce,xcoordinate. Seecofxxdescription for more details. Units:Meter
- cofyy
 Center of
yforce,ycoordinate. Seecofxxdescription for more details. Units:Meter
- cofyz
 Center of
yforce,zcoordinate. Seecofxxdescription for more details. Units:Meter
- cofzx
 Center of
zforce,xcoordinate. Seecofxxdescription for more details. Units:Meter
- cofzy
 Center of
zforce,ycoordinate. Seecofxxdescription for more details. Units:Meter
- cofzz
 Center of
zforce,zcoordinate. Seecofxxdescription for more details. Units:Meter
- colx
 Center of lift force,
xcoordinate. Units:Meter
- coly
 Center of lift force,
ycoordinate. Units:Meter
- colz
 Center of lift force,
zcoordinate. Units:Meter
References
Gaetan K. W. Kenway and Joaquim R. R. A. Martins. Buffet-onset constraint formulation for aerodynamic shape optimization. AIAA Journal, 55(6):1930–1947, June 2017. doi:10.2514/1.J055172.
Mohamed Arshath Saja Abdul-Kaiyoom, Anil Yildirim, Alasdair C. Gray, and Joaquim R. R. A. Martins. Airfoil separation constraint formulation for aerodynamic shape optimization. Journal of Aircraft, 2024. (In press). doi:10.2514/1.C037365.
Mohamed Arshath Saja Abdul-Kaiyoom. Numerical Methods for Coupled Aeropropulsive Design Optimization. PhD thesis, University of Michigan, Ann Arbor, MI, 2025. doi:.
Yingqian Liao, Joaquim R. R. A. Martins, and Yin Lu Young. 3-D high-fidelity hydrostructural optimization of cavitation-free composite lifting surfaces. Composite Structures, 268:113937, July 2021. doi:10.1016/j.compstruct.2021.113937.
James G. Coder, Thomas H. Pulliam, David Hue, Gaetan K. W. Kenway, and Anthony J. Sclafani. Contributions to the 6th AIAA CFD Drag Prediction Workshop using structured grid methods. In AIAA SciTech Forum. American Institute of Aeronautics and Astronautics, January 2017. doi:10.2514/6.2017-0960.
Nitin Garg, Gaetan K. W. Kenway, Joaquim R. R. A. Martins, and Yin Lu Young. High-fidelity multipoint hydrostructural optimization of a 3-D hydrofoil. Journal of Fluids and Structures, 71:15–39, May 2017. doi:10.1016/j.jfluidstructs.2017.02.001.
Mads H. Aa. Madsen, Frederik Zahle, Niels N. Sørensen, and Joaquim R. R. A. Martins. Multipoint high-fidelity CFD-based aerodynamic shape optimization of a 10 MW wind turbine. Wind Energy Science, 4:163–192, April 2019. doi:10.5194/wes-4-163-2019.