├── .gitignore ├── BeamContact2D ├── 01GK33-A0X.TXT ├── disp.txt ├── example1 │ ├── example1.py │ └── model.tcl ├── example2 │ ├── 2DContact_ODB │ │ ├── Elements_2Node.out │ │ ├── Elements_3Node.out │ │ ├── Elements_4Node.out │ │ ├── Elements_8Node.out │ │ ├── ModeShapes │ │ │ ├── ModalPeriods.out │ │ │ ├── ModeShape1.out │ │ │ ├── ModeShape2.out │ │ │ └── ModeShape3.out │ │ ├── Nodes.out │ │ └── Static │ │ │ ├── NodeDisp_All.out │ │ │ └── Reaction_All.out │ ├── disp.txt │ ├── example2.py │ ├── model.msh │ ├── model.tcl │ └── node.txt ├── example3 │ ├── disp.txt │ ├── example3.py │ └── model.msh ├── example4 │ └── example4.py ├── excavation.py ├── excavation.tcl ├── model.msh ├── test.py └── toOpenSeesPy.py ├── Cantilever 2D EQ ground motion with gravity Analysis ├── A10000.dat └── Canti2DEQ.py ├── Laterally-Loaded Pile Foundation ├── pile.py ├── pileDisp.out ├── pileForce.out ├── reaction.out └── testFunction.py ├── README.md ├── Reinforced Concrete Frame Earthquake Analysis ├── RCFrameEarthquake.py ├── RCFrameGravity.py ├── ReadRecord.py ├── __pycache__ │ ├── RCFrameGravity.cpython-36.pyc │ └── ReadRecord.cpython-36.pyc ├── elCentro.at2 ├── elCentro.dat └── results.out ├── RotD Spectra of Ground Motion ├── GM11.AT2 ├── GM12.AT2 ├── GM21.AT2 ├── GM22.AT2 ├── ReadGMFile.py ├── Spectra │ └── GM1_Spectra.txt └── example_RotD_Spectra_Generation.py ├── ZeroLengthContactNTS2D ├── example1 │ ├── ZeroLengthContactNTS2D - OpenSeesWiki.pdf │ ├── disp.txt │ ├── example1.py │ ├── model.msh │ ├── model.res │ └── model.tcl ├── example2 │ ├── disp.txt │ ├── example2.msh │ ├── example2.py │ ├── example2.res │ ├── model.tcl │ └── node_load.txt └── example3 │ ├── disp.txt │ ├── example3.msh │ ├── example3.py │ ├── example3.res │ └── model.tcl ├── ZeroLengthInterface2D ├── example1 │ ├── disp.txt │ ├── ele.txt │ ├── example1.msh │ ├── example1.py │ └── model.tcl ├── example2 │ ├── disp.txt │ ├── ele.txt │ ├── example2.msh │ ├── example2.py │ └── model.tcl └── example3 │ ├── disp.txt │ ├── example3.msh │ ├── example3.py │ └── model.tcl ├── index.html ├── model.tcl ├── showfigure.png └── spaced nonlinear SDOF ├── __pycache__ └── opensees_constants.cpython-36.pyc ├── example_name_spaced_nonlinear_sdof.py ├── opensees_constants.py └── test_motion_dt0p01.txt /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | lib/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | wheels/ 23 | pip-wheel-metadata/ 24 | share/python-wheels/ 25 | *.egg-info/ 26 | .installed.cfg 27 | *.egg 28 | MANIFEST 29 | 30 | # PyInstaller 31 | # Usually these files are written by a python script from a template 32 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 33 | *.manifest 34 | *.spec 35 | 36 | # Installer logs 37 | pip-log.txt 38 | pip-delete-this-directory.txt 39 | 40 | # Unit test / coverage reports 41 | htmlcov/ 42 | .tox/ 43 | .nox/ 44 | .coverage 45 | .coverage.* 46 | .cache 47 | nosetests.xml 48 | coverage.xml 49 | *.cover 50 | *.py,cover 51 | .hypothesis/ 52 | .pytest_cache/ 53 | 54 | # Translations 55 | *.mo 56 | *.pot 57 | 58 | # Django stuff: 59 | *.log 60 | local_settings.py 61 | db.sqlite3 62 | db.sqlite3-journal 63 | 64 | # Flask stuff: 65 | instance/ 66 | .webassets-cache 67 | 68 | # Scrapy stuff: 69 | .scrapy 70 | 71 | # Sphinx documentation 72 | docs/_build/ 73 | 74 | # PyBuilder 75 | target/ 76 | 77 | # Jupyter Notebook 78 | .ipynb_checkpoints 79 | 80 | # IPython 81 | profile_default/ 82 | ipython_config.py 83 | 84 | # pyenv 85 | .python-version 86 | 87 | # pipenv 88 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 89 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 90 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 91 | # install all needed dependencies. 92 | #Pipfile.lock 93 | 94 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow 95 | __pypackages__/ 96 | 97 | # Celery stuff 98 | celerybeat-schedule 99 | celerybeat.pid 100 | 101 | # SageMath parsed files 102 | *.sage.py 103 | 104 | # Environments 105 | .env 106 | .venv 107 | env/ 108 | venv/ 109 | ENV/ 110 | env.bak/ 111 | venv.bak/ 112 | 113 | # Spyder project settings 114 | .spyderproject 115 | .spyproject 116 | 117 | # Rope project settings 118 | .ropeproject 119 | 120 | # mkdocs documentation 121 | /site 122 | 123 | # mypy 124 | .mypy_cache/ 125 | .dmypy.json 126 | dmypy.json 127 | 128 | # Pyre type checker 129 | .pyre/ 130 | 131 | # GID result file 132 | *.res 133 | 134 | # pycharm file 135 | .idea 136 | -------------------------------------------------------------------------------- /BeamContact2D/disp.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zarhin/OpenSeesPyExamples/8fe924e767e0cc027f66aef0153bf3b51300af17/BeamContact2D/disp.txt -------------------------------------------------------------------------------- /BeamContact2D/example1/example1.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # author: zarhin 3 | 4 | import part 5 | import opensees_tools as opt 6 | import numpy as np 7 | 8 | # part 9 | # x = [-10.5, -0.5, 0.0, 0.5, 10.5] 10 | # y = [-20.5, -20.0, 0.0, 0.5, 3.0] 11 | x = [-1.5, -0.5, 0.0, 0.5, 1.5] 12 | y = [0, 2, 3] 13 | # rec & line 14 | part.Node.reset() 15 | part.Element.reset() 16 | rec1 = part.Rectangle() 17 | rec2 = part.Rectangle() 18 | line = part.Line() 19 | rec1.create_by_coord(((x[0], y[1]), (x[1], y[2]))) 20 | rec2.create_by_coord(((x[3], y[1]), (x[4], y[2]))) 21 | line.create_by_coord(((x[2], y[0]), (x[2], y[-1]))) 22 | # seed 23 | # general seed 24 | rec1.set_seed(1.0) 25 | rec2.set_seed(1.0) 26 | line.set_seed(1.0) 27 | # horizontal seed 28 | rec1.set_seed(point_num=11, bias_ratio=1.2, 29 | flip_para=True, direction='horizontal') 30 | rec2.set_seed(point_num=11, bias_ratio=1.2, direction='horizontal') 31 | # mesh 32 | rec1.mesh() 33 | rec2.mesh() 34 | line.mesh() 35 | 36 | # model 37 | opt.opsfunc('wipe') 38 | # soil model 39 | opt.opsfunc('model', 'basic', '-ndm', 2, '-ndf', 2) 40 | 41 | # node 42 | for node in rec1.nodes + rec2.nodes: 43 | opt.opsfunc('node', node.tag, *node.coord) 44 | 45 | # material 46 | opt.opsfunc('nDMaterial', 'PressureDependMultiYield02', 5, 2, 1.8, 9.6e3, 47 | 2.7e4, 36, 0.1, 101.0, 0.0, 26, 0.067, 0.23, 0.06, 0.27, 20, 48 | 5.0, 3.0, 1.0, 0.0, 0.77, 0.9, 0.02, 0.7, 101.0) 49 | # create wrapper material for initial state analysis 50 | opt.opsfunc('nDMaterial', 'InitialStateAnalysisWrapper', 1, 5, 2) 51 | 52 | # two-dimensional contact material 53 | opt.opsfunc('nDMaterial', 'ContactMaterial2D', 2, 0.1, 1000.0, 0.0, 0.0) 54 | 55 | # soil element 56 | for element in rec1.elements + rec2.elements: 57 | nodes = [node.tag for node in element.nodes] 58 | opt.opsfunc('element', 'quad', element.tag, *nodes, 1.0, 'PlaneStrain', 59 | 1, 0.0, 0.0, 0.0, -9.81 * 1.8) 60 | 61 | # soil boundary 62 | node_location = opt.location() 63 | for node in node_location[[0, -1], :].T: 64 | opt.opsfunc('fix', node[0], 1, 0) 65 | opt.opsfunc('fix', node[1], 1, 0) 66 | for node in node_location[:, 0]: 67 | opt.opsfunc('fix', node, 0, 1) 68 | 69 | # beam model 70 | opt.opsfunc('model', 'basic', '-ndm', 2, '-ndf', 3) 71 | 72 | # beam parameters 73 | D = 1.0 74 | area = np.pi * D ** 2 / 4.0 75 | I = np.pi * D ** 4 / 64.0 76 | thick = 0.5 77 | beamE = 200000000 78 | numIntPts = 3 79 | 80 | # node 81 | for node in line.nodes: 82 | opt.opsfunc('node', node.tag, *node.coord) 83 | 84 | # beam element 85 | opt.opsfunc('geomTransf', 'Linear', 1) 86 | # section 87 | opt.opsfunc('section', 'Elastic', 1, beamE, area, I) 88 | opt.opsfunc('beamIntegration', 'Legendre', 1, 1, numIntPts) 89 | # element 90 | for element in line.elements: 91 | nodes = [node.tag for node in element.nodes] 92 | opt.opsfunc('element', 'dispBeamColumn', element.tag, *nodes, 1, 1) 93 | 94 | # boundary 95 | bottom_node = part.Node.search((x[2], y[0])) 96 | opt.opsfunc('fix', bottom_node.tag, 0, 1, 0) 97 | opt.location(figure=True) 98 | # contact element 99 | # set gap and force tolerances for beam contact elements 100 | gapTol = 1.0e-10 101 | forceTol = 1.0e-10 102 | -------------------------------------------------------------------------------- /BeamContact2D/example2/2DContact_ODB/Elements_2Node.out: -------------------------------------------------------------------------------- 1 | 5.00000e+00 1.30000e+01 1.40000e+01 2 | 6.00000e+00 1.40000e+01 1.50000e+01 3 | 7.00000e+00 1.50000e+01 1.60000e+01 4 | -------------------------------------------------------------------------------- /BeamContact2D/example2/2DContact_ODB/Elements_3Node.out: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zarhin/OpenSeesPyExamples/8fe924e767e0cc027f66aef0153bf3b51300af17/BeamContact2D/example2/2DContact_ODB/Elements_3Node.out -------------------------------------------------------------------------------- /BeamContact2D/example2/2DContact_ODB/Elements_4Node.out: -------------------------------------------------------------------------------- 1 | 1.00000e+00 1.00000e+00 2.00000e+00 4.00000e+00 3.00000e+00 2 | 2.00000e+00 3.00000e+00 4.00000e+00 6.00000e+00 5.00000e+00 3 | 3.00000e+00 7.00000e+00 8.00000e+00 1.00000e+01 9.00000e+00 4 | 4.00000e+00 9.00000e+00 1.00000e+01 1.20000e+01 1.10000e+01 5 | 8.00000e+00 1.50000e+01 1.60000e+01 6.00000e+00 1.70000e+01 6 | 9.00000e+00 1.50000e+01 1.60000e+01 1.10000e+01 1.80000e+01 7 | 1.00000e+01 1.40000e+01 1.50000e+01 4.00000e+00 1.90000e+01 8 | 1.10000e+01 1.40000e+01 1.50000e+01 9.00000e+00 2.00000e+01 9 | 1.20000e+01 1.30000e+01 1.40000e+01 2.00000e+00 2.10000e+01 10 | 1.30000e+01 1.30000e+01 1.40000e+01 7.00000e+00 2.20000e+01 11 | -------------------------------------------------------------------------------- /BeamContact2D/example2/2DContact_ODB/Elements_8Node.out: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zarhin/OpenSeesPyExamples/8fe924e767e0cc027f66aef0153bf3b51300af17/BeamContact2D/example2/2DContact_ODB/Elements_8Node.out -------------------------------------------------------------------------------- /BeamContact2D/example2/2DContact_ODB/ModeShapes/ModalPeriods.out: -------------------------------------------------------------------------------- 1 | 5.96076e+00 5.96075e+00 5.96075e+00 2 | -------------------------------------------------------------------------------- /BeamContact2D/example2/2DContact_ODB/ModeShapes/ModeShape1.out: -------------------------------------------------------------------------------- 1 | 1.00000e+00 0.00000e+00 0.00000e+00 2 | 2.00000e+00 4.95562e-09 0.00000e+00 3 | 3.00000e+00 0.00000e+00 -5.94503e-02 4 | 4.00000e+00 -1.28818e-01 4.86663e-01 5 | 5.00000e+00 0.00000e+00 -5.43274e-07 6 | 6.00000e+00 -1.07035e-06 1.36542e-06 7 | 7.00000e+00 1.21668e-07 0.00000e+00 8 | 8.00000e+00 0.00000e+00 0.00000e+00 9 | 9.00000e+00 4.27821e-01 1.76744e-01 10 | 1.00000e+01 0.00000e+00 -7.99920e-01 11 | 1.10000e+01 -1.81467e-07 4.62363e-07 12 | 1.20000e+01 0.00000e+00 -6.10683e-07 13 | 1.30000e+01 0.00000e+00 0.00000e+00 14 | 1.40000e+01 -0.00000e+00 0.00000e+00 15 | 1.50000e+01 -0.00000e+00 0.00000e+00 16 | 1.60000e+01 0.00000e+00 -0.00000e+00 17 | 1.70000e+01 0.00000e+00 -0.00000e+00 18 | 1.80000e+01 -0.00000e+00 -0.00000e+00 19 | 1.90000e+01 0.00000e+00 0.00000e+00 20 | 2.00000e+01 0.00000e+00 -0.00000e+00 21 | 2.10000e+01 0.00000e+00 -0.00000e+00 22 | 2.20000e+01 0.00000e+00 -0.00000e+00 23 | -------------------------------------------------------------------------------- /BeamContact2D/example2/2DContact_ODB/ModeShapes/ModeShape2.out: -------------------------------------------------------------------------------- 1 | 1.00000e+00 0.00000e+00 0.00000e+00 2 | 2.00000e+00 -4.71241e-20 0.00000e+00 3 | 3.00000e+00 0.00000e+00 -1.94078e-01 4 | 4.00000e+00 -3.92136e-01 -7.24269e-01 5 | 5.00000e+00 0.00000e+00 4.45475e-17 6 | 6.00000e+00 9.96813e-17 -3.23549e-17 7 | 7.00000e+00 7.50486e-19 0.00000e+00 8 | 8.00000e+00 0.00000e+00 0.00000e+00 9 | 9.00000e+00 5.94492e-01 2.04177e-01 10 | 1.00000e+01 0.00000e+00 2.16276e-12 11 | 1.10000e+01 6.85685e-18 -2.08962e-18 12 | 1.20000e+01 0.00000e+00 5.58577e-17 13 | 1.30000e+01 0.00000e+00 0.00000e+00 14 | 1.40000e+01 0.00000e+00 0.00000e+00 15 | 1.50000e+01 0.00000e+00 0.00000e+00 16 | 1.60000e+01 0.00000e+00 0.00000e+00 17 | 1.70000e+01 0.00000e+00 0.00000e+00 18 | 1.80000e+01 0.00000e+00 0.00000e+00 19 | 1.90000e+01 0.00000e+00 0.00000e+00 20 | 2.00000e+01 0.00000e+00 0.00000e+00 21 | 2.10000e+01 0.00000e+00 0.00000e+00 22 | 2.20000e+01 0.00000e+00 0.00000e+00 23 | -------------------------------------------------------------------------------- /BeamContact2D/example2/2DContact_ODB/ModeShapes/ModeShape3.out: -------------------------------------------------------------------------------- 1 | 1.00000e+00 0.00000e+00 0.00000e+00 2 | 2.00000e+00 5.41953e-20 0.00000e+00 3 | 3.00000e+00 0.00000e+00 -3.50215e-01 4 | 4.00000e+00 -5.76762e-01 1.39191e-01 5 | 5.00000e+00 0.00000e+00 -6.93969e-18 6 | 6.00000e+00 -1.38785e-17 -3.33566e-22 7 | 7.00000e+00 4.62438e-22 0.00000e+00 8 | 8.00000e+00 0.00000e+00 0.00000e+00 9 | 9.00000e+00 -5.17829e-02 -7.96085e-01 10 | 1.00000e+01 0.00000e+00 4.29901e-12 11 | 1.10000e+01 -3.46903e-18 -6.13018e-22 12 | 1.20000e+01 0.00000e+00 6.97619e-22 13 | 1.30000e+01 0.00000e+00 0.00000e+00 14 | 1.40000e+01 0.00000e+00 0.00000e+00 15 | 1.50000e+01 0.00000e+00 0.00000e+00 16 | 1.60000e+01 0.00000e+00 0.00000e+00 17 | 1.70000e+01 0.00000e+00 0.00000e+00 18 | 1.80000e+01 0.00000e+00 0.00000e+00 19 | 1.90000e+01 0.00000e+00 0.00000e+00 20 | 2.00000e+01 0.00000e+00 0.00000e+00 21 | 2.10000e+01 0.00000e+00 0.00000e+00 22 | 2.20000e+01 0.00000e+00 0.00000e+00 23 | -------------------------------------------------------------------------------- /BeamContact2D/example2/2DContact_ODB/Nodes.out: -------------------------------------------------------------------------------- 1 | 1.00000e+00 -1.50000e+00 0.00000e+00 2 | 2.00000e+00 -5.00000e-01 0.00000e+00 3 | 3.00000e+00 -1.50000e+00 1.00000e+00 4 | 4.00000e+00 -5.00000e-01 1.00000e+00 5 | 5.00000e+00 -1.50000e+00 2.00000e+00 6 | 6.00000e+00 -5.00000e-01 2.00000e+00 7 | 7.00000e+00 5.00000e-01 0.00000e+00 8 | 8.00000e+00 1.50000e+00 0.00000e+00 9 | 9.00000e+00 5.00000e-01 1.00000e+00 10 | 1.00000e+01 1.50000e+00 1.00000e+00 11 | 1.10000e+01 5.00000e-01 2.00000e+00 12 | 1.20000e+01 1.50000e+00 2.00000e+00 13 | 1.30000e+01 0.00000e+00 -5.00000e-01 14 | 1.40000e+01 0.00000e+00 5.00000e-01 15 | 1.50000e+01 0.00000e+00 1.50000e+00 16 | 1.60000e+01 0.00000e+00 2.50000e+00 17 | 1.70000e+01 0.00000e+00 0.00000e+00 18 | 1.80000e+01 0.00000e+00 0.00000e+00 19 | 1.90000e+01 0.00000e+00 0.00000e+00 20 | 2.00000e+01 0.00000e+00 0.00000e+00 21 | 2.10000e+01 0.00000e+00 0.00000e+00 22 | 2.20000e+01 0.00000e+00 0.00000e+00 23 | -------------------------------------------------------------------------------- /BeamContact2D/example2/2DContact_ODB/Static/NodeDisp_All.out: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zarhin/OpenSeesPyExamples/8fe924e767e0cc027f66aef0153bf3b51300af17/BeamContact2D/example2/2DContact_ODB/Static/NodeDisp_All.out -------------------------------------------------------------------------------- /BeamContact2D/example2/2DContact_ODB/Static/Reaction_All.out: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zarhin/OpenSeesPyExamples/8fe924e767e0cc027f66aef0153bf3b51300af17/BeamContact2D/example2/2DContact_ODB/Static/Reaction_All.out -------------------------------------------------------------------------------- /BeamContact2D/example2/disp.txt: -------------------------------------------------------------------------------- 1 | 0.1 0 0 -5.09824e-19 0 0 -0.000665503 -7.9883e-19 -0.000665503 0 -0.000887337 -1.02178e-18 -0.000887337 -2.58478e-20 0 0 0 1.30646e-18 -0.000665503 0 -0.000665503 5.64379e-19 -0.000887337 0 -0.000887337 -5.67711e-19 0 1.3244e-19 -6.58236e-29 8.32873e-19 -6.58236e-29 1.53359e-18 -6.58236e-29 2.28489 0 2.28489 0 9.13957 0 9.13957 0 6.85468 0 6.85468 0 2 | 0.2 0 0 -5.69978e-19 0 0 -0.000665503 -8.41601e-19 -0.000665503 0 -0.000887337 -1.04715e-18 -0.000887337 -8.60011e-20 0 0 0 1.26369e-18 -0.000665503 0 -0.000665503 5.39014e-19 -0.000887337 0 -0.000887337 -6.36559e-19 0 8.09824e-20 1.29193e-23 7.98817e-19 1.28935e-23 1.51694e-18 6.4509e-24 2.28489 0 2.28489 0 9.13957 0 9.13957 0 6.85468 0 6.85468 0 3 | 0.3 0 0 -4.51137e-19 0 0 -0.000665503 -7.97581e-19 -0.000665503 0 -0.000887337 -1.07804e-18 -0.000887337 3.28399e-20 0 0 0 1.30771e-18 -0.000665503 0 -0.000665503 5.08127e-19 -0.000887337 0 -0.000887337 -4.8029e-19 0 1.62393e-19 1.21752e-21 8.05331e-19 2.06641e-21 1.44852e-18 5.34788e-21 2.28489 0 2.28489 0 9.13957 0 9.13957 0 6.85468 0 6.85468 0 4 | 0.4 0 0 -4.63938e-19 0 0 -0.000665503 -8.07043e-19 -0.000665503 0 -0.000887337 -1.08412e-18 -0.000887337 2.00382e-20 0 0 0 1.29825e-18 -0.000665503 0 -0.000665503 5.02047e-19 -0.000887337 0 -0.000887337 -4.94757e-19 0 1.51258e-19 2.60859e-21 7.97558e-19 4.49491e-21 1.44414e-18 1.12868e-20 2.28489 0 2.28489 0 9.13957 0 9.13957 0 6.85468 0 6.85468 0 5 | 0.5 0 0 -4.62008e-19 0 0 -0.000665503 -8.64897e-19 -0.000665503 0 -0.000887337 -1.20178e-18 -0.000887337 2.19681e-20 0 0 0 1.24039e-18 -0.000665503 0 -0.000665503 3.84381e-19 -0.000887337 0 -0.000887337 -4.62916e-19 0 1.23277e-19 3.96254e-21 7.09751e-19 6.85115e-21 1.29651e-18 1.70972e-20 2.28489 0 2.28489 0 9.13957 0 9.13957 0 6.85468 0 6.85468 0 6 | 0.6 0 0 -3.54916e-19 0 0 -0.000665503 -7.95391e-19 -0.000665503 0 -0.000887337 -1.16795e-18 -0.000887337 1.29061e-19 0 0 0 1.3099e-18 -0.000665503 0 -0.000665503 4.18211e-19 -0.000887337 0 -0.000887337 -3.36725e-19 0 2.11366e-19 3.16638e-21 7.61195e-19 4.94702e-21 1.31276e-18 1.57526e-20 2.28489 0 2.28489 0 9.13957 0 9.13957 0 6.85468 0 6.85468 0 7 | 0.7 0 0 -3.26903e-19 0 0 -0.000665503 -8.0355e-19 -0.000665503 0 -0.000887337 -1.21219e-18 -0.000887337 1.57073e-19 0 0 0 1.30174e-18 -0.000665503 0 -0.000665503 3.7397e-19 -0.000887337 0 -0.000887337 -2.90598e-19 0 2.21269e-19 1.48931e-21 7.34956e-19 1.21572e-21 1.25046e-18 1.18185e-20 2.28489 0 2.28489 0 9.13957 0 9.13957 0 6.85468 0 6.85468 0 8 | 0.8 0 0 -5.24158e-19 0 0 -0.000665503 -9.37523e-19 -0.000665503 0 -0.000887337 -1.28282e-18 -0.000887337 -4.01816e-20 0 0 0 1.16777e-18 -0.000665503 0 -0.000665503 3.03342e-19 -0.000887337 0 -0.000887337 -5.1951e-19 0 5.56735e-20 1.3441e-22 6.32701e-19 -1.84031e-21 1.21157e-18 8.80687e-21 2.28489 0 2.28489 0 9.13957 0 9.13957 0 6.85468 0 6.85468 0 9 | 0.1 0 0 2.71736e-19 0 0 8.8352e-18 1.73678e-19 -1.0361e-17 0 -7.35848e-18 7.79523e-20 3.9357e-17 2.64382e-19 0 0 0 1.25366e-19 -9.06945e-18 0 1.02302e-17 2.31692e-19 4.13056e-17 0 -5.79466e-18 3.21119e-19 0 2.22468e-19 -3.353e-24 1.25576e-19 4.78082e-25 3.04356e-20 -3.96829e-23 2.28489 0 2.28489 0 9.13957 0 9.13957 0 6.85468 0 6.85468 0 10 | 0.2 0 0 2.35996e-19 0 0 8.79938e-18 1.14792e-19 -1.02216e-17 0 -7.093e-18 -4.08357e-21 3.92563e-17 2.28642e-19 0 0 0 6.64796e-20 -9.07434e-18 0 1.00336e-17 1.49656e-19 4.07151e-17 0 -5.81352e-18 2.96951e-19 0 1.75156e-19 -3.54472e-24 5.51146e-20 -6.87535e-24 -6.31743e-20 -1.23767e-23 2.28489 0 2.28489 0 9.13957 0 9.13957 0 6.85468 0 6.85468 0 11 | 0.3 0 0 1.95281e-19 0 0 8.77891e-18 1.05402e-19 -1.02692e-17 0 -7.13413e-18 1.78548e-20 3.91436e-17 1.87927e-19 0 0 0 5.70889e-20 -9.09651e-18 0 9.9976e-18 1.71595e-19 4.06544e-17 0 -5.84486e-18 2.40575e-19 0 1.50102e-19 -1.54831e-24 6.13883e-20 -3.20765e-24 -2.55705e-20 -4.58764e-24 2.28489 0 2.28489 0 9.13957 0 9.13957 0 6.85468 0 6.85468 0 12 | 0.4 0 0 2.12497e-19 0 0 8.8014e-18 1.00985e-19 -1.01752e-17 0 -7.05568e-18 -8.19814e-21 3.92291e-17 2.05143e-19 0 0 0 5.26723e-20 -8.9962e-18 0 1.01069e-17 1.45542e-19 4.07468e-17 0 -5.72265e-18 2.68604e-19 0 1.56503e-19 2.36923e-24 4.6153e-20 5.04777e-24 -6.24412e-20 6.46331e-24 2.28489 0 2.28489 0 9.13957 0 9.13957 0 6.85468 0 6.85468 0 13 | -------------------------------------------------------------------------------- /BeamContact2D/example2/example2.py: -------------------------------------------------------------------------------- 1 | # -*- conding: utf-8 -*- 2 | # author: zarhin 3 | 4 | import numpy as np 5 | import part 6 | import opensees_tools as opt 7 | import opensees_to_gid as otg 8 | import openseespy.postprocessing.Get_Rendering as opg 9 | 10 | # part 11 | x = [-1.5, -0.5, 0.0, 0.5, 1.5] 12 | y = [-0.5, 0.0, 1.5, 2.0, 2.5] 13 | # rec & line 14 | part.Node.reset() 15 | part.Element.reset() 16 | rec1 = part.Rectangle() 17 | rec2 = part.Rectangle() 18 | line = part.Line() 19 | rec1.create_by_coord(((x[0], y[1]), (x[1], y[3]))) 20 | rec2.create_by_coord(((x[3], y[1]), (x[4], y[3]))) 21 | line.create_by_coord(((x[2], y[0]), (x[2], y[-1]))) 22 | # seed 23 | # general seed 24 | rec1.set_seed(1.0) 25 | rec2.set_seed(1.0) 26 | line.set_seed(1.0) 27 | # mesh 28 | rec1.mesh() 29 | rec2.mesh() 30 | line.mesh() 31 | 32 | # model 33 | opt.opsfunc('wipe') 34 | # soil model 35 | opt.opsfunc('model', 'basic', '-ndm', 2, '-ndf', 2) 36 | 37 | # node 38 | for node in rec1.nodes + rec2.nodes: 39 | opt.opsfunc('node', node.tag, *node.coord) 40 | 41 | # material 42 | opt.opsfunc('nDMaterial', 'PressureDependMultiYield02', 5, 2, 1.8, 9.6e3, 43 | 2.7e4, 36, 0.1, 101.0, 0.0, 26, 0.067, 0.23, 0.06, 0.27, 20, 44 | 5.0, 3.0, 1.0, 0.0, 0.77, 0.9, 0.02, 0.7, 101.0) 45 | # create wrapper material for initial state analysis 46 | opt.opsfunc('nDMaterial', 'InitialStateAnalysisWrapper', 1, 5, 2) 47 | 48 | # two-dimensional contact material 49 | opt.opsfunc('nDMaterial', 'ContactMaterial2D', 2, 0.1, 1000.0, 0.0, 0.0) 50 | 51 | # soil element 52 | for element in rec1.elements + rec2.elements: 53 | nodes = [node.tag for node in element.nodes] 54 | opt.opsfunc('element', 'quad', element.tag, *nodes, 1.0, 'PlaneStrain', 55 | 1, 0.0, 0.0, 0.0, -9.81 * 1.8) 56 | 57 | # soil boundary 58 | node_location = opt.location() 59 | for node in node_location[[0, -1], :].T: 60 | opt.opsfunc('fix', node[0], 1, 0) 61 | opt.opsfunc('fix', node[1], 1, 0) 62 | for node in node_location[:, 0]: 63 | opt.opsfunc('fix', node, 0, 1) 64 | 65 | # lagrange multiplier node 66 | opt.opsfunc('node', 17, 0.0, 0.0) 67 | opt.opsfunc('node', 18, 0.0, 0.0) 68 | opt.opsfunc('node', 19, 0.0, 0.0) 69 | opt.opsfunc('node', 20, 0.0, 0.0) 70 | opt.opsfunc('node', 21, 0.0, 0.0) 71 | opt.opsfunc('node', 22, 0.0, 0.0) 72 | 73 | 74 | # beam model 75 | opt.opsfunc('model', 'basic', '-ndm', 2, '-ndf', 3) 76 | 77 | # beam parameters 78 | D = 1.0 79 | area = np.pi * D ** 2 / 4.0 80 | I = np.pi * D ** 4 / 64.0 81 | thick = 1.0 82 | beamE = 200000000 83 | numIntPts = 3 84 | 85 | # node 86 | for node in line.nodes: 87 | opt.opsfunc('node', node.tag, *node.coord) 88 | 89 | # beam element 90 | opt.opsfunc('geomTransf', 'Linear', 1) 91 | # section 92 | opt.opsfunc('section', 'Elastic', 1, beamE, area, I) 93 | opt.opsfunc('beamIntegration', 'Legendre', 1, 1, numIntPts) 94 | # element 95 | for element in line.elements: 96 | nodes = [node.tag for node in element.nodes] 97 | opt.opsfunc('element', 'dispBeamColumn', element.tag, *nodes, 1, 1) 98 | 99 | # boundary 100 | bottom_node = part.Node.search((x[2], y[0])) 101 | opt.opsfunc('fix', bottom_node.tag, 0, 1, 0) 102 | 103 | # contact element 104 | # set gap and force tolerances for beam contact elements 105 | gapTol = 1.0e-10 106 | forceTol = 1.0e-10 107 | 108 | # contact element 109 | contact_element = [] 110 | opt.opsfunc('element', 'BeamContact2D', 8, 15, 16, 6, 17, 2, thick, gapTol, 111 | forceTol) 112 | opt.opsfunc('element', 'BeamContact2D', 9, 15, 16, 11, 18, 2, thick, gapTol, 113 | forceTol) 114 | opt.opsfunc('element', 'BeamContact2D', 10, 14, 15, 4, 19, 2, thick, gapTol, 115 | forceTol) 116 | opt.opsfunc('element', 'BeamContact2D', 11, 14, 15, 9, 20, 2, thick, gapTol, 117 | forceTol) 118 | opt.opsfunc('element', 'BeamContact2D', 12, 13, 14, 2, 21, 2, thick, gapTol, 119 | forceTol) 120 | opt.opsfunc('element', 'BeamContact2D', 13, 13, 14, 7, 22, 2, thick, gapTol, 121 | forceTol) 122 | opt.opsfunc('printGID', 'model.msh') 123 | 124 | # recorder 125 | node_list = opt.opsfunc('getNodeTags') 126 | opt.opsfunc('recorder', 'Node', '-file', 'disp.txt', '-time', '-nodeRange', 127 | 1, 22, '-dof', 1, 2, 'disp') 128 | 129 | # define analysis parameters for gravity phase 130 | opt.opsfunc('constraints', 'Transformation') 131 | opt.opsfunc('test', 'NormDispIncr', 1e-5, 15, 1) 132 | opt.opsfunc('algorithm', 'Newton') 133 | opt.opsfunc('numberer', 'RCM') 134 | opt.opsfunc('system', 'SparseGeneral') 135 | opt.opsfunc('integrator', 'LoadControl', 0.1) 136 | opt.opsfunc('analysis', 'Static') 137 | 138 | opt.opsfunc('InitialStateAnalysis', 'on') 139 | opt.opsfunc('updateMaterialStage', '-material', 1, '-stage', 0) 140 | opt.opsfunc('setParameter', '-val', 0, '-eleRange', 8, 13, 'friction') 141 | opt.opsfunc('analyze', 4) 142 | opt.opsfunc('updateMaterialStage', '-material', 1, '-stage', 1) 143 | opt.opsfunc('analyze', 4) 144 | # designate end of initial state analysis \ 145 | # (zeros displacements, keeps state variables) 146 | opt.opsfunc('InitialStateAnalysis', 'off') 147 | # turn on frictional behavior for beam contact elements 148 | opt.opsfunc('setParameter', '-val', 1, '-eleRange', 8, 13, 'friction') 149 | opt.opsfunc('analyze', 4) 150 | 151 | opt.opsfunc('wipeAnalysis') 152 | opt.opsfunc('loadConst', '-time', 0.0) 153 | 154 | opg.createODB('2DContact', 'Static', Nmodes=3) 155 | 156 | # recorder 157 | node_list = opt.opsfunc('getNodeTags') 158 | opt.opsfunc('recorder', 'Node', '-file', 'disp.txt', '-time', '-nodeRange', 159 | 1, 22, '-dof', 1, 2, 'disp') 160 | 161 | # load 162 | opt.opsfunc('timeSeries', 'Constant', 1) 163 | opt.opsfunc('pattern', 'Plain', 1, 1, '{') 164 | opt.opsfunc('load', 16, 10, 0, 0, '}') 165 | 166 | # analysis 167 | opt.opsfunc('constraints', 'Transformation') 168 | opt.opsfunc('test', 'NormDispIncr', 1e-5, 15, 1) 169 | opt.opsfunc('algorithm', 'Newton') 170 | opt.opsfunc('numberer', 'RCM') 171 | opt.opsfunc('system', 'SparseGeneral') 172 | opt.opsfunc('integrator', 'LoadControl', 0.1) 173 | opt.opsfunc('analysis', 'Static') 174 | opt.opsfunc('analyze', 10) 175 | 176 | opt.opsfunc('printModel', '-node', 16) 177 | # wipe 178 | opt.opsfunc('wipe') 179 | 180 | disp = np.loadtxt('disp.txt') 181 | otg.node_result(node_list, [disp], ['Displacement'], 'Static') 182 | # opg.plot_modeshape(2, 300, Model='2DContact') 183 | # opg.plot_deformedshape(Model='2DContact', LoadCase='Static') 184 | -------------------------------------------------------------------------------- /BeamContact2D/example2/model.msh: -------------------------------------------------------------------------------- 1 | MESH "2NMESH" dimension 3 ElemType Linear Nnode 2 2 | #color 0 0 255 3 | 4 | Coordinates 5 | 1 -1.5 0 0 6 | 2 -0.5 0 0 7 | 3 -1.5 1 0 8 | 4 -0.5 1 0 9 | 5 -1.5 2 0 10 | 6 -0.5 2 0 11 | 7 0.5 0 0 12 | 8 1.5 0 0 13 | 9 0.5 1 0 14 | 10 1.5 1 0 15 | 11 0.5 2 0 16 | 12 1.5 2 0 17 | 13 0 -0.5 0 18 | 14 0 0.5 0 19 | 15 0 1.5 0 20 | 16 0 2.5 0 21 | 17 0 0 0 22 | 18 0 0 0 23 | 19 0 0 0 24 | 20 0 0 0 25 | 21 0 0 0 26 | 22 0 0 0 27 | End coordinates 28 | 29 | Elements 30 | 5 13 14 31 | 6 14 15 32 | 7 15 16 33 | End elements 34 | MESH "4NMESH" dimension 3 ElemType Quadrilateral Nnode 4 35 | #color 0 255 0 36 | 37 | Coordinates 38 | 1 -1.5 0 0 39 | 2 -0.5 0 0 40 | 3 -1.5 1 0 41 | 4 -0.5 1 0 42 | 5 -1.5 2 0 43 | 6 -0.5 2 0 44 | 7 0.5 0 0 45 | 8 1.5 0 0 46 | 9 0.5 1 0 47 | 10 1.5 1 0 48 | 11 0.5 2 0 49 | 12 1.5 2 0 50 | 13 0 -0.5 0 51 | 14 0 0.5 0 52 | 15 0 1.5 0 53 | 16 0 2.5 0 54 | 17 0 0 0 55 | 18 0 0 0 56 | 19 0 0 0 57 | 20 0 0 0 58 | 21 0 0 0 59 | 22 0 0 0 60 | End coordinates 61 | 62 | Elements 63 | 1 1 2 4 3 64 | 2 3 4 6 5 65 | 3 7 8 10 9 66 | 4 9 10 12 11 67 | 8 15 16 6 17 68 | 9 15 16 11 18 69 | 10 14 15 4 19 70 | 11 14 15 9 20 71 | 12 13 14 2 21 72 | 13 13 14 7 22 73 | End elements 74 | -------------------------------------------------------------------------------- /BeamContact2D/example2/model.tcl: -------------------------------------------------------------------------------- 1 | wipe 2 | model basic -ndm 2 -ndf 2 3 | node 1 -1.5 0.0 4 | node 2 -0.5 0.0 5 | node 3 -1.5 1.0 6 | node 4 -0.5 1.0 7 | node 5 -1.5 2.0 8 | node 6 -0.5 2.0 9 | node 7 0.5 0.0 10 | node 8 1.5 0.0 11 | node 9 0.5 1.0 12 | node 10 1.5 1.0 13 | node 11 0.5 2.0 14 | node 12 1.5 2.0 15 | nDMaterial PressureDependMultiYield02 5 2 1.8 9600.0 27000.0 36 0.1 101.0 0.0 26 0.067 0.23 0.06 0.27 20 5.0 3.0 1.0 0.0 0.77 0.9 0.02 0.7 101.0 16 | nDMaterial InitialStateAnalysisWrapper 1 5 2 17 | nDMaterial ContactMaterial2D 2 0.1 1000.0 0.0 0.0 18 | element quad 1 1 2 4 3 1.0 PlaneStrain 1 0.0 0.0 0.0 -17.658 19 | element quad 2 3 4 6 5 1.0 PlaneStrain 1 0.0 0.0 0.0 -17.658 20 | element quad 3 7 8 10 9 1.0 PlaneStrain 1 0.0 0.0 0.0 -17.658 21 | element quad 4 9 10 12 11 1.0 PlaneStrain 1 0.0 0.0 0.0 -17.658 22 | fix 1 1 0 23 | fix 8 1 0 24 | fix 3 1 0 25 | fix 10 1 0 26 | fix 5 1 0 27 | fix 12 1 0 28 | fix 1 0 1 29 | fix 2 0 1 30 | fix 7 0 1 31 | fix 8 0 1 32 | node 17 0.0 0.0 33 | node 18 0.0 0.0 34 | node 19 0.0 0.0 35 | node 20 0.0 0.0 36 | node 21 0.0 0.0 37 | node 22 0.0 0.0 38 | model basic -ndm 2 -ndf 3 39 | node 13 0.0 -0.5 40 | node 14 0.0 0.5 41 | node 15 0.0 1.5 42 | node 16 0.0 2.5 43 | geomTransf Linear 1 44 | section Elastic 1 200000000 0.7853981633974483 0.04908738521234052 45 | beamIntegration Legendre 1 1 3 46 | element dispBeamColumn 5 13 14 1 1 47 | element dispBeamColumn 6 14 15 1 1 48 | element dispBeamColumn 7 15 16 1 1 49 | fix 13 0 1 0 50 | element BeamContact2D 8 15 16 6 17 2 1.0 1e-10 1e-10 51 | element BeamContact2D 9 15 16 11 18 2 1.0 1e-10 1e-10 52 | element BeamContact2D 10 14 15 4 19 2 1.0 1e-10 1e-10 53 | element BeamContact2D 11 14 15 9 20 2 1.0 1e-10 1e-10 54 | element BeamContact2D 12 13 14 2 21 2 1.0 1e-10 1e-10 55 | element BeamContact2D 13 13 14 7 22 2 1.0 1e-10 1e-10 56 | printGID model.msh 57 | getNodeTags 58 | recorder Node -file disp.txt -time -nodeRange 1 22 -dof 1 2 disp 59 | constraints Transformation 60 | test NormDispIncr 1e-05 15 1 61 | algorithm Newton 62 | numberer RCM 63 | system SparseGeneral 64 | integrator LoadControl 0.1 65 | analysis Static 66 | InitialStateAnalysis on 67 | updateMaterialStage -material 1 -stage 0 68 | setParameter -val 0 -eleRange 8 13 friction 69 | analyze 4 70 | updateMaterialStage -material 1 -stage 1 71 | analyze 4 72 | InitialStateAnalysis off 73 | setParameter -val 1 -eleRange 8 13 friction 74 | analyze 4 75 | wipe 76 | -------------------------------------------------------------------------------- /BeamContact2D/example2/node.txt: -------------------------------------------------------------------------------- 1 | 0.1 0 0 0.000493026 0 0 -0.000917711 0.000322659 -0.000835483 0 -0.00126086 0.000116329 -0.00116321 -0.000493026 0 0 0 -0.000322659 -0.000835483 0 -0.000917711 -0.000116329 -0.00116321 0 -0.00126086 0 0 1.35812e-07 0 4.75343e-07 0 9.16732e-07 0 0 0 0 0 0 0 0 0 2 | 0.2 0 0 0.000493026 0 0 -0.000917711 0.000322659 -0.000835483 0 -0.00126086 0.000116329 -0.00116321 -0.000493026 0 0 0 -0.000322659 -0.000835483 0 -0.000917711 -0.000116329 -0.00116321 0 -0.00126086 0 0 2.71624e-07 0 9.50686e-07 0 1.83346e-06 0 0 0 0 0 0 0 0 0 3 | 0.3 0 0 0.000493026 0 0 -0.000917711 0.000322659 -0.000835483 0 -0.00126086 0.000116329 -0.00116321 -0.000493026 0 0 0 -0.000322659 -0.000835483 0 -0.000917711 -0.000116329 -0.00116321 0 -0.00126086 0 0 4.07437e-07 0 1.42603e-06 0 2.7502e-06 0 0 0 0 0 0 0 0 0 4 | 0.4 0 0 0.000493026 0 0 -0.000917711 0.000322659 -0.000835483 0 -0.00126086 0.000116329 -0.00116321 -0.000493026 0 0 0 -0.000322659 -0.000835483 0 -0.000917711 -0.000116329 -0.00116321 0 -0.00126086 0 0 5.43249e-07 0 1.90137e-06 0 3.66693e-06 0 0 0 0 0 0 0 0 0 5 | 0.5 0 0 0.000493026 0 0 -0.000917711 0.000322659 -0.000835483 0 -0.00126086 0.000116329 -0.00116321 -0.000493026 0 0 0 -0.000322659 -0.000835483 0 -0.000917711 -0.000116329 -0.00116321 0 -0.00126086 0 0 6.79061e-07 0 2.37671e-06 0 4.58366e-06 0 0 0 0 0 0 0 0 0 6 | 0.6 0 0 0.000493026 0 0 -0.000917711 0.000322659 -0.000835483 0 -0.00126086 0.000116329 -0.00116321 -0.000493026 0 0 0 -0.000322659 -0.000835483 0 -0.000917711 -0.000116329 -0.00116321 0 -0.00126086 0 0 8.14873e-07 0 2.85206e-06 0 5.50039e-06 0 0 0 0 0 0 0 0 0 7 | 0.7 0 0 0.000493026 0 0 -0.000917711 0.000322659 -0.000835483 0 -0.00126086 0.000116329 -0.00116321 -0.000493026 0 0 0 -0.000322659 -0.000835483 0 -0.000917711 -0.000116329 -0.00116321 0 -0.00126086 0 0 9.50686e-07 0 3.3274e-06 0 6.41713e-06 0 0 0 0 0 0 0 0 0 8 | 0.8 0 0 0.000493026 0 0 -0.000917711 0.000322659 -0.000835483 0 -0.00126086 0.000116329 -0.00116321 -0.000493026 0 0 0 -0.000322659 -0.000835483 0 -0.000917711 -0.000116329 -0.00116321 0 -0.00126086 0 0 1.0865e-06 0 3.80274e-06 0 7.33386e-06 0 0 0 0 0 0 0 0 0 9 | 0.9 0 0 0.000493026 0 0 -0.000917711 0.000322659 -0.000835483 0 -0.00126086 0.000116329 -0.00116321 -0.000493026 0 0 0 -0.000322659 -0.000835483 0 -0.000917711 -0.000116329 -0.00116321 0 -0.00126086 0 0 1.22231e-06 0 4.27808e-06 0 8.25059e-06 0 0 0 0 0 0 0 0 0 10 | 1 0 0 0.000493026 0 0 -0.000917711 0.000322659 -0.000835483 0 -0.00126086 0.000116329 -0.00116321 -0.000493026 0 0 0 -0.000322659 -0.000835483 0 -0.000917711 -0.000116329 -0.00116321 0 -0.00126086 0 0 1.35812e-06 0 4.75343e-06 0 9.16732e-06 0 0 0 0 0 0 0 0 0 11 | -------------------------------------------------------------------------------- /BeamContact2D/example3/disp.txt: -------------------------------------------------------------------------------- 1 | 1 0 -0.47906 0.007301 -0.47906 0.007301 -0.486659 -3.24913e-18 -0.486659 0 0 0 -0.17432 0 -0.248724 0 -0.17432 0 0 2 | 2 0 -0.476627 0.00692673 -0.476249 0.00661717 -0.483555 -0.000447668 -0.483933 0 0 1.04506e-05 -0.173174 0.00044074 -0.246811 0.000875146 -0.173313 0.000875146 0 3 | 3 0 -0.476682 0.00693288 -0.476283 0.00660165 -0.483593 -0.000467069 -0.483992 0 0 6.90045e-06 -0.173217 0.0004286 -0.246865 0.000854398 -0.173332 0.000854398 0 4 | 4 0 -0.47668 0.00693266 -0.476282 0.0066021 -0.483592 -0.000466473 -0.483991 0 0 7.24505e-06 -0.173215 0.000429353 -0.246863 0.000855447 -0.173331 0.000855447 0 5 | 5 0 -0.476681 0.00693266 -0.476282 0.00660208 -0.483592 -0.000466501 -0.483991 0 0 7.23369e-06 -0.173216 0.000429329 -0.246864 0.000855415 -0.173331 0.000855415 0 6 | 6 0 -0.476681 0.00693266 -0.476282 0.00660208 -0.483592 -0.0004665 -0.483991 0 0 7.23387e-06 -0.173216 0.00042933 -0.246864 0.000855416 -0.173331 0.000855416 0 7 | 7 0 -0.476681 0.00693266 -0.476282 0.00660208 -0.483592 -0.0004665 -0.483991 0 0 7.23375e-06 -0.173216 0.00042933 -0.246864 0.000855415 -0.173331 0.000855415 0 8 | 8 0 -0.476681 0.00693266 -0.476282 0.00660208 -0.483592 -0.0004665 -0.483991 0 0 7.23372e-06 -0.173216 0.00042933 -0.246864 0.000855415 -0.173331 0.000855415 0 9 | 9 0 -0.476681 0.00693266 -0.476282 0.00660208 -0.483592 -0.0004665 -0.483991 0 0 7.23373e-06 -0.173216 0.00042933 -0.246864 0.000855415 -0.173331 0.000855415 0 10 | 10 0 -0.476681 0.00693266 -0.476282 0.00660208 -0.483592 -0.0004665 -0.483991 0 0 7.23375e-06 -0.173216 0.00042933 -0.246864 0.000855415 -0.173331 0.000855415 0 11 | -------------------------------------------------------------------------------- /BeamContact2D/example3/example3.py: -------------------------------------------------------------------------------- 1 | # -*-coding: utf-8 -*- 2 | # author: zarhin 3 | 4 | import openseespy.opensees as ops 5 | import openseespy.postprocessing.Get_Rendering as opg 6 | import opensees_to_gid as otg 7 | import numpy as np 8 | 9 | ops.wipe() 10 | ops.model('basic', '-ndm', 2, '-ndf', 2) 11 | # node 12 | ops.node(1, -0.5, 0.5) 13 | ops.node(2, 0.5, 0.5) 14 | ops.node(3, 0.5, 1.5) 15 | ops.node(4, -0.5, 1.5) 16 | 17 | ops.fix(1, 1, 0) 18 | # ops.fix(2, 1, 0) 19 | 20 | # contact node 21 | ops.node(10, -0.0, 0.0) 22 | ops.node(11, 0.0, 0.0) 23 | 24 | # material 25 | ops.nDMaterial('ElasticIsotropic', 1, 200000, 0.49, 1.9) 26 | # element 27 | ops.element('quad', 1, 1, 2, 3, 4, 1.0, 'PlaneStrain', 1, 0.0, 0.0, 0.0, 28 | -0.0) 29 | 30 | ops.model('basic', '-ndm', 2, '-ndf', 3) 31 | 32 | # node 33 | ops.node(5, -2.0, 0.0) 34 | ops.node(6, -1.0, 0.0) 35 | ops.node(7, -0.0, 0.0) 36 | ops.node(8, 1.0, 0.0) 37 | ops.node(9, 2.0, 0.0) 38 | 39 | # boundary 40 | ops.fix(5, 1, 1, 0) 41 | ops.fix(9, 0, 1, 0) 42 | 43 | # element 44 | ops.geomTransf('Linear', 1) 45 | ops.element('elasticBeamColumn', 2, 5, 6, 0.5, 2e5, 0.049, 1) 46 | ops.element('elasticBeamColumn', 3, 6, 7, 0.5, 2e5, 0.049, 1) 47 | ops.element('elasticBeamColumn', 4, 7, 8, 0.5, 2e5, 0.049, 1) 48 | ops.element('elasticBeamColumn', 5, 8, 9, 0.5, 2e5, 0.049, 1) 49 | 50 | # contact material 51 | ops.nDMaterial('ContactMaterial2D', 2, 0.1, 100000.0, 0.0, 0.0) 52 | 53 | # contact element 54 | ops.element('BeamContact2D', 6, 6, 7, 1, 10, 2, 0.5, 1e-10, 1e-10) 55 | ops.element('BeamContact2D', 7, 7, 8, 2, 11, 2, 0.5, 1e-10, 1e-10) 56 | 57 | # recorder 58 | ops.printGID('model.msh') 59 | node_list = [1, 2, 3, 4, 5, 6, 7, 8, 9] 60 | ops.recorder('Node', '-file', 'disp.txt', '-time', '-node', *node_list, 61 | '-dof', 1, 2, 'disp') 62 | # load 63 | ops.timeSeries('Constant', 1) 64 | ops.pattern('Plain', 1, 1) 65 | ops.load(3, 0, -1000) 66 | ops.load(4, 0, -1000) 67 | a = ops.nodeBounds() 68 | print(a) 69 | opg.plot_model() 70 | # analysis 71 | ops.constraints('Transformation') 72 | ops.test('NormDispIncr', 1e-4, 15, 1) 73 | ops.algorithm('Newton') 74 | ops.numberer('RCM') 75 | ops.system('SparseGeneral') 76 | ops.integrator('LoadControl', 1) 77 | ops.analysis('Static') 78 | 79 | # set contact elements to be frictionless for gravity analysis 80 | ops.setParameter('-val', 0, '-eleRange', 6, 7, 'friction') 81 | ops.analyze(5) 82 | 83 | ops.setParameter('-val', 1, '-eleRange', 6, 7, 'friction') 84 | ops.analyze(5) 85 | 86 | ops.wipe() 87 | disp = np.loadtxt('disp.txt') 88 | otg.node_result(node_list, [disp], ['Disp'], 'Load') -------------------------------------------------------------------------------- /BeamContact2D/example3/model.msh: -------------------------------------------------------------------------------- 1 | MESH "2NMESH" dimension 3 ElemType Linear Nnode 2 2 | #color 0 0 255 3 | 4 | Coordinates 5 | 1 -0.5 0.5 0 6 | 2 0.5 0.5 0 7 | 3 0.5 1.5 0 8 | 4 -0.5 1.5 0 9 | 5 -2 0 0 10 | 6 -1 0 0 11 | 7 -0 0 0 12 | 8 1 0 0 13 | 9 2 0 0 14 | 10 -0 0 0 15 | 11 0 0 0 16 | End coordinates 17 | 18 | Elements 19 | 2 5 6 20 | 3 6 7 21 | 4 7 8 22 | 5 8 9 23 | End elements 24 | MESH "4NMESH" dimension 3 ElemType Quadrilateral Nnode 4 25 | #color 0 255 0 26 | 27 | Coordinates 28 | 1 -0.5 0.5 0 29 | 2 0.5 0.5 0 30 | 3 0.5 1.5 0 31 | 4 -0.5 1.5 0 32 | 5 -2 0 0 33 | 6 -1 0 0 34 | 7 -0 0 0 35 | 8 1 0 0 36 | 9 2 0 0 37 | 10 -0 0 0 38 | 11 0 0 0 39 | End coordinates 40 | 41 | Elements 42 | 1 1 2 3 4 43 | 6 6 7 1 10 44 | 7 7 8 2 11 45 | End elements 46 | -------------------------------------------------------------------------------- /BeamContact2D/example4/example4.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | ------------------------------------------ 4 | File Name: example4 5 | Description: 6 | Author: zarhin 7 | Date : 2020/12/2 8 | ------------------------------------------ 9 | Change Activity: 10 | 2020/12/2 11 | ------------------------------------------ 12 | """ 13 | # ->| 14 | # | ____ 15 | # | | | 16 | # | |____| 17 | # -*-coding: utf-8 -*- 18 | # author: zarhin 19 | 20 | import openseespy.opensees as ops 21 | import openseespy.postprocessing.Get_Rendering as opg 22 | import opensees_to_gid as otg 23 | import numpy as np 24 | 25 | ops.wipe() 26 | ops.model('basic', '-ndm', 2, '-ndf', 2) 27 | # node 28 | ops.node(1, 0.5, 0) 29 | ops.node(2, 1.5, 0) 30 | ops.node(3, 1.5, 1.0) 31 | ops.node(4, 0.5, 1) 32 | 33 | ops.fix(1, 1, 1) 34 | ops.fix(2, 1, 0) 35 | 36 | # material 37 | ops.nDMaterial('ElasticIsotropic', 1, 200000, 0.49, 1.9) 38 | # element 39 | ops.element('quad', 1, 1, 2, 3, 4, 1.0, 'PlaneStrain', 1, 0.0, 0.0, 0.0, 40 | -0.0) 41 | 42 | ops.model('basic', '-ndm', 2, '-ndf', 3) 43 | 44 | # node 45 | ops.node(5, 0.0, 0.0) 46 | ops.node(6, 0.0, 1.0) 47 | ops.node(7, 0.0, 2.0) 48 | 49 | 50 | # boundary 51 | ops.fix(5, 1, 1, 0) 52 | 53 | 54 | # element 55 | ops.geomTransf('Linear', 1) 56 | ops.element('elasticBeamColumn', 2, 5, 6, 0.5, 2e5, 0.049, 1) 57 | ops.element('elasticBeamColumn', 3, 6, 7, 0.5, 2e5, 0.049, 1) 58 | 59 | 60 | # contact material 61 | ops.nDMaterial('ContactMaterial2D', 2, 0.1, 100000.0, 0.0, 0.0) 62 | 63 | # contact element 64 | ops.element('BeamContact2D', 6, 6, 7, 1, 10, 2, 0.5, 1e-10, 1e-10) 65 | ops.element('BeamContact2D', 7, 7, 8, 2, 11, 2, 0.5, 1e-10, 1e-10) 66 | 67 | # recorder 68 | ops.printGID('model.msh') 69 | node_list = [1, 2, 3, 4, 5, 6, 7, 8, 9] 70 | ops.recorder('Node', '-file', 'disp.txt', '-time', '-node', *node_list, 71 | '-dof', 1, 2, 'disp') 72 | # load 73 | ops.timeSeries('Constant', 1) 74 | ops.pattern('Plain', 1, 1) 75 | ops.load(3, 0, -1000) 76 | ops.load(4, 0, -1000) 77 | a = ops.nodeBounds() 78 | print(a) 79 | opg.plot_model() 80 | # analysis 81 | ops.constraints('Transformation') 82 | ops.test('NormDispIncr', 1e-4, 15, 1) 83 | ops.algorithm('Newton') 84 | ops.numberer('RCM') 85 | ops.system('SparseGeneral') 86 | ops.integrator('LoadControl', 1) 87 | ops.analysis('Static') 88 | 89 | # set contact elements to be frictionless for gravity analysis 90 | ops.setParameter('-val', 0, '-eleRange', 6, 7, 'friction') 91 | ops.analyze(5) 92 | 93 | ops.setParameter('-val', 1, '-eleRange', 6, 7, 'friction') 94 | ops.analyze(5) 95 | 96 | ops.wipe() 97 | disp = np.loadtxt('disp.txt') 98 | otg.node_result(node_list, [disp], ['Disp'], 'Load') -------------------------------------------------------------------------------- /BeamContact2D/test.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | ------------------------------------------ 4 | File Name: test 5 | Description: 6 | Author: zarhin 7 | Date : 2020/9/18 8 | ------------------------------------------ 9 | Change Activity: 10 | 2020/9/18 11 | ------------------------------------------ 12 | """ 13 | 14 | 15 | -------------------------------------------------------------------------------- /BeamContact2D/toOpenSeesPy.py: -------------------------------------------------------------------------------- 1 | # Convert an OpenSees(Tcl) script to OpenSeesPy 2 | # Author: Michael H. Scott, michael.scott@oregonstate.edu 3 | # Date: June 2018 4 | # 5 | # Usage in a Python script 6 | # exec(open('toOpenSeesPy.py').read()) 7 | # ... 8 | # outfile = open('model.py','w') 9 | # toOpenSeesPy('model.tcl',outfile) 10 | # toOpenSeesPy('anotherScript.tcl',outfile) 11 | # ... 12 | # outfile.close() 13 | # 14 | # - Assumes the OpenSees(.tcl) file defines the model line by line 15 | # without any loops, conditionals, variables, expressions, etc. 16 | # This is the format generated when you export a model from 17 | # OpenSees Navigator and perhaps from other front-ends to OpenSees. 18 | # 19 | # - The calling Python script should open and close the file stream for 20 | # for writing the converted .py file. This allows you to call the 21 | # converter on multiple Tcl files in sequence, as shown above. 22 | # 23 | # - If your OpenSees(.tcl) file uses any loops, conditionals, variables, 24 | # expressions, etc., you might be better off to port your OpenSees 25 | # model from Tcl to Python manually, or you can look in to Tkinter. 26 | # 27 | # - You may have some luck making your own "middleware" to convert your 28 | # OpenSees(.tcl) script to a model defined line by line by inserting 29 | # output statements in your loops and other constructs. Even though 30 | # this won't get you to 100% conversion and you'll still have some 31 | # conversions to make here and there, it'll get you pretty far. 32 | # 33 | # set output [open lineByLine.tcl w] 34 | # ... 35 | # for {set i 1} {$i <= $N} {incr i} { 36 | # element truss $i ... 37 | # puts $output "element truss $i ..." 38 | # } 39 | # ... 40 | # close $output 41 | # 42 | # Then, in your Python script, call toOpenSeesPy with lineByLine.tcl as 43 | # the input file. 44 | # 45 | # - If you see any improvements to make to this toOpenSeesPy function, 46 | # please submit a pull request at OpenSees/OpenSees on github 47 | 48 | 49 | # Helper function to deterine if a variable is a floating point value or not 50 | # 51 | def isfloat(value): 52 | try: 53 | float(value) 54 | return True 55 | except ValueError: 56 | return False 57 | 58 | 59 | # Function that does the conversion 60 | # 61 | def toOpenSeesPy(infile, outfile): 62 | outfile.write('\n\n') 63 | outfile.write('import openseespy.opensees as ops') 64 | infile = open(infile, 'r') 65 | for line in infile: 66 | info = line.split() 67 | N = len(info) 68 | 69 | # Ignore a close brace 70 | if N > 0 and info[0][0] == '}': 71 | continue 72 | # Echo a comment line 73 | if N < 2 or info[0][0] == '#': 74 | outfile.write(line) 75 | continue 76 | 77 | # Needs to be a special case for now due to beam integration 78 | if info[1] == 'forceBeamColumn' or info[1] == 'dispBeamColumn': 79 | secTag = info[6] 80 | eleTag = info[2] 81 | Np = info[5] 82 | if info[1] == 'dispBeamColumn': 83 | outfile.write( 84 | 'ops.beamIntegration(\'Legendre\',%s,%s,%s)\n' % ( 85 | eleTag, secTag, Np)) 86 | if info[1] == 'forceBeamColumn': 87 | outfile.write( 88 | 'ops.beamIntegration(\'Lobatto\',%s,%s,%s)\n' % ( 89 | eleTag, secTag, Np)) 90 | outfile.write('ops.element(\'%s\',%s,%s,%s,%s,%s)\n' % ( 91 | info[1], eleTag, info[3], info[4], info[7], eleTag)) 92 | continue 93 | 94 | # Change print to printModel 95 | if info[0] == 'print': 96 | info[0] = 'printModel' 97 | 98 | # For everything else, have to do the first one before loop because of the commas 99 | if isfloat(info[1]): 100 | if info[1] == 'puts': 101 | outfile.write('print(') 102 | else: 103 | outfile.write('ops.%s(%s' % (info[0], info[1])) 104 | else: 105 | outfile.write('ops.%s(\'%s\'' % (info[0], info[1])) 106 | # Now loop through the rest with preceding commas 107 | writeClose = True 108 | for i in range(2, N): 109 | if info[i] == '{': 110 | writeClose = True 111 | break 112 | if info[i] == '}': 113 | writeClose = False 114 | break 115 | if info[0] == 'recorder': 116 | # If it's a recorder, make everything immediately after material, section, or fiber a string 117 | if info[i - 1] in ['material', 'section', 118 | 'fiber'] and isfloat(info[i]): 119 | outfile.write(',str(%s)' % info[i]) 120 | continue 121 | if isfloat(info[i]): 122 | outfile.write(',%s' % info[i]) 123 | else: 124 | outfile.write(',\'%s\'' % info[i]) 125 | if writeClose: 126 | outfile.write(')\n') 127 | infile.close() 128 | 129 | 130 | if __name__ == '__main__': 131 | outfile = open('excavation.py', 'w+') 132 | toOpenSeesPy('excavation.tcl', outfile) 133 | -------------------------------------------------------------------------------- /Cantilever 2D EQ ground motion with gravity Analysis/Canti2DEQ.py: -------------------------------------------------------------------------------- 1 | print("=========================================================") 2 | print("Start cantilever 2D EQ ground motion with gravity example") 3 | 4 | 5 | from openseespy.opensees import * 6 | 7 | 8 | # -------------------------------------------------------------------------------------------------- 9 | # Example 1. cantilever 2D 10 | # EQ ground motion with gravity 11 | # all units are in kip, inch, second 12 | # elasticBeamColumn ELEMENT 13 | # Silvia Mazzoni & Frank McKenna, 2006 14 | # 15 | # ^Y 16 | # | 17 | # 2 __ 18 | # | | 19 | # | | 20 | # | | 21 | # (1) 36' 22 | # | | 23 | # | | 24 | # | | 25 | # =1= ---- -------->X 26 | # 27 | 28 | # SET UP ---------------------------------------------------------------------------- 29 | wipe() # clear opensees model 30 | model('basic', '-ndm', 2, '-ndf', 3) # 2 dimensions, 3 dof per node 31 | # file mkdir data # create data directory 32 | 33 | # define GEOMETRY ------------------------------------------------------------- 34 | # nodal coordinates: 35 | node(1, 0., 0.) # node#, X Y 36 | node(2, 0., 432.) 37 | 38 | # Single point constraints -- Boundary Conditions 39 | fix(1, 1, 1, 1) # node DX DY RZ 40 | 41 | # nodal masses: 42 | mass(2, 5.18, 0., 0.) # node#, Mx My Mz, Mass=Weight/g. 43 | 44 | # Define ELEMENTS ------------------------------------------------------------- 45 | # define geometric transformation: performs a linear geometric transformation of beam stiffness and resisting force from the basic system to the global-coordinate system 46 | geomTransf('Linear', 1) # associate a tag to transformation 47 | 48 | # connectivity: 49 | element('elasticBeamColumn', 1, 1, 2, 3600.0, 3225.0,1080000.0, 1) 50 | 51 | # define GRAVITY ------------------------------------------------------------- 52 | timeSeries('Linear', 1) 53 | pattern('Plain', 1, 1,) 54 | load(2, 0., -2000., 0.) # node#, FX FY MZ -- superstructure-weight 55 | 56 | constraints('Plain') # how it handles boundary conditions 57 | numberer('Plain') # renumber dof's to minimize band-width (optimization), if you want to 58 | system('BandGeneral') # how to store and solve the system of equations in the analysis 59 | algorithm('Linear') # use Linear algorithm for linear analysis 60 | integrator('LoadControl', 0.1) # determine the next time step for an analysis, # apply gravity in 10 steps 61 | analysis('Static') # define type of analysis static or transient 62 | analyze(10) # perform gravity analysis 63 | loadConst('-time', 0.0) # hold gravity constant and restart time 64 | 65 | # DYNAMIC ground-motion analysis ------------------------------------------------------------- 66 | # create load pattern 67 | G = 386.0 68 | timeSeries('Path', 2, '-dt', 0.005, '-filePath', 'A10000.dat', '-factor', G) # define acceleration vector from file (dt=0.005 is associated with the input file gm) 69 | pattern('UniformExcitation', 2, 1, '-accel', 2) # define where and how (pattern tag, dof) acceleration is applied 70 | 71 | # set damping based on first eigen mode 72 | freq = eigen('-fullGenLapack', 1)**0.5 73 | dampRatio = 0.02 74 | rayleigh(0., 0., 0., 2*dampRatio/freq) 75 | 76 | # create the analysis 77 | wipeAnalysis() # clear previously-define analysis parameters 78 | constraints('Plain') # how it handles boundary conditions 79 | numberer('Plain') # renumber dof's to minimize band-width (optimization), if you want to 80 | system('BandGeneral') # how to store and solve the system of equations in the analysis 81 | algorithm('Linear') # use Linear algorithm for linear analysis 82 | integrator('Newmark', 0.5, 0.25) # determine the next time step for an analysis 83 | analysis('Transient') # define type of analysis: time-dependent 84 | analyze(3995, 0.01) # apply 3995 0.01-sec time steps in analysis 85 | 86 | u2 = nodeDisp(2, 2) 87 | print("u2 = ", u2) 88 | 89 | 90 | if abs(u2+0.07441860465116277579) < 1e-12: 91 | print("Passed!") 92 | else: 93 | print("Failed!") 94 | 95 | wipe() 96 | 97 | print("=========================================") 98 | -------------------------------------------------------------------------------- /Laterally-Loaded Pile Foundation/reaction.out: -------------------------------------------------------------------------------- 1 | 10.05 0.000194823 0.000297958 0.000400886 0.000503172 0.000604045 0.000702302 0.000796232 0.000883524 0.000961194 0.00102551 0.00107192 0.00109501 0.00108846 0.00104502 0.000956514 0.000813898 0.000607318 0.000326235 -4.03916e-05 -0.000503869 -0.00107546 -0.00176597 -0.00258529 -0.00354179 -0.00464162 -0.0058879 -0.0072798 -0.00881146 -0.0104708 -0.0122383 -0.0140854 -0.0159733 -0.0178511 -0.0196544 -0.0213037 -0.0227027 -0.0237372 -0.0242735 -0.0241581 -0.0232169 -0.0212553 -0.0180592 -0.0133966 -0.00702043 0.00132761 0.0119114 0.0249936 0.040826 0.0596392 0.0816284 0.106938 0.135642 0.167724 0.203051 0.241347 0.282165 0.324851 0.368511 0.411975 0.453761 0.492036 0.524584 0.54877 0.561515 0.559277 0.538038 0.493307 0.420141 0.31318 0.166715 -0.0252256 -0.268749 -0.569932 -0.934616 -1.36815 -1.87508 -2.45877 -3.121 -3.86143 -4.67708 -5.56166 2 | 10.55 0.00228119 0.00342408 0.00456455 0.00569758 0.0068143 0.007901 0.00893815 0.00989957 0.0107515 0.0114516 0.0119488 0.012182 0.0120802 0.0115618 0.0105354 0.00889958 0.00654412 0.00335137 -0.000801764 -0.0060411 -0.0124916 -0.020273 -0.0294941 -0.0402464 -0.0525961 -0.066575 -0.0821699 -0.0993109 -0.117858 -0.137587 -0.158174 -0.179175 -0.200016 -0.219968 -0.238133 -0.253427 -0.264563 -0.27004 -0.268133 -0.256889 -0.234128 -0.197454 -0.144274 -0.0718297 0.0227577 0.142424 0.290083 0.468522 0.680279 0.927489 1.2117 1.53369 1.89315 2.28853 2.71662 3.17227 3.64803 4.13375 4.61617 5.07854 5.50016 5.85606 6.11659 6.24712 6.20788 5.9538 5.43456 4.59484 3.37474 1.7105 -0.464417 -3.21795 -6.61757 -10.7279 -15.6079 -21.3074 -27.8626 -35.292 -42.6321 -50.4086 -58.7091 3 | 11.05 0.00510484 0.00729272 0.00947523 0.0116415 0.0137727 0.0158401 0.0178032 0.019608 0.0211857 0.0224505 0.023299 0.0236085 0.0232368 0.0220217 0.0197813 0.0163151 0.0114062 0.00482382 -0.00367213 -0.0143256 -0.0273772 -0.043055 -0.0615633 -0.0830695 -0.107689 -0.135464 -0.166348 -0.200176 -0.236644 -0.275275 -0.315393 -0.356086 -0.396176 -0.43418 -0.468283 -0.496297 -0.51564 -0.52331 -0.515868 -0.489431 -0.439683 -0.361894 -0.250966 -0.101498 0.09212 0.335577 0.634476 0.994129 1.4193 1.9139 2.48062 3.12051 3.83254 4.61296 5.45481 6.34716 7.27448 8.21581 9.14403 10.025 10.817 11.4695 11.923 12.1083 11.946 11.3467 10.2105 8.42842 5.88254 2.44805 -2.00475 -7.60754 -14.4902 -22.7759 -32.5756 -42.9671 -54.0623 -66.3104 -79.526 -93.4084 -107.519 4 | 11.55 0.00889913 0.0121315 0.0153546 0.0185501 0.0216867 0.0247172 0.0275762 0.0301771 0.0324101 0.0341398 0.0352034 0.0354089 0.0345348 0.0323296 0.0285128 0.0227764 0.0147886 0.00419863 -0.00935658 -0.0262432 -0.0468189 -0.0714188 -0.100337 -0.133808 -0.171978 -0.214881 -0.262403 -0.314247 -0.369894 -0.428555 -0.489128 -0.550147 -0.609731 -0.665529 -0.714676 -0.75374 -0.778687 -0.784841 -0.76687 -0.718777 -0.633919 -0.505047 -0.324381 -0.0837187 0.225409 0.611534 1.08298 1.64755 2.31211 3.08211 3.96101 4.94966 6.04552 7.24182 8.52667 9.88198 11.2824 12.6943 14.0743 15.3684 16.5104 17.4214 18.0082 18.1632 17.7632 16.6699 14.7299 11.7758 7.62791 2.09657 -5.0141 -13.9016 -24.7592 -37.6216 -50.7199 -65.5113 -81.7731 -99.0634 -116.628 -133.338 -147.828 5 | 12.05 0.014935 0.0192186 0.0234869 0.0277101 0.0318388 0.0357998 0.0394931 0.0427882 0.0455212 0.0474918 0.0484613 0.0481508 0.0462402 0.0423691 0.0361378 0.027111 0.0148233 -0.00121346 -0.0214995 -0.0465333 -0.0767945 -0.112722 -0.15469 -0.202975 -0.257721 -0.318899 -0.386261 -0.459287 -0.537126 -0.61854 -0.701831 -0.784777 -0.864559 -0.937694 -0.999964 -1.04636 -1.07101 -1.06718 -1.02722 -0.942571 -0.803819 -0.600752 -0.322485 0.0423661 0.505447 1.07835 1.77224 2.59732 3.56229 4.67362 5.93473 7.34506 8.89898 10.5846 12.3824 14.2641 16.1905 18.1105 19.9593 21.6567 23.1054 24.19 24.7752 24.7055 23.8044 21.8745 18.6984 14.0401 7.64827 -0.740357 -11.3953 -24.5854 -40.0378 -56.185 -74.4163 -94.2797 -114.85 -134.528 -151.173 -163.191 -170.747 6 | 12.55 0.0257226 0.0309647 0.0361805 0.0413213 0.0463074 0.051024 0.0553174 0.0589901 0.061798 0.0634472 0.063591 0.0618295 0.0577087 0.0507226 0.0403166 0.0258935 0.0068223 -0.0175492 -0.0478782 -0.0848063 -0.128933 -0.180787 -0.240782 -0.309181 -0.38604 -0.47115 -0.563976 -0.663578 -0.768539 -0.876876 -0.985954 -1.09239 -1.19197 -1.27955 -1.34897 -1.39299 -1.40324 -1.37015 -1.28298 -1.12982 -0.897701 -0.572684 -0.140092 0.415225 1.10852 1.95467 2.9676 4.15953 5.54016 7.11561 8.88729 10.8505 12.993 15.2934 17.719 20.2243 22.7487 25.2144 27.5243 29.5599 31.1793 32.2156 32.4754 31.7383 29.7562 26.2544 20.9331 13.4706 3.52766 -9.24628 -25.2048 -43.5779 -63.2015 -85.1885 -108.598 -131.518 -150.977 -164.506 -172.393 -176.761 -179.104 7 | 13.05 0.0450923 0.0508725 0.0566072 0.0622141 0.0675629 0.0724702 0.0766957 0.0799374 0.0818283 0.0819337 0.0797499 0.0747036 0.0661543 0.0533986 0.0356774 0.0121871 -0.0179054 -0.0554429 -0.101252 -0.156109 -0.220707 -0.295602 -0.381162 -0.477501 -0.584411 -0.701274 -0.826976 -0.959804 -1.09734 -1.23637 -1.37271 -1.50115 -1.61533 -1.70758 -1.76889 -1.78879 -1.75533 -1.65502 -1.47292 -1.19267 -0.796698 -0.266409 0.417433 1.27427 2.32317 3.58209 5.06699 6.79074 8.76188 10.9832 13.4499 16.1479 19.0517 22.1219 25.3032 28.5211 31.6798 34.6595 37.2281 39.0852 40.3261 40.7472 40.1134 38.1545 34.2335 27.8271 18.7622 6.61126 -9.06868 -28.7267 -50.4797 -74.3195 -100.426 -126.726 -149.441 -164.893 -173.324 -177.647 -179.834 -181.053 -181.777 8 | 13.55 0.078837 0.0840373 0.0891587 0.0940621 0.098533 0.102277 0.104915 0.105983 0.104927 0.101103 0.0937798 0.0821393 0.065285 0.0422512 0.0120178 -0.0264703 -0.0742772 -0.132443 -0.201944 -0.283642 -0.378224 -0.486137 -0.607503 -0.74203 -0.888908 -1.0467 -1.21319 -1.38531 -1.55893 -1.72876 -1.88817 -2.02908 -2.1418 -2.21492 -2.23522 -2.18761 -2.05511 -1.81888 -1.45836 -0.951472 -0.274906 0.595426 1.68382 3.01404 4.60837 6.48652 8.66423 11.1517 13.9517 17.0576 20.4507 24.0979 27.9487 31.932 35.953 39.4521 42.6323 45.4358 47.6783 49.1451 49.5871 48.7163 46.1989 41.6484 34.3009 22.8362 7.5215 -12.1903 -36.8309 -62.3568 -91.0466 -120.799 -147.127 -164.847 -173.941 -178.267 -180.339 -181.448 -182.089 -182.481 -182.733 9 | 14.05 0.133994 0.136184 0.13824 0.139934 0.140918 0.140726 0.138772 0.134353 0.126646 0.114715 0.0975177 0.0739141 0.0426832 0.00254168 -0.0478284 -0.109746 -0.184487 -0.273233 -0.377008 -0.4966 -0.632474 -0.784673 -0.952701 -1.13539 -1.33076 -1.53588 -1.74666 -1.95772 -2.16221 -2.3516 -2.51552 -2.64163 -2.71543 -2.72021 -2.63696 -2.44434 -2.11884 -1.63484 -0.964986 -0.0805291 1.04805 2.45032 4.1549 6.1883 8.57346 11.328 14.4622 17.9768 21.86 26.0848 30.6056 35.3545 39.7518 43.9523 47.9987 51.7279 54.9467 57.4301 58.9174 59.1061 57.6438 54.1169 48.0066 38.3725 24.2801 4.58069 -20.5784 -49.6843 -80.8289 -114.025 -144.232 -164.535 -174.406 -178.734 -180.714 -181.735 -182.308 -182.652 -182.869 -183.012 -183.11 10 | 14.55 0.218671 0.213567 0.208246 0.202343 0.195315 0.186446 0.174857 0.159508 0.139214 0.112653 0.0783872 0.0348827 -0.0194584 -0.0862628 -0.167139 -0.263619 -0.377092 -0.50872 -0.659344 -0.829368 -1.01863 -1.22628 -1.45056 -1.68872 -1.93673 -2.18916 -2.4389 -2.67701 -2.89247 -3.07199 -3.19982 -3.25763 -3.22435 -3.07619 -2.78661 -2.3265 -1.66439 -0.766866 0.400852 1.87417 3.68812 5.87608 8.46824 11.4898 14.9586 18.8827 23.2576 28.0624 33.2565 38.4914 43.4349 48.4293 53.333 57.9747 62.1525 65.6316 68.1414 69.369 68.9496 66.4506 61.354 52.7091 39.499 21.0036 -3.74391 -36.0367 -69.589 -106.196 -140.566 -163.897 -174.711 -179.085 -180.996 -181.948 -182.469 -182.774 -182.965 -183.088 -183.172 -183.23 -183.272 11 | 15.05 0.341666 0.322348 0.302694 0.282143 0.259877 0.234839 0.20575 0.171133 0.129339 0.0785722 0.0169287 -0.0575601 -0.146875 -0.252948 -0.377581 -0.522359 -0.688546 -0.876957 -1.08782 -1.32061 -1.57389 -1.84508 -2.13027 -2.42398 -2.71892 -3.00574 -3.27278 -3.50584 -3.68793 -3.7991 -3.81628 -3.71317 -3.46026 -3.02492 -2.37157 -1.46213 -0.256517 1.28654 3.20848 5.54962 8.34746 11.6348 15.4371 19.7702 24.6364 30.0214 35.8899 41.423 47.0847 52.8634 58.6101 64.1448 69.2553 73.6973 77.1917 79.4197 80.0108 78.524 74.4207 66.8267 54.3925 36.2741 11.6169 -20.4663 -57.4409 -97.37 -136.105 -162.942 -174.872 -179.351 -181.215 -182.112 -182.59 -182.866 -183.035 -183.143 -183.216 -183.266 -183.301 -183.327 -183.346 12 | 15.55 0.510581 0.466868 0.422654 0.377117 0.329073 0.277021 0.219178 0.153529 0.0778717 -0.0101228 -0.112849 -0.232691 -0.371935 -0.532664 -0.716646 -0.925191 -1.159 -1.41797 -1.70104 -2.00591 -2.32886 -2.66443 -3.00521 -3.34152 -3.66111 -3.94892 -4.18678 -4.35315 -4.42297 -4.36749 -4.15421 -3.74696 -3.10605 -2.18867 -0.949376 0.659064 2.68465 5.17476 8.17442 11.7242 15.8577 20.5985 25.9564 31.9241 38.2291 44.3038 50.6847 57.2472 63.8341 70.2548 76.2858 81.6726 86.1293 89.3354 90.9239 90.4587 87.3977 80.9781 69.5468 52.0165 27.4585 -5.11748 -46.6129 -88.8347 -130.17 -161.336 -174.809 -179.519 -181.373 -182.233 -182.68 -182.934 -183.087 -183.184 -183.248 -183.292 -183.322 -183.345 -183.361 -183.373 -183.382 13 | 16.05 0.73032 0.647787 0.564542 0.479426 0.390802 0.296625 0.194519 0.0818584 -0.0441482 -0.186358 -0.347589 -0.530499 -0.737446 -0.970335 -1.23044 -1.51821 -1.83304 -2.17304 -2.53475 -2.91287 -3.29993 -3.686 -4.05835 -4.40111 -4.69497 -4.91688 -5.03985 -5.03267 -4.85992 -4.4819 -3.85482 -2.93112 -1.66001 0.0117454 2.13874 4.77548 7.97461 11.7846 16.2472 21.3938 27.2423 33.7921 40.4245 47.1432 54.2361 61.5716 68.9818 76.2633 83.1789 89.4621 94.8205 98.936 101.454 101.959 99.9242 94.6448 84.3796 67.6402 43.391 10.5204 -32.0957 -78.803 -125.564 -160.432 -174.58 -179.624 -181.492 -182.327 -182.751 -182.986 -183.126 -183.214 -183.272 -183.311 -183.338 -183.357 -183.371 -183.382 -183.39 -183.396 -183.401 14 | 16.55 0.99946 0.858848 0.717265 0.573154 0.424346 0.26819 0.101672 -0.0784459 -0.275488 -0.492708 -0.733123 -0.999329 -1.2933 -1.61614 -1.96788 -2.34714 -2.7509 -3.17411 -3.60941 -4.04671 -4.4729 -4.87138 -5.2218 -5.49965 -5.67602 -5.71732 -5.58517 -5.23637 -4.62298 -3.69267 -2.38923 -0.653346 1.57624 4.36128 7.76212 11.8353 16.6308 22.1883 28.5333 35.6725 42.6307 49.9955 57.7997 65.9022 74.1218 82.2387 89.9982 97.1189 103.301 108.232 111.58 112.965 111.902 107.719 98.7684 82.9655 59.1868 26.2219 -17.1809 -68.0693 -118.829 -158.393 -174.868 -179.928 -181.584 -182.402 -182.807 -183.028 -183.158 -183.238 -183.291 -183.326 -183.35 -183.367 -183.379 -183.389 -183.396 -183.401 -183.405 -183.408 -183.411 15 | 17.05 1.30444 1.08152 0.857343 0.62991 0.396499 0.153854 -0.101618 -0.373638 -0.665837 -0.981527 -1.32345 -1.69352 -2.0925 -2.51974 -2.97279 -3.44706 -3.93542 -4.42784 -4.91093 -5.36753 -5.77633 -6.11146 -6.34215 -6.43247 -6.34111 -6.02132 -5.42102 -4.48301 -3.14559 -1.34327 0.992027 3.92946 7.53727 11.8802 17.0167 22.9948 29.8482 37.4683 44.8754 52.8945 61.4152 70.2842 79.3035 88.232 96.7926 104.684 111.599 117.231 121.283 123.431 123.259 120.153 112.689 98.0594 74.9434 42.0744 -1.90335 -56.521 -111.081 -155.775 -174.585 -179.986 -181.774 -182.524 -182.852 -183.062 -183.183 -183.258 -183.305 -183.337 -183.359 -183.374 -183.386 -183.394 -183.4 -183.405 -183.408 -183.411 -183.413 -183.415 -183.417 16 | 17.55 1.61246 1.27867 0.943331 0.604033 0.257567 -0.0997858 -0.471965 -0.86282 -1.2758 -1.71362 -2.17789 -2.66879 -3.18463 -3.72145 -4.27258 -4.8282 -5.37484 -5.89496 -6.36642 -6.76211 -7.04952 -7.1904 -7.14055 -6.84967 -6.26144 -5.31378 -3.93931 -2.06623 0.380563 3.47782 7.30191 11.9261 17.4175 23.8329 31.2142 39.1876 47.1965 55.8858 65.1354 74.7764 84.5888 94.3043 103.616 112.198 119.729 125.919 130.513 133.265 133.858 131.779 125.922 112.782 90.6418 58.1376 13.8135 -43.8349 -102.234 -152.416 -174.148 -180.003 -181.832 -182.573 -182.924 -183.111 -183.204 -183.273 -183.317 -183.346 -183.366 -183.38 -183.39 -183.398 -183.403 -183.407 -183.411 -183.413 -183.415 -183.417 -183.418 -183.419 -183.42 17 | 18.05 1.86116 1.38556 0.90819 0.426352 -0.063414 -0.564929 -1.08196 -1.61779 -2.17478 -2.75392 -3.35434 -3.97283 -4.60335 -5.23645 -5.85879 -6.45258 -6.99505 -7.45798 -7.8072 -8.00222 -7.99596 -7.73454 -7.15737 -6.19729 -4.78115 -2.83059 -0.263251 3.00552 7.06053 11.9839 17.8518 24.7298 32.6687 41.008 49.6451 59.0298 69.0288 79.4528 90.0531 100.526 110.524 119.689 127.687 134.247 139.176 142.325 143.505 142.339 138.02 126.816 106.02 74.206 29.8625 -28.6294 -92.2888 -148.191 -173.541 -179.98 -181.873 -182.611 -182.954 -183.133 -183.234 -183.295 -183.327 -183.354 -183.372 -183.385 -183.394 -183.401 -183.406 -183.41 -183.413 -183.415 -183.416 -183.418 -183.419 -183.42 -183.421 -183.421 -183.422 18 | 18.55 1.94671 1.29996 0.651359 -0.00174032 -0.662561 -1.33432 -2.01966 -2.72011 -3.43547 -4.16321 -4.89791 -5.6306 -6.34814 -7.03264 -7.66078 -8.20331 -8.62447 -8.88156 -8.92457 -8.69598 -8.13072 -7.15639 -5.69376 -3.65756 -0.957787 2.49859 6.8053 12.0539 18.3299 25.7088 34.2501 42.9764 52.2841 62.4054 73.1898 84.4207 95.8112 107.009 117.616 127.23 135.506 142.21 147.231 150.542 152.097 151.682 148.712 140.014 121.105 90.4841 46.5503 -12.3912 -80.7812 -142.61 -172.645 -179.901 -181.893 -182.639 -182.977 -183.15 -183.247 -183.305 -183.341 -183.364 -183.377 -183.389 -183.397 -183.404 -183.408 -183.411 -183.414 -183.416 -183.418 -183.419 -183.42 -183.421 -183.421 -183.422 -183.422 -183.423 -183.423 19 | 19.05 1.70277 0.86425 0.0241639 -0.819552 -1.66898 -2.5255 -3.38909 -4.25756 -5.12585 -5.98528 -6.82284 -7.62041 -8.3541 -8.99355 -9.5013 -9.83231 -9.93347 -9.74334 -9.19211 -8.20174 -6.68644 -4.55353 -1.70474 1.96196 6.54997 12.1609 18.8906 26.8247 36.0326 45.1737 55.2117 66.128 77.748 89.818 101.999 113.872 124.971 134.846 143.153 149.721 154.561 157.784 159.483 159.603 157.767 151.9 135.616 106.819 63.8724 5.02287 -67.4777 -135.22 -171.311 -179.748 -181.891 -182.657 -182.995 -183.164 -183.258 -183.313 -183.347 -183.369 -183.384 -183.394 -183.4 -183.406 -183.41 -183.413 -183.415 -183.417 -183.418 -183.42 -183.42 -183.421 -183.422 -183.422 -183.423 -183.423 -183.423 -183.423 -183.424 20 | -------------------------------------------------------------------------------- /Laterally-Loaded Pile Foundation/testFunction.py: -------------------------------------------------------------------------------- 1 | #!usr/bin/pyton3 2 | # -*- coding: UTF-8 -*- 3 | 4 | import math 5 | import numpy as np 6 | from scipy import interpolate 7 | 8 | def get_pyParam ( pyDepth, gamma, phiDegree, b, pEleLength, puSwitch, kSwitch, gwtSwitch): 9 | # soil unit weight (kN/m^3) 10 | pyDepth=3.1 11 | gamma = 17.0 12 | # soil internal friction angle (degrees) 13 | phiDegree = 36.0 14 | # soil shear modulus at pile tip (kPa) 15 | Gsoil = 150000.0 16 | # length of pile head (above ground surface) (m) 17 | L1 = 1.0 18 | # length of embedded pile (below ground surface) (m) 19 | L2 = 20.0 20 | # pile diameter 21 | b = 1.0 22 | # number of pile elements 23 | nElePile = 84 24 | # pile element length 25 | pEleLength = (L1+L2)/nElePile 26 | # number of total pile nodes 27 | nNodePile = 1 + nElePile 28 | puSwitch=1 29 | kSwitch=1 30 | gwtSwitch=1 31 | #---------------------------------------------------------- 32 | # define ultimate lateral resistance, pult 33 | #---------------------------------------------------------- 34 | 35 | # pult is defined per API recommendations (Reese and Van Impe, 2001 or API, 1987) for puSwitch = 1 36 | # OR per the method of Brinch Hansen (1961) for puSwitch = 2 37 | 38 | pi = 3.14159265358979 39 | phi = phiDegree * (pi/180) 40 | zbRatio = pyDepth / b 41 | 42 | #-------API recommended method------- 43 | 44 | if puSwitch == 1: 45 | 46 | # obtain loading-type coefficient A for given depth-to-diameter ratio zb 47 | # ---> values are obtained from a figure and are therefore approximate 48 | zb = [] 49 | dataNum = 41 50 | zb=np.linspace(0.0,5.0,dataNum) 51 | As = [2.8460, 2.7105, 2.6242, 2.5257, 2.4271, 2.3409, 2.2546, 2.1437, 2.0575, 1.9589, 1.8973, 1.8111, 1.7372, 1.6632, 1.5893, 1.5277, 1.4415, 1.3799, 1.3368, 1.2690, 1.2074, 1.1581, 52 | 1.1211, 1.0780, 1.0349, 1.0164, 0.9979, 0.9733, 0.9610, 0.9487, 0.9363, 0.9117, 0.8994, 0.8994, 0.8871, 0.8871, 0.8809, 0.8809, 0.8809, 0.8809, 0.8809] 53 | f=interpolate.interp1d(zb,As) 54 | # linear interpolation to define A for intermediate values of depth:diameter ratio 55 | 56 | if zbRatio >= 5.0: 57 | A = 0.88 58 | else : 59 | A=f(zbRatio) 60 | # define common terms 61 | alpha = phi / 2 62 | beta = pi / 4 + phi / 2 63 | K0 = 0.4 64 | 65 | tan_1 = math.tan(pi / 4 - phi / 2) 66 | Ka = math.pow(tan_1 , 2) 67 | 68 | # terms for Equation (3.44), Reese and Van Impe (2001) 69 | tan_2 = math.tan(phi) 70 | tan_3 = math.tan(beta - phi) 71 | sin_1 = math.sin(beta) 72 | cos_1 = math.cos(alpha) 73 | c1 = K0 * tan_2 * sin_1 / (tan_3*cos_1) 74 | 75 | tan_4 = math.tan(beta) 76 | tan_5 = math.tan(alpha) 77 | c2 = (tan_4/tan_3)*tan_4 * tan_5 78 | c3 = K0 * tan_4 * (tan_2 * sin_1 - tan_5) 79 | c4 = tan_4 / tan_3 - Ka 80 | 81 | # terms for Equation (3.45), Reese and Van Impe (2001) 82 | pow_1 = math.pow(tan_4,8) 83 | pow_2 = math.pow(tan_4,4) 84 | c5 = Ka * (pow_1-1) 85 | c6 = K0 * tan_2 * pow_2 86 | 87 | # Equation (3.44), Reese and Van Impe (2001) 88 | pst = gamma * pyDepth * (pyDepth * (c1 + c2 + c3) + b * c4) 89 | 90 | # Equation (3.45), Reese and Van Impe (2001) 91 | psd = b * gamma * pyDepth * (c5 + c6) 92 | 93 | # pult is the lesser of pst and psd. At surface, an arbitrary value is defined 94 | if pst <=psd: 95 | if pyDepth == 0: 96 | pu = 0.01 97 | 98 | else: 99 | pu = A * pst 100 | 101 | else: 102 | pu = A * psd 103 | 104 | # PySimple1 material formulated with pult as a force, not force/length, multiply by trib. length 105 | pult = pu * pEleLength 106 | 107 | #-------Brinch Hansen method------- 108 | elif puSwitch == 2: 109 | # pressure at ground surface 110 | cos_2 = math.cos(phi) 111 | 112 | tan_6 = math.tan(pi/4+phi/2) 113 | 114 | sin_2 = math.sin(phi) 115 | sin_3 = math.sin(pi/4 + phi/2) 116 | 117 | exp_1 = math.exp((pi/2+phi)*tan_2) 118 | exp_2 = math.exp(-(pi/2-phi) * tan_2) 119 | 120 | Kqo = exp_1 * cos_2 * tan_6 - exp_2 * cos_2 * tan_1 121 | Kco = (1/tan_2) * (exp_1 * cos_2 * tan_6 - 1) 122 | 123 | # pressure at great depth 124 | exp_3 = math.exp(pi * tan_2) 125 | pow_3 = math.pow(tan_2,4) 126 | pow_4 = math.pow(tan_6,2) 127 | dcinf = 1.58 + 4.09 * (pow_3) 128 | Nc = (1/tan_2)*(exp_3)*(pow_4 - 1) 129 | Ko = 1 - sin_2 130 | Kcinf = Nc * dcinf 131 | Kqinf = Kcinf * Ko * tan_2 132 | 133 | # pressure at an arbitrary depth 134 | aq = (Kqo/(Kqinf - Kqo))*(Ko*sin_2/sin_3) 135 | KqD = (Kqo + Kqinf * aq * zbRatio)/(1 + aq * zbRatio) 136 | 137 | # ultimate lateral resistance 138 | if pyDepth == 0: 139 | pu = 0.01 140 | else: 141 | pu = gamma * pyDepth * KqD * b 142 | 143 | # PySimple1 material formulated with pult as a force, not force/length, multiply by trib. length 144 | pult = pu * pEleLength 145 | 146 | #---------------------------------------------------------- 147 | # define displacement at 50% lateral capacity, y50 148 | #---------------------------------------------------------- 149 | 150 | # values of y50 depend of the coefficent of subgrade reaction, k, which can be defined in several ways. 151 | # for gwtSwitch = 1, k reflects soil above the groundwater table 152 | # for gwtSwitch = 2, k reflects soil below the groundwater table 153 | # a linear variation of k with depth is defined for kSwitch = 1 after API (1987) 154 | # a parabolic variation of k with depth is defined for kSwitch = 2 after Boulanger et al. (2003) 155 | 156 | # API (1987) recommended subgrade modulus for given friction angle, values obtained from figure (approximate) 157 | 158 | ph = [28.8, 29.5, 30.0, 31.0, 32.0, 33.0, 34.0, 35.0, 36.0, 37.0, 38.0, 39.0, 40.0] 159 | 160 | # subgrade modulus above the water table 161 | if gwtSwitch == 1: 162 | k = [10, 23, 45, 61, 80, 100, 120, 140, 160, 182, 215, 250, 275] 163 | 164 | else: 165 | k = [10, 20, 33, 42, 50, 60, 70, 85, 95, 107, 122, 141, 155] 166 | f=interpolate.interp1d(ph,k) 167 | khat=f(phiDegree) 168 | 169 | # change units from (lb/in^3) to (kN/m^3) 170 | k_SIunits = khat * 271.45 171 | 172 | # define parabolic distribution of k with depth if desired (i.e. lin_par switch == 2) 173 | sigV = pyDepth * gamma 174 | 175 | if sigV == 0: 176 | sigV = 0.01 177 | 178 | if kSwitch == 2: 179 | # Equation (5-16), Boulanger et al. (2003) 180 | cSigma = math.pow(50 / sigV , 0.5) 181 | # Equation (5-15), Boulanger et al. (2003) 182 | k_SIunits = cSigma * k_SIunits 183 | 184 | # define y50 based on pult and subgrade modulus k 185 | 186 | # based on API (1987) recommendations, p-y curves are described using tanh functions. 187 | # tcl does not have the atanh function, so must define this specifically 188 | 189 | # i.e. atanh(x) = 1/2*ln((1+x)/(1-x)), |x| < 1 190 | 191 | # when half of full resistance has been mobilized, p(y50)/pult = 0.5 192 | x = 0.5 193 | log_1 = math.log((1+x)/(1-x)) 194 | atanh_value = 0.5 * log_1 195 | 196 | # need to be careful at ground surface (don't want to divide by zero) 197 | if pyDepth == 0.0: 198 | pyDepth = 0.01 199 | 200 | y50 = 0.5 * (pu/ A)/(k_SIunits * pyDepth) * atanh_value 201 | # return pult and y50 parameters 202 | outResult = [] 203 | outResult.append(pult) 204 | outResult.append(y50) 205 | 206 | return outResult -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # OpenSeesPyExamples 2 | 基于Python语言的OpenSees算例,重点在于Python语言在OpenSees中的应用。 3 | -------------------------------------------------------------------------------- /Reinforced Concrete Frame Earthquake Analysis/RCFrameEarthquake.py: -------------------------------------------------------------------------------- 1 | print("==========================") 2 | print("Start RCFrameEarthquake Example") 3 | 4 | # Units: kips, in, sec 5 | # 6 | # Written: Minjie 7 | 8 | 9 | from openseespy.opensees import * 10 | 11 | import ReadRecord 12 | import numpy as np 13 | import matplotlib.pyplot as plt 14 | 15 | wipe() 16 | # ---------------------------------------------------- 17 | # Start of Model Generation & Initial Gravity Analysis 18 | # ---------------------------------------------------- 19 | 20 | # Do operations of Example3.1 by sourcing in the tcl file 21 | import RCFrameGravity 22 | print("Gravity Analysis Completed") 23 | 24 | # Set the gravity loads to be constant & reset the time in the domain 25 | loadConst('-time', 0.0) 26 | 27 | # ---------------------------------------------------- 28 | # End of Model Generation & Initial Gravity Analysis 29 | # ---------------------------------------------------- 30 | 31 | # Define nodal mass in terms of axial load on columns 32 | g = 386.4 33 | m = RCFrameGravity.P/g 34 | 35 | mass(3, m, m, 0.0) 36 | mass(4, m, m, 0.0) 37 | 38 | # Set some parameters 39 | record = 'elCentro' 40 | 41 | # Permform the conversion from SMD record to OpenSees record 42 | dt, nPts = ReadRecord.ReadRecord(record+'.at2', record+'.dat') 43 | 44 | # Set time series to be passed to uniform excitation 45 | timeSeries('Path', 2, '-filePath', record+'.dat', '-dt', dt, '-factor', g) 46 | 47 | # Create UniformExcitation load pattern 48 | # tag dir 49 | pattern('UniformExcitation', 2, 1, '-accel', 2) 50 | 51 | # set the rayleigh damping factors for nodes & elements 52 | rayleigh(0.0, 0.0, 0.0, 0.000625) 53 | 54 | # Delete the old analysis and all it's component objects 55 | wipeAnalysis() 56 | 57 | # Create the system of equation, a banded general storage scheme 58 | system('BandGeneral') 59 | 60 | # Create the constraint handler, a plain handler as homogeneous boundary 61 | constraints('Plain') 62 | 63 | # Create the convergence test, the norm of the residual with a tolerance of 64 | # 1e-12 and a max number of iterations of 10 65 | test('NormDispIncr', 1.0e-12, 10 ) 66 | 67 | # Create the solution algorithm, a Newton-Raphson algorithm 68 | algorithm('Newton') 69 | 70 | # Create the DOF numberer, the reverse Cuthill-McKee algorithm 71 | numberer('RCM') 72 | 73 | # Create the integration scheme, the Newmark with alpha =0.5 and beta =.25 74 | integrator('Newmark', 0.5, 0.25 ) 75 | 76 | # Create the analysis object 77 | analysis('Transient') 78 | 79 | # Perform an eigenvalue analysis 80 | numEigen = 2 81 | eigenValues = eigen(numEigen) 82 | print("eigen values at start of transient:",eigenValues) 83 | 84 | # set some variables 85 | tFinal = nPts*dt 86 | tCurrent = getTime() 87 | ok = 0 88 | 89 | time = [tCurrent] 90 | u3 = [0.0] 91 | 92 | # Perform the transient analysis 93 | while ok == 0 and tCurrent < tFinal: 94 | 95 | ok = analyze(1, .01) 96 | 97 | # if the analysis fails try initial tangent iteration 98 | if ok != 0: 99 | print("regular newton failed .. lets try an initail stiffness for this step") 100 | test('NormDispIncr', 1.0e-12, 100, 0) 101 | algorithm('ModifiedNewton', '-initial') 102 | ok =analyze( 1, .01) 103 | if ok == 0: 104 | print("that worked .. back to regular newton") 105 | test('NormDispIncr', 1.0e-12, 10 ) 106 | algorithm('Newton') 107 | 108 | tCurrent = getTime() 109 | 110 | time.append(tCurrent) 111 | u3.append(nodeDisp(3,1)) 112 | 113 | 114 | 115 | # Perform an eigenvalue analysis 116 | eigenValues = eigen(numEigen) 117 | print("eigen values at end of transient:",eigenValues) 118 | 119 | results = open('results.out','a+') 120 | 121 | if ok == 0: 122 | results.write('PASSED : RCFrameEarthquake.py\n'); 123 | print("Passed!") 124 | else: 125 | results.write('FAILED : RCFrameEarthquake.py\n'); 126 | print("Failed!") 127 | 128 | results.close() 129 | 130 | plt.plot(time, u3) 131 | plt.ylabel('Horizontal Displacement of node 3 (in)') 132 | plt.xlabel('Time (s)') 133 | 134 | plt.show() 135 | 136 | 137 | 138 | print("==========================") 139 | -------------------------------------------------------------------------------- /Reinforced Concrete Frame Earthquake Analysis/RCFrameGravity.py: -------------------------------------------------------------------------------- 1 | print("==========================") 2 | 3 | 4 | from openseespy.opensees import * 5 | 6 | print("Starting RCFrameGravity example") 7 | 8 | # Create ModelBuilder (with two-dimensions and 3 DOF/node) 9 | model('basic', '-ndm', 2, '-ndf', 3) 10 | 11 | # Create nodes 12 | # ------------ 13 | 14 | # Set parameters for overall model geometry 15 | width = 360.0 16 | height = 144.0 17 | 18 | # Create nodes 19 | # tag, X, Y 20 | node(1, 0.0, 0.0) 21 | node(2, width, 0.0) 22 | node(3, 0.0, height) 23 | node(4, width, height) 24 | 25 | # Fix supports at base of columns 26 | # tag, DX, DY, RZ 27 | fix(1, 1, 1, 1) 28 | fix(2, 1, 1, 1) 29 | 30 | # Define materials for nonlinear columns 31 | # ------------------------------------------ 32 | # CONCRETE tag f'c ec0 f'cu ecu 33 | # Core concrete (confined) 34 | uniaxialMaterial('Concrete01', 1, -6.0, -0.004, -5.0, -0.014) 35 | 36 | # Cover concrete (unconfined) 37 | uniaxialMaterial('Concrete01', 2, -5.0, -0.002, 0.0, -0.006) 38 | 39 | # STEEL 40 | # Reinforcing steel 41 | fy = 60.0; # Yield stress 42 | E = 30000.0; # Young's modulus 43 | # tag fy E0 b 44 | uniaxialMaterial('Steel01', 3, fy, E, 0.01) 45 | 46 | # Define cross-section for nonlinear columns 47 | # ------------------------------------------ 48 | 49 | # some parameters 50 | colWidth = 15 51 | colDepth = 24 52 | 53 | cover = 1.5 54 | As = 0.60 # area of no. 7 bars 55 | 56 | # some variables derived from the parameters 57 | y1 = colDepth / 2.0 58 | z1 = colWidth / 2.0 59 | 60 | section('Fiber', 1) 61 | 62 | # Create the concrete core fibers 63 | patch('rect', 1, 10, 1, cover - y1, cover - z1, y1 - cover, z1 - cover) 64 | 65 | # Create the concrete cover fibers (top, bottom, left, right) 66 | patch('rect', 2, 10, 1, -y1, z1 - cover, y1, z1) 67 | patch('rect', 2, 10, 1, -y1, -z1, y1, cover - z1) 68 | patch('rect', 2, 2, 1, -y1, cover - z1, cover - y1, z1 - cover) 69 | patch('rect', 2, 2, 1, y1 - cover, cover - z1, y1, z1 - cover) 70 | 71 | # Create the reinforcing fibers (left, middle, right) 72 | layer('straight', 3, 3, As, y1 - cover, z1 - cover, y1 - cover, cover - z1) 73 | layer('straight', 3, 2, As, 0.0, z1 - cover, 0.0, cover - z1) 74 | layer('straight', 3, 3, As, cover - y1, z1 - cover, cover - y1, cover - z1) 75 | 76 | # Define column elements 77 | # ---------------------- 78 | 79 | # Geometry of column elements 80 | # tag 81 | 82 | geomTransf('PDelta', 1) 83 | 84 | # Number of integration points along length of element 85 | np = 5 86 | 87 | # Lobatto integratoin 88 | beamIntegration('Lobatto', 1, 1, np) 89 | 90 | # Create the coulumns using Beam-column elements 91 | # e tag ndI ndJ transfTag integrationTag 92 | eleType = 'forceBeamColumn' 93 | element(eleType, 1, 1, 3, 1, 1) 94 | element(eleType, 2, 2, 4, 1, 1) 95 | 96 | # Define beam elment 97 | # ----------------------------- 98 | 99 | # Geometry of column elements 100 | # tag 101 | geomTransf('Linear', 2) 102 | 103 | # Create the beam element 104 | # tag, ndI, ndJ, A, E, Iz, transfTag 105 | element('elasticBeamColumn', 3, 3, 4, 360.0, 4030.0, 8640.0, 2) 106 | 107 | # Define gravity loads 108 | # -------------------- 109 | 110 | # a parameter for the axial load 111 | P = 180.0; # 10% of axial capacity of columns 112 | 113 | # Create a Plain load pattern with a Linear TimeSeries 114 | timeSeries('Linear', 1) 115 | pattern('Plain', 1, 1) 116 | 117 | # Create nodal loads at nodes 3 & 4 118 | # nd FX, FY, MZ 119 | load(3, 0.0, -P, 0.0) 120 | load(4, 0.0, -P, 0.0) 121 | 122 | # ------------------------------ 123 | # End of model generation 124 | # ------------------------------ 125 | 126 | 127 | # ------------------------------ 128 | # Start of analysis generation 129 | # ------------------------------ 130 | 131 | # Create the system of equation, a sparse solver with partial pivoting 132 | system('BandGeneral') 133 | 134 | # Create the constraint handler, the transformation method 135 | constraints('Transformation') 136 | 137 | # Create the DOF numberer, the reverse Cuthill-McKee algorithm 138 | numberer('RCM') 139 | 140 | # Create the convergence test, the norm of the residual with a tolerance of 141 | # 1e-12 and a max number of iterations of 10 142 | test('NormDispIncr', 1.0e-12, 10, 3) 143 | 144 | # Create the solution algorithm, a Newton-Raphson algorithm 145 | algorithm('Newton') 146 | 147 | # Create the integration scheme, the LoadControl scheme using steps of 0.1 148 | integrator('LoadControl', 0.1) 149 | 150 | # Create the analysis object 151 | analysis('Static') 152 | 153 | # ------------------------------ 154 | # End of analysis generation 155 | # ------------------------------ 156 | 157 | 158 | # ------------------------------ 159 | # Finally perform the analysis 160 | # ------------------------------ 161 | 162 | # perform the gravity load analysis, requires 10 steps to reach the load level 163 | analyze(10) 164 | 165 | # Print out the state of nodes 3 and 4 166 | # print node 3 4 167 | 168 | # Print out the state of element 1 169 | # print ele 1 170 | 171 | u3 = nodeDisp(3, 2) 172 | u4 = nodeDisp(4, 2) 173 | 174 | results = open('results.out', 'a+') 175 | 176 | if abs(u3 + 0.0183736) < 1e-6 and abs(u4 + 0.0183736) < 1e-6: 177 | results.write('PASSED : RCFrameGravity.py\n') 178 | print("Passed!") 179 | else: 180 | results.write('FAILED : RCFrameGravity.py\n') 181 | print("Failed!") 182 | 183 | results.close() 184 | 185 | print("==========================") 186 | -------------------------------------------------------------------------------- /Reinforced Concrete Frame Earthquake Analysis/ReadRecord.py: -------------------------------------------------------------------------------- 1 | # ReadRecord.py 2 | # ------------------------------------------------------------------------------------------------------------ 3 | # 4 | # Written: minjie 5 | # Date: May 2016 6 | 7 | # A procedure which parses a ground motion record from the PEER 8 | # strong motion database by finding dt in the record header, then 9 | # echoing data values to the output file. 10 | # 11 | # Formal arguments 12 | # inFilename -- file which contains PEER strong motion record 13 | # outFilename -- file to be written in format G3 can read 14 | # Return values 15 | # dt -- time step determined from file header 16 | # nPts -- number of data points from file header 17 | # 18 | # Assumptions 19 | # The header in the PEER record is, e.g., formatted as 1 of following: 20 | # 1) new PGA database 21 | # PACIFIC ENGINEERING AND ANALYSIS STRONG-MOTION DATA 22 | # IMPERIAL VALLEY 10/15/79 2319, EL CENTRO ARRAY 6, 230 23 | # ACCELERATION TIME HISTORY IN UNITS OF G 24 | # 3930 0.00500 NPTS, DT 25 | 26 | # 2) old SMD database 27 | # PACIFIC ENGINEERING AND ANALYSIS STRONG-MOTION DATA 28 | # IMPERIAL VALLEY 10/15/79 2319, EL CENTRO ARRAY 6, 230 29 | # ACCELERATION TIME HISTORY IN UNITS OF G 30 | # NPTS= 3930, DT= .00500 SEC 31 | 32 | 33 | def ReadRecord (inFilename, outFilename): 34 | 35 | dt = 0.0 36 | npts = 0 37 | 38 | # Open the input file and catch the error if it can't be read 39 | inFileID = open(inFilename, 'r') 40 | 41 | # Open output file for writing 42 | outFileID = open(outFilename, 'w') 43 | 44 | # Flag indicating dt is found and that ground motion 45 | # values should be read -- ASSUMES dt is on last line 46 | # of header!!! 47 | flag = 0 48 | 49 | # Look at each line in the file 50 | for line in inFileID: 51 | if line == '\n': 52 | # Blank line --> do nothing 53 | continue 54 | elif flag == 1: 55 | # Echo ground motion values to output file 56 | outFileID.write(line) 57 | else: 58 | # Search header lines for dt 59 | words = line.split() 60 | lengthLine = len(words) 61 | 62 | if lengthLine >= 4: 63 | 64 | if words[0] == 'NPTS=': 65 | # old SMD format 66 | for word in words: 67 | if word != '': 68 | # Read in the time step 69 | if flag == 1: 70 | dt = float(word) 71 | break 72 | 73 | if flag == 2: 74 | npts = int(word.strip(',')) 75 | flag = 0 76 | 77 | # Find the desired token and set the flag 78 | if word == 'DT=' or word == 'dt': 79 | flag = 1 80 | 81 | if word == 'NPTS=': 82 | flag = 2 83 | 84 | 85 | elif words[-1] == 'DT': 86 | # new NGA format 87 | count = 0 88 | for word in words: 89 | if word != '': 90 | if count == 0: 91 | npts = int(word) 92 | elif count == 1: 93 | dt = float(word) 94 | elif word == 'DT': 95 | flag = 1 96 | break 97 | 98 | count += 1 99 | 100 | 101 | 102 | inFileID.close() 103 | outFileID.close() 104 | 105 | return dt, npts 106 | -------------------------------------------------------------------------------- /Reinforced Concrete Frame Earthquake Analysis/__pycache__/RCFrameGravity.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zarhin/OpenSeesPyExamples/8fe924e767e0cc027f66aef0153bf3b51300af17/Reinforced Concrete Frame Earthquake Analysis/__pycache__/RCFrameGravity.cpython-36.pyc -------------------------------------------------------------------------------- /Reinforced Concrete Frame Earthquake Analysis/__pycache__/ReadRecord.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zarhin/OpenSeesPyExamples/8fe924e767e0cc027f66aef0153bf3b51300af17/Reinforced Concrete Frame Earthquake Analysis/__pycache__/ReadRecord.cpython-36.pyc -------------------------------------------------------------------------------- /Reinforced Concrete Frame Earthquake Analysis/elCentro.at2: -------------------------------------------------------------------------------- 1 | Data for El Centro 1940 North South Component (Peknold Version) 2 | 1559 points at equal spacing of 0.02 sec 3 | Points are listed in the format of 8F10.5, i.e., 8 points across in 4 | a row with 5 decimal places 5 | The units are (g) 6 | *** Begin data *** 7 | NPTS= 1559, DT= .02000 SEC 8 | 0.00630 0.00364 0.00099 0.00428 0.00758 0.01087 0.00682 0.00277 9 | -0.00128 0.00368 0.00864 0.01360 0.00727 0.00094 0.00420 0.00221 10 | 0.00021 0.00444 0.00867 0.01290 0.01713 -0.00343 -0.02400 -0.00992 11 | 0.00416 0.00528 0.01653 0.02779 0.03904 0.02449 0.00995 0.00961 12 | 0.00926 0.00892 -0.00486 -0.01864 -0.03242 -0.03365 -0.05723 -0.04534 13 | -0.03346 -0.03201 -0.03056 -0.02911 -0.02766 -0.04116 -0.05466 -0.06816 14 | -0.08166 -0.06846 -0.05527 -0.04208 -0.04259 -0.04311 -0.02428 -0.00545 15 | 0.01338 0.03221 0.05104 0.06987 0.08870 0.04524 0.00179 -0.04167 16 | -0.08513 -0.12858 -0.17204 -0.12908 -0.08613 -0.08902 -0.09192 -0.09482 17 | -0.09324 -0.09166 -0.09478 -0.09789 -0.12902 -0.07652 -0.02401 0.02849 18 | 0.08099 0.13350 0.18600 0.23850 0.21993 0.20135 0.18277 0.16420 19 | 0.14562 0.16143 0.17725 0.13215 0.08705 0.04196 -0.00314 -0.04824 20 | -0.09334 -0.13843 -0.18353 -0.22863 -0.27372 -0.31882 -0.25024 -0.18166 21 | -0.11309 -0.04451 0.02407 0.09265 0.16123 0.22981 0.29839 0.23197 22 | 0.16554 0.09912 0.03270 -0.03372 -0.10014 -0.16656 -0.23299 -0.29941 23 | -0.00421 0.29099 0.22380 0.15662 0.08943 0.02224 -0.04495 0.01834 24 | 0.08163 0.14491 0.20820 0.18973 0.17125 0.13759 0.10393 0.07027 25 | 0.03661 0.00295 -0.03071 -0.00561 0.01948 0.04458 0.06468 0.08478 26 | 0.10487 0.05895 0.01303 -0.03289 -0.07882 -0.03556 0.00771 0.05097 27 | 0.01013 -0.03071 -0.07156 -0.11240 -0.15324 -0.11314 -0.07304 -0.03294 28 | 0.00715 -0.06350 -0.13415 -0.20480 -0.12482 -0.04485 0.03513 0.11510 29 | 0.19508 0.12301 0.05094 -0.02113 -0.09320 -0.02663 0.03995 0.10653 30 | 0.17311 0.11283 0.05255 -0.00772 0.01064 0.02900 0.04737 0.06573 31 | 0.02021 -0.02530 -0.07081 -0.04107 -0.01133 0.00288 0.01709 0.03131 32 | -0.02278 -0.07686 -0.13095 -0.18504 -0.14347 -0.10190 -0.06034 -0.01877 33 | 0.02280 -0.00996 -0.04272 -0.02147 -0.00021 0.02104 -0.01459 -0.05022 34 | -0.08585 -0.12148 -0.15711 -0.19274 -0.22837 -0.18145 -0.13453 -0.08761 35 | -0.04069 0.00623 0.05316 0.10008 0.14700 0.09754 0.04808 -0.00138 36 | 0.05141 0.10420 0.15699 0.20979 0.26258 0.16996 0.07734 -0.01527 37 | -0.10789 -0.20051 -0.06786 0.06479 0.01671 -0.03137 -0.07945 -0.12753 38 | -0.17561 -0.22369 -0.27177 -0.15851 -0.04525 0.06802 0.18128 0.14464 39 | 0.10800 0.07137 0.03473 0.09666 0.15860 0.22053 0.18296 0.14538 40 | 0.10780 0.07023 0.03265 0.06649 0.10033 0.13417 0.10337 0.07257 41 | 0.04177 0.01097 -0.01983 0.04438 0.10860 0.17281 0.10416 0.03551 42 | -0.03315 -0.10180 -0.07262 -0.04344 -0.01426 0.01492 -0.02025 -0.05543 43 | -0.09060 -0.12578 -0.16095 -0.19613 -0.14784 -0.09955 -0.05127 -0.00298 44 | -0.01952 -0.03605 -0.05259 -0.04182 -0.03106 -0.02903 -0.02699 0.02515 45 | 0.01770 0.02213 0.02656 0.00419 -0.01819 -0.04057 -0.06294 -0.02417 46 | 0.01460 0.05337 0.02428 -0.00480 -0.03389 -0.00557 0.02274 0.00679 47 | -0.00915 -0.02509 -0.04103 -0.05698 -0.01826 0.02046 0.00454 -0.01138 48 | -0.00215 0.00708 0.00496 0.00285 0.00074 -0.00534 -0.01141 0.00361 49 | 0.01863 0.03365 0.04867 0.03040 0.01213 -0.00614 -0.02441 0.01375 50 | 0.01099 0.00823 0.00547 0.00812 0.01077 -0.00692 -0.02461 -0.04230 51 | -0.05999 -0.07768 -0.09538 -0.06209 -0.02880 0.00448 0.03777 0.01773 52 | -0.00231 -0.02235 0.01791 0.05816 0.03738 0.01660 -0.00418 -0.02496 53 | -0.04574 -0.02071 0.00432 0.02935 0.01526 0.01806 0.02086 0.00793 54 | -0.00501 -0.01795 -0.03089 -0.01841 -0.00593 0.00655 -0.02519 -0.05693 55 | -0.04045 -0.02398 -0.00750 0.00897 0.00384 -0.00129 -0.00642 -0.01156 56 | -0.02619 -0.04082 -0.05545 -0.04366 -0.03188 -0.06964 -0.05634 -0.04303 57 | -0.02972 -0.01642 -0.00311 0.01020 0.02350 0.03681 0.05011 0.02436 58 | -0.00139 -0.02714 -0.00309 0.02096 0.04501 0.06906 0.05773 0.04640 59 | 0.03507 0.03357 0.03207 0.03057 0.03250 0.03444 0.03637 0.01348 60 | -0.00942 -0.03231 -0.02997 -0.03095 -0.03192 -0.02588 -0.01984 -0.01379 61 | -0.00775 -0.01449 -0.02123 0.01523 0.05170 0.08816 0.12463 0.16109 62 | 0.12987 0.09864 0.06741 0.03618 0.00495 0.00420 0.00345 0.00269 63 | -0.05922 -0.12112 -0.18303 -0.12043 -0.05782 0.00479 0.06740 0.13001 64 | 0.08373 0.03745 0.06979 0.10213 -0.03517 -0.17247 -0.13763 -0.10278 65 | -0.06794 -0.03310 -0.03647 -0.03984 -0.00517 0.02950 0.06417 0.09883 66 | 0.13350 0.05924 -0.01503 -0.08929 -0.16355 -0.06096 0.04164 0.01551 67 | -0.01061 -0.03674 -0.06287 -0.08899 -0.05430 -0.01961 0.01508 0.04977 68 | 0.08446 0.05023 0.01600 -0.01823 -0.05246 -0.08669 -0.06769 -0.04870 69 | -0.02970 -0.01071 0.00829 -0.00314 0.02966 0.06246 -0.00234 -0.06714 70 | -0.04051 -0.01388 0.01274 0.00805 0.03024 0.05243 0.02351 -0.00541 71 | -0.03432 -0.06324 -0.09215 -0.12107 -0.08450 -0.04794 -0.01137 0.02520 72 | 0.06177 0.04028 0.01880 0.04456 0.07032 0.09608 0.12184 0.06350 73 | 0.00517 -0.05317 -0.03124 -0.00930 0.01263 0.03457 0.03283 0.03109 74 | 0.02935 0.04511 0.06087 0.07663 0.09239 0.05742 0.02245 -0.01252 75 | 0.00680 0.02611 0.04543 0.01571 -0.01402 -0.04374 -0.07347 -0.03990 76 | -0.00633 0.02724 0.06080 0.03669 0.01258 -0.01153 -0.03564 -0.00677 77 | 0.02210 0.05098 0.07985 0.06915 0.05845 0.04775 0.03706 0.02636 78 | 0.05822 0.09009 0.12196 0.10069 0.07943 0.05816 0.03689 0.01563 79 | -0.00564 -0.02690 -0.04817 -0.06944 -0.09070 -0.11197 -0.11521 -0.11846 80 | -0.12170 -0.12494 -0.16500 -0.20505 -0.15713 -0.10921 -0.06129 -0.01337 81 | 0.03455 0.08247 0.07576 0.06906 0.06236 0.08735 0.11235 0.13734 82 | 0.12175 0.10616 0.09057 0.07498 0.08011 0.08524 0.09037 0.06208 83 | 0.03378 0.00549 -0.02281 -0.05444 -0.04030 -0.02615 -0.01201 -0.02028 84 | -0.02855 -0.06243 -0.03524 -0.00805 -0.04948 -0.03643 -0.02337 -0.03368 85 | -0.01879 -0.00389 0.01100 0.02589 0.01446 0.00303 -0.00840 0.00463 86 | 0.01766 0.03069 0.04372 0.02165 -0.00042 -0.02249 -0.04456 -0.03638 87 | -0.02819 -0.02001 -0.01182 -0.02445 -0.03707 -0.04969 -0.05882 -0.06795 88 | -0.07707 -0.08620 -0.09533 -0.06276 -0.03018 0.00239 0.03496 0.04399 89 | 0.05301 0.03176 0.01051 -0.01073 -0.03198 -0.05323 0.00186 0.05696 90 | 0.01985 -0.01726 -0.05438 -0.01204 0.03031 0.07265 0.11499 0.07237 91 | 0.02975 -0.01288 0.01212 0.03711 0.03517 0.03323 0.01853 0.00383 92 | 0.00342 -0.02181 -0.04704 -0.07227 -0.09750 -0.12273 -0.08317 -0.04362 93 | -0.00407 0.03549 0.07504 0.11460 0.07769 0.04078 0.00387 0.00284 94 | 0.00182 -0.05513 0.04732 0.05223 0.05715 0.06206 0.06698 0.07189 95 | 0.02705 -0.01779 -0.06263 -0.10747 -0.15232 -0.12591 -0.09950 -0.07309 96 | -0.04668 -0.02027 0.00614 0.03255 0.00859 -0.01537 -0.03932 -0.06328 97 | -0.03322 -0.00315 0.02691 0.01196 -0.00300 0.00335 0.00970 0.01605 98 | 0.02239 0.04215 0.06191 0.08167 0.03477 -0.01212 -0.01309 -0.01407 99 | -0.05274 -0.02544 0.00186 0.02916 0.05646 0.08376 0.01754 -0.04869 100 | -0.02074 0.00722 0.03517 -0.00528 -0.04572 -0.08617 -0.06960 -0.05303 101 | -0.03646 -0.01989 -0.00332 0.01325 0.02982 0.01101 -0.00781 -0.02662 102 | -0.00563 0.01536 0.03635 0.05734 0.03159 0.00584 -0.01992 -0.00201 103 | 0.01589 -0.01024 -0.03636 -0.06249 -0.04780 -0.03311 -0.04941 -0.06570 104 | -0.08200 -0.04980 -0.01760 0.01460 0.04680 0.07900 0.04750 0.01600 105 | -0.01550 -0.00102 0.01347 0.02795 0.04244 0.05692 0.03781 0.01870 106 | -0.00041 -0.01952 -0.00427 0.01098 0.02623 0.04148 0.01821 -0.00506 107 | -0.00874 -0.03726 -0.06579 -0.02600 0.01380 0.05359 0.09338 0.05883 108 | 0.02429 -0.01026 -0.04480 -0.01083 -0.01869 -0.02655 -0.03441 -0.02503 109 | -0.01564 -0.00626 -0.01009 -0.01392 0.01490 0.04372 0.03463 0.02098 110 | 0.00733 -0.00632 -0.01997 0.00767 0.03532 0.03409 0.03287 0.03164 111 | 0.02403 0.01642 0.00982 0.00322 -0.00339 0.02202 -0.01941 -0.06085 112 | -0.10228 -0.07847 -0.05466 -0.03084 -0.00703 0.01678 0.01946 0.02214 113 | 0.02483 0.01809 -0.00202 -0.02213 -0.00278 0.01656 0.03590 0.05525 114 | 0.07459 0.06203 0.04948 0.03692 -0.00145 0.04599 0.04079 0.03558 115 | 0.03037 0.03626 0.04215 0.04803 0.05392 0.04947 0.04502 0.04056 116 | 0.03611 0.03166 0.00614 -0.01937 -0.04489 -0.07040 -0.09592 -0.07745 117 | -0.05899 -0.04052 -0.02206 -0.00359 0.01487 0.01005 0.00523 0.00041 118 | -0.00441 -0.00923 -0.01189 -0.01523 -0.01856 -0.02190 -0.00983 0.00224 119 | 0.01431 0.00335 -0.00760 -0.01856 -0.00737 0.00383 0.01502 0.02622 120 | 0.01016 -0.00590 -0.02196 -0.00121 0.01953 0.04027 0.02826 0.01625 121 | 0.00424 0.00196 -0.00031 -0.00258 -0.00486 -0.00713 -0.00941 -0.01168 122 | -0.01396 -0.01750 -0.02104 -0.02458 -0.02813 -0.03167 -0.03521 -0.04205 123 | -0.04889 -0.03559 -0.02229 -0.00899 0.00431 0.01762 0.00714 -0.00334 124 | -0.01383 0.01314 0.04011 0.06708 0.04820 0.02932 0.01043 -0.00845 125 | -0.02733 -0.04621 -0.03155 -0.01688 -0.00222 0.01244 0.02683 0.04121 126 | 0.05559 0.03253 0.00946 -0.01360 -0.01432 -0.01504 -0.01576 -0.04209 127 | -0.02685 -0.01161 0.00363 0.01887 0.03411 0.03115 0.02819 0.02917 128 | 0.03015 0.03113 0.00388 -0.02337 -0.05062 -0.03820 -0.02579 -0.01337 129 | -0.00095 0.01146 0.02388 0.03629 0.01047 -0.01535 -0.04117 -0.06699 130 | -0.05207 -0.03715 -0.02222 -0.00730 0.00762 0.02254 0.03747 0.04001 131 | 0.04256 0.04507 0.04759 0.05010 0.04545 0.04080 0.02876 0.01671 132 | 0.00467 -0.00738 -0.00116 0.00506 0.01128 0.01750 -0.00211 -0.02173 133 | -0.04135 -0.06096 -0.08058 -0.06995 -0.05931 -0.04868 -0.03805 -0.02557 134 | -0.01310 -0.00063 0.01185 0.02432 0.03680 0.04927 0.02974 0.01021 135 | -0.00932 -0.02884 -0.04837 -0.06790 -0.04862 -0.02934 -0.01006 0.00922 136 | 0.02851 0.04779 0.02456 0.00133 -0.02190 -0.04513 -0.06836 -0.04978 137 | -0.03120 -0.01262 0.00596 0.02453 0.04311 0.06169 0.08027 0.09885 138 | 0.06452 0.03019 -0.00414 -0.03848 -0.07281 -0.05999 -0.04717 -0.03435 139 | -0.03231 -0.03028 -0.02824 -0.00396 0.02032 0.00313 -0.01406 -0.03124 140 | -0.04843 -0.06562 -0.05132 -0.03702 -0.02272 -0.00843 0.00587 0.02017 141 | 0.02698 0.03379 0.04061 0.04742 0.05423 0.03535 0.01647 0.01622 142 | 0.01598 0.01574 0.00747 -0.00080 -0.00907 0.00072 0.01051 0.02030 143 | 0.03009 0.03989 0.03478 0.02967 0.02457 0.03075 0.03694 0.04313 144 | 0.04931 0.05550 0.06168 -0.00526 -0.07220 -0.06336 -0.05451 -0.04566 145 | -0.03681 -0.03678 -0.03675 -0.03672 -0.01765 0.00143 0.02051 0.03958 146 | 0.05866 0.03556 0.01245 -0.01066 -0.03376 -0.05687 -0.04502 -0.03317 147 | -0.02131 -0.00946 0.00239 -0.00208 -0.00654 -0.01101 -0.01548 -0.01200 148 | -0.00851 -0.00503 -0.00154 0.00195 0.00051 -0.00092 0.01135 0.02363 149 | 0.03590 0.04818 0.06045 0.07273 0.02847 -0.01579 -0.06004 -0.05069 150 | -0.04134 -0.03199 -0.03135 -0.03071 -0.03007 -0.01863 -0.00719 0.00425 151 | 0.01570 0.02714 0.03858 0.02975 0.02092 0.02334 0.02576 0.02819 152 | 0.03061 0.03304 0.01371 -0.00561 -0.02494 -0.02208 -0.01923 -0.01638 153 | -0.01353 -0.01261 -0.01170 -0.00169 0.00833 0.01834 0.02835 0.03836 154 | 0.04838 0.03749 0.02660 0.01571 0.00482 -0.00607 -0.01696 -0.00780 155 | 0.00136 0.01052 0.01968 0.02884 -0.00504 -0.03893 -0.02342 -0.00791 156 | 0.00759 0.02310 0.00707 -0.00895 -0.02498 -0.04100 -0.05703 -0.02920 157 | -0.00137 0.02645 0.05428 0.03587 0.01746 -0.00096 -0.01937 -0.03778 158 | -0.02281 -0.00784 0.00713 0.02210 0.03707 0.05204 0.06701 0.08198 159 | 0.03085 -0.02027 -0.07140 -0.12253 -0.08644 -0.05035 -0.01426 0.02183 160 | 0.05792 0.09400 0.13009 0.03611 -0.05787 -0.04802 -0.03817 -0.02832 161 | -0.01846 -0.00861 -0.03652 -0.06444 -0.06169 -0.05894 -0.05618 -0.06073 162 | -0.06528 -0.04628 -0.02728 -0.00829 0.01071 0.02970 0.03138 0.03306 163 | 0.03474 0.03642 0.04574 0.05506 0.06439 0.07371 0.08303 0.03605 164 | -0.01092 -0.05790 -0.04696 -0.03602 -0.02508 -0.01414 -0.03561 -0.05708 165 | -0.07855 -0.06304 -0.04753 -0.03203 -0.01652 -0.00102 0.00922 0.01946 166 | 0.02970 0.03993 0.05017 0.06041 0.07065 0.08089 -0.00192 -0.08473 167 | -0.07032 -0.05590 -0.04148 -0.05296 -0.06443 -0.07590 -0.08738 -0.09885 168 | -0.06798 -0.03710 -0.00623 0.02465 0.05553 0.08640 0.11728 0.14815 169 | 0.08715 0.02615 -0.03485 -0.09584 -0.07100 -0.04616 -0.02132 0.00353 170 | 0.02837 0.05321 -0.00469 -0.06258 -0.12048 -0.09960 -0.07872 -0.05784 171 | -0.03696 -0.01608 0.00480 0.02568 0.04656 0.06744 0.08832 0.10920 172 | 0.13008 0.10995 0.08982 0.06969 0.04955 0.04006 0.03056 0.02107 173 | 0.01158 0.00780 0.00402 0.00024 -0.00354 -0.00732 -0.01110 -0.00780 174 | -0.00450 -0.00120 0.00210 0.00540 -0.00831 -0.02203 -0.03575 -0.04947 175 | -0.06319 -0.05046 -0.03773 -0.02500 -0.01227 0.00046 0.00482 0.00919 176 | 0.01355 0.01791 0.02228 0.00883 -0.00462 -0.01807 -0.03152 -0.02276 177 | -0.01401 -0.00526 0.00350 0.01225 0.02101 0.01437 0.00773 0.00110 178 | 0.00823 0.01537 0.02251 0.01713 0.01175 0.00637 0.01376 0.02114 179 | 0.02852 0.03591 0.04329 0.03458 0.02587 0.01715 0.00844 -0.00027 180 | -0.00898 -0.00126 0.00645 0.01417 0.02039 0.02661 0.03283 0.03905 181 | 0.04527 0.03639 0.02750 0.01862 0.00974 0.00086 -0.01333 -0.02752 182 | -0.04171 -0.02812 -0.01453 -0.00094 0.01264 0.02623 0.01690 0.00756 183 | -0.00177 -0.01111 -0.02044 -0.02977 -0.03911 -0.02442 -0.00973 0.00496 184 | 0.01965 0.03434 0.02054 0.00674 -0.00706 -0.02086 -0.03466 -0.02663 185 | -0.01860 -0.01057 -0.00254 -0.00063 0.00128 0.00319 0.00510 0.00999 186 | 0.01488 0.00791 0.00093 -0.00605 0.00342 0.01288 0.02235 0.03181 187 | 0.04128 0.02707 0.01287 -0.00134 -0.01554 -0.02975 -0.04395 -0.03612 188 | -0.02828 -0.02044 -0.01260 -0.00476 0.00307 0.01091 0.00984 0.00876 189 | 0.00768 0.00661 0.01234 0.01807 0.02380 0.02953 0.03526 0.02784 190 | 0.02042 0.01300 -0.03415 -0.00628 -0.00621 -0.00615 -0.00609 -0.00602 191 | -0.00596 -0.00590 -0.00583 -0.00577 -0.00571 -0.00564 -0.00558 -0.00552 192 | -0.00545 -0.00539 -0.00532 -0.00526 -0.00520 -0.00513 -0.00507 -0.00501 193 | -0.00494 -0.00488 -0.00482 -0.00475 -0.00469 -0.00463 -0.00456 -0.00450 194 | -0.00444 -0.00437 -0.00431 -0.00425 -0.00418 -0.00412 -0.00406 -0.00399 195 | -0.00393 -0.00387 -0.00380 -0.00374 -0.00368 -0.00361 -0.00355 -0.00349 196 | -0.00342 -0.00336 -0.00330 -0.00323 -0.00317 -0.00311 -0.00304 -0.00298 197 | -0.00292 -0.00285 -0.00279 -0.00273 -0.00266 -0.00260 -0.00254 -0.00247 198 | -0.00241 -0.00235 -0.00228 -0.00222 -0.00216 -0.00209 -0.00203 -0.00197 199 | -0.00190 -0.00184 -0.00178 -0.00171 -0.00165 -0.00158 -0.00152 -0.00146 200 | -0.00139 -0.00133 -0.00127 -0.00120 -0.00114 -0.00108 -0.00101 -0.00095 201 | -0.00089 -0.00082 -0.00076 -0.00070 -0.00063 -0.00057 -0.00051 -0.00044 202 | -0.00038 -0.00032 -0.00025 -0.00019 -0.00013 -0.00006 0.00000 203 | *** End Data *** 204 | 205 | 206 | -------------------------------------------------------------------------------- /Reinforced Concrete Frame Earthquake Analysis/elCentro.dat: -------------------------------------------------------------------------------- 1 | 0.00630 0.00364 0.00099 0.00428 0.00758 0.01087 0.00682 0.00277 2 | -0.00128 0.00368 0.00864 0.01360 0.00727 0.00094 0.00420 0.00221 3 | 0.00021 0.00444 0.00867 0.01290 0.01713 -0.00343 -0.02400 -0.00992 4 | 0.00416 0.00528 0.01653 0.02779 0.03904 0.02449 0.00995 0.00961 5 | 0.00926 0.00892 -0.00486 -0.01864 -0.03242 -0.03365 -0.05723 -0.04534 6 | -0.03346 -0.03201 -0.03056 -0.02911 -0.02766 -0.04116 -0.05466 -0.06816 7 | -0.08166 -0.06846 -0.05527 -0.04208 -0.04259 -0.04311 -0.02428 -0.00545 8 | 0.01338 0.03221 0.05104 0.06987 0.08870 0.04524 0.00179 -0.04167 9 | -0.08513 -0.12858 -0.17204 -0.12908 -0.08613 -0.08902 -0.09192 -0.09482 10 | -0.09324 -0.09166 -0.09478 -0.09789 -0.12902 -0.07652 -0.02401 0.02849 11 | 0.08099 0.13350 0.18600 0.23850 0.21993 0.20135 0.18277 0.16420 12 | 0.14562 0.16143 0.17725 0.13215 0.08705 0.04196 -0.00314 -0.04824 13 | -0.09334 -0.13843 -0.18353 -0.22863 -0.27372 -0.31882 -0.25024 -0.18166 14 | -0.11309 -0.04451 0.02407 0.09265 0.16123 0.22981 0.29839 0.23197 15 | 0.16554 0.09912 0.03270 -0.03372 -0.10014 -0.16656 -0.23299 -0.29941 16 | -0.00421 0.29099 0.22380 0.15662 0.08943 0.02224 -0.04495 0.01834 17 | 0.08163 0.14491 0.20820 0.18973 0.17125 0.13759 0.10393 0.07027 18 | 0.03661 0.00295 -0.03071 -0.00561 0.01948 0.04458 0.06468 0.08478 19 | 0.10487 0.05895 0.01303 -0.03289 -0.07882 -0.03556 0.00771 0.05097 20 | 0.01013 -0.03071 -0.07156 -0.11240 -0.15324 -0.11314 -0.07304 -0.03294 21 | 0.00715 -0.06350 -0.13415 -0.20480 -0.12482 -0.04485 0.03513 0.11510 22 | 0.19508 0.12301 0.05094 -0.02113 -0.09320 -0.02663 0.03995 0.10653 23 | 0.17311 0.11283 0.05255 -0.00772 0.01064 0.02900 0.04737 0.06573 24 | 0.02021 -0.02530 -0.07081 -0.04107 -0.01133 0.00288 0.01709 0.03131 25 | -0.02278 -0.07686 -0.13095 -0.18504 -0.14347 -0.10190 -0.06034 -0.01877 26 | 0.02280 -0.00996 -0.04272 -0.02147 -0.00021 0.02104 -0.01459 -0.05022 27 | -0.08585 -0.12148 -0.15711 -0.19274 -0.22837 -0.18145 -0.13453 -0.08761 28 | -0.04069 0.00623 0.05316 0.10008 0.14700 0.09754 0.04808 -0.00138 29 | 0.05141 0.10420 0.15699 0.20979 0.26258 0.16996 0.07734 -0.01527 30 | -0.10789 -0.20051 -0.06786 0.06479 0.01671 -0.03137 -0.07945 -0.12753 31 | -0.17561 -0.22369 -0.27177 -0.15851 -0.04525 0.06802 0.18128 0.14464 32 | 0.10800 0.07137 0.03473 0.09666 0.15860 0.22053 0.18296 0.14538 33 | 0.10780 0.07023 0.03265 0.06649 0.10033 0.13417 0.10337 0.07257 34 | 0.04177 0.01097 -0.01983 0.04438 0.10860 0.17281 0.10416 0.03551 35 | -0.03315 -0.10180 -0.07262 -0.04344 -0.01426 0.01492 -0.02025 -0.05543 36 | -0.09060 -0.12578 -0.16095 -0.19613 -0.14784 -0.09955 -0.05127 -0.00298 37 | -0.01952 -0.03605 -0.05259 -0.04182 -0.03106 -0.02903 -0.02699 0.02515 38 | 0.01770 0.02213 0.02656 0.00419 -0.01819 -0.04057 -0.06294 -0.02417 39 | 0.01460 0.05337 0.02428 -0.00480 -0.03389 -0.00557 0.02274 0.00679 40 | -0.00915 -0.02509 -0.04103 -0.05698 -0.01826 0.02046 0.00454 -0.01138 41 | -0.00215 0.00708 0.00496 0.00285 0.00074 -0.00534 -0.01141 0.00361 42 | 0.01863 0.03365 0.04867 0.03040 0.01213 -0.00614 -0.02441 0.01375 43 | 0.01099 0.00823 0.00547 0.00812 0.01077 -0.00692 -0.02461 -0.04230 44 | -0.05999 -0.07768 -0.09538 -0.06209 -0.02880 0.00448 0.03777 0.01773 45 | -0.00231 -0.02235 0.01791 0.05816 0.03738 0.01660 -0.00418 -0.02496 46 | -0.04574 -0.02071 0.00432 0.02935 0.01526 0.01806 0.02086 0.00793 47 | -0.00501 -0.01795 -0.03089 -0.01841 -0.00593 0.00655 -0.02519 -0.05693 48 | -0.04045 -0.02398 -0.00750 0.00897 0.00384 -0.00129 -0.00642 -0.01156 49 | -0.02619 -0.04082 -0.05545 -0.04366 -0.03188 -0.06964 -0.05634 -0.04303 50 | -0.02972 -0.01642 -0.00311 0.01020 0.02350 0.03681 0.05011 0.02436 51 | -0.00139 -0.02714 -0.00309 0.02096 0.04501 0.06906 0.05773 0.04640 52 | 0.03507 0.03357 0.03207 0.03057 0.03250 0.03444 0.03637 0.01348 53 | -0.00942 -0.03231 -0.02997 -0.03095 -0.03192 -0.02588 -0.01984 -0.01379 54 | -0.00775 -0.01449 -0.02123 0.01523 0.05170 0.08816 0.12463 0.16109 55 | 0.12987 0.09864 0.06741 0.03618 0.00495 0.00420 0.00345 0.00269 56 | -0.05922 -0.12112 -0.18303 -0.12043 -0.05782 0.00479 0.06740 0.13001 57 | 0.08373 0.03745 0.06979 0.10213 -0.03517 -0.17247 -0.13763 -0.10278 58 | -0.06794 -0.03310 -0.03647 -0.03984 -0.00517 0.02950 0.06417 0.09883 59 | 0.13350 0.05924 -0.01503 -0.08929 -0.16355 -0.06096 0.04164 0.01551 60 | -0.01061 -0.03674 -0.06287 -0.08899 -0.05430 -0.01961 0.01508 0.04977 61 | 0.08446 0.05023 0.01600 -0.01823 -0.05246 -0.08669 -0.06769 -0.04870 62 | -0.02970 -0.01071 0.00829 -0.00314 0.02966 0.06246 -0.00234 -0.06714 63 | -0.04051 -0.01388 0.01274 0.00805 0.03024 0.05243 0.02351 -0.00541 64 | -0.03432 -0.06324 -0.09215 -0.12107 -0.08450 -0.04794 -0.01137 0.02520 65 | 0.06177 0.04028 0.01880 0.04456 0.07032 0.09608 0.12184 0.06350 66 | 0.00517 -0.05317 -0.03124 -0.00930 0.01263 0.03457 0.03283 0.03109 67 | 0.02935 0.04511 0.06087 0.07663 0.09239 0.05742 0.02245 -0.01252 68 | 0.00680 0.02611 0.04543 0.01571 -0.01402 -0.04374 -0.07347 -0.03990 69 | -0.00633 0.02724 0.06080 0.03669 0.01258 -0.01153 -0.03564 -0.00677 70 | 0.02210 0.05098 0.07985 0.06915 0.05845 0.04775 0.03706 0.02636 71 | 0.05822 0.09009 0.12196 0.10069 0.07943 0.05816 0.03689 0.01563 72 | -0.00564 -0.02690 -0.04817 -0.06944 -0.09070 -0.11197 -0.11521 -0.11846 73 | -0.12170 -0.12494 -0.16500 -0.20505 -0.15713 -0.10921 -0.06129 -0.01337 74 | 0.03455 0.08247 0.07576 0.06906 0.06236 0.08735 0.11235 0.13734 75 | 0.12175 0.10616 0.09057 0.07498 0.08011 0.08524 0.09037 0.06208 76 | 0.03378 0.00549 -0.02281 -0.05444 -0.04030 -0.02615 -0.01201 -0.02028 77 | -0.02855 -0.06243 -0.03524 -0.00805 -0.04948 -0.03643 -0.02337 -0.03368 78 | -0.01879 -0.00389 0.01100 0.02589 0.01446 0.00303 -0.00840 0.00463 79 | 0.01766 0.03069 0.04372 0.02165 -0.00042 -0.02249 -0.04456 -0.03638 80 | -0.02819 -0.02001 -0.01182 -0.02445 -0.03707 -0.04969 -0.05882 -0.06795 81 | -0.07707 -0.08620 -0.09533 -0.06276 -0.03018 0.00239 0.03496 0.04399 82 | 0.05301 0.03176 0.01051 -0.01073 -0.03198 -0.05323 0.00186 0.05696 83 | 0.01985 -0.01726 -0.05438 -0.01204 0.03031 0.07265 0.11499 0.07237 84 | 0.02975 -0.01288 0.01212 0.03711 0.03517 0.03323 0.01853 0.00383 85 | 0.00342 -0.02181 -0.04704 -0.07227 -0.09750 -0.12273 -0.08317 -0.04362 86 | -0.00407 0.03549 0.07504 0.11460 0.07769 0.04078 0.00387 0.00284 87 | 0.00182 -0.05513 0.04732 0.05223 0.05715 0.06206 0.06698 0.07189 88 | 0.02705 -0.01779 -0.06263 -0.10747 -0.15232 -0.12591 -0.09950 -0.07309 89 | -0.04668 -0.02027 0.00614 0.03255 0.00859 -0.01537 -0.03932 -0.06328 90 | -0.03322 -0.00315 0.02691 0.01196 -0.00300 0.00335 0.00970 0.01605 91 | 0.02239 0.04215 0.06191 0.08167 0.03477 -0.01212 -0.01309 -0.01407 92 | -0.05274 -0.02544 0.00186 0.02916 0.05646 0.08376 0.01754 -0.04869 93 | -0.02074 0.00722 0.03517 -0.00528 -0.04572 -0.08617 -0.06960 -0.05303 94 | -0.03646 -0.01989 -0.00332 0.01325 0.02982 0.01101 -0.00781 -0.02662 95 | -0.00563 0.01536 0.03635 0.05734 0.03159 0.00584 -0.01992 -0.00201 96 | 0.01589 -0.01024 -0.03636 -0.06249 -0.04780 -0.03311 -0.04941 -0.06570 97 | -0.08200 -0.04980 -0.01760 0.01460 0.04680 0.07900 0.04750 0.01600 98 | -0.01550 -0.00102 0.01347 0.02795 0.04244 0.05692 0.03781 0.01870 99 | -0.00041 -0.01952 -0.00427 0.01098 0.02623 0.04148 0.01821 -0.00506 100 | -0.00874 -0.03726 -0.06579 -0.02600 0.01380 0.05359 0.09338 0.05883 101 | 0.02429 -0.01026 -0.04480 -0.01083 -0.01869 -0.02655 -0.03441 -0.02503 102 | -0.01564 -0.00626 -0.01009 -0.01392 0.01490 0.04372 0.03463 0.02098 103 | 0.00733 -0.00632 -0.01997 0.00767 0.03532 0.03409 0.03287 0.03164 104 | 0.02403 0.01642 0.00982 0.00322 -0.00339 0.02202 -0.01941 -0.06085 105 | -0.10228 -0.07847 -0.05466 -0.03084 -0.00703 0.01678 0.01946 0.02214 106 | 0.02483 0.01809 -0.00202 -0.02213 -0.00278 0.01656 0.03590 0.05525 107 | 0.07459 0.06203 0.04948 0.03692 -0.00145 0.04599 0.04079 0.03558 108 | 0.03037 0.03626 0.04215 0.04803 0.05392 0.04947 0.04502 0.04056 109 | 0.03611 0.03166 0.00614 -0.01937 -0.04489 -0.07040 -0.09592 -0.07745 110 | -0.05899 -0.04052 -0.02206 -0.00359 0.01487 0.01005 0.00523 0.00041 111 | -0.00441 -0.00923 -0.01189 -0.01523 -0.01856 -0.02190 -0.00983 0.00224 112 | 0.01431 0.00335 -0.00760 -0.01856 -0.00737 0.00383 0.01502 0.02622 113 | 0.01016 -0.00590 -0.02196 -0.00121 0.01953 0.04027 0.02826 0.01625 114 | 0.00424 0.00196 -0.00031 -0.00258 -0.00486 -0.00713 -0.00941 -0.01168 115 | -0.01396 -0.01750 -0.02104 -0.02458 -0.02813 -0.03167 -0.03521 -0.04205 116 | -0.04889 -0.03559 -0.02229 -0.00899 0.00431 0.01762 0.00714 -0.00334 117 | -0.01383 0.01314 0.04011 0.06708 0.04820 0.02932 0.01043 -0.00845 118 | -0.02733 -0.04621 -0.03155 -0.01688 -0.00222 0.01244 0.02683 0.04121 119 | 0.05559 0.03253 0.00946 -0.01360 -0.01432 -0.01504 -0.01576 -0.04209 120 | -0.02685 -0.01161 0.00363 0.01887 0.03411 0.03115 0.02819 0.02917 121 | 0.03015 0.03113 0.00388 -0.02337 -0.05062 -0.03820 -0.02579 -0.01337 122 | -0.00095 0.01146 0.02388 0.03629 0.01047 -0.01535 -0.04117 -0.06699 123 | -0.05207 -0.03715 -0.02222 -0.00730 0.00762 0.02254 0.03747 0.04001 124 | 0.04256 0.04507 0.04759 0.05010 0.04545 0.04080 0.02876 0.01671 125 | 0.00467 -0.00738 -0.00116 0.00506 0.01128 0.01750 -0.00211 -0.02173 126 | -0.04135 -0.06096 -0.08058 -0.06995 -0.05931 -0.04868 -0.03805 -0.02557 127 | -0.01310 -0.00063 0.01185 0.02432 0.03680 0.04927 0.02974 0.01021 128 | -0.00932 -0.02884 -0.04837 -0.06790 -0.04862 -0.02934 -0.01006 0.00922 129 | 0.02851 0.04779 0.02456 0.00133 -0.02190 -0.04513 -0.06836 -0.04978 130 | -0.03120 -0.01262 0.00596 0.02453 0.04311 0.06169 0.08027 0.09885 131 | 0.06452 0.03019 -0.00414 -0.03848 -0.07281 -0.05999 -0.04717 -0.03435 132 | -0.03231 -0.03028 -0.02824 -0.00396 0.02032 0.00313 -0.01406 -0.03124 133 | -0.04843 -0.06562 -0.05132 -0.03702 -0.02272 -0.00843 0.00587 0.02017 134 | 0.02698 0.03379 0.04061 0.04742 0.05423 0.03535 0.01647 0.01622 135 | 0.01598 0.01574 0.00747 -0.00080 -0.00907 0.00072 0.01051 0.02030 136 | 0.03009 0.03989 0.03478 0.02967 0.02457 0.03075 0.03694 0.04313 137 | 0.04931 0.05550 0.06168 -0.00526 -0.07220 -0.06336 -0.05451 -0.04566 138 | -0.03681 -0.03678 -0.03675 -0.03672 -0.01765 0.00143 0.02051 0.03958 139 | 0.05866 0.03556 0.01245 -0.01066 -0.03376 -0.05687 -0.04502 -0.03317 140 | -0.02131 -0.00946 0.00239 -0.00208 -0.00654 -0.01101 -0.01548 -0.01200 141 | -0.00851 -0.00503 -0.00154 0.00195 0.00051 -0.00092 0.01135 0.02363 142 | 0.03590 0.04818 0.06045 0.07273 0.02847 -0.01579 -0.06004 -0.05069 143 | -0.04134 -0.03199 -0.03135 -0.03071 -0.03007 -0.01863 -0.00719 0.00425 144 | 0.01570 0.02714 0.03858 0.02975 0.02092 0.02334 0.02576 0.02819 145 | 0.03061 0.03304 0.01371 -0.00561 -0.02494 -0.02208 -0.01923 -0.01638 146 | -0.01353 -0.01261 -0.01170 -0.00169 0.00833 0.01834 0.02835 0.03836 147 | 0.04838 0.03749 0.02660 0.01571 0.00482 -0.00607 -0.01696 -0.00780 148 | 0.00136 0.01052 0.01968 0.02884 -0.00504 -0.03893 -0.02342 -0.00791 149 | 0.00759 0.02310 0.00707 -0.00895 -0.02498 -0.04100 -0.05703 -0.02920 150 | -0.00137 0.02645 0.05428 0.03587 0.01746 -0.00096 -0.01937 -0.03778 151 | -0.02281 -0.00784 0.00713 0.02210 0.03707 0.05204 0.06701 0.08198 152 | 0.03085 -0.02027 -0.07140 -0.12253 -0.08644 -0.05035 -0.01426 0.02183 153 | 0.05792 0.09400 0.13009 0.03611 -0.05787 -0.04802 -0.03817 -0.02832 154 | -0.01846 -0.00861 -0.03652 -0.06444 -0.06169 -0.05894 -0.05618 -0.06073 155 | -0.06528 -0.04628 -0.02728 -0.00829 0.01071 0.02970 0.03138 0.03306 156 | 0.03474 0.03642 0.04574 0.05506 0.06439 0.07371 0.08303 0.03605 157 | -0.01092 -0.05790 -0.04696 -0.03602 -0.02508 -0.01414 -0.03561 -0.05708 158 | -0.07855 -0.06304 -0.04753 -0.03203 -0.01652 -0.00102 0.00922 0.01946 159 | 0.02970 0.03993 0.05017 0.06041 0.07065 0.08089 -0.00192 -0.08473 160 | -0.07032 -0.05590 -0.04148 -0.05296 -0.06443 -0.07590 -0.08738 -0.09885 161 | -0.06798 -0.03710 -0.00623 0.02465 0.05553 0.08640 0.11728 0.14815 162 | 0.08715 0.02615 -0.03485 -0.09584 -0.07100 -0.04616 -0.02132 0.00353 163 | 0.02837 0.05321 -0.00469 -0.06258 -0.12048 -0.09960 -0.07872 -0.05784 164 | -0.03696 -0.01608 0.00480 0.02568 0.04656 0.06744 0.08832 0.10920 165 | 0.13008 0.10995 0.08982 0.06969 0.04955 0.04006 0.03056 0.02107 166 | 0.01158 0.00780 0.00402 0.00024 -0.00354 -0.00732 -0.01110 -0.00780 167 | -0.00450 -0.00120 0.00210 0.00540 -0.00831 -0.02203 -0.03575 -0.04947 168 | -0.06319 -0.05046 -0.03773 -0.02500 -0.01227 0.00046 0.00482 0.00919 169 | 0.01355 0.01791 0.02228 0.00883 -0.00462 -0.01807 -0.03152 -0.02276 170 | -0.01401 -0.00526 0.00350 0.01225 0.02101 0.01437 0.00773 0.00110 171 | 0.00823 0.01537 0.02251 0.01713 0.01175 0.00637 0.01376 0.02114 172 | 0.02852 0.03591 0.04329 0.03458 0.02587 0.01715 0.00844 -0.00027 173 | -0.00898 -0.00126 0.00645 0.01417 0.02039 0.02661 0.03283 0.03905 174 | 0.04527 0.03639 0.02750 0.01862 0.00974 0.00086 -0.01333 -0.02752 175 | -0.04171 -0.02812 -0.01453 -0.00094 0.01264 0.02623 0.01690 0.00756 176 | -0.00177 -0.01111 -0.02044 -0.02977 -0.03911 -0.02442 -0.00973 0.00496 177 | 0.01965 0.03434 0.02054 0.00674 -0.00706 -0.02086 -0.03466 -0.02663 178 | -0.01860 -0.01057 -0.00254 -0.00063 0.00128 0.00319 0.00510 0.00999 179 | 0.01488 0.00791 0.00093 -0.00605 0.00342 0.01288 0.02235 0.03181 180 | 0.04128 0.02707 0.01287 -0.00134 -0.01554 -0.02975 -0.04395 -0.03612 181 | -0.02828 -0.02044 -0.01260 -0.00476 0.00307 0.01091 0.00984 0.00876 182 | 0.00768 0.00661 0.01234 0.01807 0.02380 0.02953 0.03526 0.02784 183 | 0.02042 0.01300 -0.03415 -0.00628 -0.00621 -0.00615 -0.00609 -0.00602 184 | -0.00596 -0.00590 -0.00583 -0.00577 -0.00571 -0.00564 -0.00558 -0.00552 185 | -0.00545 -0.00539 -0.00532 -0.00526 -0.00520 -0.00513 -0.00507 -0.00501 186 | -0.00494 -0.00488 -0.00482 -0.00475 -0.00469 -0.00463 -0.00456 -0.00450 187 | -0.00444 -0.00437 -0.00431 -0.00425 -0.00418 -0.00412 -0.00406 -0.00399 188 | -0.00393 -0.00387 -0.00380 -0.00374 -0.00368 -0.00361 -0.00355 -0.00349 189 | -0.00342 -0.00336 -0.00330 -0.00323 -0.00317 -0.00311 -0.00304 -0.00298 190 | -0.00292 -0.00285 -0.00279 -0.00273 -0.00266 -0.00260 -0.00254 -0.00247 191 | -0.00241 -0.00235 -0.00228 -0.00222 -0.00216 -0.00209 -0.00203 -0.00197 192 | -0.00190 -0.00184 -0.00178 -0.00171 -0.00165 -0.00158 -0.00152 -0.00146 193 | -0.00139 -0.00133 -0.00127 -0.00120 -0.00114 -0.00108 -0.00101 -0.00095 194 | -0.00089 -0.00082 -0.00076 -0.00070 -0.00063 -0.00057 -0.00051 -0.00044 195 | -0.00038 -0.00032 -0.00025 -0.00019 -0.00013 -0.00006 0.00000 196 | *** End Data *** 197 | -------------------------------------------------------------------------------- /Reinforced Concrete Frame Earthquake Analysis/results.out: -------------------------------------------------------------------------------- 1 | PASSED : RCFrameGravity.py 2 | PASSED : RCFrameGravity.py 3 | PASSED : RCFrameEarthquake.py 4 | PASSED : RCFrameGravity.py 5 | PASSED : RCFrameEarthquake.py 6 | -------------------------------------------------------------------------------- /RotD Spectra of Ground Motion/ReadGMFile.py: -------------------------------------------------------------------------------- 1 | """ 2 | author : JAWAD FAYAZ (email: jfayaz@uci.edu) (website: https://jfayaz.github.io) 3 | 4 | ------------------------------ Instructions --------------------------------------------- 5 | 6 | This is an associated file to generation of RotD(50 and 100) Spectra of bi-directional GM 7 | 8 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 9 | """ 10 | 11 | def ReadGMFile(): 12 | with open (inFile, "r") as myfile: 13 | data = myfile.read().splitlines() 14 | sp = data[3].split(' ') 15 | NumPts = int(sp[2].split(',')[0]) 16 | dt = float(sp[4]) 17 | hdlines = 4 18 | 19 | for k in range(0,hdlines): 20 | del data [0] 21 | 22 | 23 | data = list(filter(str.strip, data)) 24 | gm = np.array(list(map(float, data))) 25 | gmXY[i+1] = gm 26 | 27 | 28 | del data 29 | del gm 30 | 31 | return dt,NumPts,gmXY -------------------------------------------------------------------------------- /RotD Spectra of Ground Motion/Spectra/GM1_Spectra.txt: -------------------------------------------------------------------------------- 1 | Period(s) RotD50Sa(g) RotD100Sa(g) 2 | 0.1 0.22868634554790024 0.2883252937587826 3 | 0.2 0.3344427423288241 0.42759339517152545 4 | 0.30000000000000004 0.2935732230744857 0.3638858648243511 5 | 0.4 0.31790684194190033 0.4756088194638878 6 | 0.5 0.3309537231594736 0.3508192775064591 7 | 0.6 0.3530722461477219 0.382618502052286 8 | 0.7000000000000001 0.38720503467495415 0.45496079023070657 9 | 0.8 0.3914721968601675 0.4581225136442061 10 | 0.9 0.3403596421914732 0.427483182158641 11 | 1.0 0.3139100289390673 0.4022921724658247 12 | 1.2 0.3180597185614807 0.40774807386937223 13 | 1.4 0.3517130453804068 0.4696099111574423 14 | 1.5999999999999999 0.3233793202559531 0.4268106849419821 15 | 1.7999999999999998 0.26336889909717676 0.3503264199903015 16 | 1.9999999999999998 0.19025657247042213 0.2759298586479027 17 | 2.1999999999999997 0.15104859147358346 0.21272826305143505 18 | 2.5 0.11508985977382176 0.15905051472121365 19 | 3.0 0.08654103690112205 0.12565344616259524 20 | 3.5 0.07870501613005129 0.09458593187461894 21 | 4.0 0.05630325607038707 0.07035278033001051 22 | 4.5 0.04045106636506461 0.06111314896539563 23 | 5.0 0.034154767964472955 0.04637504167951486 24 | -------------------------------------------------------------------------------- /RotD Spectra of Ground Motion/example_RotD_Spectra_Generation.py: -------------------------------------------------------------------------------- 1 | """ 2 | author : JAWAD FAYAZ (email: jfayaz@uci.edu) (website: https://jfayaz.github.io) 3 | 4 | ------------------------------ Instructions ------------------------------------- 5 | This code develops the RotD50 Sa and RotD100 Sa Spectra of the Bi-Directional 6 | Ground Motion records as '.AT2' files provided in the current directory 7 | 8 | The two directions of the ground motion record must be named as 'GM1i' and 'GM2i', 9 | where 'i' is the ground motion number which goes from 1 to 'n', 'n' being the total 10 | number of ground motions for which the Spectra needs to be generated. The extension 11 | of the files must be '.AT2' 12 | 13 | For example: If the Spectra of two ground motion records are required, 4 files with 14 | the following names must be provided in the given 'GM' folder: 15 | 'GM11.AT2' - Ground Motion 1 in direction 1 (direction 1 can be either one of the bi-directional GM as we are rotating the ground motions it does not matter) 16 | 'GM21.AT2' - Ground Motion 1 in direction 2 (direction 2 is the other direction of the bi-directional GM) 17 | 'GM12.AT2' - Ground Motion 2 in direction 1 (direction 1 can be either one of the bi-directional GM as we are rotating the ground motions it does not matter) 18 | 'GM22.AT2' - Ground Motion 2 in direction 2 (direction 2 is the other direction of the bi-directional GM) 19 | 20 | The Ground Motion file must be a vector file with 4 header lines.The first 3 lines can have 21 | any content, however, the 4th header line must be written exactly as per the following example: 22 | 'NPTS= 15864, DT= 0.0050' 23 | The 'ReadGMFile.py' can be edited accordingly for any other format 24 | 25 | You may run this code in python IDE: 'Spyder' or any other similar IDE 26 | 27 | Make sure you have the following python libraries installed: 28 | os 29 | sys 30 | pathlib 31 | fnmatch 32 | shutil 33 | IPython 34 | pandas 35 | numpy 36 | matplotlib.pyplot 37 | 38 | INPUT: 39 | This codes provides the option to have 3 different regions of developing the Spectra of ground motions with different period intervals (discretizations) 40 | The following inputs within the code are required: 41 | 'Path_to_openpyfiles'--> Path where the library files 'opensees.pyd' and 'LICENSE.rst' of OpenSeesPy are included (for further details go to https://openseespydoc.readthedocs.io/en/latest/windows.html) 42 | 'Int_T_Reg_1' --> Period Interval for the first region of the Spectrum 43 | 'End_T_Reg_1' --> Last Period of the first region of the Spectrum (where to end the first region) 44 | 'Int_T_Reg_2' --> Period Interval for the second region of the Spectrum 45 | 'End_T_Reg_2' --> Last Period of the second region of the Spectrum (where to end the second region) 46 | 'Int_T_Reg_3' --> Period Interval for the third region of the Spectrum 47 | 'End_T_Reg_3' --> Last Period of the third region of the Spectrum (where to end the third region) 48 | 'Plot_Spectra' --> whether to plot the generated Spectra of the ground motions (options: 'Yes', 'No') 49 | 50 | OUTPUT: 51 | The output will be provided in a saperate 'GMi_Spectra.txt' file for each ground motion record, where 'i' denotes the number of ground motion in the same of 52 | provided 'GM1i.AT2' and 'GM2i.AT2' files. The output files will be generated in a saperate folder 'Spectra' which will be created in the current folder 53 | The 'GMi_Spectra.txt' file will consist of space-saperated file with: 54 | 'Periods (secs)' 'RotD50 Sa (g)' 'RotD100 Sa (g)' 55 | 56 | %%%%% ========================================================================================================================================================================= %%%%%% 57 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 58 | 59 | """ 60 | 61 | ##### ================== INPUTS ================== ##### 62 | 63 | # Path where the library files 'opensees.pyd' and 'LICENSE.rst' are included (for further details go to https://openseespydoc.readthedocs.io/en/latest/windows.html) 64 | Path_to_openpyfiles = 'C:\Tcl' 65 | 66 | # For periods 0 to 'End_T_Reg_1' in an interval of 'Int_T_Reg_1' 67 | Int_T_Reg_1 = 0.1 68 | End_T_Reg_1 = 1 69 | 70 | # For periods ['End_T_Reg_1'+'Int_T_Reg_2'] to 'End_T_Reg_2' in an interval of 'Int_T_Reg_2' 71 | Int_T_Reg_2 = 0.2 72 | End_T_Reg_2 = 2 73 | 74 | # For periods ['End_T_Reg_2'+'Int_T_Reg_3'] to 'End_T_Reg_3' in an interval of 'Int_T_Reg_3' 75 | Int_T_Reg_3 = 0.5 76 | End_T_Reg_3 = 5 77 | 78 | # Plot Spectra (options: 'Yes' or 'No') 79 | Plot_Spectra = 'Yes' 80 | 81 | 82 | ##### =============== CODE BEGINS ================ ####### 83 | ## Importing Libraries 84 | import os, sys, pathlib, fnmatch 85 | import shutil as st 86 | from IPython import get_ipython 87 | from openseespy.opensees import * 88 | import pandas as pd 89 | import numpy as np 90 | import matplotlib.pyplot as plt 91 | import warnings 92 | import matplotlib.cbook 93 | warnings.filterwarnings("ignore",category=matplotlib.cbook.mplDeprecation) 94 | wipe() 95 | 96 | # Getting Number of Ground Motions from the GM folder 97 | GMdir = os.getcwd() 98 | No_of_GMs = int(len(fnmatch.filter(os.listdir(GMdir),'*.AT2'))/2) 99 | print('\nGenerating Spectra for {} provided GMs \n\n'.format(np.round(No_of_GMs,0))) 100 | 101 | # Initializations 102 | DISPLACEMENTS = pd.DataFrame(columns=['uX','uY']) 103 | GM_SPECTRA = pd.DataFrame(columns=['Period(s)','RotD50Sa(g)', 'RotD100Sa(g)']) 104 | SDOF_RESPONSE = [[]] 105 | GM_RESPONSE = [[]] 106 | 107 | # Spectra Generation 108 | for iEQ in range(1,No_of_GMs+1): 109 | print('Generating Spectra for GM: {} ...\n'.format(np.round(iEQ,0))) 110 | Periods = np.concatenate((list(np.arange(Int_T_Reg_1,End_T_Reg_1+Int_T_Reg_1,Int_T_Reg_1)),list(np.arange(End_T_Reg_1+Int_T_Reg_2,End_T_Reg_2+Int_T_Reg_2,Int_T_Reg_2)),list(np.arange(End_T_Reg_2+Int_T_Reg_3,End_T_Reg_3+Int_T_Reg_3,Int_T_Reg_3))),axis=0) 111 | ii = 0 112 | 113 | for T in Periods: 114 | ii = ii+1 115 | GMinter = 0 116 | 117 | # Storing Periods 118 | GM_SPECTRA.loc[ii-1,'Period(s)'] = T 119 | 120 | # Setting modelbuilder 121 | model('basic', '-ndm', 3, '-ndf', 6) 122 | 123 | # Setting SODF Variables 124 | g = 386.1 # value of g 125 | L = 1.0 # Length 126 | d = 2 # Diameter 127 | r = d/2 # Radius 128 | A = np.pi*(r**2) # Area 129 | E = 1.0 # Elastic Modulus 130 | G = 1.0 # Shear Modulus 131 | I3 = np.pi*(r**4)/4 # Moment of Inertia (zz) 132 | J = np.pi*(r**4)/2 # Polar Moment of Inertia 133 | I2 = np.pi*(r**4)/4 # Moment of Inertia (yy) 134 | K = 3*E*I3/(L**3) # Stiffness 135 | M = K*(T**2)/4/(np.pi**2) # Mass 136 | omega = np.sqrt(K/M) # Natural Frequency 137 | Tn = 2*np.pi/omega # Natural Period 138 | 139 | # Creating nodes 140 | node(1, 0.0, 0.0, 0.0) 141 | node(2, 0.0, 0.0, L) 142 | 143 | # Transformation 144 | transfTag = 1 145 | geomTransf('Linear',transfTag,0.0,1.0,0.0) 146 | 147 | # Setting boundary condition 148 | fix(1, 1, 1, 1, 1, 1, 1) 149 | 150 | # Defining materials 151 | uniaxialMaterial("Elastic", 11, E) 152 | 153 | # Defining elements 154 | element("elasticBeamColumn",12,1,2,A,E,G,J,I2,I3,1) 155 | 156 | # Defining mass 157 | mass(2,M,M,0.0,0.0,0.0,0.0) 158 | 159 | # Eigen Value Analysis (Verifying Period) 160 | numEigen = 1 161 | eigenValues = eigen(numEigen) 162 | omega = np.sqrt(eigenValues) 163 | T = 2*np.pi/omega 164 | print(' Calculating Spectral Ordinate for Period = {} secs'.format(np.round(T,3))) 165 | 166 | ## Reading GM Files 167 | exec(open("ReadGMFile.py").read()) # read in procedure Multinition 168 | iGMinput = 'GM1'+str(iEQ)+' GM2'+str(iEQ) ; 169 | GMinput = iGMinput.split(' '); 170 | gmXY = {} 171 | for i in range(0,2): 172 | inFile = GMdir + '/'+ GMinput[i]+'.AT2'; 173 | dt, NumPts , gmXY = ReadGMFile() 174 | 175 | # Storing GM Histories 176 | gmX = gmXY[1] 177 | gmY = gmXY[2] 178 | gmXY_mat = np.column_stack((gmX,gmX,gmY,gmY)) 179 | 180 | # Bidirectional Uniform Earthquake ground motion (uniform acceleration input at all support nodes) 181 | iGMfile = 'GM1'+str(iEQ)+' GM2'+str(iEQ) ; 182 | GMfile = iGMfile.split(' ') 183 | GMdirection = [1,1,2,2]; 184 | GMfact = [np.cos(GMinter*np.pi/180),np.sin(-GMinter*np.pi/180), np.sin(GMinter*np.pi/180), np.cos(GMinter*np.pi/180)]; 185 | IDTag = 2 186 | loop = [1,2,3,4] 187 | 188 | for i in loop: 189 | # Setting time series to be passed to uniform excitation 190 | timeSeries('Path',IDTag +i, '-dt', dt, '-values', *list(gmXY_mat[:,i-1]), '-factor', GMfact[i-1]*g) 191 | # Creating UniformExcitation load pattern 192 | pattern('UniformExcitation', IDTag+i, GMdirection[i-1], '-accel', IDTag+i) 193 | 194 | # Defining Damping 195 | # Applying Rayleigh Damping from $xDamp 196 | # D=$alphaM*M + $betaKcurr*Kcurrent + $betaKcomm*KlastCommit + $beatKinit*$Kinitial 197 | xDamp = 0.05; # 5% damping ratio 198 | alphaM = 0.; # M-prop. damping; D = alphaM*M 199 | betaKcurr = 0.; # K-proportional damping; +beatKcurr*KCurrent 200 | betaKcomm = 2.*xDamp/omega; # K-prop. damping parameter; +betaKcomm*KlastCommitt 201 | betaKinit = 0.; # initial-stiffness proportional damping +beatKinit*Kini 202 | rayleigh(alphaM,betaKcurr,betaKinit,betaKcomm); # RAYLEIGH damping 203 | 204 | # Creating the analysis 205 | wipeAnalysis() # clear previously-define analysis parameters 206 | constraints("Penalty",1e18, 1e18) # how to handle boundary conditions 207 | numberer("RCM") # renumber dof's to minimize band-width (optimization), if you want to 208 | system('SparseGeneral') # how to store and solve the system of equations in the analysis 209 | algorithm('Linear') # use Linear algorithm for linear analysis 210 | integrator("TRBDF2") # determine the next time step for an analysis 211 | algorithm("NewtonLineSearch") # define type of analysis: time-dependent 212 | test('EnergyIncr',1.0e-6, 100, 1) 213 | analysis("Transient") 214 | 215 | # Variables (Can alter the speed of analysis) 216 | dtAnalysis = dt 217 | TmaxAnanlysis = dt*NumPts 218 | tFinal = int(TmaxAnanlysis/dtAnalysis) 219 | tCurrent = getTime() 220 | ok = 0 221 | time = [tCurrent] 222 | 223 | # Initializations of response 224 | u1 = [0.0] 225 | u2 = [0.0] 226 | 227 | # Performing the transient analysis (Performance is slow in this loop, can be altered by changing the parameters) 228 | while ok == 0 and tCurrent < tFinal: 229 | ok = analyze(1, dtAnalysis) 230 | # if the analysis fails try initial tangent iteration 231 | if ok != 0: 232 | print("Iteration failed .. lets try an initial stiffness for this step") 233 | test('NormDispIncr', 1.0e-12, 100, 0) 234 | algorithm('ModifiedNewton', '-initial') 235 | ok =analyze( 1, .001) 236 | 237 | if ok == 0: 238 | print("that worked .. back to regular newton") 239 | test('NormDispIncr', 1.0e-12, 10 ) 240 | algorithm('Newton') 241 | 242 | tCurrent = getTime() 243 | time.append(tCurrent) 244 | u1.append(nodeDisp(2,1)) 245 | u2.append(nodeDisp(2,2)) 246 | 247 | # Storing responses 248 | DISPLACEMENTS.loc[ii-1,'uX'] = np.array(u1) 249 | DISPLACEMENTS.loc[ii-1,'uY'] = np.array(u2) 250 | DISP_X_Y = np.column_stack((np.array(u1),np.array(u2))) 251 | 252 | # Rotating the Spectra (Projections) 253 | Rot_Matrix = np.zeros((2,2)) 254 | Rot_Disp = np.zeros((180,1)) 255 | for theta in range (0,180,1): 256 | Rot_Matrix [0,0] = np.cos(np.deg2rad(theta)) 257 | Rot_Matrix [0,1] = np.sin(np.deg2rad(-theta)) 258 | Rot_Matrix [1,0] = np.sin(np.deg2rad(theta)) 259 | Rot_Matrix [1,1] = np.cos(np.deg2rad(theta)) 260 | Rot_Disp[theta,0] = np.max(np.matmul(DISP_X_Y,Rot_Matrix)[:,0]) 261 | 262 | # Storing Spectra 263 | Rot_Acc = np.dot(Rot_Disp,(omega**2)/g) 264 | GM_SPECTRA.loc[ii-1,'RotD50Sa(g)'] = np.median(Rot_Acc) 265 | GM_SPECTRA.loc[ii-1,'RotD100Sa(g)']= np.max(Rot_Acc) 266 | wipe() 267 | 268 | # Writing Spectra to Files 269 | if not os.path.exists('Spectra'): 270 | os.makedirs('Spectra') 271 | GM_SPECTRA.to_csv('Spectra//GM'+str(iEQ)+'_Spectra.txt', sep=' ',header=True,index=False) 272 | 273 | # Plotting Spectra 274 | if Plot_Spectra == 'Yes': 275 | 276 | def plot_spectra(PlotTitle,SpectraType,iGM): 277 | axes = fig.add_subplot(1, 1, 1) 278 | axes.plot(GM_SPECTRA['Period(s)'] , GM_SPECTRA[SpectraType] , '.-',lw=7,markersize=20, label='GM'+str(iGM)) 279 | axes.set_xlabel('Period (sec)',fontsize=30,fontweight='bold') 280 | axes.set_ylabel(SpectraType,fontsize=30,fontweight='bold') 281 | axes.set_title(PlotTitle,fontsize=40,fontweight='bold') 282 | axes.tick_params(labelsize= 25) 283 | axes.grid(True) 284 | axes.set_xlim(0, np.ceil(max(GM_SPECTRA['Period(s)']))) 285 | axes.set_ylim(0, np.ceil(max(GM_SPECTRA[SpectraType]))) 286 | axes.axhline(linewidth=10,color='black') 287 | axes.axvline(linewidth=10,color='black') 288 | axes.hold(True) 289 | axes.legend(fontsize =30) 290 | 291 | fig = plt.figure(1,figsize=(18,12)) 292 | plot_spectra('RotD50 Spectra','RotD50Sa(g)',iEQ) 293 | 294 | fig = plt.figure(2,figsize=(18,12)) 295 | plot_spectra('RotD100 Spectra','RotD100Sa(g)',iEQ) 296 | 297 | SDOF_RESPONSE.insert(iEQ-1,DISPLACEMENTS) 298 | GM_RESPONSE.insert(iEQ-1,GM_SPECTRA) 299 | 300 | print('\nGenerated Spectra for GM: {}\n\n'.format(np.round(iEQ,0))) -------------------------------------------------------------------------------- /ZeroLengthContactNTS2D/example1/ZeroLengthContactNTS2D - OpenSeesWiki.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zarhin/OpenSeesPyExamples/8fe924e767e0cc027f66aef0153bf3b51300af17/ZeroLengthContactNTS2D/example1/ZeroLengthContactNTS2D - OpenSeesWiki.pdf -------------------------------------------------------------------------------- /ZeroLengthContactNTS2D/example1/disp.txt: -------------------------------------------------------------------------------- 1 | 0.01 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 6.53473e-23 -1.5198e-09 1.69752e-07 -1.0152e-07 1.69752e-07 -1.0304e-07 1.68292e-07 -1.0304e-07 1.68292e-07 -1.0152e-07 2 | 0.02 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 1.15733e-16 -1.5198e-09 1.69752e-07 -1.0152e-07 1.69752e-07 -1.0304e-07 1.68292e-07 -1.0304e-07 1.68292e-07 -1.0152e-07 3 | 0.03 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 1.15733e-16 -1.5198e-09 1.39969e-07 -1.0152e-07 1.3997e-07 -1.0304e-07 1.38509e-07 -1.0304e-07 1.38509e-07 -1.0152e-07 4 | 0.04 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 9.52516e-17 -1.5198e-09 1.10187e-07 -1.0152e-07 1.10187e-07 -1.0304e-07 1.08726e-07 -1.0304e-07 1.08726e-07 -1.0152e-07 5 | 0.05 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 7.47702e-17 -1.5198e-09 8.57394e-08 -1.0152e-07 8.57394e-08 -1.0304e-07 8.42792e-08 -1.0304e-07 8.42792e-08 -1.0152e-07 6 | 0.06 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 5.79581e-17 -1.5198e-09 6.65308e-08 -1.0152e-07 6.65309e-08 -1.0304e-07 6.50707e-08 -1.0304e-07 6.50706e-08 -1.0152e-07 7 | 0.07 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 4.47485e-17 -1.5198e-09 5.15909e-08 -1.0152e-07 5.15909e-08 -1.0304e-07 5.01307e-08 -1.0304e-07 5.01307e-08 -1.0152e-07 8 | 0.08 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 3.44744e-17 -1.5198e-09 4.00464e-08 -1.0152e-07 4.00464e-08 -1.0304e-07 3.85862e-08 -1.0304e-07 3.85862e-08 -1.0152e-07 9 | 0.09 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 2.65354e-17 -1.5198e-09 3.11212e-08 -1.0152e-07 3.11212e-08 -1.0304e-07 2.9661e-08 -1.0304e-07 2.9661e-08 -1.0152e-07 10 | 0.1 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 2.03976e-17 -1.5198e-09 2.42333e-08 -1.0152e-07 2.42333e-08 -1.0304e-07 2.27731e-08 -1.0304e-07 2.27731e-08 -1.0152e-07 11 | 0.11 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 1.56609e-17 -1.5198e-09 1.88976e-08 -1.0152e-07 1.88976e-08 -1.0304e-07 1.74374e-08 -1.0304e-07 1.74374e-08 -1.0152e-07 12 | 0.12 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 1.19915e-17 -1.5198e-09 1.4726e-08 -1.0152e-07 1.4726e-08 -1.0304e-07 1.32658e-08 -1.0304e-07 1.32658e-08 -1.0152e-07 13 | 0.13 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 9.1228e-18 -1.5198e-09 1.15246e-08 -1.0152e-07 1.15246e-08 -1.0304e-07 1.00644e-08 -1.0304e-07 1.00644e-08 -1.0152e-07 14 | 0.14 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 6.92121e-18 -1.5198e-09 8.90527e-09 -1.0152e-07 8.90527e-09 -1.0304e-07 7.44507e-09 -1.0304e-07 7.44507e-09 -1.0152e-07 15 | 0.15 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 5.11991e-18 -1.5198e-09 7.15904e-09 -1.0152e-07 7.15904e-09 -1.0304e-07 5.69884e-09 -1.0304e-07 5.69884e-09 -1.0152e-07 16 | 0.16 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 3.91904e-18 -1.5198e-09 5.80087e-09 -1.0152e-07 5.80087e-09 -1.0304e-07 4.34067e-09 -1.0304e-07 4.34067e-09 -1.0152e-07 17 | 0.17 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 2.98504e-18 -1.5198e-09 4.83074e-09 -1.0152e-07 4.83074e-09 -1.0304e-07 3.37054e-09 -1.0304e-07 3.37054e-09 -1.0152e-07 18 | 0.18 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 2.31789e-18 -1.5198e-09 3.95762e-09 -1.0152e-07 3.95762e-09 -1.0304e-07 2.49742e-09 -1.0304e-07 2.49742e-09 -1.0152e-07 19 | 0.19 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 1.71746e-18 -1.5198e-09 3.47256e-09 -1.0152e-07 3.47256e-09 -1.0304e-07 2.01236e-09 -1.0304e-07 2.01236e-09 -1.0152e-07 20 | 0.2 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 1.38388e-18 -1.5198e-09 2.9875e-09 -1.0152e-07 2.9875e-09 -1.0304e-07 1.5273e-09 -1.0304e-07 1.5273e-09 -1.0152e-07 21 | 0.21 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 1.05031e-18 -1.5198e-09 2.69646e-09 -1.0152e-07 2.69646e-09 -1.0304e-07 1.23626e-09 -1.0304e-07 1.23626e-09 -1.0152e-07 22 | 0.22 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 8.50164e-19 -1.5198e-09 2.40542e-09 -1.0152e-07 2.40542e-09 -1.0304e-07 9.4522e-10 -1.0304e-07 9.4522e-10 -1.0152e-07 23 | 0.23 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 6.50019e-19 -1.5198e-09 2.21139e-09 -1.0152e-07 2.21139e-09 -1.0304e-07 7.51194e-10 -1.0304e-07 7.51194e-10 -1.0152e-07 24 | 0.24 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 5.1659e-19 -1.5198e-09 2.01737e-09 -1.0152e-07 2.01737e-09 -1.0304e-07 5.57169e-10 -1.0304e-07 5.57169e-10 -1.0152e-07 25 | 0.25 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 3.8316e-19 -1.5198e-09 1.92036e-09 -1.0152e-07 1.92036e-09 -1.0304e-07 4.60156e-10 -1.0304e-07 4.60156e-10 -1.0152e-07 26 | 0.26 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 3.16445e-19 -1.5198e-09 1.82334e-09 -1.0152e-07 1.82334e-09 -1.0304e-07 3.63143e-10 -1.0304e-07 3.63143e-10 -1.0152e-07 27 | 0.27 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 2.4973e-19 -1.5198e-09 1.72633e-09 -1.0152e-07 1.72633e-09 -1.0304e-07 2.6613e-10 -1.0304e-07 2.6613e-10 -1.0152e-07 28 | 0.28 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 1.83016e-19 -1.5198e-09 1.62932e-09 -1.0152e-07 1.62932e-09 -1.0304e-07 1.69118e-10 -1.0304e-07 1.69118e-10 -1.0152e-07 29 | 0.29 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 1.16301e-19 -1.5198e-09 1.62932e-09 -1.0152e-07 1.62932e-09 -1.0304e-07 1.69118e-10 -1.0304e-07 1.69118e-10 -1.0152e-07 30 | 0.3 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 1.163e-19 -1.5198e-09 1.53231e-09 -1.0152e-07 1.53231e-09 -1.0304e-07 7.2105e-11 -1.0304e-07 7.2105e-11 -1.0152e-07 31 | 0.31 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 4.9586e-20 -1.5198e-09 1.5323e-09 -1.0152e-07 1.5323e-09 -1.0304e-07 7.21049e-11 -1.0304e-07 7.21049e-11 -1.0152e-07 32 | 0.32 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 4.95859e-20 -1.5198e-09 1.5323e-09 -1.0152e-07 1.5323e-09 -1.0304e-07 7.2105e-11 -1.0304e-07 7.2105e-11 -1.0152e-07 33 | 0.33 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 4.95856e-20 -1.5198e-09 1.5323e-09 -1.0152e-07 1.5323e-09 -1.0304e-07 7.21049e-11 -1.0304e-07 7.21049e-11 -1.0152e-07 34 | 0.34 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 4.95861e-20 -1.5198e-09 1.5323e-09 -1.0152e-07 1.5323e-09 -1.0304e-07 7.2105e-11 -1.0304e-07 7.21049e-11 -1.0152e-07 35 | 0.35 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 4.95857e-20 -1.5198e-09 1.43529e-09 -1.0152e-07 1.43529e-09 -1.0304e-07 -2.49078e-11 -1.0304e-07 -2.49077e-11 -1.0152e-07 36 | 0.36 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 -1.7128e-20 -1.5198e-09 1.5323e-09 -1.0152e-07 1.5323e-09 -1.0304e-07 7.2105e-11 -1.0304e-07 7.21049e-11 -1.0152e-07 37 | 0.37 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 4.95854e-20 -1.5198e-09 1.43529e-09 -1.0152e-07 1.43529e-09 -1.0304e-07 -2.49078e-11 -1.0304e-07 -2.49077e-11 -1.0152e-07 38 | 0.38 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 -1.71285e-20 -1.5198e-09 1.5323e-09 -1.0152e-07 1.5323e-09 -1.0304e-07 7.21049e-11 -1.0304e-07 7.21049e-11 -1.0152e-07 39 | 0.39 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 4.95856e-20 -1.5198e-09 1.43529e-09 -1.0152e-07 1.43529e-09 -1.0304e-07 -2.49078e-11 -1.0304e-07 -2.49077e-11 -1.0152e-07 40 | 0.4 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 -1.71285e-20 -1.5198e-09 1.5323e-09 -1.0152e-07 1.5323e-09 -1.0304e-07 7.21049e-11 -1.0304e-07 7.21049e-11 -1.0152e-07 41 | 0.41 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 4.95858e-20 -1.5198e-09 1.43529e-09 -1.0152e-07 1.43529e-09 -1.0304e-07 -2.49078e-11 -1.0304e-07 -2.49078e-11 -1.0152e-07 42 | 0.42 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 -1.71282e-20 -1.5198e-09 1.5323e-09 -1.0152e-07 1.5323e-09 -1.0304e-07 7.21049e-11 -1.0304e-07 7.21048e-11 -1.0152e-07 43 | 0.43 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 4.95855e-20 -1.5198e-09 1.43529e-09 -1.0152e-07 1.43529e-09 -1.0304e-07 -2.49078e-11 -1.0304e-07 -2.49078e-11 -1.0152e-07 44 | 0.44 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 -1.71289e-20 -1.5198e-09 1.43529e-09 -1.0152e-07 1.43529e-09 -1.0304e-07 -2.49077e-11 -1.0304e-07 -2.49077e-11 -1.0152e-07 45 | 0.45 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 -1.71289e-20 -1.5198e-09 1.43529e-09 -1.0152e-07 1.43529e-09 -1.0304e-07 -2.49078e-11 -1.0304e-07 -2.49078e-11 -1.0152e-07 46 | 0.46 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 -1.71286e-20 -1.5198e-09 1.43529e-09 -1.0152e-07 1.43529e-09 -1.0304e-07 -2.49077e-11 -1.0304e-07 -2.49077e-11 -1.0152e-07 47 | 0.47 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 -1.71291e-20 -1.5198e-09 1.43529e-09 -1.0152e-07 1.43529e-09 -1.0304e-07 -2.49078e-11 -1.0304e-07 -2.49078e-11 -1.0152e-07 48 | 0.48 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 -1.71288e-20 -1.5198e-09 1.43529e-09 -1.0152e-07 1.43529e-09 -1.0304e-07 -2.49077e-11 -1.0304e-07 -2.49077e-11 -1.0152e-07 49 | 0.49 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 -1.71285e-20 -1.5198e-09 1.5323e-09 -1.0152e-07 1.5323e-09 -1.0304e-07 7.2105e-11 -1.0304e-07 7.21049e-11 -1.0152e-07 50 | 0.5 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 4.95856e-20 -1.5198e-09 1.43529e-09 -1.0152e-07 1.43529e-09 -1.0304e-07 -2.49077e-11 -1.0304e-07 -2.49077e-11 -1.0152e-07 51 | 0.51 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 -1.71283e-20 -1.5198e-09 1.5323e-09 -1.0152e-07 1.5323e-09 -1.0304e-07 7.2105e-11 -1.0304e-07 7.21049e-11 -1.0152e-07 52 | 0.52 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 4.95856e-20 -1.5198e-09 1.43529e-09 -1.0152e-07 1.43529e-09 -1.0304e-07 -2.49078e-11 -1.0304e-07 -2.49077e-11 -1.0152e-07 53 | 0.53 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 -1.71285e-20 -1.5198e-09 1.5323e-09 -1.0152e-07 1.5323e-09 -1.0304e-07 7.2105e-11 -1.0304e-07 7.21049e-11 -1.0152e-07 54 | 0.54 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 4.95854e-20 -1.5198e-09 1.43529e-09 -1.0152e-07 1.43529e-09 -1.0304e-07 -2.49078e-11 -1.0304e-07 -2.49078e-11 -1.0152e-07 55 | 0.55 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 -1.71284e-20 -1.5198e-09 1.5323e-09 -1.0152e-07 1.5323e-09 -1.0304e-07 7.21049e-11 -1.0304e-07 7.21049e-11 -1.0152e-07 56 | 0.56 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 4.95857e-20 -1.5198e-09 1.43529e-09 -1.0152e-07 1.43529e-09 -1.0304e-07 -2.49078e-11 -1.0304e-07 -2.49078e-11 -1.0152e-07 57 | 0.57 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 -1.71285e-20 -1.5198e-09 1.5323e-09 -1.0152e-07 1.5323e-09 -1.0304e-07 7.21049e-11 -1.0304e-07 7.21048e-11 -1.0152e-07 58 | 0.58 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 4.95857e-20 -1.5198e-09 1.43529e-09 -1.0152e-07 1.43529e-09 -1.0304e-07 -2.49078e-11 -1.0304e-07 -2.49078e-11 -1.0152e-07 59 | 0.59 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 -1.7129e-20 -1.5198e-09 1.43529e-09 -1.0152e-07 1.43529e-09 -1.0304e-07 -2.49077e-11 -1.0304e-07 -2.49077e-11 -1.0152e-07 60 | 0.6 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 -1.71289e-20 -1.5198e-09 1.43529e-09 -1.0152e-07 1.43529e-09 -1.0304e-07 -2.49078e-11 -1.0304e-07 -2.49078e-11 -1.0152e-07 61 | 0.61 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 -1.71291e-20 -1.5198e-09 1.43529e-09 -1.0152e-07 1.43529e-09 -1.0304e-07 -2.49077e-11 -1.0304e-07 -2.49077e-11 -1.0152e-07 62 | 0.62 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 -1.71289e-20 -1.5198e-09 1.43529e-09 -1.0152e-07 1.43529e-09 -1.0304e-07 -2.49078e-11 -1.0304e-07 -2.49078e-11 -1.0152e-07 63 | 0.63 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 -1.71289e-20 -1.5198e-09 1.43529e-09 -1.0152e-07 1.43529e-09 -1.0304e-07 -2.49077e-11 -1.0304e-07 -2.49077e-11 -1.0152e-07 64 | 0.64 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 -1.71289e-20 -1.5198e-09 1.43529e-09 -1.0152e-07 1.43529e-09 -1.0304e-07 -2.49078e-11 -1.0304e-07 -2.49078e-11 -1.0152e-07 65 | 0.65 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 -1.71287e-20 -1.5198e-09 1.43529e-09 -1.0152e-07 1.43529e-09 -1.0304e-07 -2.49077e-11 -1.0304e-07 -2.49077e-11 -1.0152e-07 66 | 0.66 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 -1.71288e-20 -1.5198e-09 1.43529e-09 -1.0152e-07 1.43529e-09 -1.0304e-07 -2.49078e-11 -1.0304e-07 -2.49078e-11 -1.0152e-07 67 | 0.67 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 -1.71285e-20 -1.5198e-09 1.43529e-09 -1.0152e-07 1.43529e-09 -1.0304e-07 -2.49077e-11 -1.0304e-07 -2.49077e-11 -1.0152e-07 68 | 0.68 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 -1.71283e-20 -1.5198e-09 1.5323e-09 -1.0152e-07 1.5323e-09 -1.0304e-07 7.2105e-11 -1.0304e-07 7.21049e-11 -1.0152e-07 69 | 0.69 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 4.95856e-20 -1.5198e-09 1.43529e-09 -1.0152e-07 1.43529e-09 -1.0304e-07 -2.49077e-11 -1.0304e-07 -2.49077e-11 -1.0152e-07 70 | 0.7 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 -1.71283e-20 -1.5198e-09 1.5323e-09 -1.0152e-07 1.5323e-09 -1.0304e-07 7.2105e-11 -1.0304e-07 7.21049e-11 -1.0152e-07 71 | 0.71 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 4.95857e-20 -1.5198e-09 1.43529e-09 -1.0152e-07 1.43529e-09 -1.0304e-07 -2.49078e-11 -1.0304e-07 -2.49077e-11 -1.0152e-07 72 | 0.72 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 -1.71285e-20 -1.5198e-09 1.5323e-09 -1.0152e-07 1.5323e-09 -1.0304e-07 7.2105e-11 -1.0304e-07 7.21049e-11 -1.0152e-07 73 | 0.73 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 4.95857e-20 -1.5198e-09 1.43529e-09 -1.0152e-07 1.43529e-09 -1.0304e-07 -2.49078e-11 -1.0304e-07 -2.49078e-11 -1.0152e-07 74 | 0.74 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 -1.71284e-20 -1.5198e-09 1.5323e-09 -1.0152e-07 1.5323e-09 -1.0304e-07 7.21049e-11 -1.0304e-07 7.21049e-11 -1.0152e-07 75 | 0.75 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 4.95856e-20 -1.5198e-09 1.43529e-09 -1.0152e-07 1.43529e-09 -1.0304e-07 -2.49078e-11 -1.0304e-07 -2.49078e-11 -1.0152e-07 76 | 0.76 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 -1.71284e-20 -1.5198e-09 1.5323e-09 -1.0152e-07 1.5323e-09 -1.0304e-07 7.21049e-11 -1.0304e-07 7.21048e-11 -1.0152e-07 77 | 0.77 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 4.95853e-20 -1.5198e-09 1.43529e-09 -1.0152e-07 1.43529e-09 -1.0304e-07 -2.49078e-11 -1.0304e-07 -2.49078e-11 -1.0152e-07 78 | 0.78 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 -1.7129e-20 -1.5198e-09 1.43529e-09 -1.0152e-07 1.43529e-09 -1.0304e-07 -2.49077e-11 -1.0304e-07 -2.49077e-11 -1.0152e-07 79 | 0.79 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 -1.7129e-20 -1.5198e-09 1.43529e-09 -1.0152e-07 1.43529e-09 -1.0304e-07 -2.49078e-11 -1.0304e-07 -2.49078e-11 -1.0152e-07 80 | 0.8 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 -1.7129e-20 -1.5198e-09 1.43529e-09 -1.0152e-07 1.43529e-09 -1.0304e-07 -2.49077e-11 -1.0304e-07 -2.49077e-11 -1.0152e-07 81 | 0.81 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 -1.71289e-20 -1.5198e-09 1.43529e-09 -1.0152e-07 1.43529e-09 -1.0304e-07 -2.49078e-11 -1.0304e-07 -2.49078e-11 -1.0152e-07 82 | 0.82 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 -1.7129e-20 -1.5198e-09 1.43529e-09 -1.0152e-07 1.43529e-09 -1.0304e-07 -2.49077e-11 -1.0304e-07 -2.49077e-11 -1.0152e-07 83 | 0.83 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 -1.71288e-20 -1.5198e-09 1.43529e-09 -1.0152e-07 1.43529e-09 -1.0304e-07 -2.49078e-11 -1.0304e-07 -2.49078e-11 -1.0152e-07 84 | 0.84 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 -1.71289e-20 -1.5198e-09 1.43529e-09 -1.0152e-07 1.43529e-09 -1.0304e-07 -2.49077e-11 -1.0304e-07 -2.49077e-11 -1.0152e-07 85 | 0.85 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 -1.71288e-20 -1.5198e-09 1.43529e-09 -1.0152e-07 1.43529e-09 -1.0304e-07 -2.49078e-11 -1.0304e-07 -2.49078e-11 -1.0152e-07 86 | 0.86 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 -1.71288e-20 -1.5198e-09 1.43529e-09 -1.0152e-07 1.43529e-09 -1.0304e-07 -2.49077e-11 -1.0304e-07 -2.49077e-11 -1.0152e-07 87 | 0.87 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 -1.71283e-20 -1.5198e-09 1.5323e-09 -1.0152e-07 1.5323e-09 -1.0304e-07 7.2105e-11 -1.0304e-07 7.21049e-11 -1.0152e-07 88 | 0.88 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 4.95857e-20 -1.5198e-09 1.43529e-09 -1.0152e-07 1.43529e-09 -1.0304e-07 -2.49077e-11 -1.0304e-07 -2.49077e-11 -1.0152e-07 89 | 0.89 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 -1.71284e-20 -1.5198e-09 1.5323e-09 -1.0152e-07 1.5323e-09 -1.0304e-07 7.2105e-11 -1.0304e-07 7.21049e-11 -1.0152e-07 90 | 0.9 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 4.95853e-20 -1.5198e-09 1.43529e-09 -1.0152e-07 1.43529e-09 -1.0304e-07 -2.49078e-11 -1.0304e-07 -2.49077e-11 -1.0152e-07 91 | 0.91 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 -1.71282e-20 -1.5198e-09 1.5323e-09 -1.0152e-07 1.5323e-09 -1.0304e-07 7.2105e-11 -1.0304e-07 7.21049e-11 -1.0152e-07 92 | 0.92 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 4.95854e-20 -1.5198e-09 1.43529e-09 -1.0152e-07 1.43529e-09 -1.0304e-07 -2.49078e-11 -1.0304e-07 -2.49078e-11 -1.0152e-07 93 | 0.93 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 -1.71281e-20 -1.5198e-09 1.5323e-09 -1.0152e-07 1.5323e-09 -1.0304e-07 7.21049e-11 -1.0304e-07 7.21048e-11 -1.0152e-07 94 | 0.94 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 4.95856e-20 -1.5198e-09 1.43529e-09 -1.0152e-07 1.43529e-09 -1.0304e-07 -2.49078e-11 -1.0304e-07 -2.49078e-11 -1.0152e-07 95 | 0.95 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 -1.71284e-20 -1.5198e-09 1.5323e-09 -1.0152e-07 1.5323e-09 -1.0304e-07 7.21049e-11 -1.0304e-07 7.21048e-11 -1.0152e-07 96 | 0.96 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 4.95855e-20 -1.5198e-09 1.43529e-09 -1.0152e-07 1.43529e-09 -1.0304e-07 -2.49078e-11 -1.0304e-07 -2.49078e-11 -1.0152e-07 97 | 0.97 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 -1.71288e-20 -1.5198e-09 1.43529e-09 -1.0152e-07 1.43529e-09 -1.0304e-07 -2.49077e-11 -1.0304e-07 -2.49077e-11 -1.0152e-07 98 | 0.98 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 -1.71286e-20 -1.5198e-09 1.43529e-09 -1.0152e-07 1.43529e-09 -1.0304e-07 -2.49078e-11 -1.0304e-07 -2.49078e-11 -1.0152e-07 99 | 0.99 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 -1.71293e-20 -1.5198e-09 1.43529e-09 -1.0152e-07 1.43529e-09 -1.0304e-07 -2.49077e-11 -1.0304e-07 -2.49077e-11 -1.0152e-07 100 | 1 0 0 1.4602e-09 0 1.4602e-09 -1.5198e-09 -1.7129e-20 -1.5198e-09 1.43529e-09 -1.0152e-07 1.43529e-09 -1.0304e-07 -2.49078e-11 -1.0304e-07 -2.49078e-11 -1.0152e-07 101 | -------------------------------------------------------------------------------- /ZeroLengthContactNTS2D/example1/example1.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 2 | # author: zarhin 3 | # date: 2020/8/6 16:01 4 | 5 | import numpy as np 6 | import openseesfunction as ops 7 | import opensees_to_gid as otg 8 | 9 | ops.opsfunc('wipe') 10 | 11 | ops.opsfunc('model', 'basic', '-ndm', 2, '-ndf', 2) 12 | # nDMaterial ElasticIsotropic $matTag $E $v <$rho> 13 | ops.opsfunc('nDMaterial', 'ElasticIsotropic', 1, 1.0e10, 0.49, 6.75) 14 | 15 | # ################################ 16 | # build the model 17 | # ################################# 18 | # y 19 | # | 20 | # 7-------6 21 | # | slave | 22 | # 8-------5 23 | # 4-------3 24 | # | master| 25 | # 1-------2---->x 26 | # 27 | 28 | ops.opsfunc('node', 1, 0.0, 0.0) 29 | ops.opsfunc('node', 2, 1.0, 0.0) 30 | ops.opsfunc('node', 3, 1.0, 1.0) 31 | ops.opsfunc('node', 4, 0.0, 1.0) 32 | ops.opsfunc('node', 5, 1.0, 1.0) 33 | ops.opsfunc('node', 6, 1.0, 2.0) 34 | ops.opsfunc('node', 7, 0.0, 2.0) 35 | ops.opsfunc('node', 8, 0.0, 1.0) 36 | 37 | ops.opsfunc('element', 'quad', 1, 1, 2, 3, 4, 1, 'PlaneStrain', 1) 38 | ops.opsfunc('element', 'quad', 2, 5, 6, 7, 8, 1, 'PlaneStrain', 1) 39 | 40 | 41 | kn = 1e8 42 | kt = 0 43 | phi = 16.0 44 | # element ZeroLengthContactNTS2D eleTag? -sNdNum sNode? -mNdNum mNode? 45 | # -Nodes Nodes? Kn? Kt? phi? 46 | ops.opsfunc('element', 'zeroLengthContactNTS2D', 3, '-sNdNum', 2, '-mNdNum', 47 | 2, '-Nodes', 3, 4, 8, 5, kn, kt, phi) 48 | 49 | mass = {} 50 | node_list = ops.opsfunc('getNodeTags') 51 | for node in node_list: 52 | mass[node] = ops.opsfunc('nodeMass', node, 1, 2) 53 | 54 | print(mass) 55 | 56 | ops.opsfunc('fix', 1, 1, 1) 57 | ops.opsfunc('fix', 2, 0, 1) 58 | 59 | # gravity loads 60 | ops.opsfunc('timeSeries', 'Constant', 1) 61 | ops.opsfunc('pattern', 'Plain', 1, 1, '{') 62 | ops.opsfunc('load', 6, 0.0, -10.0) 63 | ops.opsfunc('load', 7, 0.0, -10.0, '}') 64 | 65 | ops.opsfunc('printGID', 'model.msh') 66 | # -------------------------------------------------------------------- 67 | # Start of static analysis (creation of the analysis & analysis itself) 68 | # -------------------------------------------------------------------- 69 | 70 | ops.opsfunc('recorder', 'Node', '-file', 'disp.txt', '-time', '-nodeRange', 1, 71 | 8, '-dof', 1, 2, 'disp') 72 | 73 | # Load control with variable load steps 74 | # init Jd min max 75 | # integrator LoadControl 0.01 1 1.0 10.0 76 | ops.opsfunc('integrator', 'LoadControl', 0.01) 77 | 78 | # Convergence test 79 | # tolerance maxIter displayCode 80 | ops.opsfunc('test', 'EnergyIncr', 1.0e-6, 100, 5) 81 | 82 | # Solution algorithm 83 | ops.opsfunc('algorithm', 'Newton') 84 | 85 | # DOF numberer 86 | ops.opsfunc('numberer', 'RCM') 87 | 88 | # Cosntraint handler 89 | ops.opsfunc('constraints', 'Plain') 90 | 91 | # System of equations solver 92 | ops.opsfunc('system', 'ProfileSPD') 93 | 94 | # Analysis for gravity load 95 | ops.opsfunc('analysis', 'Static') 96 | 97 | # Perform the analysis 98 | ops.opsfunc('analyze', 100) 99 | nodes = ops.opsfunc('getNodeTags') 100 | ops.opsfunc('printModel', 'ele') 101 | ops.opsfunc('printModel', 'node') 102 | ops.opsfunc('wipe') 103 | # 104 | disp = np.loadtxt('disp.txt') 105 | otg.node_result(nodes, [disp], ['displacement'], 'static analysis', 106 | 'model.res') 107 | -------------------------------------------------------------------------------- /ZeroLengthContactNTS2D/example1/model.msh: -------------------------------------------------------------------------------- 1 | MESH "4NMESH" dimension 3 ElemType Quadrilateral Nnode 4 2 | #color 0 255 0 3 | 4 | Coordinates 5 | 1 0 0 0 6 | 2 1 0 0 7 | 3 1 1 0 8 | 4 0 1 0 9 | 5 1 1 0 10 | 6 1 2 0 11 | 7 0 2 0 12 | 8 0 1 0 13 | End coordinates 14 | 15 | Elements 16 | 1 1 2 3 4 17 | 2 5 6 7 8 18 | 3 3 4 8 5 19 | End elements 20 | -------------------------------------------------------------------------------- /ZeroLengthContactNTS2D/example1/model.tcl: -------------------------------------------------------------------------------- 1 | wipe 2 | model basic -ndm 2 -ndf 2 3 | nDMaterial ElasticIsotropic 1 10000000000.0 0.49 6.75 4 | node 1 0.0 0.0 5 | node 2 1.0 0.0 6 | node 3 1.0 1.0 7 | node 4 0.0 1.0 8 | node 5 1.0 1.0 9 | node 6 1.0 2.0 10 | node 7 0.0 2.0 11 | node 8 0.0 1.0 12 | element quad 1 1 2 3 4 1 PlaneStrain 1 13 | element quad 2 5 6 7 8 1 PlaneStrain 1 14 | element zeroLengthContactNTS2D 3 -sNdNum 2 -mNdNum 2 -Nodes 3 4 8 5 100000000.0 0 16.0 15 | getNodeTags 16 | nodeMass 1 1 2 17 | nodeMass 2 1 2 18 | nodeMass 3 1 2 19 | nodeMass 4 1 2 20 | nodeMass 5 1 2 21 | nodeMass 6 1 2 22 | nodeMass 7 1 2 23 | nodeMass 8 1 2 24 | fix 1 1 1 25 | fix 2 0 1 26 | timeSeries Constant 1 27 | pattern Plain 1 1 { 28 | load 6 0.0 -10.0 29 | load 7 0.0 -10.0 } 30 | printGID model.msh 31 | recorder Node -file disp.txt -time -nodeRange 1 8 -dof 1 2 disp 32 | integrator LoadControl 0.01 33 | test EnergyIncr 1e-06 100 5 34 | algorithm Newton 35 | numberer RCM 36 | constraints Plain 37 | system ProfileSPD 38 | analysis Static 39 | analyze 100 40 | getNodeTags 41 | printModel ele 42 | printModel node 43 | wipe 44 | -------------------------------------------------------------------------------- /ZeroLengthContactNTS2D/example2/example2.msh: -------------------------------------------------------------------------------- 1 | MESH "4NMESH" dimension 3 ElemType Quadrilateral Nnode 4 2 | #color 0 255 0 3 | 4 | Coordinates 5 | 1 0 0 0 6 | 2 1 0 0 7 | 3 2 0 0 8 | 4 3 0 0 9 | 5 4 0 0 10 | 6 5 0 0 11 | 7 6 0 0 12 | 8 7 0 0 13 | 9 8 0 0 14 | 10 9 0 0 15 | 11 10 0 0 16 | 12 0 1 0 17 | 13 1 1 0 18 | 14 2 1 0 19 | 15 3 1 0 20 | 16 4 1 0 21 | 17 5 1 0 22 | 18 6 1 0 23 | 19 7 1 0 24 | 20 8 1 0 25 | 21 9 1 0 26 | 22 10 1 0 27 | 23 0 1 0 28 | 24 1 1 0 29 | 25 2 1 0 30 | 26 3 1 0 31 | 27 4 1 0 32 | 28 5 1 0 33 | 29 6 1 0 34 | 30 7 1 0 35 | 31 8 1 0 36 | 32 9 1 0 37 | 33 10 1 0 38 | 34 0 2 0 39 | 35 1 2 0 40 | 36 2 2 0 41 | 37 3 2 0 42 | 38 4 2 0 43 | 39 5 2 0 44 | 40 6 2 0 45 | 41 7 2 0 46 | 42 8 2 0 47 | 43 9 2 0 48 | 44 10 2 0 49 | End coordinates 50 | 51 | Elements 52 | 1 1 2 13 12 53 | 2 2 3 14 13 54 | 3 3 4 15 14 55 | 4 4 5 16 15 56 | 5 5 6 17 16 57 | 6 6 7 18 17 58 | 7 7 8 19 18 59 | 8 8 9 20 19 60 | 9 9 10 21 20 61 | 10 10 11 22 21 62 | 11 23 24 35 34 63 | 12 24 25 36 35 64 | 13 25 26 37 36 65 | 14 26 27 38 37 66 | 15 27 28 39 38 67 | 16 28 29 40 39 68 | 17 29 30 41 40 69 | 18 30 31 42 41 70 | 19 31 32 43 42 71 | 20 32 33 44 43 72 | End elements 73 | -------------------------------------------------------------------------------- /ZeroLengthContactNTS2D/example2/example2.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 2 | # author: zarhin 3 | # date: 2020/8/6 16:04 4 | 5 | import numpy as np 6 | import part 7 | import openseesfunction as ops 8 | import opensees_to_gid as otg 9 | 10 | p0 = part.Point([0.0, 0.0]) 11 | p1 = part.Point([10.0, 1.0]) 12 | p2 = part.Point([0.0, 1.0]) 13 | p3 = part.Point([10.0, 2.0]) 14 | 15 | # part 1 16 | part.Node.reset() 17 | part.Element.reset() 18 | rec1 = part.Rectangle([p0, p1]) 19 | rec1.set_seed(1.0) 20 | rec1_nodes, rec1_element = rec1.mesh() 21 | 22 | # part 2 23 | rec2 = part.Rectangle([p2, p3]) 24 | rec2.set_seed(1.0) 25 | rec2_nodes, rec2_element = rec2.mesh() 26 | 27 | # opensees model 28 | ops.opsfunc('wipe') 29 | ops.opsfunc('model', 'basic', '-ndm', 2, '-ndf', 2) 30 | 31 | # opensees nodes 32 | nodes = rec1_nodes + rec2_nodes 33 | for node in nodes: 34 | ops.Node(node.coord, tag=node.tag) 35 | 36 | # boundary 37 | boundary_nodes = part.Node.search([0.0, 0.0], [10.0, 0.0]) 38 | for node in boundary_nodes: 39 | ops.opsfunc('fix', node.tag, 1, 1) 40 | # ops.opsfunc('fix', 34, 1, 1) 41 | # material 42 | # Material "Material01": matTag E v rho 43 | mat1 = ops.Material('ElasticIsotropic') 44 | mat1.nDMaterial(1.0e5, .25, 6.75) 45 | 46 | # elements 47 | elements = rec1_element + rec2_element 48 | for element in elements: 49 | node_tags = [node.tag for node in element.nodes] 50 | ele = ops.Element(node_tags, 'quad', tag=element.tag) 51 | ele.element(1, 'PlaneStrain', mat1.tag) 52 | 53 | # contact nodes 54 | slave_nodes = part.Node.search([0.0, 1.0], [10.0, 1.0], rec1_nodes) 55 | master_nodes = part.Node.search([0.0, 1.0], [10.0, 1.0], rec2_nodes) 56 | contact_nodes = ([node.tag for node in slave_nodes[-1::-1]] 57 | + [node.tag for node in master_nodes]) 58 | ele = part.Element(id0='contact_element') 59 | ops.opsfunc('element', 'zeroLengthContactNTS2D', ele.tag, 60 | '-sNdNum', len(slave_nodes), '-mNdNum', len(master_nodes), 61 | '-Nodes', *contact_nodes, 1.0e10, 1.0e10, 0 62 | ) 63 | 64 | # load pattern 65 | ops.opsfunc('timeSeries', 'Constant', 1) 66 | ops.opsfunc('pattern', 'Plain', 1, 1, '{') 67 | load_node = part.Node.search([10.0, 2.0]) 68 | load_node = load_node[0] 69 | # ops.opsfunc('load', load_node.tag, 0.0, -1000, '}') 70 | ops.opsfunc('load', 39, 0.0, -1000, '}') 71 | 72 | # recorder 73 | ops.opsfunc('printGID', 'example2.msh') 74 | node_list = ops.opsfunc('getNodeTags') 75 | ops.opsfunc('recorder', 'Node', '-file', 'node_load.txt', '-time', '-node', 44, 76 | '-dof', 1, 2, 'disp') 77 | ops.opsfunc('recorder', 'Node', '-file', 'disp.txt', '-node', 78 | *node_list, '-dof', 1, 2, 'disp') 79 | 80 | # analysis option 81 | # ops.opsfunc('integrator', 'DisplacementControl', load_node.tag, 2, -1.0e-3) 82 | ops.opsfunc('integrator', 'LoadControl', 0.01) 83 | ops.opsfunc('test', 'EnergyIncr', 1.0e-6, 100, 5) 84 | ops.opsfunc('algorithm', 'Newton') 85 | ops.opsfunc('numberer', 'RCM') 86 | ops.opsfunc('constraints', 'Transformation') 87 | ops.opsfunc('system', 'ProfileSPD') 88 | ops.opsfunc('analysis', 'Static') 89 | ops.opsfunc('analyze', 100) 90 | 91 | ops.opsfunc('printModel', 'node', load_node.tag, 34) 92 | ops.opsfunc('wipe') 93 | # ops.opsfunc() 94 | 95 | disp = np.loadtxt('disp.txt') 96 | otg.node_result(node_list, [disp], ['Displacement'], 'Static Analysis', 97 | time_column=False, file_name='example2.res') 98 | -------------------------------------------------------------------------------- /ZeroLengthContactNTS2D/example2/model.tcl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zarhin/OpenSeesPyExamples/8fe924e767e0cc027f66aef0153bf3b51300af17/ZeroLengthContactNTS2D/example2/model.tcl -------------------------------------------------------------------------------- /ZeroLengthContactNTS2D/example2/node_load.txt: -------------------------------------------------------------------------------- 1 | 0.01 0.000162739 -3.51595e-05 2 | 0.02 -0.00227611 0.0292692 3 | 0.03 -0.00227613 0.0292695 4 | 0.04 -0.00227613 0.0292695 5 | 0.05 -0.00227613 0.0292695 6 | 0.06 -0.00227613 0.0292695 7 | 0.07 -0.00227613 0.0292695 8 | 0.08 -0.00227613 0.0292695 9 | 0.09 -0.00227613 0.0292695 10 | 0.1 -0.00227613 0.0292695 11 | 0.11 -0.00227613 0.0292695 12 | 0.12 -0.00227613 0.0292695 13 | 0.13 -0.00227613 0.0292695 14 | 0.14 -0.00227613 0.0292695 15 | 0.15 -0.00227613 0.0292695 16 | 0.16 -0.00227613 0.0292695 17 | 0.17 -0.00227613 0.0292695 18 | 0.18 -0.00227613 0.0292695 19 | 0.19 -0.00227613 0.0292695 20 | 0.2 -0.00227613 0.0292695 21 | 0.21 -0.00227613 0.0292695 22 | 0.22 -0.00227613 0.0292695 23 | 0.23 -0.00227613 0.0292695 24 | 0.24 -0.00227613 0.0292695 25 | 0.25 -0.00227613 0.0292695 26 | 0.26 -0.00227613 0.0292695 27 | 0.27 -0.00227613 0.0292695 28 | 0.28 -0.00227613 0.0292695 29 | 0.29 -0.00227613 0.0292695 30 | 0.3 -0.00227613 0.0292695 31 | 0.31 -0.00227613 0.0292695 32 | 0.32 -0.00227613 0.0292695 33 | 0.33 -0.00227613 0.0292695 34 | 0.34 -0.00227613 0.0292695 35 | 0.35 -0.00227613 0.0292695 36 | 0.36 -0.00227613 0.0292695 37 | 0.37 -0.00227613 0.0292695 38 | 0.38 -0.00227613 0.0292695 39 | 0.39 -0.00227613 0.0292695 40 | 0.4 -0.00227613 0.0292695 41 | 0.41 -0.00227613 0.0292695 42 | 0.42 -0.00227613 0.0292695 43 | 0.43 -0.00227613 0.0292695 44 | 0.44 -0.00227613 0.0292695 45 | 0.45 -0.00227613 0.0292695 46 | 0.46 -0.00227613 0.0292695 47 | 0.47 -0.00227613 0.0292695 48 | 0.48 -0.00227613 0.0292695 49 | 0.49 -0.00227613 0.0292695 50 | 0.5 -0.00227613 0.0292695 51 | 0.51 -0.00227613 0.0292695 52 | 0.52 -0.00227613 0.0292695 53 | 0.53 -0.00227613 0.0292695 54 | 0.54 -0.00227613 0.0292695 55 | 0.55 -0.00227613 0.0292695 56 | 0.56 -0.00227613 0.0292695 57 | 0.57 -0.00227613 0.0292695 58 | 0.58 -0.00227613 0.0292695 59 | 0.59 -0.00227613 0.0292695 60 | 0.6 -0.00227613 0.0292695 61 | 0.61 -0.00227613 0.0292695 62 | 0.62 -0.00227613 0.0292695 63 | 0.63 -0.00227613 0.0292695 64 | 0.64 -0.00227613 0.0292695 65 | 0.65 -0.00227613 0.0292695 66 | 0.66 -0.00227613 0.0292695 67 | 0.67 -0.00227613 0.0292695 68 | 0.68 -0.00227613 0.0292695 69 | 0.69 -0.00227613 0.0292695 70 | 0.7 -0.00227613 0.0292695 71 | 0.71 -0.00227613 0.0292695 72 | 0.72 -0.00227613 0.0292695 73 | 0.73 -0.00227613 0.0292695 74 | 0.74 -0.00227613 0.0292695 75 | 0.75 -0.00227613 0.0292695 76 | 0.76 -0.00227613 0.0292695 77 | 0.77 -0.00227613 0.0292695 78 | 0.78 -0.00227613 0.0292695 79 | 0.79 -0.00227613 0.0292695 80 | 0.8 -0.00227613 0.0292695 81 | 0.81 -0.00227613 0.0292695 82 | 0.82 -0.00227613 0.0292695 83 | 0.83 -0.00227613 0.0292695 84 | 0.84 -0.00227613 0.0292695 85 | 0.85 -0.00227613 0.0292695 86 | 0.86 -0.00227613 0.0292695 87 | 0.87 -0.00227613 0.0292695 88 | 0.88 -0.00227613 0.0292695 89 | 0.89 -0.00227613 0.0292695 90 | 0.9 -0.00227613 0.0292695 91 | 0.91 -0.00227613 0.0292695 92 | 0.92 -0.00227613 0.0292695 93 | 0.93 -0.00227613 0.0292695 94 | 0.94 -0.00227613 0.0292695 95 | 0.95 -0.00227613 0.0292695 96 | 0.96 -0.00227613 0.0292695 97 | 0.97 -0.00227613 0.0292695 98 | 0.98 -0.00227613 0.0292695 99 | 0.99 -0.00227613 0.0292695 100 | 1 -0.00227613 0.0292695 101 | -------------------------------------------------------------------------------- /ZeroLengthContactNTS2D/example3/example3.msh: -------------------------------------------------------------------------------- 1 | MESH "4NMESH" dimension 3 ElemType Quadrilateral Nnode 4 2 | #color 0 255 0 3 | 4 | Coordinates 5 | 1 -10 -10 0 6 | 2 -8.96109 -10 0 7 | 3 -7.94301 -10 0 8 | 4 -6.94535 -10 0 9 | 5 -5.96769 -10 0 10 | 6 -5.00964 -10 0 11 | 7 -4.07081 -10 0 12 | 8 -3.1508 -10 0 13 | 9 -2.24924 -10 0 14 | 10 -1.36576 -10 0 15 | 11 -0.5 -10 0 16 | 12 -10 -9 0 17 | 13 -8.96109 -9 0 18 | 14 -7.94301 -9 0 19 | 15 -6.94535 -9 0 20 | 16 -5.96769 -9 0 21 | 17 -5.00964 -9 0 22 | 18 -4.07081 -9 0 23 | 19 -3.1508 -9 0 24 | 20 -2.24924 -9 0 25 | 21 -1.36576 -9 0 26 | 22 -0.5 -9 0 27 | 23 -10 -8 0 28 | 24 -8.96109 -8 0 29 | 25 -7.94301 -8 0 30 | 26 -6.94535 -8 0 31 | 27 -5.96769 -8 0 32 | 28 -5.00964 -8 0 33 | 29 -4.07081 -8 0 34 | 30 -3.1508 -8 0 35 | 31 -2.24924 -8 0 36 | 32 -1.36576 -8 0 37 | 33 -0.5 -8 0 38 | 34 -10 -7 0 39 | 35 -8.96109 -7 0 40 | 36 -7.94301 -7 0 41 | 37 -6.94535 -7 0 42 | 38 -5.96769 -7 0 43 | 39 -5.00964 -7 0 44 | 40 -4.07081 -7 0 45 | 41 -3.1508 -7 0 46 | 42 -2.24924 -7 0 47 | 43 -1.36576 -7 0 48 | 44 -0.5 -7 0 49 | 45 -10 -6 0 50 | 46 -8.96109 -6 0 51 | 47 -7.94301 -6 0 52 | 48 -6.94535 -6 0 53 | 49 -5.96769 -6 0 54 | 50 -5.00964 -6 0 55 | 51 -4.07081 -6 0 56 | 52 -3.1508 -6 0 57 | 53 -2.24924 -6 0 58 | 54 -1.36576 -6 0 59 | 55 -0.5 -6 0 60 | 56 -10 -5 0 61 | 57 -8.96109 -5 0 62 | 58 -7.94301 -5 0 63 | 59 -6.94535 -5 0 64 | 60 -5.96769 -5 0 65 | 61 -5.00964 -5 0 66 | 62 -4.07081 -5 0 67 | 63 -3.1508 -5 0 68 | 64 -2.24924 -5 0 69 | 65 -1.36576 -5 0 70 | 66 -0.5 -5 0 71 | 67 -10 -4 0 72 | 68 -8.96109 -4 0 73 | 69 -7.94301 -4 0 74 | 70 -6.94535 -4 0 75 | 71 -5.96769 -4 0 76 | 72 -5.00964 -4 0 77 | 73 -4.07081 -4 0 78 | 74 -3.1508 -4 0 79 | 75 -2.24924 -4 0 80 | 76 -1.36576 -4 0 81 | 77 -0.5 -4 0 82 | 78 -10 -3 0 83 | 79 -8.96109 -3 0 84 | 80 -7.94301 -3 0 85 | 81 -6.94535 -3 0 86 | 82 -5.96769 -3 0 87 | 83 -5.00964 -3 0 88 | 84 -4.07081 -3 0 89 | 85 -3.1508 -3 0 90 | 86 -2.24924 -3 0 91 | 87 -1.36576 -3 0 92 | 88 -0.5 -3 0 93 | 89 -10 -2 0 94 | 90 -8.96109 -2 0 95 | 91 -7.94301 -2 0 96 | 92 -6.94535 -2 0 97 | 93 -5.96769 -2 0 98 | 94 -5.00964 -2 0 99 | 95 -4.07081 -2 0 100 | 96 -3.1508 -2 0 101 | 97 -2.24924 -2 0 102 | 98 -1.36576 -2 0 103 | 99 -0.5 -2 0 104 | 100 -10 -1 0 105 | 101 -8.96109 -1 0 106 | 102 -7.94301 -1 0 107 | 103 -6.94535 -1 0 108 | 104 -5.96769 -1 0 109 | 105 -5.00964 -1 0 110 | 106 -4.07081 -1 0 111 | 107 -3.1508 -1 0 112 | 108 -2.24924 -1 0 113 | 109 -1.36576 -1 0 114 | 110 -0.5 -1 0 115 | 111 -10 0 0 116 | 112 -8.96109 0 0 117 | 113 -7.94301 0 0 118 | 114 -6.94535 0 0 119 | 115 -5.96769 0 0 120 | 116 -5.00964 0 0 121 | 117 -4.07081 0 0 122 | 118 -3.1508 0 0 123 | 119 -2.24924 0 0 124 | 120 -1.36576 0 0 125 | 121 -0.5 0 0 126 | 122 -0.5 -10 0 127 | 123 -0.166667 -10 0 128 | 124 0.166667 -10 0 129 | 125 0.5 -10 0 130 | 126 -0.5 -9.5 0 131 | 127 -0.166667 -9.5 0 132 | 128 0.166667 -9.5 0 133 | 129 0.5 -9.5 0 134 | 130 -0.5 -9 0 135 | 131 -0.166667 -9 0 136 | 132 0.166667 -9 0 137 | 133 0.5 -9 0 138 | 134 -0.5 -8.5 0 139 | 135 -0.166667 -8.5 0 140 | 136 0.166667 -8.5 0 141 | 137 0.5 -8.5 0 142 | 138 -0.5 -8 0 143 | 139 -0.166667 -8 0 144 | 140 0.166667 -8 0 145 | 141 0.5 -8 0 146 | 142 -0.5 -7.5 0 147 | 143 -0.166667 -7.5 0 148 | 144 0.166667 -7.5 0 149 | 145 0.5 -7.5 0 150 | 146 -0.5 -7 0 151 | 147 -0.166667 -7 0 152 | 148 0.166667 -7 0 153 | 149 0.5 -7 0 154 | 150 -0.5 -6.5 0 155 | 151 -0.166667 -6.5 0 156 | 152 0.166667 -6.5 0 157 | 153 0.5 -6.5 0 158 | 154 -0.5 -6 0 159 | 155 -0.166667 -6 0 160 | 156 0.166667 -6 0 161 | 157 0.5 -6 0 162 | 158 -0.5 -5.5 0 163 | 159 -0.166667 -5.5 0 164 | 160 0.166667 -5.5 0 165 | 161 0.5 -5.5 0 166 | 162 -0.5 -5 0 167 | 163 -0.166667 -5 0 168 | 164 0.166667 -5 0 169 | 165 0.5 -5 0 170 | 166 -0.5 -4.5 0 171 | 167 -0.166667 -4.5 0 172 | 168 0.166667 -4.5 0 173 | 169 0.5 -4.5 0 174 | 170 -0.5 -4 0 175 | 171 -0.166667 -4 0 176 | 172 0.166667 -4 0 177 | 173 0.5 -4 0 178 | 174 -0.5 -3.5 0 179 | 175 -0.166667 -3.5 0 180 | 176 0.166667 -3.5 0 181 | 177 0.5 -3.5 0 182 | 178 -0.5 -3 0 183 | 179 -0.166667 -3 0 184 | 180 0.166667 -3 0 185 | 181 0.5 -3 0 186 | 182 -0.5 -2.5 0 187 | 183 -0.166667 -2.5 0 188 | 184 0.166667 -2.5 0 189 | 185 0.5 -2.5 0 190 | 186 -0.5 -2 0 191 | 187 -0.166667 -2 0 192 | 188 0.166667 -2 0 193 | 189 0.5 -2 0 194 | 190 -0.5 -1.5 0 195 | 191 -0.166667 -1.5 0 196 | 192 0.166667 -1.5 0 197 | 193 0.5 -1.5 0 198 | 194 -0.5 -1 0 199 | 195 -0.166667 -1 0 200 | 196 0.166667 -1 0 201 | 197 0.5 -1 0 202 | 198 -0.5 -0.5 0 203 | 199 -0.166667 -0.5 0 204 | 200 0.166667 -0.5 0 205 | 201 0.5 -0.5 0 206 | 202 -0.5 0 0 207 | 203 -0.166667 0 0 208 | 204 0.166667 0 0 209 | 205 0.5 0 0 210 | 206 -0.5 0.5 0 211 | 207 -0.166667 0.5 0 212 | 208 0.166667 0.5 0 213 | 209 0.5 0.5 0 214 | 210 -0.5 1 0 215 | 211 -0.166667 1 0 216 | 212 0.166667 1 0 217 | 213 0.5 1 0 218 | 214 -0.5 1.5 0 219 | 215 -0.166667 1.5 0 220 | 216 0.166667 1.5 0 221 | 217 0.5 1.5 0 222 | 218 -0.5 2 0 223 | 219 -0.166667 2 0 224 | 220 0.166667 2 0 225 | 221 0.5 2 0 226 | 222 -0.5 2.5 0 227 | 223 -0.166667 2.5 0 228 | 224 0.166667 2.5 0 229 | 225 0.5 2.5 0 230 | 226 -0.5 3 0 231 | 227 -0.166667 3 0 232 | 228 0.166667 3 0 233 | 229 0.5 3 0 234 | 230 0.5 -10 0 235 | 231 1.36576 -10 0 236 | 232 2.24924 -10 0 237 | 233 3.1508 -10 0 238 | 234 4.07081 -10 0 239 | 235 5.00964 -10 0 240 | 236 5.96769 -10 0 241 | 237 6.94535 -10 0 242 | 238 7.94301 -10 0 243 | 239 8.96109 -10 0 244 | 240 10 -10 0 245 | 241 0.5 -9 0 246 | 242 1.36576 -9 0 247 | 243 2.24924 -9 0 248 | 244 3.1508 -9 0 249 | 245 4.07081 -9 0 250 | 246 5.00964 -9 0 251 | 247 5.96769 -9 0 252 | 248 6.94535 -9 0 253 | 249 7.94301 -9 0 254 | 250 8.96109 -9 0 255 | 251 10 -9 0 256 | 252 0.5 -8 0 257 | 253 1.36576 -8 0 258 | 254 2.24924 -8 0 259 | 255 3.1508 -8 0 260 | 256 4.07081 -8 0 261 | 257 5.00964 -8 0 262 | 258 5.96769 -8 0 263 | 259 6.94535 -8 0 264 | 260 7.94301 -8 0 265 | 261 8.96109 -8 0 266 | 262 10 -8 0 267 | 263 0.5 -7 0 268 | 264 1.36576 -7 0 269 | 265 2.24924 -7 0 270 | 266 3.1508 -7 0 271 | 267 4.07081 -7 0 272 | 268 5.00964 -7 0 273 | 269 5.96769 -7 0 274 | 270 6.94535 -7 0 275 | 271 7.94301 -7 0 276 | 272 8.96109 -7 0 277 | 273 10 -7 0 278 | 274 0.5 -6 0 279 | 275 1.36576 -6 0 280 | 276 2.24924 -6 0 281 | 277 3.1508 -6 0 282 | 278 4.07081 -6 0 283 | 279 5.00964 -6 0 284 | 280 5.96769 -6 0 285 | 281 6.94535 -6 0 286 | 282 7.94301 -6 0 287 | 283 8.96109 -6 0 288 | 284 10 -6 0 289 | 285 0.5 -5 0 290 | 286 1.36576 -5 0 291 | 287 2.24924 -5 0 292 | 288 3.1508 -5 0 293 | 289 4.07081 -5 0 294 | 290 5.00964 -5 0 295 | 291 5.96769 -5 0 296 | 292 6.94535 -5 0 297 | 293 7.94301 -5 0 298 | 294 8.96109 -5 0 299 | 295 10 -5 0 300 | 296 0.5 -4 0 301 | 297 1.36576 -4 0 302 | 298 2.24924 -4 0 303 | 299 3.1508 -4 0 304 | 300 4.07081 -4 0 305 | 301 5.00964 -4 0 306 | 302 5.96769 -4 0 307 | 303 6.94535 -4 0 308 | 304 7.94301 -4 0 309 | 305 8.96109 -4 0 310 | 306 10 -4 0 311 | 307 0.5 -3 0 312 | 308 1.36576 -3 0 313 | 309 2.24924 -3 0 314 | 310 3.1508 -3 0 315 | 311 4.07081 -3 0 316 | 312 5.00964 -3 0 317 | 313 5.96769 -3 0 318 | 314 6.94535 -3 0 319 | 315 7.94301 -3 0 320 | 316 8.96109 -3 0 321 | 317 10 -3 0 322 | 318 0.5 -2 0 323 | 319 1.36576 -2 0 324 | 320 2.24924 -2 0 325 | 321 3.1508 -2 0 326 | 322 4.07081 -2 0 327 | 323 5.00964 -2 0 328 | 324 5.96769 -2 0 329 | 325 6.94535 -2 0 330 | 326 7.94301 -2 0 331 | 327 8.96109 -2 0 332 | 328 10 -2 0 333 | 329 0.5 -1 0 334 | 330 1.36576 -1 0 335 | 331 2.24924 -1 0 336 | 332 3.1508 -1 0 337 | 333 4.07081 -1 0 338 | 334 5.00964 -1 0 339 | 335 5.96769 -1 0 340 | 336 6.94535 -1 0 341 | 337 7.94301 -1 0 342 | 338 8.96109 -1 0 343 | 339 10 -1 0 344 | 340 0.5 0 0 345 | 341 1.36576 0 0 346 | 342 2.24924 0 0 347 | 343 3.1508 0 0 348 | 344 4.07081 0 0 349 | 345 5.00964 0 0 350 | 346 5.96769 0 0 351 | 347 6.94535 0 0 352 | 348 7.94301 0 0 353 | 349 8.96109 0 0 354 | 350 10 0 0 355 | End coordinates 356 | 357 | Elements 358 | 1 1 2 13 12 359 | 2 2 3 14 13 360 | 3 3 4 15 14 361 | 4 4 5 16 15 362 | 5 5 6 17 16 363 | 6 6 7 18 17 364 | 7 7 8 19 18 365 | 8 8 9 20 19 366 | 9 9 10 21 20 367 | 10 10 11 22 21 368 | 11 12 13 24 23 369 | 12 13 14 25 24 370 | 13 14 15 26 25 371 | 14 15 16 27 26 372 | 15 16 17 28 27 373 | 16 17 18 29 28 374 | 17 18 19 30 29 375 | 18 19 20 31 30 376 | 19 20 21 32 31 377 | 20 21 22 33 32 378 | 21 23 24 35 34 379 | 22 24 25 36 35 380 | 23 25 26 37 36 381 | 24 26 27 38 37 382 | 25 27 28 39 38 383 | 26 28 29 40 39 384 | 27 29 30 41 40 385 | 28 30 31 42 41 386 | 29 31 32 43 42 387 | 30 32 33 44 43 388 | 31 34 35 46 45 389 | 32 35 36 47 46 390 | 33 36 37 48 47 391 | 34 37 38 49 48 392 | 35 38 39 50 49 393 | 36 39 40 51 50 394 | 37 40 41 52 51 395 | 38 41 42 53 52 396 | 39 42 43 54 53 397 | 40 43 44 55 54 398 | 41 45 46 57 56 399 | 42 46 47 58 57 400 | 43 47 48 59 58 401 | 44 48 49 60 59 402 | 45 49 50 61 60 403 | 46 50 51 62 61 404 | 47 51 52 63 62 405 | 48 52 53 64 63 406 | 49 53 54 65 64 407 | 50 54 55 66 65 408 | 51 56 57 68 67 409 | 52 57 58 69 68 410 | 53 58 59 70 69 411 | 54 59 60 71 70 412 | 55 60 61 72 71 413 | 56 61 62 73 72 414 | 57 62 63 74 73 415 | 58 63 64 75 74 416 | 59 64 65 76 75 417 | 60 65 66 77 76 418 | 61 67 68 79 78 419 | 62 68 69 80 79 420 | 63 69 70 81 80 421 | 64 70 71 82 81 422 | 65 71 72 83 82 423 | 66 72 73 84 83 424 | 67 73 74 85 84 425 | 68 74 75 86 85 426 | 69 75 76 87 86 427 | 70 76 77 88 87 428 | 71 78 79 90 89 429 | 72 79 80 91 90 430 | 73 80 81 92 91 431 | 74 81 82 93 92 432 | 75 82 83 94 93 433 | 76 83 84 95 94 434 | 77 84 85 96 95 435 | 78 85 86 97 96 436 | 79 86 87 98 97 437 | 80 87 88 99 98 438 | 81 89 90 101 100 439 | 82 90 91 102 101 440 | 83 91 92 103 102 441 | 84 92 93 104 103 442 | 85 93 94 105 104 443 | 86 94 95 106 105 444 | 87 95 96 107 106 445 | 88 96 97 108 107 446 | 89 97 98 109 108 447 | 90 98 99 110 109 448 | 91 100 101 112 111 449 | 92 101 102 113 112 450 | 93 102 103 114 113 451 | 94 103 104 115 114 452 | 95 104 105 116 115 453 | 96 105 106 117 116 454 | 97 106 107 118 117 455 | 98 107 108 119 118 456 | 99 108 109 120 119 457 | 100 109 110 121 120 458 | 101 122 123 127 126 459 | 102 123 124 128 127 460 | 103 124 125 129 128 461 | 104 126 127 131 130 462 | 105 127 128 132 131 463 | 106 128 129 133 132 464 | 107 130 131 135 134 465 | 108 131 132 136 135 466 | 109 132 133 137 136 467 | 110 134 135 139 138 468 | 111 135 136 140 139 469 | 112 136 137 141 140 470 | 113 138 139 143 142 471 | 114 139 140 144 143 472 | 115 140 141 145 144 473 | 116 142 143 147 146 474 | 117 143 144 148 147 475 | 118 144 145 149 148 476 | 119 146 147 151 150 477 | 120 147 148 152 151 478 | 121 148 149 153 152 479 | 122 150 151 155 154 480 | 123 151 152 156 155 481 | 124 152 153 157 156 482 | 125 154 155 159 158 483 | 126 155 156 160 159 484 | 127 156 157 161 160 485 | 128 158 159 163 162 486 | 129 159 160 164 163 487 | 130 160 161 165 164 488 | 131 162 163 167 166 489 | 132 163 164 168 167 490 | 133 164 165 169 168 491 | 134 166 167 171 170 492 | 135 167 168 172 171 493 | 136 168 169 173 172 494 | 137 170 171 175 174 495 | 138 171 172 176 175 496 | 139 172 173 177 176 497 | 140 174 175 179 178 498 | 141 175 176 180 179 499 | 142 176 177 181 180 500 | 143 178 179 183 182 501 | 144 179 180 184 183 502 | 145 180 181 185 184 503 | 146 182 183 187 186 504 | 147 183 184 188 187 505 | 148 184 185 189 188 506 | 149 186 187 191 190 507 | 150 187 188 192 191 508 | 151 188 189 193 192 509 | 152 190 191 195 194 510 | 153 191 192 196 195 511 | 154 192 193 197 196 512 | 155 194 195 199 198 513 | 156 195 196 200 199 514 | 157 196 197 201 200 515 | 158 198 199 203 202 516 | 159 199 200 204 203 517 | 160 200 201 205 204 518 | 161 202 203 207 206 519 | 162 203 204 208 207 520 | 163 204 205 209 208 521 | 164 206 207 211 210 522 | 165 207 208 212 211 523 | 166 208 209 213 212 524 | 167 210 211 215 214 525 | 168 211 212 216 215 526 | 169 212 213 217 216 527 | 170 214 215 219 218 528 | 171 215 216 220 219 529 | 172 216 217 221 220 530 | 173 218 219 223 222 531 | 174 219 220 224 223 532 | 175 220 221 225 224 533 | 176 222 223 227 226 534 | 177 223 224 228 227 535 | 178 224 225 229 228 536 | 179 230 231 242 241 537 | 180 231 232 243 242 538 | 181 232 233 244 243 539 | 182 233 234 245 244 540 | 183 234 235 246 245 541 | 184 235 236 247 246 542 | 185 236 237 248 247 543 | 186 237 238 249 248 544 | 187 238 239 250 249 545 | 188 239 240 251 250 546 | 189 241 242 253 252 547 | 190 242 243 254 253 548 | 191 243 244 255 254 549 | 192 244 245 256 255 550 | 193 245 246 257 256 551 | 194 246 247 258 257 552 | 195 247 248 259 258 553 | 196 248 249 260 259 554 | 197 249 250 261 260 555 | 198 250 251 262 261 556 | 199 252 253 264 263 557 | 200 253 254 265 264 558 | 201 254 255 266 265 559 | 202 255 256 267 266 560 | 203 256 257 268 267 561 | 204 257 258 269 268 562 | 205 258 259 270 269 563 | 206 259 260 271 270 564 | 207 260 261 272 271 565 | 208 261 262 273 272 566 | 209 263 264 275 274 567 | 210 264 265 276 275 568 | 211 265 266 277 276 569 | 212 266 267 278 277 570 | 213 267 268 279 278 571 | 214 268 269 280 279 572 | 215 269 270 281 280 573 | 216 270 271 282 281 574 | 217 271 272 283 282 575 | 218 272 273 284 283 576 | 219 274 275 286 285 577 | 220 275 276 287 286 578 | 221 276 277 288 287 579 | 222 277 278 289 288 580 | 223 278 279 290 289 581 | 224 279 280 291 290 582 | 225 280 281 292 291 583 | 226 281 282 293 292 584 | 227 282 283 294 293 585 | 228 283 284 295 294 586 | 229 285 286 297 296 587 | 230 286 287 298 297 588 | 231 287 288 299 298 589 | 232 288 289 300 299 590 | 233 289 290 301 300 591 | 234 290 291 302 301 592 | 235 291 292 303 302 593 | 236 292 293 304 303 594 | 237 293 294 305 304 595 | 238 294 295 306 305 596 | 239 296 297 308 307 597 | 240 297 298 309 308 598 | 241 298 299 310 309 599 | 242 299 300 311 310 600 | 243 300 301 312 311 601 | 244 301 302 313 312 602 | 245 302 303 314 313 603 | 246 303 304 315 314 604 | 247 304 305 316 315 605 | 248 305 306 317 316 606 | 249 307 308 319 318 607 | 250 308 309 320 319 608 | 251 309 310 321 320 609 | 252 310 311 322 321 610 | 253 311 312 323 322 611 | 254 312 313 324 323 612 | 255 313 314 325 324 613 | 256 314 315 326 325 614 | 257 315 316 327 326 615 | 258 316 317 328 327 616 | 259 318 319 330 329 617 | 260 319 320 331 330 618 | 261 320 321 332 331 619 | 262 321 322 333 332 620 | 263 322 323 334 333 621 | 264 323 324 335 334 622 | 265 324 325 336 335 623 | 266 325 326 337 336 624 | 267 326 327 338 337 625 | 268 327 328 339 338 626 | 269 329 330 341 340 627 | 270 330 331 342 341 628 | 271 331 332 343 342 629 | 272 332 333 344 343 630 | 273 333 334 345 344 631 | 274 334 335 346 345 632 | 275 335 336 347 346 633 | 276 336 337 348 347 634 | 277 337 338 349 348 635 | 278 338 339 350 349 636 | End elements 637 | -------------------------------------------------------------------------------- /ZeroLengthContactNTS2D/example3/example3.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 2 | # author: zarhin 3 | # email: lizaixianvip@163.com 4 | 5 | import numpy as np 6 | import part 7 | import openseesfunction as ops 8 | import opensees_to_gid as otg 9 | 10 | # points 11 | p0 = part.Point([-10, -10]) 12 | p1 = part.Point([-0.5, 0]) 13 | p2 = part.Point([-0.5, -10]) 14 | p3 = part.Point([0.5, 3.0]) 15 | p4 = part.Point([0.5, -10.0]) 16 | p5 = part.Point([10, 0.0]) 17 | 18 | # rectangle 19 | rec1 = part.Rectangle([p0, p1]) 20 | rec2 = part.Rectangle([p2, p3]) 21 | rec3 = part.Rectangle([p4, p5]) 22 | 23 | # mesh 24 | part.Node.reset() 25 | part.Element.reset() 26 | 27 | rec1.set_seed(1.0) 28 | rec1.set_seed(point_num=11, bias_ratio=1.2, direction='horizontal', 29 | flip_para=True) 30 | rec1.nodes, rec1.elements = rec1.mesh() 31 | 32 | rec2.set_seed(0.5) 33 | rec2.set_seed(point_num=4, direction='horizontal') 34 | rec2.nodes, rec2.elements = rec2.mesh() 35 | 36 | rec3.set_seed(1.0) 37 | rec3.set_seed(point_num=11, bias_ratio=1.2, direction='horizontal') 38 | rec3.nodes, rec3.elements = rec3.mesh() 39 | 40 | # opensees model 41 | ops.opsfunc('wipe') 42 | ops.opsfunc('model', 'basic', '-ndm', 2, '-ndf', 2) 43 | 44 | # node 45 | nodes = rec1.nodes + rec2.nodes + rec3.nodes 46 | for node in nodes: 47 | ops.opsfunc('node', node.tag, *node.coord) 48 | 49 | # material 50 | # nDMaterial('ElasticIsotropic', matTag, E, nu, rho=0.0) 51 | ops.opsfunc('nDMaterial', 'ElasticIsotropic', 1, 2.24e5, 0.4, 0.0) 52 | ops.opsfunc('nDMaterial', 'ElasticIsotropic', 2, 3.25e7, 0.2, 0.0) 53 | 54 | # element 55 | # soil element 56 | elements = rec1.elements + rec3.elements 57 | for element in elements: 58 | nodes = [node.tag for node in element.nodes] 59 | # element('quad', eleTag, *eleNodes, thick, type, matTag, ) 61 | ops.opsfunc('element', 'quad', element.tag, *nodes, 1.0, 'PlaneStrain', 62 | 1, 0.0, 2.0, 0.0, 0.0) 63 | # concrete element 64 | for element in rec2.elements: 65 | nodes = [node.tag for node in element.nodes] 66 | ops.opsfunc('element', 'quad', element.tag, *nodes, 1.0, 'PlaneStrain', 67 | 2, 0.0, 2.5, 0.0, 0.0) 68 | 69 | # contact element 70 | contact_nodes1 = part.Node.search([-0.5, -10.0], [-0.5, 0], rec1.nodes) 71 | contact_nodes2 = part.Node.search([-0.5, -10.0], [-0.5, 0], rec2.nodes) 72 | contact_nodes3 = part.Node.search([0.5, -10.0], [0.5, 0], rec2.nodes) 73 | contact_nodes4 = part.Node.search([0.5, -10.0], [0.5, 0], rec3.nodes) 74 | ele1 = part.Element(contact_nodes1 + contact_nodes2[-1::-1], id0='contact01') 75 | ops.opsfunc('element', 'zeroLengthContactNTS2D', ele1.tag, '-sNdNum', 76 | len(contact_nodes1), '-mNdNum', len(contact_nodes2), '-Nodes', 77 | *[node.tag for node in ele1.nodes], 1.0e10, 1.0e10, 0.0) 78 | ele2 = part.Element(contact_nodes4[-1::-1] + contact_nodes3, id0='contact2') 79 | ops.opsfunc('element', 'zeroLengthContactNTS2D', ele2.tag, '-sNdNum', 80 | len(contact_nodes4), '-mNdNum', len(contact_nodes3), '-Nodes', 81 | *[node.tag for node in ele2.nodes], 1.0e10, 1.0e10, 0.0) 82 | 83 | # boundary 84 | bottom_boundary = part.Node.search([-10, -10], [10, -10]) 85 | for node in bottom_boundary[1:-1:1]: 86 | ops.opsfunc('fix', node.tag, 0, 1) 87 | ops.opsfunc('fix', bottom_boundary[0].tag, 1, 1) 88 | ops.opsfunc('fix', bottom_boundary[-1].tag, 1, 1) 89 | # left side nodes 90 | for node in part.Node.search([-10, -9.8], [-10, 0]): 91 | ops.opsfunc('fix', node.tag, 1, 0) 92 | for node in part.Node.search([10, -9.8], [10, 0]): 93 | ops.opsfunc('fix', node.tag, 1, 0) 94 | 95 | # load pattern 96 | ops.opsfunc('timeSeries', 'Constant', 1) 97 | ops.opsfunc('pattern', 'Plain', 1, 1, '{') 98 | load_node = part.Node.search([-0.48, 3.0], [0.48, 3.0]) 99 | for node in load_node: 100 | ops.opsfunc('load', node.tag, 500, 0.0) 101 | ops.opsfunc('}') 102 | 103 | # print model 104 | ops.opsfunc('printGID', 'example3.msh') 105 | 106 | # recorder 107 | node_list = ops.opsfunc('getNodeTags') 108 | ops.opsfunc('recorder', 'Node', '-file', 'disp.txt', '-node', 109 | *node_list, '-dof', 1, 2, 'disp') 110 | 111 | 112 | # analysis option 113 | # ops.opsfunc('integrator', 'DisplacementControl', load_node[0].tag, 1, -1.0e-3) 114 | ops.opsfunc('integrator', 'LoadControl', 0.01) 115 | ops.opsfunc('test', 'EnergyIncr', 1.0e-6, 100, 5) 116 | ops.opsfunc('algorithm', 'Newton') 117 | ops.opsfunc('numberer', 'RCM') 118 | ops.opsfunc('constraints', 'Transformation') 119 | ops.opsfunc('system', 'ProfileSPD') 120 | ops.opsfunc('analysis', 'Static') 121 | ops.opsfunc('analyze', 100) 122 | 123 | ops.opsfunc('printModel', 'node', *[node.tag for node in load_node]) 124 | ops.opsfunc('wipe') 125 | # ops.opsfunc() 126 | # load node displacement result 127 | disp = np.loadtxt('disp.txt') 128 | otg.node_result(node_list, [disp], ['Displacement'], 'Static Analysis', 129 | time_column=False, file_name='example3.res') 130 | 131 | -------------------------------------------------------------------------------- /ZeroLengthInterface2D/example1/ele.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zarhin/OpenSeesPyExamples/8fe924e767e0cc027f66aef0153bf3b51300af17/ZeroLengthInterface2D/example1/ele.txt -------------------------------------------------------------------------------- /ZeroLengthInterface2D/example1/example1.msh: -------------------------------------------------------------------------------- 1 | MESH "2NMESH" dimension 3 ElemType Linear Nnode 2 2 | #color 0 0 255 3 | 4 | Coordinates 5 | 1 4 0 0 6 | 2 6 0 0 7 | 3 4 1 0 8 | 4 6 1 0 9 | 5 0 0 0 10 | 6 2 0 0 11 | 7 4 0 0 12 | 8 6 0 0 13 | 9 8 0 0 14 | 10 10 0 0 15 | End coordinates 16 | 17 | Elements 18 | 2 5 6 19 | 3 6 7 20 | 4 7 8 21 | 5 8 9 22 | 6 9 10 23 | End elements 24 | MESH "4NMESH" dimension 3 ElemType Quadrilateral Nnode 4 25 | #color 0 255 0 26 | 27 | Coordinates 28 | 1 4 0 0 29 | 2 6 0 0 30 | 3 4 1 0 31 | 4 6 1 0 32 | 5 0 0 0 33 | 6 2 0 0 34 | 7 4 0 0 35 | 8 6 0 0 36 | 9 8 0 0 37 | 10 10 0 0 38 | End coordinates 39 | 40 | Elements 41 | 1 1 2 4 3 42 | End elements 43 | -------------------------------------------------------------------------------- /ZeroLengthInterface2D/example1/example1.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 2 | # author: zarhin 3 | # email: lizaixianvip@163.com 4 | 5 | import numpy as np 6 | import part 7 | import opensees_tools as ops 8 | import opensees_to_gid as otg 9 | 10 | # point 11 | p0 = part.Point([0.0, 0.0]) 12 | p1 = part.Point([10.0, 0.0]) 13 | p2 = part.Point([4.0, 0.0]) 14 | p3 = part.Point([6.0, 1.0]) 15 | 16 | # rectangle 17 | rec = part.Rectangle([p2, p3]) 18 | line = part.Line([p0, p1]) 19 | 20 | # mesh 21 | rec.set_seed(1) 22 | rec.set_seed(2, direction='horizontal') 23 | rec.mesh() 24 | line.set_seed(2) 25 | line.mesh() 26 | 27 | # soil model 28 | ops.opsfunc('wipe') 29 | ops.opsfunc('model', 'basic', '-ndm', 2, '-ndf', 2) 30 | 31 | # soil nodes 32 | for node in rec.nodes: 33 | ops.opsfunc('node', node.tag, *node.coord) 34 | 35 | # soil material 36 | ops.opsfunc('nDMaterial', 'ElasticIsotropic', 1, 1.0e10, 0.49, 6.75) 37 | 38 | # soil element 39 | for element in rec.elements: 40 | nodes = [node.tag for node in element.nodes] 41 | ops.opsfunc('element', 'quad', element.tag, *nodes, 1.0, 'PlaneStrain', 1) 42 | 43 | # load 44 | ops.opsfunc('timeSeries', 'Linear', 1) 45 | ops.opsfunc('pattern', 'Plain', 1, 1) 46 | for node in part.Node.search([4.0, 1.0], [6.0, 1.0]): 47 | ops.opsfunc('load', node.tag, 0.0, -10.0) 48 | 49 | 50 | # pile model 51 | ops.opsfunc('model', 'basic', '-ndm', 2, '-ndf', 3) 52 | 53 | # pile node 54 | for node in line.nodes: 55 | ops.opsfunc('node', node.tag, *node.coord) 56 | 57 | # boundary 58 | ops.opsfunc('fix', line.nodes[0].tag, 1, 1, 0) 59 | ops.opsfunc('fix', line.nodes[-1].tag, 0, 1, 0) 60 | 61 | # pile element 62 | ops.opsfunc('geomTransf', 'Linear', 1) 63 | for element in line.elements: 64 | nodes = [node.tag for node in element.nodes] 65 | ops.opsfunc('element', 'elasticBeamColumn', element.tag, *nodes, 3600, 66 | 4227, 1080000, 1) 67 | 68 | # contact element 69 | soil_node = part.Node.search([4.0, 0.0], [6.0, 0.0], rec.nodes) 70 | pile_node = part.Node.search([0.0, 0.0], [10.0, 0.0], line.nodes) 71 | nodes = soil_node + pile_node[-1::-1] 72 | ele = part.Element(nodes, id0='contact') 73 | ops.opsfunc('element', 'zeroLengthInterface2D', ele.tag, '-sNdNum', 74 | len(soil_node), '-mNdNum', len(pile_node), '-dof', 2, 3, 75 | '-Nodes', *[node.tag for node in ele.nodes], 1e8, 1e8, 16) 76 | # print gid 77 | ops.opsfunc('printGID', 'example1.msh') 78 | 79 | 80 | # recorder 81 | node_list = ops.opsfunc('getNodeTags') 82 | ops.opsfunc('recorder', 'Node', '-file', 'disp.txt', '-node', *node_list, 83 | '-dof', 1, 2, 3, 'disp') 84 | ops.opsfunc('recorder', 'Element', '-file', 'ele.txt', '-ele', 8, 'gap') 85 | 86 | # analysis option 87 | ops.opsfunc('integrator', 'LoadControl', 0.01) 88 | ops.opsfunc('test', 'EnergyIncr', 1.0e6, 100, 5) 89 | ops.opsfunc('algorithm', 'Newton') 90 | ops.opsfunc('numberer', 'RCM') 91 | ops.opsfunc('constraints', 'Plain') 92 | ops.opsfunc('system', 'ProfileSPD') 93 | ops.opsfunc('analysis', 'Static') 94 | ops.opsfunc('analyze', 100) 95 | print(ops.opsfunc('eleResponse', 8, 'force')) 96 | # ops.opsfunc('printModel', 'ele') 97 | # ops.opsfunc('printModel', 'node') 98 | 99 | ops.opsfunc('wipe') 100 | 101 | disp = np.loadtxt('disp.txt') 102 | otg.node_result(node_list, [disp], ['Displacement'], 'Static', False, 103 | 'example1.res') 104 | -------------------------------------------------------------------------------- /ZeroLengthInterface2D/example1/model.tcl: -------------------------------------------------------------------------------- 1 | wipe 2 | model basic -ndm 2 -ndf 2 3 | node 1 4.0 0.0 4 | node 2 6.0 0.0 5 | node 3 4.0 1.0 6 | node 4 6.0 1.0 7 | nDMaterial ElasticIsotropic 1 10000000000.0 0.49 6.75 8 | element quad 1 1 2 4 3 1.0 PlaneStrain 1 9 | timeSeries Linear 1 10 | pattern Plain 1 1 11 | load 3 0.0 -10.0 12 | load 4 0.0 -10.0 13 | model basic -ndm 2 -ndf 3 14 | node 5 0.0 0.0 15 | node 6 2.0 0.0 16 | node 7 4.0 0.0 17 | node 8 6.0 0.0 18 | node 9 8.0 0.0 19 | node 10 10.0 0.0 20 | fix 5 1 1 0 21 | fix 10 0 1 0 22 | geomTransf Linear 1 23 | element elasticBeamColumn 2 5 6 3600 4227 1080000 1 24 | element elasticBeamColumn 3 6 7 3600 4227 1080000 1 25 | element elasticBeamColumn 4 7 8 3600 4227 1080000 1 26 | element elasticBeamColumn 5 8 9 3600 4227 1080000 1 27 | element elasticBeamColumn 6 9 10 3600 4227 1080000 1 28 | element zeroLengthInterface2D 7 -sNdNum 2 -mNdNum 6 -dof 2 3 -Nodes 1 2 10 9 8 7 6 5 100000000.0 100000000.0 16 29 | printGID example1.msh 30 | getNodeTags 31 | recorder Node -file disp.txt -node 1 2 3 4 5 6 7 8 9 10 -dof 1 2 3 disp 32 | recorder Element -file ele.txt -ele 8 gap 33 | integrator LoadControl 0.01 34 | test EnergyIncr 1000000.0 100 5 35 | algorithm Newton 36 | numberer RCM 37 | constraints Plain 38 | system ProfileSPD 39 | analysis Static 40 | analyze 100 41 | eleResponse 8 force 42 | wipe 43 | -------------------------------------------------------------------------------- /ZeroLengthInterface2D/example2/ele.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zarhin/OpenSeesPyExamples/8fe924e767e0cc027f66aef0153bf3b51300af17/ZeroLengthInterface2D/example2/ele.txt -------------------------------------------------------------------------------- /ZeroLengthInterface2D/example2/example2.msh: -------------------------------------------------------------------------------- 1 | MESH "4NMESH" dimension 3 ElemType Quadrilateral Nnode 4 2 | #color 0 255 0 3 | 4 | Coordinates 5 | 1 0 0 0 6 | 2 1 0 0 7 | 3 2 0 0 8 | 4 3 0 0 9 | 5 4 0 0 10 | 6 5 0 0 11 | 7 6 0 0 12 | 8 7 0 0 13 | 9 8 0 0 14 | 10 9 0 0 15 | 11 10 0 0 16 | 12 0 1 0 17 | 13 1 1 0 18 | 14 2 1 0 19 | 15 3 1 0 20 | 16 4 1 0 21 | 17 5 1 0 22 | 18 6 1 0 23 | 19 7 1 0 24 | 20 8 1 0 25 | 21 9 1 0 26 | 22 10 1 0 27 | 23 0 1 0 28 | 24 1 1 0 29 | 25 2 1 0 30 | 26 3 1 0 31 | 27 4 1 0 32 | 28 5 1 0 33 | 29 6 1 0 34 | 30 7 1 0 35 | 31 8 1 0 36 | 32 9 1 0 37 | 33 10 1 0 38 | 34 0 2 0 39 | 35 1 2 0 40 | 36 2 2 0 41 | 37 3 2 0 42 | 38 4 2 0 43 | 39 5 2 0 44 | 40 6 2 0 45 | 41 7 2 0 46 | 42 8 2 0 47 | 43 9 2 0 48 | 44 10 2 0 49 | End coordinates 50 | 51 | Elements 52 | 1 1 2 13 12 53 | 2 2 3 14 13 54 | 3 3 4 15 14 55 | 4 4 5 16 15 56 | 5 5 6 17 16 57 | 6 6 7 18 17 58 | 7 7 8 19 18 59 | 8 8 9 20 19 60 | 9 9 10 21 20 61 | 10 10 11 22 21 62 | 11 23 24 35 34 63 | 12 24 25 36 35 64 | 13 25 26 37 36 65 | 14 26 27 38 37 66 | 15 27 28 39 38 67 | 16 28 29 40 39 68 | 17 29 30 41 40 69 | 18 30 31 42 41 70 | 19 31 32 43 42 71 | 20 32 33 44 43 72 | End elements 73 | -------------------------------------------------------------------------------- /ZeroLengthInterface2D/example2/example2.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 2 | # author: zarhin 3 | # date: 2020/8/6 16:04 4 | 5 | import numpy as np 6 | import part 7 | import opensees_tools as ops 8 | import opensees_to_gid as otg 9 | 10 | p0 = part.Point([0.0, 0.0]) 11 | p1 = part.Point([10.0, 1.0]) 12 | p2 = part.Point([0.0, 1.0]) 13 | p3 = part.Point([10.0, 2.0]) 14 | 15 | # part 1 16 | part.Node.reset() 17 | part.Element.reset() 18 | rec1 = part.Rectangle([p0, p1]) 19 | rec1.set_seed(1.0) 20 | rec1.mesh() 21 | 22 | # part 2 23 | rec2 = part.Rectangle([p2, p3]) 24 | rec2.set_seed(1.0) 25 | rec2.mesh() 26 | 27 | # opensees model 28 | ops.opsfunc('wipe') 29 | ops.opsfunc('model', 'basic', '-ndm', 2, '-ndf', 2) 30 | 31 | # opensees nodes 32 | nodes = rec1.nodes + rec2.nodes 33 | for node in nodes: 34 | ops.opsfunc('node', node.tag, *node.coord) 35 | 36 | # boundary 37 | for node in part.Node.search([0.0, 0.0], [0.0, 2.0]): 38 | ops.opsfunc('fix', node.tag, 1, 1) 39 | 40 | # material 41 | # Material "Material01": matTag E v rho 42 | ops.opsfunc('nDMaterial', 'ElasticIsotropic', 1, 1e5, 0.25, 6.75) 43 | 44 | # elements 45 | elements = rec1.elements + rec2.elements 46 | for element in elements: 47 | nodes = [node.tag for node in element.nodes] 48 | ops.opsfunc('element', 'quad', element.tag, *nodes, 1.0, 'PlaneStrain', 1) 49 | 50 | # contact nodes 51 | slave_nodes = part.Node.search([0.0, 1.0], [10.0, 1.0], rec1.nodes) 52 | master_nodes = part.Node.search([0.0, 1.0], [10.0, 1.0], rec2.nodes) 53 | contact_nodes = slave_nodes[-1::-1] + master_nodes 54 | ele = part.Element(contact_nodes, id0='contact') 55 | ops.opsfunc('element', 'zeroLengthInterface2D', ele.tag, '-sNdNum', 56 | len(slave_nodes), '-mNdNum', len(master_nodes), '-dof', 2, 2, 57 | '-Nodes', *[node.tag for node in ele.nodes], 1e8, 1e8, 16) 58 | 59 | # load pattern 60 | ops.opsfunc('timeSeries', 'Constant', 1) 61 | ops.opsfunc('pattern', 'Plain', 1, 1, '{') 62 | load_node = part.Node.search([10.0, 2.0]) 63 | ops.opsfunc('load', load_node.tag, 0.0, -0.1, '}') 64 | 65 | # recorder 66 | ops.opsfunc('printGID', 'example2.msh') 67 | node_list = ops.opsfunc('getNodeTags') 68 | ops.opsfunc('recorder', 'Node', '-file', 'disp.txt', '-node', *node_list, 69 | '-dof', 1, 2, 'disp') 70 | ops.opsfunc('recorder', 'Element', '-file', 'ele.txt', '-ele', 21, 'material', 1, 'pressure') 71 | 72 | print(ops.opsfunc('eleResponse', 21, 'pressure')) 73 | # analysis option 74 | ops.opsfunc('integrator', 'DisplacementControl', load_node.tag, 2, -1.0e-5) 75 | ops.opsfunc('test', 'EnergyIncr', 1.0e-6, 100, 5) 76 | ops.opsfunc('algorithm', 'Newton') 77 | ops.opsfunc('numberer', 'RCM') 78 | ops.opsfunc('constraints', 'Transformation') 79 | # ops.opsfunc('system', 'ProfileSPD') 80 | ops.opsfunc('system', 'UmfPack') 81 | ops.opsfunc('analysis', 'Static') 82 | ops.opsfunc('analyze', 500) 83 | print(ops.opsfunc('eleResponse', 21, 'material', 1, 'pressure')) 84 | # ops.opsfunc('printModel', 'ele') 85 | ops.opsfunc('wipe') 86 | # ops.opsfunc() 87 | 88 | disp = np.loadtxt('disp.txt') 89 | otg.node_result(node_list, [disp], ['Displacement'], 'Static Analysis', 90 | time_column=False, file_name='example2.res') 91 | -------------------------------------------------------------------------------- /ZeroLengthInterface2D/example2/model.tcl: -------------------------------------------------------------------------------- 1 | wipe 2 | model basic -ndm 2 -ndf 2 3 | node 1 0.0 0.0 4 | node 2 1.0 0.0 5 | node 3 2.0 0.0 6 | node 4 3.0 0.0 7 | node 5 4.0 0.0 8 | node 6 5.0 0.0 9 | node 7 6.0 0.0 10 | node 8 7.0 0.0 11 | node 9 8.0 0.0 12 | node 10 9.0 0.0 13 | node 11 10.0 0.0 14 | node 12 0.0 1.0 15 | node 13 1.0 1.0 16 | node 14 2.0 1.0 17 | node 15 3.0 1.0 18 | node 16 4.0 1.0 19 | node 17 5.0 1.0 20 | node 18 6.0 1.0 21 | node 19 7.0 1.0 22 | node 20 8.0 1.0 23 | node 21 9.0 1.0 24 | node 22 10.0 1.0 25 | node 23 0.0 1.0 26 | node 24 1.0 1.0 27 | node 25 2.0 1.0 28 | node 26 3.0 1.0 29 | node 27 4.0 1.0 30 | node 28 5.0 1.0 31 | node 29 6.0 1.0 32 | node 30 7.0 1.0 33 | node 31 8.0 1.0 34 | node 32 9.0 1.0 35 | node 33 10.0 1.0 36 | node 34 0.0 2.0 37 | node 35 1.0 2.0 38 | node 36 2.0 2.0 39 | node 37 3.0 2.0 40 | node 38 4.0 2.0 41 | node 39 5.0 2.0 42 | node 40 6.0 2.0 43 | node 41 7.0 2.0 44 | node 42 8.0 2.0 45 | node 43 9.0 2.0 46 | node 44 10.0 2.0 47 | fix 1 1 1 48 | fix 12 1 1 49 | fix 23 1 1 50 | fix 34 1 1 51 | nDMaterial ElasticIsotropic 1 100000.0 0.25 6.75 52 | element quad 1 1 2 13 12 1.0 PlaneStrain 1 53 | element quad 2 2 3 14 13 1.0 PlaneStrain 1 54 | element quad 3 3 4 15 14 1.0 PlaneStrain 1 55 | element quad 4 4 5 16 15 1.0 PlaneStrain 1 56 | element quad 5 5 6 17 16 1.0 PlaneStrain 1 57 | element quad 6 6 7 18 17 1.0 PlaneStrain 1 58 | element quad 7 7 8 19 18 1.0 PlaneStrain 1 59 | element quad 8 8 9 20 19 1.0 PlaneStrain 1 60 | element quad 9 9 10 21 20 1.0 PlaneStrain 1 61 | element quad 10 10 11 22 21 1.0 PlaneStrain 1 62 | element quad 11 23 24 35 34 1.0 PlaneStrain 1 63 | element quad 12 24 25 36 35 1.0 PlaneStrain 1 64 | element quad 13 25 26 37 36 1.0 PlaneStrain 1 65 | element quad 14 26 27 38 37 1.0 PlaneStrain 1 66 | element quad 15 27 28 39 38 1.0 PlaneStrain 1 67 | element quad 16 28 29 40 39 1.0 PlaneStrain 1 68 | element quad 17 29 30 41 40 1.0 PlaneStrain 1 69 | element quad 18 30 31 42 41 1.0 PlaneStrain 1 70 | element quad 19 31 32 43 42 1.0 PlaneStrain 1 71 | element quad 20 32 33 44 43 1.0 PlaneStrain 1 72 | element zeroLengthInterface2D 21 -sNdNum 11 -mNdNum 11 -dof 2 2 -Nodes 22 21 20 19 18 17 16 15 14 13 12 23 24 25 26 27 28 29 30 31 32 33 100000000.0 100000000.0 16 73 | timeSeries Constant 1 74 | pattern Plain 1 1 { 75 | load 44 0.0 -0.1 } 76 | printGID example2.msh 77 | getNodeTags 78 | recorder Node -file disp.txt -node 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 -dof 1 2 disp 79 | recorder Element -file ele.txt -ele 21 material 1 pressure 80 | eleResponse 21 pressure 81 | integrator DisplacementControl 44 2 -1e-05 82 | test EnergyIncr 1e-06 100 5 83 | algorithm Newton 84 | numberer RCM 85 | constraints Transformation 86 | system UmfPack 87 | analysis Static 88 | analyze 500 89 | eleResponse 21 material 1 pressure 90 | wipe 91 | -------------------------------------------------------------------------------- /ZeroLengthInterface2D/example3/disp.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zarhin/OpenSeesPyExamples/8fe924e767e0cc027f66aef0153bf3b51300af17/ZeroLengthInterface2D/example3/disp.txt -------------------------------------------------------------------------------- /ZeroLengthInterface2D/example3/example3.py: -------------------------------------------------------------------------------- 1 | # -*-coding:utf-8 2 | # author: zarhin 3 | # email: lizaixainvip@163.com 4 | # date: 2020.08.12 5 | 6 | import numpy as np 7 | import part 8 | import opensees_tools as ops 9 | import opensees_to_gid as otg 10 | 11 | # points 12 | p1 = part.Point([-10, -10]) 13 | p2 = part.Point([-0.5, 0.0]) 14 | p3 = part.Point([0.0, -10]) 15 | p4 = part.Point([0.0, 3.0]) 16 | p5 = part.Point([0.5, -10]) 17 | p6 = part.Point([10, 0.0]) 18 | 19 | # part 20 | rec1 = part.Rectangle([p1, p2]) 21 | line = part.Line([p3, p4]) 22 | rec2 = part.Rectangle([p5, p6]) 23 | 24 | # mesh 25 | part.Element.reset() 26 | part.Node.reset() 27 | rec1.set_seed(1.0) 28 | rec1.set_seed(point_num=11, bias_ratio=1.2, flip_para=True, 29 | direction='horizontal') 30 | rec1.mesh() 31 | line.set_seed(0.5) 32 | line.mesh() 33 | rec2.set_seed(1.0) 34 | rec2.set_seed(point_num=11, bias_ratio=1.2, flip_para=False, 35 | direction='horizontal') 36 | rec2.mesh() 37 | 38 | # opensees model 39 | # soil model 40 | ops.opsfunc('wipe') 41 | ops.opsfunc('model', 'basic', '-ndm', 2, '-ndf', 2) 42 | 43 | # soil node 44 | for node in rec1.nodes + rec2.nodes: 45 | ops.opsfunc('node', node.tag, *node.coord) 46 | 47 | # material 48 | ops.opsfunc('nDMaterial', 'ElasticIsotropic', 1, 2.24e5, 0.4, 2.0) 49 | 50 | # soil elements 51 | for element in rec1.elements + rec2.elements: 52 | nodes = [node.tag for node in element.nodes] 53 | ops.opsfunc('element', 'quad', element.tag, *nodes, 1.0, 'PlaneStrain', 1) 54 | 55 | # boundary 56 | bottom_nodes = part.Node.search([-10, -10], [10, -10], 57 | rec1.nodes + rec2.nodes) 58 | side_nodes = part.Node.search([-10.0, -9.8], [-10, 0]) 59 | side_nodes = side_nodes + part.Node.search([10, -9.8], [10, 0]) 60 | ops.opsfunc('fix', bottom_nodes[0].tag, 1, 1) 61 | ops.opsfunc('fix', bottom_nodes[-1].tag, 1, 1) 62 | for node in bottom_nodes[1:-1:1]: 63 | ops.opsfunc('fix', node.tag, 0, 1) 64 | for node in side_nodes: 65 | ops.opsfunc('fix', node.tag, 1, 0) 66 | 67 | 68 | # pile model 69 | ops.opsfunc('model', 'basic', '-ndm', 2, '-ndf', 3) 70 | 71 | # Pile Material Parameter 72 | IZ = 3.1415926 * 1.0 ** 4 / 64.0 73 | AREA = 3.1415926 * 1.0 ** 2 / 4.0 74 | E = 3.25e7 75 | 76 | # geomTransf 77 | ops.opsfunc('geomTransf', 'Linear', 1) 78 | 79 | # pile node 80 | translation = np.array([0.5, 0.0]) 81 | arm_nodes = [] 82 | arm_elements = [] 83 | for node in line.nodes: 84 | node1 = part.Node(node.coord + translation) 85 | node2 = part.Node(node.coord - translation) 86 | arm_nodes += [node1, node2] 87 | # nodes 88 | ops.opsfunc('node', node.tag, *node.coord) 89 | ops.opsfunc('node', node1.tag, *node1.coord) 90 | ops.opsfunc('node', node2.tag, *node2.coord) 91 | # rigid arm 92 | ele1 = part.Element([node, node1]) 93 | ele2 = part.Element([node, node2]) 94 | arm_elements += [ele1, ele2] 95 | ops.opsfunc('element', 'elasticBeamColumn', ele1.tag, node.tag, 96 | node1.tag, AREA * 1E3, E * 1e3, IZ * 1e3, 1) 97 | ops.opsfunc('element', 'elasticBeamColumn', ele2.tag, node.tag, 98 | node2.tag, AREA * 1E3, E * 1e3, IZ * 1e3, 1) 99 | 100 | # pile elements 101 | for element in line.elements: 102 | nodes = [node.tag for node in element.nodes] 103 | ops.opsfunc('element', 'elasticBeamColumn', element.tag, *nodes, AREA, 104 | 3.25e7, IZ, 1) 105 | 106 | # boundary 107 | pile_bottom_node = part.Node.search([0.0, -10.0]) 108 | ops.opsfunc('fix', pile_bottom_node.tag, 0, 1, 0) 109 | 110 | # contact element 111 | left_arm_nodes = part.Node.search([-0.5, -10], [-0.5, 0], arm_nodes) 112 | left_soil_nodes = part.Node.search([-0.5, -10], [-0.5, 0], rec1.nodes) 113 | right_arm_nodes = part.Node.search([0.5, -10], [0.5, 0], arm_nodes) 114 | right_soil_nodes = part.Node.search([0.5, -10], [0.5, 0], rec2.nodes) 115 | # left contact element 116 | left_contact_nodes = left_soil_nodes + left_arm_nodes[-1::-1] 117 | ele1 = part.Element(left_contact_nodes, id0='left_contact') 118 | ops.opsfunc('element', 'zeroLengthInterface2D', ele1.tag, '-sNdNum', 119 | len(left_soil_nodes), '-mNdNum', len(left_arm_nodes), '-dof', 120 | 2, 3, '-Nodes', *[node.tag for node in left_contact_nodes], 121 | 1e8, 1e8, 0.0) 122 | # right contact element 123 | right_contact_nodes = right_soil_nodes[-1::-1] + right_arm_nodes 124 | ele2 = part.Element(right_contact_nodes, id0='right_contact') 125 | ops.opsfunc('element', 'zeroLengthInterface2D', ele2.tag, '-sNdNum', 126 | len(right_soil_nodes), '-mNdNum', len(right_arm_nodes), '-dof', 127 | 2, 3, '-Nodes', *[node.tag for node in right_contact_nodes], 128 | 1e8, 1e8, 16) 129 | 130 | # print gid 131 | ops.opsfunc('printGID', 'example3.msh') 132 | 133 | # load 134 | ops.opsfunc('timeSeries', 'Linear', 1) 135 | ops.opsfunc('pattern', 'Plain', 1, 1) 136 | load_node = part.Node.search([0.0, 3.0]) 137 | ops.opsfunc('load', load_node.tag, -1000.0, 0.0, 0.0) 138 | 139 | 140 | # recorder 141 | node_list = ops.opsfunc('getNodeTags') 142 | ops.opsfunc('recorder', 'Node', '-file', 'disp.txt', '-node', *node_list, 143 | '-dof', 1, 2, 3, 'disp') 144 | 145 | # analysis option 146 | ops.opsfunc('integrator', 'LoadControl', 0.01) 147 | # ops.opsfunc('test', 'EnergyIncr', 1, 100, 5) 148 | ops.opsfunc('test', 'FixedNumIter', 5, 5) 149 | ops.opsfunc('algorithm', 'Newton') 150 | ops.opsfunc('numberer', 'RCM') 151 | ops.opsfunc('constraints', 'Plain') 152 | ops.opsfunc('system', 'ProfileSPD') 153 | ops.opsfunc('analysis', 'Static') 154 | ops.opsfunc('analyze', 100) 155 | 156 | ops.opsfunc('printModel', 'node', load_node.tag) 157 | 158 | ops.opsfunc('wipe') 159 | ops.opsfunc() 160 | 161 | disp = np.loadtxt('disp.txt') 162 | otg.node_result(node_list, [disp], ['Displacement'], 'Static', False, 163 | 'example3.res') 164 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 这是一个新的分ss53 分支的指针也会随着向前推进,因为它就是当前分支(换句话说,当前的 HEAD 指针正指向 iss支 2 | -------------------------------------------------------------------------------- /showfigure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zarhin/OpenSeesPyExamples/8fe924e767e0cc027f66aef0153bf3b51300af17/showfigure.png -------------------------------------------------------------------------------- /spaced nonlinear SDOF/__pycache__/opensees_constants.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zarhin/OpenSeesPyExamples/8fe924e767e0cc027f66aef0153bf3b51300af17/spaced nonlinear SDOF/__pycache__/opensees_constants.cpython-36.pyc -------------------------------------------------------------------------------- /spaced nonlinear SDOF/example_name_spaced_nonlinear_sdof.py: -------------------------------------------------------------------------------- 1 | import eqsig 2 | from eqsig import duhamels 3 | import matplotlib.pyplot as plt 4 | import numpy as np 5 | 6 | 7 | import openseespy.opensees as op # change this to the path where opensees python is stored 8 | import opensees_constants as opc 9 | 10 | 11 | def get_inelastic_response(mass, k_spring, f_yield, motion, dt, xi=0.05, r_post=0.0): 12 | """ 13 | Run seismic analysis of a nonlinear SDOF 14 | 15 | :param mass: SDOF mass 16 | :param k_spring: spring stiffness 17 | :param f_yield: yield strength 18 | :param motion: list, acceleration values 19 | :param dt: float, time step of acceleration values 20 | :param xi: damping ratio 21 | :param r_post: post-yield stiffness 22 | :return: 23 | """ 24 | 25 | op.wipe() 26 | op.model('basic', '-ndm', 2, '-ndf', 3) # 2 dimensions, 3 dof per node 27 | 28 | # Establish nodes 29 | bot_node = 1 30 | top_node = 2 31 | op.node(bot_node, 0., 0.) 32 | op.node(top_node, 0., 0.) 33 | 34 | # Fix bottom node 35 | op.fix(top_node, opc.FREE, opc.FIXED, opc.FIXED) 36 | op.fix(bot_node, opc.FIXED, opc.FIXED, opc.FIXED) 37 | # Set out-of-plane DOFs to be slaved 38 | op.equalDOF(1, 2, *[2, 3]) 39 | 40 | # nodal mass (weight / g): 41 | op.mass(top_node, mass, 0., 0.) 42 | 43 | # Define material 44 | bilinear_mat_tag = 1 45 | mat_type = "Steel01" 46 | mat_props = [f_yield, k_spring, r_post] 47 | op.uniaxialMaterial(mat_type, bilinear_mat_tag, *mat_props) 48 | 49 | # Assign zero length element 50 | beam_tag = 1 51 | op.element('zeroLength', beam_tag, bot_node, top_node, "-mat", bilinear_mat_tag, "-dir", 1, '-doRayleigh', 1) 52 | 53 | # Define the dynamic analysis 54 | load_tag_dynamic = 1 55 | pattern_tag_dynamic = 1 56 | 57 | values = list(-1 * motion) # should be negative 58 | op.timeSeries('Path', load_tag_dynamic, '-dt', dt, '-values', *values) 59 | op.pattern('UniformExcitation', pattern_tag_dynamic, opc.X, '-accel', load_tag_dynamic) 60 | 61 | # set damping based on first eigen mode 62 | angular_freq = op.eigen('-fullGenLapack', 1) ** 0.5 63 | alpha_m = 0.0 64 | beta_k = 2 * xi / angular_freq 65 | beta_k_comm = 0.0 66 | beta_k_init = 0.0 67 | 68 | op.rayleigh(alpha_m, beta_k, beta_k_init, beta_k_comm) 69 | 70 | # Run the dynamic analysis 71 | 72 | op.wipeAnalysis() 73 | 74 | op.algorithm('Newton') 75 | op.system('SparseGeneral') 76 | op.numberer('RCM') 77 | op.constraints('Transformation') 78 | op.integrator('Newmark', 0.5, 0.25) 79 | op.analysis('Transient') 80 | 81 | tol = 1.0e-10 82 | iterations = 10 83 | op.test('EnergyIncr', tol, iterations, 0, 2) 84 | analysis_time = (len(values) - 1) * dt 85 | analysis_dt = 0.001 86 | outputs = { 87 | "time": [], 88 | "rel_disp": [], 89 | "rel_accel": [], 90 | "rel_vel": [], 91 | "force": [] 92 | } 93 | 94 | while op.getTime() < analysis_time: 95 | curr_time = op.getTime() 96 | op.analyze(1, analysis_dt) 97 | outputs["time"].append(curr_time) 98 | outputs["rel_disp"].append(op.nodeDisp(top_node, 1)) 99 | outputs["rel_vel"].append(op.nodeVel(top_node, 1)) 100 | outputs["rel_accel"].append(op.nodeAccel(top_node, 1)) 101 | op.reactions() 102 | outputs["force"].append(-op.nodeReaction(bot_node, 1)) # Negative since diff node 103 | op.wipe() 104 | for item in outputs: 105 | outputs[item] = np.array(outputs[item]) 106 | 107 | return outputs 108 | 109 | 110 | def show_single_comparison(): 111 | """ 112 | Create a plot of an elastic analysis, nonlinear analysis and closed form elastic 113 | 114 | :return: 115 | """ 116 | 117 | record_filename = 'test_motion_dt0p01.txt' 118 | motion_step = 0.01 119 | rec = np.loadtxt(record_filename) 120 | acc_signal = eqsig.AccSignal(rec, motion_step) 121 | period = 1.0 122 | xi = 0.05 123 | mass = 1.0 124 | f_yield = 1.5 # Reduce this to make it nonlinear 125 | r_post = 0.0 126 | 127 | periods = np.array([period]) 128 | resp_u, resp_v, resp_a = duhamels.response_series(motion=rec, dt=motion_step, periods=periods, xi=xi) 129 | 130 | k_spring = 4 * np.pi ** 2 * mass / period ** 2 131 | outputs = get_inelastic_response(mass, k_spring, f_yield, rec, motion_step, xi=xi, r_post=r_post) 132 | outputs_elastic = get_inelastic_response(mass, k_spring, f_yield * 100, rec, motion_step, xi=xi, r_post=r_post) 133 | ux_opensees = outputs["rel_disp"] 134 | ux_opensees_elastic = outputs_elastic["rel_disp"] 135 | 136 | bf, sps = plt.subplots(nrows=2) 137 | sps[0].plot(acc_signal.time, resp_u[0], label="Eqsig") 138 | sps[0].plot(outputs["time"], ux_opensees, label="Opensees fy=%.3gN" % f_yield, ls="--") 139 | sps[0].plot(outputs["time"], ux_opensees_elastic, label="Opensees fy=%.3gN" % (f_yield * 100), ls="--") 140 | sps[1].plot(acc_signal.time, resp_a[0], label="Eqsig") # Elastic solution 141 | time = acc_signal.time 142 | acc_opensees_elastic = np.interp(time, outputs_elastic["time"], outputs_elastic["rel_accel"]) - rec 143 | print("diff", sum(acc_opensees_elastic - resp_a[0])) 144 | sps[1].plot(time, acc_opensees_elastic, label="Opensees fy=%.2gN" % (f_yield * 100), ls="--") 145 | sps[0].legend() 146 | sps[1].legend() 147 | plt.show() 148 | 149 | 150 | if __name__ == '__main__': 151 | show_single_comparison() 152 | -------------------------------------------------------------------------------- /spaced nonlinear SDOF/opensees_constants.py: -------------------------------------------------------------------------------- 1 | FREE = 0 2 | FIXED = 1 3 | 4 | X = 1 5 | Y = 2 6 | ROTZ = 3 7 | --------------------------------------------------------------------------------