PySAGAS Sensitivity Calculators

class pysagas.sensitivity.calculator.AbstractSensitivityCalculator[source]

Abstract sensitivity calculator class defining the interface.

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

None

abstract _extract_parameters()[source]

Extract the geometry parameters.

Returns:

parameters – A list of the parameter names.

Return type:

List[str]

abstract _transcribe_cells(parameters)[source]

Transcribes the unified Cells from the solver data.

Returns:

cells – A list of the Cells from the flow solution.

Return type:

List[Cell]

Parameters:

parameters (List) –

abstract to_csv()[source]

Dumps the sensitivity data to CSV file.

class pysagas.sensitivity.calculator.GenericSensitivityCalculator[source]
__init__(cells, sensitivity_filepath=None, cells_have_sens_data=False, verbosity=1, **kwargs)[source]

Instantiate a generic PySAGAS sensitivity calculator.

Parameters:
  • cells (list[Cell]) – A list of transcribed Cell objects, containing the nominal flow solution.

  • sensitivity_filepath (str) – The filepath to the geometry sensitivities. This must be provided, if the cells do not have geometric sensitivity information attached. This must also be provided anyway, to determine the geometric design parameters.

  • cells_have_sens_data (bool, optional) – The cells already have geometric sensitivity data matched to them. When this is True, the sensitivity_filepath argument (if provided) is ignored. The default is False.

  • verbosity (int, optional) – The verbosity of the code. The defualt is 1.

Return type:

None

_transcribe_cells(**kwargs)[source]

This is a dummy method to satisfy the abstract base class. Transcribed cells are provided upon instantiation of the sensitivity calculator.

Return type:

List[Cell]

class pysagas.sensitivity.calculator.SensitivityCalculator[source]

SensitivityCalculator base class.

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

None

_extract_parameters()[source]

Extract the geometry parameters.

Returns:

parameters – A list of the parameter names.

Return type:

List[str]

calculate(sensitivity_model='van_dyke', cog=Vector(0, 0, 0), flowstate=None, **kwargs)[source]

Calculate the force sensitivities of the surface to the parameters.

Parameters:
  • sensitivity_model (Callable | Literal["piston", "van_dyke", "isentropic"], optional) – The model used to calculate the pressure/parameter sensitivities. The default is Van Dyke’s second-order theory model.

  • cog (Vector, optional) – The centre of gravity. The default is Vector(0, 0, 0).

  • flowstate (FlowState, optional) – The flowstate associated with this result. The default is None.

Returns:

SensitivityResults

Return type:

the sensitivity results object.

static cell_sensitivity(cell, sensitivity_function, cog=Vector(0, 0, 0), **kwargs)[source]

Calculates force and moment sensitivities for a single cell.

Parameters:
  • cell (Cell) – The cell.

  • sensitivity_function (Callable) – The function to use when calculating the pressure sensitivities.

  • cog (Vector, optional) – The reference centre of gravity, used in calculating the moment sensitivities. The defualt is Vector(0,0,0).

Returns:

sensitivities – An array of shape n x 3, for a 3-dimensional cell with n parameters.

Return type:

np.array

See also

all_dfdp

a wrapper to calculate force sensitivities for many cells

static net_sensitivity(cells, sensitivity_model='van_dyke', cog=Vector(0, 0, 0), **kwargs)[source]

Calcualtes the net force and moment sensitivities for a list of Cells.

Parameters:
  • cells (list[Cell]) – The cells to be analysed.

  • sensitivity_model (Callable | Literal["piston", "van_dyke", "isentropic"], optional) – The model used to calculate the pressure/parameter sensitivities. The default is Van Dyke’s second-order theory model.

  • cog (Vector, optional) – The reference centre of gravity, used in calculating the moment sensitivities. The defualt is Vector(0,0,0).

Returns:

  • dFdp (np.array) – The force sensitivity matrix with respect to the parameters.

  • dMdp (np.array) – The moment sensitivity matrix with respect to the parameters.

Return type:

Tuple[array, array]

to_csv()[source]

Dumps the sensitivity data to CSV file.

Supported CFD Wrappers

The following CFD sensitivity wrappers have been implemented into PySAGAS.