zhuminjie / OpenSeesPyDoc

OpenSeesPy Documentation
http://openseespydoc.readthedocs.io
Other
141 stars 105 forks source link

eleResponse with "localForce" returns wrong values #289

Closed em812 closed 1 year ago

em812 commented 1 year ago

Opensees verison == 3.3.0.0 Issue tested with beam column elements.

When eleReponse is called with the "localForce" argument, it returns the local forces at the previous time step (not at the current time).

On the contrary, when eleResponse is called with "force" or "globalForce", it returns the correct forces at the current time.

Note that if the response of an element in the global system is obtained with "force" or "globalForce" first and then "localForce" is requested, this returns the correct local forces at the current time step of the analysis.

Please see the code snippet below as an example:

import openseespy.opensees as ops
import numpy as np

# %%
# SET UP ----------------------------------------------------------------------------
ops.wipe()                             # clear opensees model
ops.model('basic', '-ndm', 3, '-ndf', 6)           # 2 dimensions, 3 dof per node
# file mkdir data                  # create data directory

# define GEOMETRY -------------------------------------------------------------
# nodal coordinates:
ops.node(1, 0., 0., 0.)                # node#, X Y
ops.node(2, 0., 0., 0.5)
ops.node(3, 0., 0., 1.)

# Single point constraints -- Boundary Conditions
ops.fix(1, 1, 1, 1, 1, 1, 1)                       # node DX DY RZ

# Define ELEMENTS ------------------------------------------------------
# define geometric transformation: performs a linear geometric transformation of beam stiffness and resisting force from the basic system to the global-coordinate system
ops.geomTransf('Linear', 1, *[0, 1, 0])                # associate a tag to transformation

# connectivity:
# eleTag, *eleNodes, E_mod, G_mod, Area, Iz, Jxx, Iy, Iz, Avy, Avz, transfTag
D = 1
t = 0.10
Area = np.pi / 4 * (D ** 2 -  (D - 2* t) ** 2)
Iz = np.pi * (D ** 4 - (D - 2 * t) ** 4) / 64
Jxx = 2 * Iz
Iy = Iz
Avy = 0.01555194137
Avz = Avy
E = 2.1e11
G = E / (2 * (1 + 0.3))

ops.element('ElasticTimoshenkoBeam', 1, 1, 2, E, G, Area, Jxx, Iy, Iz, Avy, Avz, 1)
ops.element('ElasticTimoshenkoBeam', 2, 2, 3, E, G, Area, Jxx, Iy, Iz, Avy, Avz, 1)

# %%
# # define loads-------------------------------------------------
ops.timeSeries('Linear', 1)
ops.pattern('Plain', 1, 1,)
ops.load(2, -2000., 0., 0.,0,0,0)

ops.constraints('Plain')
ops.numberer('Plain')
ops.system('BandGeneral')
ops.algorithm('Linear')
ops.integrator('LoadControl', 0.5)
ops.analysis('Static')
ops.analyze(2)

response = {}
response["eleResponse_localForce"] = ops.eleResponse(1, "localForce")
response["eleResponse_globalForce"] = ops.eleResponse(1, "globalForce")
response["eleResponse_forces"]=ops.eleResponse(1, "force")
response["eleForce"] = ops.eleForce(1)
response["eleResponse_localForce_atTheEnd"] = ops.eleResponse(1, "localForce")

for key,value in response.items():
    print(f"{key} : {value}")
mhscott commented 1 year ago

Not the issue, but please upgrade your openseespy!

Can you try with algorithm Newton instead of Linear?

em812 commented 1 year ago

Many thanks for the quick response.

Indeed when using Newton I do not have the same issue. What is the source of this problem? Would you recommend against using the Linear algorithm?

mhscott commented 1 year ago

Generally, yes, I would not use the Linear algorithm