elType

Module Contents

The elType module provides the elType class, which stores information about an Abaqus element type.

class elType.elType(name, numNodes, solvers='', description='')

Bases: object

The elType class stores information about a particular Abaqus element type.

__init__(name, numNodes, solvers, description='')

Initializes attributes of the elType class.

At the moment, numNodes is the only attribute used by inpRW. The other attributes are provided for the user’s convenience.

If numNodes is an integer, it will be stored to numNodes. If numNodes is a set, it will be stored to numNodesSet.

Parameters:
  • name (str) – The name of the element type.

  • numNodes (int or set) – The number of nodes needed to define the element. This is either an integer or a set of integers if the element type can have a varying number of nodes.

  • solvers (str) – A string indicating which Abaqus solvers support the element type. ‘S’ for Standard, ‘E’ for Explicit, and ‘SE’ for both.

  • description (str) – The description string for the element type, taken from the Abaqus documentation.

Examples

Here’s the basic usage of the class:

>>> from elType import elType
>>> elType('AC1D2', 2, 'S', '    2-node acoustic link')
elType(name='AC1D2', numNodes=2, solvers='S', description='    2-node acoustic link')

If numNodes is a set, you need to use the numNodesSet attribute instead of numNodes:

>>> elType1 = elType('C3D15V', {16, 17, 18, 15}, 'S', '    15 to 18-node triangular prism')
>>> l = list(elType1.numNodesSet)
>>> l.sort()
>>> l
[15, 16, 17, 18]
name

The element type name.

Type:

str

numNodesSet

A set of all the numbers of nodes which can define the element.

Type:

set

numNodes

The number of nodes needed to define the element.

Type:

int

description

The description string for the element type, taken from the Abaqus documentation.

Type:

str

solvers

A string indicating which Abaqus solvers support the element type. ‘S’ for Standard, ‘E’ for Explicit, and ‘SE’ for both.

Type:

str

__getattr__(name)

Overrides the default attribute retrieval behavior for cases where numNodes is not defined.

This function raises an AttributeError guiding users towards the numNodesSet attribute if numNodes does not exist.

See __getattr__() for more information.

Parameters:

name (str) – The attribute name.

Raises:

AttributeError

Examples

Here’s an example of trying to retrieve numNodes if it doesn’t exist:

>>> from elType import elType
>>> elType1 = elType('C3D15V', {16, 17, 18, 15}, 'S', '    15 to 18-node triangular prism')
>>> elType1.numNodes 
Traceback (most recent call last):
    ...
AttributeError: elType object has no attribute 'numNodes'. Use 'numNodesSet' instead...

The error is slightly different for any other attribute:

>>> elType1.test
Traceback (most recent call last):
    ...
AttributeError: elType object has no attribute 'test'.
__repr__()

Produces a repr of the elType instance.

If the instance includes numNodesSet, this will be reported as numNodes.

Returns:

str

Examples

Here’s a basic example:

>>> from elType import elType
>>> elType('AC1D2', 2, 'S', '    2-node acoustic link')
elType(name='AC1D2', numNodes=2, solvers='S', description='    2-node acoustic link')

If the instance has numNodesSet, this will be listed as ‘numNodes’:

>>> elType('C3D15V', {16, 17, 18, 15}, 'S', '    15 to 18-node triangular prism')
elType(name='C3D15V', numNodes={16, 17, 18, 15}, solvers='S', description='    15 to 18-node triangular prism')
__str__()

Produces a string of the elType instance.

Produces an identical string as __repr__().

Returns:

str

Examples

>>> from elType import elType
>>> str(elType(name='C3D8R', numNodes=8, solvers='SE'))
"elType(name='C3D8R', numNodes=8, solvers='SE', description='')"
__weakref__

list of weak references to the object (if defined)