LineSpring#

class planestress.pre.boundary_condition.LineSpring(point1: tuple[float, float], point2: tuple[float, float], direction: str, value: float)[source]#

Bases: LineBoundaryCondition

Class for adding springs along a line.

Variables:

mesh_tag – Tagged line object.

Methods

apply_bc

Applies the boundary condition.

get_dofs_given_direction

Gets the degrees of freedom based on the BC direction.

get_unique_nodes

Returns a list of unique node indexes along the line BC.

__init__(point1: tuple[float, float], point2: tuple[float, float], direction: str, value: float) None[source]#

Inits the LineSpring class.

Parameters:
  • point1 (tuple[float, float]) – Point location (x, y) of the start of the line spring.

  • point2 (tuple[float, float]) – Point location (x, y) of the end of the line spring.

  • direction (str) – Direction of the line spring, either "x", "y" or "xy".

  • value (float) – Spring stiffness per unit length.

Example

TODO.

apply_bc(k: lil_array, f: npt.NDArray[np.float64]) tuple[lil_array, npt.NDArray[np.float64]][source]#

Applies the boundary condition.

Parameters:
  • k (lil_array) – Stiffness matrix.

  • f (npt.NDArray[np.float64]) – Load vector.

Returns:

Modified stiffness matrix and load vector (k, f).

Return type:

tuple[lil_array, npt.NDArray[np.float64]]

get_dofs_given_direction(dofs: list[int]) list[int]#

Gets the degrees of freedom based on the BC direction.

Parameters:

dofs (list[int]) – Degrees of freedom.

Returns:

Degrees of freeom in BC direction.

Return type:

list[int]

get_unique_nodes() list[int]#

Returns a list of unique node indexes along the line BC.

Raises:

RuntimeError – If a mesh tag has not been assigned.

Returns:

List of unique node indexes along the line.

Return type:

list[int]