Skip to content

Element

Element

Element(element_type: str, ndof: int, material: Union[Material, List[Material], None] = None, section: Section = None, transformation: GeometricTransformation = None, **element_params)

Bases: ABC

Base abstract class for manager-owned OpenSees finite elements.

Element instances do not self-register and do not assign their own tags. An ElementManager owns lifecycle operations, tag assignment, removal, and retagging for a local model context.

Attributes:

Name Type Description
tag Optional[int]

Manager-assigned OpenSees element tag. Remains None until this object is added to an ElementManager.

_owner object | None

Reference to the owning manager, or None when unmanaged.

element_type

The type of element (e.g., 'quad', 'truss', 'beam').

_ndof

Number of degrees of freedom for the element.

element_params

Dictionary of element-specific parameters.

_material

Primary material assigned to this element.

_materials

List of all materials assigned to this element.

_section

Section assigned to this element (for section-based elements).

_transformation

Geometric transformation assigned to this element (for beam elements).

Initializes the Element with flexible dependency support.

Methods:

Name Description
assign_material

Replace this definition's material references without registration.

assign_section

Replace the section reference without compatibility validation.

assign_transformation

Replace the transformation reference without registry lookup.

assign_ndof

Store a new nodal DOF count on this definition.

get_material

Return the primary material reference, or None when absent.

get_materials

Return a shallow copy of the assigned material list.

get_section

Return the assigned section object, or None if absent.

get_transformation

Return the assigned transformation object, or None if absent.

get_element_params

Return a shallow copy of the element parameter dictionary.

update_element_params

Merge keyword entries into the element parameter dictionary.

get_ndof

Return the stored nodal degree-of-freedom count.

to_tcl

Render one solver cell using explicit connectivity.

get_section_tag

Return the section's current tag, or zero if no section is assigned.

get_material_tag

Return the primary material's tag, or zero if there is no material.

get_mass_per_length

Return mass per unit length as defined by the concrete formulation.

get_density

Return the concrete formulation's density contribution.

Methods:

assign_material

assign_material(material: Union[Material, List[Material]]) -> None

Replace this definition's material references without registration.

Parameters:

Name Type Description Default
material Material | list[Material]

Primary material or ordered material list. An empty list clears the primary reference.

required
Note

The base setter does not validate compatibility or register materials. Changes affect the shared definition, not just one assembled cell.

assign_section

assign_section(section: Section) -> None

Replace the section reference without compatibility validation.

Parameters:

Name Type Description Default
section Section

Section object; this setter does not resolve tags or add the section to a manager.

required

assign_transformation

assign_transformation(transformation: GeometricTransformation) -> None

Replace the transformation reference without registry lookup.

Parameters:

Name Type Description Default
transformation GeometricTransformation

Transformation object. Ensure registration and formulation compatibility before export.

required

assign_ndof

assign_ndof(ndof: int) -> None

Store a new nodal DOF count on this definition.

Parameters:

Name Type Description Default
ndof int

Requested count. The base setter does not validate it, rebuild a mesh, or update already assembled node metadata.

required

get_material

get_material() -> Optional[Material]

Return the primary material reference, or None when absent.

For a material list, the primary material is its first entry. No object is copied and no registry lookup is performed.

get_materials

get_materials() -> List[Material]

Return a shallow copy of the assigned material list.

Material objects are shared; editing list membership does not alter the definition, but changing an individual material affects that object.

get_section

get_section() -> Optional[Section]

Return the assigned section object, or None if absent.

This is the original reference, not a copy or newly resolved section.

get_transformation

get_transformation() -> Optional[GeometricTransformation]

Return the assigned transformation object, or None if absent.

No copy is made. This method does not test whether it remains registered.

get_element_params

get_element_params() -> Dict[str, Any]

Return a shallow copy of the element parameter dictionary.

Editing top-level keys does not change this definition; nested mutable values remain shared. Use update_element_params to replace entries.

update_element_params

update_element_params(**new_params: Any) -> None

Merge keyword entries into the element parameter dictionary.

Parameters:

Name Type Description Default
**new_params Any

Keys and replacement values. The base method does not validate them, rerun the constructor, or reassemble meshes.

{}

get_ndof

get_ndof() -> int

Return the stored nodal degree-of-freedom count.

This describes the reusable definition, not the total equation count of a model or the number of nodes in a cell.

to_tcl abstractmethod

to_tcl(tag: int, nodes: List[int]) -> str

Render one solver cell using explicit connectivity.

Parameters:

Name Type Description Default
tag int

Solver element tag for the particular cell, distinct from the reusable definition's manager tag.

required
nodes list[int]

Ordered solver node tags required by the formulation.

required

Returns:

Name Type Description
command str

Tcl supplied by a concrete implementation. This abstract base does not implement cell rendering or execution.

get_section_tag

get_section_tag() -> Optional[int]

Return the section's current tag, or zero if no section is assigned.

An assigned but unmanaged section can return None. This helper does not register the section or guarantee that the tag is exportable.

get_material_tag

get_material_tag() -> Optional[int]

Return the primary material's tag, or zero if there is no material.

An assigned unmanaged material can return None. The value is a material definition tag, not a solver element tag.

get_mass_per_length

get_mass_per_length() -> float

Return mass per unit length as defined by the concrete formulation.

This base implementation returns 0.0. It does not integrate geometry or add nodal masses; relevant subclasses override the hook.

get_density

get_density() -> float

Return the concrete formulation's density contribution.

This base implementation returns 0.0 rather than deriving a density from its material. Concrete subclasses may supply a formulation-specific value.