for i in range(NNy): if i == 0 or i == (NNy - 1): f[(NNx * ndof1) * (i + 1) - 2] = f_ele / 2 else: f[(NNx * ndof1) * (i + 1) - 2] = f_ele # constraints = np.zeros(10) # A = np.zeros((10, 18)) # A[0,0] = A[1][1] = A[2][2] = A[3][3] = A[4][4] = A[5][5] = A[6][6] = A[7][7] = A[8][12] = A[9][13] = 1 # f = np.zeros(18) # f[4] = f[16] = 2.5 # f[10] = 5 mesh = Mesh() mesh.set_nodes(node_coords1, ndof1) mesh.add_elem_group(ent1, 2) # 2 is element type for rectangular elements #-------------------------------------------------------------------- #-------------------------------------------------------------------- # 1D cantilever beam example: minimize compliance wrt thickness #-------------------------------------------------------------------- #v = 0.1 #E = 1. # # #prob_type = 'beam' # #ng = 2 # #