Nonlinear finite element analysis.
xara is a Python package that provides an intuitive and performant API for nonlinear finite element analysis, implemented in C++ through the OpenSeesRT framework. OpenSees features state-of-the-art finite element formulations and solution algorithms, including mixed formulations for beams and solids, over 200 material models, and an extensive collection of continuation algorithms to solve highly nonlinear problems.
This package may be used as a drop-in replacement for both OpenSees.exe
and
OpenSeesPy (see Getting Started below), and generally provides a substantial performance boost.
The xara
package can be installed into a Python environment
in the standard manner. For example, using pip
:
pip install xara
There are several ways to use the xara
package:
-
The standard way to use
xara
from Python is to create axara.Model
, and invoke its methods:model = xara.Model(ndm=2, ndf=2) # Create a 2D model with 2 DOFs per node model.node(1, 2.0, 3.0) ...
Most of the functions from the OpenSeesPy library can be invoked directly as methods of a
xara.Model
without any changes in syntax, although it is generally encouraged to use the safer variants supported byxara
. For example:# BAD model.pattern("Plain", 1, "Linear") model.load(1, 2.0, 3.0) # GOOD model.pattern("Plain", 1, "Linear") model.load(1, 2.0, 3.0, pattern=1)
-
To start an interactive Tcl interpreter run the shell command:
python -m opensees
To quit the interpreter, just run
exit
:opensees > exit
-
To execute Tcl procedures programmatically from Python, create an instance of the
xara.Model
class and call itseval()
method to evaluate Tcl code:model = xara.Model() model.eval("model Basic -ndm 2") model.eval("print -json")
-
The
xara
package exposes a compatibility layer that exactly reproduces the OpenSeesPy functions, but does so without mandating a single global program state. To run OpenSeesPy scripts, just change the import:import openseespy.opensees
to
import opensees.openseespy
For true stateless modeling, the
Model
class should be used instead of the legacymodel
function; see the documentation here.
To compile the project see about/compiling
![]() |
![]() |