ApameCorePython Python API

AirFrame 0.0.20261017 · import ApameCorePython
APAME panel method solver Python bindings (C++ API + pybind11)

Module functions

getVersion() -> str
Get APAME version
getSubversion() -> str
Get APAME subversion
getBuildDate() -> str
Get APAME build date (YYYYMMDD)

class APAME

Panel method aerodynamic solver.

Supports context manager protocol for automatic cleanup:
    with APAME() as solver:
        solver.addNode([0, 0, 0])

Every failing call raises ApameError (a RuntimeError) with the solver's description of the error.
Nodes, panels and cases are numbered from 0 in the order they are added. Angles are in radians.
APAME() -> None
Create a new APAME solver instance.
setCallback(callback: object, printProgressBar: bool = True) -> None
Receive the solver's messages in Python instead of on the console.

Args:
    callback (callable): callback(kind, text, newLine), kind being 'message', 'warning' or 'error';
                         None to print to the console again
    printProgressBar (bool): Pass progress bar messages too (default True)
getErrorDescription(code: int) -> str
Get the description of a solver error code.
allocateNodes(numNodes: int) -> None
Pre-allocate memory for nodes.

Args:
    numNodes (int): Number of nodes to allocate
addNode(xyz: Annotated[numpy.ArrayLike, numpy.float64]) -> None
Add a single node.

Args:
    xyz (array): Node coordinates [x, y, z]
storeNodes(xyz: Annotated[numpy.ArrayLike, numpy.float64]) -> None
Store all nodes at once (replaces the nodes added before; also how a deformed shape is passed).

Args:
    xyz (ndarray): Node coordinates, shape (N, 3)
getNumNodes() -> int
Get number of nodes.
allocatePanels(numPanels: int) -> None
Pre-allocate memory for panels.

Args:
    numPanels (int): Number of panels to allocate
addBodyPanel(panelType: int, nodeIndices: Annotated[numpy.ArrayLike, numpy.int32], component: int) -> None
Add a body panel. Its normal (by the right-hand rule over its nodes) points into the flow.

Args:
    panelType (PanelType): Panel type (QUAD or TRIA)
    nodeIndices (array): Node indices (4 or 3)
    component (int): Component ID (forces can be asked per component)
getNumPanels() -> int
Get number of body panels.
getNumComponents() -> int
Get number of components.

Returns:
    int: Number of components
setFarField(farField: float) -> None
Set far-field coefficient (distance, in panel sizes, beyond which panels are taken as point singularities).
getFarField() -> float
setCollDepth(collDepth: float) -> None
Set collocation depth (collocation points moved this far inside the body).
getCollDepth() -> float
setNeighboringAngle(angle: float) -> None
Set neighboring panel angle threshold (radians): panels meeting at a sharper angle are not
neighbors when velocities are calculated.

Args:
    angle (float): Angle threshold in radians
getNeighboringAngle() -> float
Get neighboring panel angle threshold (radians)
setTimeStep(timeStep: float) -> None
Set time step of the transient analysis (s).
getTimeStep() -> float
setSingularity(singularityType: int) -> None
Set singularity type (SingularityType).
getSingularity() -> int
setCurvature(curvatureType: int) -> None
Set curvature correction (CurvatureType).
getCurvature() -> int
setDensity(density: float) -> None
Set air density.

Args:
    density (float): Air density (kg/m^3)
getDensity() -> float
Get air density (kg/m^3)
setMach(mach: float) -> None
Set Mach number for compressibility correction.

Args:
    mach (float): Mach number
getMach() -> float
Get Mach number
setRefPressure(pressure: float) -> None
Set reference (free-stream static) pressure.
getRefPressure() -> float
setArea(area: float) -> None
Set reference wing area.

Args:
    area (float): Wing surface area
getArea() -> float
Get reference wing area
setSpan(span: float) -> None
Set reference wing span.

Args:
    span (float): Wing span
getSpan() -> float
Get reference wing span
setMac(mac: float) -> None
Set mean aerodynamic chord.

Args:
    mac (float): Mean aerodynamic chord
getMac() -> float
Get mean aerodynamic chord
setOrigin(x: float, y: float, z: float) -> None
Set reference origin for moments.

Args:
    x, y, z (float): Origin coordinates
getOrigin() -> numpy.NDArray[numpy.float64]
Get reference origin.

Returns:
    ndarray: Origin coordinates [x, y, z]
setCalculationRequests(requests: int) -> None
Set what is calculated after solving (CalculationRequest values combined with |; default COEF | PRES).
Forces need FORC, coefficients COEF, the pressure fields their own request.
getCalculationRequests() -> int
clearCalculationRequests() -> None
Clear all calculation requests.
setWakeRequest(request: bool) -> None
Generate a wake from the trailing edges (default True).
getWakeRequest() -> bool
setWakeAngle(angle: float) -> None
Set trailing edge angle threshold (radians): edges sharper than this shed a wake.
getWakeAngle() -> float
setWakeLength(length: float) -> None
Set wake length (steady state).
getWakeLength() -> float
setNumWakeRows(numRows: int) -> None
Set number of wake rows (steady state).
getNumWakeRowsSteady() -> int
Get number of wake rows of the steady state analysis.
getNumWakeRowsTrans() -> int
Get number of wake rows of the transient analysis: the wake length over the distance travelled in one step
(one row is shed per step until there are as many; getNumWakePanels() counts those shed so far).
setWakePropagation(propType: int) -> None
Set wake propagation (WakePropagation).
getWakePropagation() -> int
setWakePropAngle(angle: float) -> None
Set wake propagation angle (radians).
getWakePropAngle() -> float
setWakePropMinScaling(minScaling: float) -> None
Set wake strength scaling at the end of the propagation (ratio, 0 to 1).
getWakePropMinScaling() -> float
addCaseInBodyCs(x: float, y: float, z: float) -> None
Add a flow case in body coordinate system.

Args:
    x, y, z (float): Flow velocity components
addCaseInAeroCs(airspeed: float, alfa: float, beta: float) -> None
Add a flow case in aerodynamic coordinate system.

Args:
    airspeed (float): Airspeed (m/s)
    alfa (float): Angle of attack (radians)
    beta (float): Sideslip angle (radians)
getNumCases() -> int
Get number of flow cases.

Returns:
    int: Number of cases
getCases() -> numpy.NDArray[numpy.float64]
Get the flow velocity of every case in body axes, shape (numCases, 3).
runSteadyStateAnalysis() -> None
Run steady-state panel method analysis (every case).
initializeTransientAnalysis() -> None
Initialize transient analysis (first case, time step set before): solves the impulsive start
with the first wake row.
runTransientAnalysisStep() -> None
Run one transient time step: sheds a wake row and solves. Pass a moved shape before with
storeNodes() and the panels' own velocities with addPanelVelocities().
addPanelVelocities(velocities: Annotated[numpy.ArrayLike, numpy.float64]) -> None
Set velocities of the panels due to structural motion (oscillation, rotation), shape (numPanels, 3).
getProgress() -> float
Get analysis progress (0.0 to 1.0).

Returns:
    float: Progress fraction
requestStop() -> None
Request analysis termination (from another thread)
requestPause() -> None
Request analysis pause (from another thread)
requestResume() -> None
Request analysis resume
getAeroForce(caseIndex: int, dir: int, component: int = -1) -> float
Get aerodynamic force in aero coordinate system (needs CalculationRequest.FORC).

Args:
    caseIndex (int): Case index
    dir (int): Direction (0=X, 1=Y, 2=Z)
    component (int): Component ID (-1 for all)

Returns:
    float: Force in Newtons
getBodyForce(caseIndex: int, dir: int, component: int = -1) -> float
Get force in body coordinate system (needs CalculationRequest.FORC).

Args:
    caseIndex (int): Case index
    dir (int): Direction (0=X, 1=Y, 2=Z)
    component (int): Component ID (-1 for all)

Returns:
    float: Force in Newtons
getMoment(caseIndex: int, dir: int, component: int = -1) -> float
Get moment about reference origin (needs CalculationRequest.FORC).

Args:
    caseIndex (int): Case index
    dir (int): Direction (0=X, 1=Y, 2=Z)
    component (int): Component ID (-1 for all)

Returns:
    float: Moment in N m
getAeroForceCoef(caseIndex: int, dir: int, component: int = -1) -> float
Get aerodynamic force coefficient.

Args:
    caseIndex (int): Case index
    dir (int): Direction (0=drag, 1=side, 2=lift)
    component (int): Component ID (-1 for all)

Returns:
    float: Force coefficient (CD, CY, CL)
getBodyForceCoef(caseIndex: int, dir: int, component: int = -1) -> float
Get body force coefficient.

Args:
    caseIndex (int): Case index
    dir (int): Direction (0=X, 1=Y, 2=Z)
    component (int): Component ID (-1 for all)

Returns:
    float: Force coefficient
getMomentCoef(caseIndex: int, dir: int, component: int = -1) -> float
Get moment coefficient.

Args:
    caseIndex (int): Case index
    dir (int): Direction (0=roll, 1=pitch, 2=yaw)
    component (int): Component ID (-1 for all)

Returns:
    float: Moment coefficient (Cl, Cm, Cn)
getFieldResult(field: int) -> object
Get a field result of the last solution, one value per panel and case.

Args:
    field (FieldType): Field

Returns:
    ndarray: shape (numCases, numPanels), or None if the field was not calculated (pressures
             need their CalculationRequest, SORC the SOURCE_DIPOLE singularity)
getNumWakeNodes() -> int
Get number of wake nodes.
getWakeNodes() -> numpy.NDArray[numpy.float64]
Get wake node coordinates, shape (numWakeNodes, 3).
getNumWakePanels() -> int
Get number of wake panels.
getWakePanelInfo(panelIndex: int) -> tuple
Get a wake panel's wake node indices and the two body panels at its trailing edge.

Returns:
    tuple: (nodeIndices ndarray, (upperPanel, lowerPanel))
getWakePanelScaling(panelIndex: int) -> float
Get a wake panel's strength scaling (wake propagation).
getWakePanelStrength(panelIndex: int, caseIndex: int = 0) -> float
Get a wake panel's dipole strength.
getPlaneCut(origin: Annotated[numpy.ArrayLike, numpy.float64], dirH: Annotated[numpy.ArrayLike, numpy.float64], dirV: Annotated[numpy.ArrayLike, numpy.float64], field: int, components: object = None) -> list
Cut the body with a plane and evaluate a field along the cut (field averaged to the nodes).

Args:
    origin (array): Point of the plane [x, y, z]
    dirH, dirV (array): Two directions in the plane
    field (FieldType): Field to evaluate
    components (list, optional): Only cut panels of these component IDs

Returns:
    list: One dict per curve: 'points' (n, 3), 'values' (n,), 'closed' (bool); empty if the
          plane misses the body or the field was not calculated
getForceDistributionCurve(dirU: Annotated[numpy.ArrayLike, numpy.float64], dirV: Annotated[numpy.ArrayLike, numpy.float64], numPoints: int, caseIndex: int = 0, components: object = None) -> tuple
Get the distribution of force per unit length along a direction.

Args:
    dirU (array): Span direction
    dirV (array): Force direction
    numPoints (int): Number of points along the span
    caseIndex (int): Case index (default 0)
    components (list, optional): Only these component IDs

Returns:
    tuple: (span coordinates, force per unit length), two arrays of numPoints
getLiftDistributionCurve(dirU: Annotated[numpy.ArrayLike, numpy.float64], numPoints: int, caseIndex: int = 0, components: object = None) -> tuple
Get the distribution of lift per unit length along a direction.

Args:
    dirU (array): Span direction
    numPoints (int): Number of points along the span
    caseIndex (int): Case index (default 0)
    components (list, optional): Only these component IDs

Returns:
    tuple: (span coordinates, lift per unit length), two arrays of numPoints
releaseLicense() -> None
Give the license back to the license server now (the next run takes it again).
getLicenseStamp() -> str
Get the line naming the registered user and the license type, as put on results.
clear() -> None
Clear all data
clearNodes() -> None
Clear nodes
clearPanels() -> None
Clear panels
clearCases() -> None
Clear flow cases
clearPlaneCuts() -> None
Clear the plane cuts the solver keeps
exception ApameError(RuntimeError)

Enumerations

enum PanelType
Panel geometry types
QUAD0Quadrilateral panel
TRIA1Triangular panel
enum SingularityType
Singularity types
SOURCE_DIPOLE0Source + dipole
DIPOLE1Dipole only
enum CurvatureType
Curvature correction
OFF0No curvature correction
ON1Curvature correction enabled
enum WakePropagation
Wake strength propagation along the wake
OFF0Off
NEIGHBORS_ONLY1Off, but neighbors near the wake are split
CONSTANT2Constant strength
LINEAR3Linear strength
PARABOLIC4Parabolic strength
enum CalculationRequest
What the solver calculates after solving; combine with | (e.g. CalculationRequest.COEF | CalculationRequest.PRES)
COEF1Force and moment coefficients
FORC2Forces and moments
PRES4Pressure coefficient field
PSTA8Static pressure field
PDYN16Dynamic pressure field
PMAN32Manometer pressure field
enum FieldType
Field results, one value per panel
DBLT0Dipole (doublet) strength
SORC1Source strength
VMAG2Velocity magnitude
VELX3Velocity X component
VELY4Velocity Y component
VELZ5Velocity Z component
VSQR6Squared velocity
PRES7Pressure coefficient
PSTA8Static pressure
PDYN9Dynamic pressure
PMAN10Manometer pressure