def ops_node(): i = 1 for _i in nodes_high: for _j in nodes_width: ops.node(i, _j, 0, _i) i = i + 1 for _i in range(1, 7): ops.fix(_i, 1, 1, 1, 1, 1, 1) for _i in range(1, 67, 6): ops.equalDOF(_i, _i + 1, 1, 2, 3, 4, 5, 6) for _i in range(5, 71, 6): ops.equalDOF(_i, _i + 1, 1, 2, 3, 4, 5, 6)
def geom(L, Nnodes): # Define the coordinates: coords = np.linspace(0, L, Nnodes) coords = coords.reshape((Nnodes, 1)) temp = np.zeros((Nnodes, 1)) coords = np.append(coords, temp, axis=1) ########################################################################## # Define the nodes: [ops.node(i + 1, *coords[i, :]) for i in range(Nnodes)] ########################################################################## # Define boundary conditions: fix = [[1, 1, 1], [1, 1, 0], [1, 0, 0], [0, 1, 0]] # Fix the first node: ops.fix(1, *fix[0])
def buildModel(K, periodStruct, dampRatio): wn = 2.0 * PI / periodStruct m = K / (wn * wn) ops.wipe() ops.model('basic', '-ndm', 1, '-ndf', 1) ops.node(1, 0.) ops.node(2, 0., '-mass', m) ops.uniaxialMaterial('Elastic', 1, K) ops.element('zeroLength', 1, 1, 2, '-mat', 1, '-dir', 1) ops.fix(1, 1) # add damping using rayleigh damping on the mass term a0 = 2.0 * wn * dampRatio ops.rayleigh(a0, 0., 0., 0.)
def MomentCurvature(secTag, axialLoad, maxK, numIncr=100): # Define two nodes at (0,0) ops.node(1, 0.0, 0.0) ops.node(2, 0.0, 0.0) # Fix all degrees of freedom except axial and bending ops.fix(1, 1, 1, 1) ops.fix(2, 0, 1, 0) # Define element # tag ndI ndJ secTag ops.element('zeroLengthSection', 1, 1, 2, secTag) # Define constant axial load ops.timeSeries('Constant', 1) ops.pattern('Plain', 1, 1) ops.load(2, axialLoad, 0.0, 0.0) # Define analysis parameters ops.integrator('LoadControl', 0.0) ops.system('SparseGeneral', '-piv') ops.test('NormUnbalance', 1e-9, 10) ops.numberer('Plain') ops.constraints('Plain') ops.algorithm('Newton') ops.analysis('Static') # Do one analysis for constant axial load ops.analyze(1) # Define reference moment ops.timeSeries('Linear', 2) ops.pattern('Plain', 2, 2) ops.load(2, 0.0, 0.0, 1.0) # Compute curvature increment dK = maxK / numIncr # Use displacement control at node 2 for section analysis ops.integrator('DisplacementControl', 2, 3, dK, 1, dK, dK) # Do the section analysis ops.analyze(numIncr)
def define_geometry(self, nodes, elements, fixities, num_integ=10): ''' Define geometry of the structure (all dimensions are in mm). Args: nodes: A list of nodes in a form [node_tag, coord1, coord2]. elements: A list of elements in a form [ele_tag, node1, node2, disc]. fixities: A list of fixities in a form [node, x, y, z]. num_integ: Number of integration points along each element (default=10) ''' self.nodes = nodes self.elements = elements self.fixities = fixities if self.section == None: raise Exception('No section is defined.') ops.geomTransf('PDelta', 1) ops.beamIntegration('Lobatto', 1, 1, num_integ) for nd in self.nodes: ops.node(*nd) for el in self.elements: ele_tag, node1, node2, disc = el DiscretizeMember.DiscretizeMember(node1, node2, disc, 'forceBeamColumn', 1, 1, nodeTag=len(ops.getNodeTags()) + 1, eleTag=len(ops.getEleTags()) + 1) for fx in self.fixities: ops.fix(*fx)
def buildModel(): nodeX = np.array([0., 0., 0., 0.]) nodeY = np.array([0., 1., 2., 3.]) Nnode = len(nodeX) # Define Nodes for ii in range(Nnode): tag = int(ii + 1) op.node(tag, nodeX[ii], nodeY[ii]) # Assign boundary constraints op.fix(1, 1, 1, 1) # define Element # element('forceBeamColumn', eleTag, *eleNodes, transfTag, integrationTag, '-iter', maxIter=10, tol=1e-12, '-mass', mass=0.0) op.element('forceBeamColumn', 1, *[1, 2], 1, 2, '-iter', 30, 1e-12) op.element('forceBeamColumn', 2, *[2, 3], 1, 2, '-iter', 30, 1e-12) op.element('forceBeamColumn', 3, *[3, 4], 1, 2, '-iter', 30, 1e-12) pass
def geom(coords): # Define the nodes: [ops.node(i, *coords[i, :]) for i in range(len(coords))] ########################################################################## # Define boundary conditions: fix = [[1, 1], [1, 0]] # Pin the first node: ops.fix(1, *fix[0]) # Roll the second node: ops.fix(2, *fix[0])
def get_Model(coords): ''' Summary ------- Parameters ---------- coords : TYPE DESCRIPTION. Returns ------- None. ''' # Define nodes: N = coords.shape[0] [ops.node(i + 1, *coords[i, :]) for i in range(N)] # Fix base point: fixxity = [1, 1, 1] # The base is fully fixxed. ops.fix(1, *fixxity) # Define elements: transfTag = 1 # testing. #transfTag = 10 # actual. integrationTag = 1 # testing. #integrationTag = 10 # actual. # element('forceBeamColumn', eleTag, *eleNodes, transfTag, integrationTag, '-iter', maxIter=10, tol=1e-12) #ops.element('forceBeamColumn', i, *[i, i + 1], transfTag, integrationTag, '-iter', 30, 1e-12) [ ops.element('forceBeamColumn', i, *[i, i + 1], transfTag, integrationTag, '-iter', 30, 1e-12) for i in range(1, N) ] print('Model built.')