_SpringData

class _SpringData(dll: SofDll)

Bases: object

This class provides methods and a data structure to:

  • access keys 170/00 of the CDB file;

  • store the retrieved data in a convenient format;

  • provide access to the data after the CDB is closed.

The underlying data structure is a pandas.DataFrame with the following columns:

  • GROUP element group

  • ELEM_ID element number

  • N1 id of the first node

  • N2: id of the second node

  • CP: axial stiffness

  • CT: lateral stiffness

  • CM: rotational stiffness

  • DX: normal direction, X-component

  • DY: normal direction, Y-component

  • DZ: normal direction, Z-component

The DataFrame uses a MultiIndex with level ELEM_ID to enable fast lookups via the get method. The index column is not dropped from the DataFrame.

Note

Not all available quantities are retrieved and stored. In particular:

  • material or work law number

  • reference area

  • prestress

  • slip

  • maximum tension force

  • yielding load

  • reference axis

  • friction coefficient

  • cohesion coefficient

  • dilatancy factor

  • transversal slip

are currently not included, together with quantities for coupled damping elements.

This is a deliberate design choice and may be changed in the future without breaking the existing API.

clear() None

Clear all the loaded data.

get(element_id: int, quantity: str, default: float | int | None = None) float | int

Retrieve the requested spring quantity.

Parameters:
  • element_id (int) – Spring element number

  • quantity (str) –

    Quantity to retrieve. Must be one of:

    • "N1"

    • "N2"

    • "CP"

    • "CT"

    • "CM"

    • "DX"

    • "DY"

    • "DZ"

  • default (float or int or None, default None) – Value to return if the requested quantity is not found

Returns:

value – The requested quantity if found. Otherwise, returns default when it is not None.

Return type:

float or int

Raises:

LookupError – If the requested quantity is not found and default is None.

get_data(deep: bool = True) DataFrame

Return the pandas.DataFrame containing the loaded key 170/00.

Parameters:

deep (bool, default True) – When deep=True, a new object will be created with a copy of the calling object’s data and indices. Modifications to the data or indices of the copy will not be reflected in the original object (refer to pandas.DataFrame.copy() documentation for details).

has_stiffness(element_id: int, component: str = 'CP') bool

Return whether the specified stiffness component of a spring element is non-zero.

Parameters:
  • element_id (int) – Spring element number

  • component (str, default "CP") –

    Stiffness component to test. Must be one of:

    • "CP"

    • "CT"

    • "CM"

Returns:

True if the requested stiffness component exists and is non-zero. False if the component is zero or the element is not found.

Return type:

bool

load() None

Retrieve all spring data. If the key does not exist or it is empty, a warning is raised only if echo_level > 0.