PySAGAS CFD Module

class pysagas.cfd.solver.AbstractFlowSolver[source]

Abstract interface for flow solvers.

abstract __init__(**kwargs)[source]
Return type:

None

class pysagas.cfd.solver.FlowResults[source]

A class containing the aerodynamic force and moment information with respect to design parameters.

freestream

The freestream flow state.

Type:

FlowState

net_force

The net force in cartesian coordinate frame (x,y,z).

Type:

pd.DataFrame

m_sense

The net moment in cartesian coordinate frame (x,y,z).

Type:

pd.DataFrame

__init__(freestream, net_force, net_moment)[source]
Parameters:
Return type:

None

coefficients(A_ref=1.0, c_ref=1.0)[source]

Calculate the aerodynamic coefficients CL, CD and Cm.

Parameters:
  • A_ref (float, optional) – The reference area (m^2). The default is 1 m^2.

  • c_ref (float, optional) – The reference length (m). The default is 1 m.

Return type:

C_L, C_D, C_m

class pysagas.cfd.solver.FlowSolver[source]

Base class for CFD flow solver.

__init__(cells, freestream=None, verbosity=1)[source]

Instantiates the flow solver.

Parameters:
  • cells (list[Cell]) – A list of the cells describing the geometry.

  • freestream (Flowstate, optional) – The free-stream flow state. The default is the freestream provided upon instantiation of the solver.

  • verbosity (int, optional) – The verbosity of the solver. The default is 1.

Return type:

None

static body_to_wind(v, aoa)[source]

Converts a vector from body axes to wind axes.

Parameters:
  • v (Vector) – The result to transform.

  • aoa (float) – The angle of attack, specified in degrees.

Returns:

r – The transformed result.

Return type:

Vector

save(name, attributes)[source]

Save the solution to VTK file format. Note that the geometry mesh must have been loaded from a parser which includes connectivity information (eg. PyMesh or TRI).

Parameters:
  • name (str) – The filename prefix of the desired output file.

  • attributes (Dict[str, list]) – The attributes dictionary used to initialise the file writer. Note that this is not required when calling solve from a child FlowSolver.

solve(freestream=None, mach=None, aoa=None)[source]

Run the flow solver.

Parameters:
  • freestream (Flowstate, optional) – The free-stream flow state. The default is the freestream provided upon instantiation of the solver.

  • mach (float, optional) – The free-stream Mach number. The default is that specified in the freestream flow state.

  • aoa (float, optional) – The free-stream angle of attack. The default is that specified in the freestream flow state.

Returns:

result – The flow results.

Return type:

FlowResults

:raises Exception : when no freestream can be found.:

solve_sens(freestream=None, mach=None, aoa=None)[source]

Run the flow solver to obtain sensitivity information.

Parameters:
  • freestream (Flowstate, optional) – The free-stream flow state. The default is the freestream provided upon instantiation of the solver.

  • Mach (float, optional) – The free-stream Mach number. The default is that specified in the freestream flow state.

  • aoa (float, optional) – The free-stream angle of attack. The default is that specified in the freestream flow state.

  • mach (float | None) –

Return type:

SensitivityResults

:raises Exception : when no freestream can be found.:

sweep(aoa_range, mach_range)[source]

Evaluate the aerodynamic coefficients over a sweep of angle of attack and mach numbers.

Parameters:
  • aoa_range (list[float]) – The angles of attack to evaluate at, specified in degrees.

  • mach_range (list[float]) – The Mach numbers to evaluate at.

Returns:

results – A Pandas DataFrame of the aerodynamic coefficients at each angle of attack and Mach number combination.

Return type:

pd.DataFrame

class pysagas.cfd.solver.SensitivityResults[source]

A class containing the aerodynamic force and moment sensitivity information with respect to design parameters.

freestream

The freestream flow state.

Type:

FlowState

f_sense

The force sensitivities in cartesian coordinate frame (x,y,z).

Type:

pd.DataFrame

m_sense

The moment sensitivities in cartesian coordinate frame (x,y,z).

Type:

pd.DataFrame

__init__(f_sens, m_sens, freestream=None)[source]
Parameters:
  • f_sens (DataFrame) –

  • m_sens (DataFrame) –

  • freestream (FlowState | None) –

Return type:

None

coefficients(A_ref=1.0, c_ref=1.0)[source]

Calculate the aerodynamic coefficients CL, CD and Cm.

Parameters:
  • A_ref (float, optional) – The reference area (m^2). The default is 1 m^2.

  • c_ref (float, optional) – The reference length (m). The default is 1 m.

Return type:

A tuple (cf_sens, cm_sens) containing the force and moment coefficient sensitivities.