OpenSees Cloud
OpenSees AMI
Line Mesh
Original Post - 30 Nov 2021 - Michael H. Scott
Show your support at Buy Me a Coffee.
The DiscretizeMember function, 
which dates back many years, was recently 
superseded by the 
line mesh 
command, written by 
Minjie. In addition to 
creating boundaries for solid meshes, as shown in 
this post, 
you can use 
line meshes to discretize a frame member (2D or 3D) into beam-column 
elements–just pass the optional element type and arguments to the mesh 
command.
Below is example code for a portal frame model. First, define nodes for the joints.
import openseespy.opensees as ops
H = 360
L = 144
ops.wipe()
ops.model('basic','-ndm',2,'-ndf',3)
ops.node(1,0,0); ops.fix(1,1,1,1)
ops.node(2,0,L)
ops.node(3,H,L)
ops.node(4,H,0); ops.fix(4,1,1,1)

Next, define line meshes with the element type and arguments that would 
come after the nodes in the regular element command–in this case, the 
transformation tag and beam integration tag for a dispBeamColumn 
element. The mesh type is 0 (not an FSI analysis) and there are 3 DOFs 
per node.
E = 29000
# W14x90
A = 26.5
Ic = 999
ops.section('Elastic',1,E,A,Ic)
ops.beamIntegration('Legendre',1,1,2)
# W18x76
A = 22.3
Ig = 1330
ops.section('Elastic',2,E,A,Ig)
ops.beamIntegration('Legendre',2,2,2)
# Corotational transformation
ops.geomTransf('Corotational',1)
# Number of elements/member
Nele = 8
# Columns
c = L/Nele
# tag Npts nodes type dofs size eleType transfTag beamIntTag
ops.mesh('line',1,2,*[1,2],0,3,c,'dispBeamColumn',1,1)
ops.mesh('line',2,2,*[3,4],0,3,c,'dispBeamColumn',1,1)
    
# Beam
c = H/Nele
# tag Npts nodes type dofs size eleType transfTag beamIntTag
ops.mesh('line',3,2,*[2,3],0,3,c,'dispBeamColumn',1,2)

And that’s pretty much it.
Compared to DiscretizeMember, the line mesh is easier because it doesn’t 
require you to keep track of node and element tags to pass into the 
function–the numbering of nodes and elements is handled internally.
The meshes shown in this post were plotted using the 
opsvis package 
developed by 
Seweryn Kokot.