Transitioning

Transitioning#

The only step required to transition from OpenSeesPy to 𝜒ara is to switch import statements from openseespy.opensees to opensees.openseespy.

With this change, most scripts should work without any other modifications. Once the switch is made, some simple changes to make scripts more readable are:

  • Change string flags to Python keywords. For example, change

    import openseespy.opensees as ops
    ops.model("BasicBuilder", "-ndm", 2, "-ndf", 3)
    

    to:

    import opensees.openseespy as ops
    ops.model("BasicBuilder", ndm=2, ndf=3)
    
  • Group related arguments into tuples. For example, change

    ops.node(1, 0.0, 0.0)
    

    to:

    ops.node(1, (0.0, 0.0))
    

    Both forms above are equivalent in 𝜒ara, but the second form is more readable and easier to maintain.

  • Prefer keyword arguments over positional arguments in supported commands. For example, change

    ops.uniaxialMaterial("Steel01", 1, 29000, 0.02)
    

    to:

    ops.uniaxialMaterial("Steel01", tag, E=29000, b=0.02)
    

    Note

    In general, a tag argument cannot be specified as a keyword argument.

  • Change ops to a xara.Model instance for model building commands. For example, change

    ops.model("BasicBuilder", "-ndm", 2, "-ndf", 3)
    ops.node(1, 0.0, 0.0)
    

    to:

    model = xara.Model("BasicBuilder", ndm=2, ndf=3)
    model.node(1, 0.0, 0.0)