Many structural analysis software programs will automatically define mass based on the input gravity loads.
OpenSees is not one of those programs.
You have to define mass and weight separately. Fortunately, using variables for units makes the mass and weight definitions easy. Plus, if using customary units, you won’t have to waste time Googling the definition of a slug.
kip = 1.0 inch = 1.0 sec = 1.0 ft = 12*inch g = 32.2*ft/sec**2
For nodes, typically you’ll know the gravity load, then convert to mass. For example, a gravity load of 200 kip applied to node 2:
P = 200*kip ops.mass(2,P/g,P/g,0) ops.timeSeries('Constant',1) # Or 'Linear' if you want to ramp up gravity loads ops.pattern('Plain',1,1) ops.load(2,0,-P,0)
Likewise, for elements with known distributed gravity loads, you’ll convert the distributed load to distributed mass, or mass “density” per length. For example, a distributed load of 0.3 kip/ft applied to element 1:
wD = 0.3*kip/ft ops.element('elasticBeamColumn',1,1,2,A,E,I,1,'-mass',wD/g) ops.timeSeries('Constant',1) # Or 'Linear' if you want to ramp up gravity loads ops.pattern('Plain',1,1) ops.eleLoad('-ele',1,'-type','beamUniform',-wD)
'-mass' option works for the
elasticBeamColumn, as well as
forceBeamColumn, but it could be some other string for other elements. Check the documentation, or if there’s nothing there, take a look at the source code.