Element#

class ansys.dpf.core.elements.Element(mesh, elementid, index, nodes)#

Contains all properties of an element of a mesh.

The element is created from the MeshedRegion class. Properties include the element ID, index, type, shape, and connectivity.

Parameters:
  • mesh (ansys.dpf.core.meshed_region.MeshedRegion) – Mesh containing the element.

  • elementid (int) – Number (ID) of the element.

  • index (int) – Fortran-based (1-based) index of the element in the result.

  • nodes (list) – List of DPF nodes belonging to the element.

Examples

Extract a single element from a meshed region.

>>> import ansys.dpf.core as dpf
>>> from ansys.dpf.core import examples
>>> model = dpf.Model(examples.find_static_rst())
>>> elements = model.metadata.meshed_region.elements
>>> element = elements[0]

List the coordinates belonging to the first node of the element.

>>> element.nodes[0].coordinates
[0.015, 0.045, 0.015]

Overview#

node_ids

IDs of all nodes in the element.

id

ID of the element.

index

Index of the element in the result.

nodes

All nodes in the element.

n_nodes

Number of nodes in the element.

type

Type of the element.

shape

Shape of the element.

connectivity

Ordered list of node indices of the element.

__str__

Provide more details in the string representation.

Import detail#

from ansys.dpf.core.elements import Element

Property detail#

property Element.node_ids#

IDs of all nodes in the element.

Returns:

List of IDs for all nodes in the element.

Return type:

list

Examples

>>> import ansys.dpf.core as dpf
>>> from ansys.dpf.core import examples
>>> model = dpf.Model(examples.find_static_rst())
>>> elements = model.metadata.meshed_region.elements
>>> element = elements[0]
>>> element.node_ids
[1, 26, 14, 12, 2, 27, 15, 13, 33, 64, 59, 30, 37, 65, 61, 34, 28, 81, 63, 58]
property Element.id: int#

ID of the element.

Returns:

ID of the element.

Return type:

int

property Element.index: int#

Index of the element in the result.

Returns:

Index of the element in the result. This uses zero-based indexing starting at 0.

Return type:

int

property Element.nodes#

All nodes in the element.

Returns:

List of all nodes in the element.

Return type:

list

Examples

>>> import ansys.dpf.core as dpf
>>> from ansys.dpf.core import examples
>>> model = dpf.Model(examples.find_static_rst())
>>> elements = model.metadata.meshed_region.elements
>>> element = elements[0]
>>> first_node = element.nodes[0]
property Element.n_nodes: int#

Number of nodes in the element.

Returns:

Number of nodes.

Return type:

int

property Element.type: element_types#

Type of the element.

Returns:

Type of the element. For more information, see ansys.dpf.core.elements.element_types.

Return type:

element_types

Examples

>>> import ansys.dpf.core as dpf
>>> from ansys.dpf.core import examples
>>> model = dpf.Model(examples.find_static_rst())
>>> elements = model.metadata.meshed_region.elements
>>> element = elements[0]
>>> element.type

property Element.shape: str#

Shape of the element.

Returns:

Shape of the element, which can be "shell", "solid", "beam", or "unknown_shape".

Return type:

str

Examples

>>> import ansys.dpf.core as dpf
>>> from ansys.dpf.core import examples
>>> model = dpf.Model(examples.find_static_rst())
>>> elements = model.metadata.meshed_region.elements
>>> element = elements[0]
>>> element.shape
'solid'
property Element.connectivity#

Ordered list of node indices of the element.

Returns:

Ordered list of node indices.

Return type:

list

Method detail#

Element.__str__()#

Provide more details in the string representation.