Section integrator

Base class for section integrators

class structuralcodes.sections.SectionIntegrator[source]

Abstract base class for section integrators.

abstract prepare_input(geo: CompoundGeometry, strain: ArrayLike, integrate: str)[source]

Prepare general input to the stress integration method.

Parameters:
  • geo (CompoundGeometry) – The geometry to integrate over.

  • strain (ArrayLike) – The scalar strain components necessary for describing the assumed strain distribution over the geometry.

  • integrate (str) – The integrand, i.e., the quantity to be integrated over the section.

abstract integrate_stress(*prepared_input, **kwargs)[source]

Integrate stresses over the geometry.

The input to this method is generated by the prepare_input method. It also takes kwargs depending on the concrete implementation.

Parameters:

*prepared_input – The input prepared by the prepare_input method.

Keyword Arguments:

**kwargs – Keyword arguments depending on the concrete implementation.

abstract integrate_modulus(*prepared_input, **kwargs)[source]

Integrate material modulus over the geometry.

The input to this method is generated by the prepare_input method. It also takes kwargs depending on the concrete implementation.

Parameters:

*prepared_input – The input prepared by the prepare_input method.

Keyword Arguments:

**kwargs – Keyword arguments depending on the concrete implementation.

abstract integrate_strain_response_on_geometry(geo: CompoundGeometry, strain: ArrayLike, integrate: str, **kwargs)[source]

Integrate stresses over the geometry to obtain the response due to strains.

Integrator factory

structuralcodes.sections.integrator_factory(method: Literal['marin', 'fiber']) SectionIntegrator

A factory for integrators.

The Marin integrator

class structuralcodes.sections.MarinIntegrator[source]

Section integrator based on the Marin algorithm.

prepare_input(geo: CompoundGeometry, strain: ArrayLike, integrate: Literal['stress', 'modulus'] = 'stress') Tuple[float, Tuple[ndarray, ndarray, ndarray]][source]

Prepare general input to the integration of stress or material modulus in the section.

Calculate the stress resultants or tangent section stiffness based on strains in a set of points.

Keyword Arguments:
  • geo (CompoundGeometry) – The geometry of the section.

  • strain (ArrayLike) – The strains and curvatures of the section, given in the format (ea, ky, kz) which are i) strain at 0,0, ii) curvature y axis, iii) curvature z axis.

  • integrate (str) – a string indicating the quantity to integrate over the section. It can be ‘stress’ or ‘modulus’. When ‘stress’ is selected, the return value will be the stress resultants N, My, Mz, while if ‘modulus’ is selected, the return will be the section stiffness matrix (default is ‘stress’).

Returns:

The prepared input represented as the angle of rotation computed (needed for rotating back the resultants) and as a tuple with 3 ndarrys collecting respectively y, z and stress coefficients for each sub-part.

Return type:

Tuple(float, Tuple(ndarray, ndarray, ndarray))

Raises:
  • ValueError – If a unkown value is passed to the integrate

  • parameter.

integrate_stress(angle: float, prepared_input: List[Tuple[int, ndarray, ndarray, ndarray]]) Tuple[float, float, float][source]

Integrate stresses over the geometry.

Parameters:

prepared_input (List) – The prepared input from .prepare_input().

Returns:

The stress resultants N, My and Mz.

Return type:

Tuple(float, float, float)

integrate_modulus(angle: float, prepared_input: List[Tuple[int, ndarray, ndarray, ndarray]]) ndarray[tuple[int, ...], dtype[float64]][source]

Integrate material modulus over the geometry.

Parameters:

prepared_input (List) – The prepared input from .prepare_input().

Returns:

The section stiffness matrix as a (3, 3) ndarray.

Return type:

ndarray

integrate_strain_response_on_geometry(geo: CompoundGeometry, strain: ArrayLike, integrate: Literal['stress', 'modulus'] = 'stress', **kwargs)[source]

Integrate strees or material modulus in the section with the marin algorithm.

Calculate the stress resultants or tangent section stiffness based on strains in a set of points.

Parameters:
  • geo (CompoundGeometry) – The geometry of the section.

  • strain (ArrayLike) – The strains and curvatures of the section, given in the format (ea, ky, kz) which are i) strain at 0,0, ii) curvature y axis, iii) curvature z axis.

  • integrate (str) – a string indicating the quantity to integrate over the section. It can be ‘stress’ or ‘modulus’. When ‘stress’ is selected, the return value will be the stress resultants N, My, Mz, while if ‘modulus’ is selected, the return will be the

Returns:

The first element is either a tuple of floats (for the stress resultants (N, My, Mz) when integrate=’stress’, or a numpy array representing the stiffness matrix then integrate=’modulus’.

Return type:

Tuple(Union(Tuple(float, float, float), np.ndarray), None)

Example

result, _ = integrate_strain_response_on_geometry(geo, strain, integrate=’tanent’) # result will be the stiffness matrix (a 3x3 numpy array) if # integrate=’modulus’

Raises:
  • ValueError – If a unkown value is passed to the integrate

  • parameter.

structuralcodes.sections.marin_integration(y: List[float], z: List[float], m: int, n: int) float[source]

Marin’s algorithm for integrating a polynomial over a closed polygon.

The order of the polygon vertices is significant. If the points are in counterclockwise order the integral is positive, otherwise the integral is negative.

Parameters:
  • y (List(float)) – Y coordinates of polygon vertices.

  • z (List(float)) – Z coordinates of polygon vertices.

  • m (int) – The degree of the polynomial in the y direction.

  • n (int) – The degree of the polynomial in the z direction.

Returns:

The result of the integrated polynomial.

Return type:

float

The fiber integrator

class structuralcodes.sections.FiberIntegrator[source]

Section integrator based on the Marin algorithm.

prepare_input(geo: CompoundGeometry, strain: ArrayLike, integrate: Literal['stress', 'modulus'] = 'stress', **kwargs) Tuple[Tuple[ndarray, ndarray, ndarray]][source]

Prepare general input to the integration of stress or material modulus in the section.

Calculate the stress resultants or tangent section stiffness based on strains in a set of points.

Parameters:
  • geo (CompoundGeometry) – The geometry of the section.

  • strain (ArrayLike) – The strains and curvatures of the section, given in the format (ea, ky, kz) which are i) strain at 0,0, ii) curvature y axis, iii) curvature z axis.

  • integrate (str) – a string indicating the quantity to integrate over the section. It can be ‘stress’ or ‘modulus’. When ‘stress’ is selected, the return value will be the stress resultants N, My, Mz, while if ‘modulus’ is selected, the return will be the tangent section stiffness matrix (default is ‘stress’).

Keyword Arguments:

mesh_size (float) – Percentage of area (number from 0 to 1) max for triangle elements.

Returns:

The prepared input representing a list with x-coordinates, y-coordinates and force for each fiber and a list containing the triangulation data that can be stored and used later to avoid repetition of triangulation.

Return type:

Tuple(List)

Raises:
  • ValueError – If a unkown value is passed to the integrate

  • parameter.

integrate_stress(prepared_input: List[Tuple[int, ndarray, ndarray, ndarray]]) Tuple[float, float, float][source]

Integrate stresses over the geometry.

Parameters:

prepared_input (List) – The prepared input from .prepare_input().

Returns:

The stress resultants N, Mx and My.

Return type:

Tuple(float, float, float)

integrate_modulus(prepared_input: List[Tuple[int, ndarray, ndarray, ndarray]]) ndarray[tuple[int, ...], dtype[_ScalarType_co]][source]

Integrate material modulus over the geometry to obtain section stiffness.

Parameters:

prepared_input (List) – The prepared input from .prepare_input().

Returns:

The stiffness matrix with shape (3,3).

Return type:

NDArray[float]

integrate_strain_response_on_geometry(geo: CompoundGeometry, strain: ArrayLike, integrate: Literal['stress', 'modulus'] = 'stress', **kwargs) Tuple[Tuple[float, float, float] | ndarray, List][source]

Integrate stress or material modulus in the section with the fiber algorithm.

Parameters:
  • geo (CompoundGeometry) – The geometry of the section.

  • strain (ArrayLike) – The strains and curvatures of the section, given in the format (ea, ky, kz) which are i) strain at 0,0, ii) curvature y axis, iii) curvature z axis.

  • integrate (str) – a string indicating the quantity to integrate over the section. It can be ‘stress’ or ‘modulus’. When ‘stress’ is selected, the return value will be the stress resultants N, My, Mz, while if ‘modulus’ is selected, the return will be the section stiffness matrix (default is ‘stress’).

  • mesh_size – Percentage of area (number from 0 to 1) max for triangle elements.

Returns:

The first element is either a tuple of floats (for the stress resultants (N, My, Mz) when integrate=’stress’, or a numpy array representing the stiffness matrix then integrate=’modulus’. The second element is a list with data from triangulation.

Return type:

Tuple(Union(Tuple(float, float, float), np.ndarray), List)

Example

result, tri = integrate_strain_response_on_geometry(geo, strain, integrate=’tangent’) result will be the stiffness matrix (a 3x3 numpy array) if

Raises:
  • ValueError – If a unkown value is passed to the integrate

  • parameter.

prepare_triangulation(geo: SurfaceGeometry) Dict[source]

Prepare data for triangulating it with triangle.

Parameters:

geo (SurfaceGeometry) – The geometry to triangulate.

Returns:

The triangulation data.

Return type:

Dict