Skip to content
This repository has been archived by the owner on Oct 24, 2024. It is now read-only.

Use new opensees Python package #128

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ pytest >=3.2
sphinx_compas_theme >=0.13
sphinx >=3.4
twine
opensees>=0.1.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only requirements related to package development should be listed here...

-e .
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
COMPAS >=1.0
opensees>=0.1.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should indeed be an optional dependency since it is not compatible with Rhino 7

14 changes: 13 additions & 1 deletion src/compas_fea/fea/opensees/opensees.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def input_generate(structure, fields, output, ndof):
print('***** OpenSees input file generated: {0} *****\n'.format(filename))


def launch_process(structure, exe, output):
def launch_process(structure, exe, output, subproc=True):
""" Runs the analysis through OpenSees.

Parameters
Expand All @@ -70,6 +70,9 @@ def launch_process(structure, exe, output):
OpenSees exe path to bypass defaults.
output : bool
Print terminal output.
subproc : bool (optional, default=True)
Whether to lauch OpenSees as a subprocess. If False, the
new opensees Python package is used to evaluate the input.

Returns
-------
Expand All @@ -90,6 +93,15 @@ def launch_process(structure, exe, output):

tic = time()

if not subproc:
# use new opensees python package to execute the Tcl input
import opensees.tcl
with open(f"{path}{name}.tcl", "r") as f:
opensees.tcl.eval(f.read())
toc = time() - tic
pprint('\n***** OpenSees analysis time : {0} s *****'.format(toc))
return

if not exe:
exe = 'C:/OpenSees.exe'

Expand Down
Loading