Skip to content

GhostNodeElement

GhostNodeElement

GhostNodeElement(ndof: int = 3, **kwargs)

Bases: Element

Virtual element that owns mesh nodes without creating OpenSees elements.

GhostNodeElement keeps nodes in the Femora mesh and Tcl export pipeline without emitting a structural element command. It is commonly used for center-of-mass nodes, control or reference nodes, and mass application points that should not participate in element stiffness.

Note
  • Each instance receives a unique sentinel ndf value so mesh merging does not combine ghost nodes with structural nodes or with one another. At export, the sentinel is mapped back to the real DOF count through resolve_ndf.
  • to_tcl returns a Tcl comment rather than an OpenSees element command; the owning nodes are still written by the export loop.
Example
from femora.core.model import Model

model = Model()
ghost = model.element.special.ghost_node(ndof=6)
print(ghost.real_ndof)

Create a GhostNodeElement with merge-protected sentinel DOF metadata.

Parameters:

Name Type Description Default
ndof int

Real number of DOFs per node written during Tcl export. Must be 3 or 6.

3
**kwargs

Additional keyword arguments forwarded to the base element constructor.

{}

Raises:

Type Description
ValueError

If ndof is not 3 or 6.

Attributes

real_ndof property

real_ndof: int

Return the real DOF count written to the Tcl node command.

Methods:

resolve_ndf classmethod

resolve_ndf(ndf_value: int) -> int

Map a mesh ndf value to the real DOF count for Tcl export.

If ndf_value is a ghost sentinel, it is resolved through the internal map. Otherwise the input is returned unchanged.

Parameters:

Name Type Description Default
ndf_value int

Raw ndf value from mesh point_data["ndf"].

required

Returns:

Type Description
int

The real DOF count to write into the Tcl node command.

is_ghost_ndf classmethod

is_ghost_ndf(ndf_value: int) -> bool

Check whether an ndf value is a ghost-node sentinel.

Parameters:

Name Type Description Default
ndf_value int

The ndf value to inspect.

required

Returns:

Type Description
bool

True if the value is a ghost-node sentinel.