A_body = elastic3d_body_force(nodes[int_idx+free_idx+roller_idx],nodes,lamb=lamb,mu=mu,n=n) A_body_x,A_body_y,A_body_z = (hstack(i) for i in A_body) # build the "right hand side" vectors for body force constraints b_body_x = np.zeros_like(int_idx+free_idx+roller_idx) b_body_y = np.zeros_like(int_idx+free_idx+roller_idx) b_body_z = body_force*np.ones_like(int_idx+free_idx+roller_idx) # build the "left hand side" matrices for free surface constraints A_surf = elastic3d_surface_force(nodes[free_idx],free_normals,nodes,lamb=lamb,mu=mu,n=n) A_surf_x,A_surf_y,A_surf_z = (hstack(i) for i in A_surf) # build the "right hand side" vectors for free surface constraints b_surf_x = np.zeros_like(free_idx) b_surf_y = np.zeros_like(free_idx) b_surf_z = np.zeros_like(free_idx) # build the "left hand side" matrices for roller constraints # constrain displacements in the surface normal direction A_roller = elastic3d_displacement(nodes[roller_idx],nodes,lamb=lamb,mu=mu,n=1) A_roller_x,A_roller_y,A_roller_z = (hstack(i) for i in A_roller) normals_x = diags(roller_normals[:,0]) normals_y = diags(roller_normals[:,1]) normals_z = diags(roller_normals[:,2]) A_roller_n = (normals_x.dot(A_roller_x) + normals_y.dot(A_roller_y) + normals_z.dot(A_roller_z)) # constrain surface traction in the surface parallel directions A_roller = elastic3d_surface_force(nodes[roller_idx],roller_normals,nodes,lamb=lamb,mu=mu,n=n) A_roller_x,A_roller_y,A_roller_z = (hstack(i) for i in A_roller) parallels_x = diags(roller_parallels1[:,0]) parallels_y = diags(roller_parallels1[:,1]) parallels_z = diags(roller_parallels1[:,2]) A_roller_p1 = (parallels_x.dot(A_roller_x) + parallels_y.dot(A_roller_y) +
parallels1, parallels2 = find_orthogonals(normals[groups['boundary:bottom']]) parallels1_x = sp.diags(parallels1[:, 0]) parallels1_y = sp.diags(parallels1[:, 1]) parallels1_z = sp.diags(parallels1[:, 2]) parallels2_x = sp.diags(parallels2[:, 0]) parallels2_y = sp.diags(parallels2[:, 1]) parallels2_z = sp.diags(parallels2[:, 2]) # have zero displacement normal to the boundary out = elastic3d_displacement( nodes[groups['boundary:bottom']], nodes, lamb=lamb, mu=mu, n=1, basis=basis, order=0) # [G_xx, G_xy, G_xz] * [u_x, u_y, u_z] should be the displacement # along the normal direction G_xx = add_rows(G_xx, normals_x.dot(out['xx']), groups['boundary:bottom']) G_xy = add_rows(G_xy, normals_y.dot(out['yy']), groups['boundary:bottom']) G_xz = add_rows(G_xz, normals_z.dot(out['zz']), groups['boundary:bottom']) # have zero traction parallel to the boundary out = elastic3d_surface_force( nodes[groups['boundary:bottom']], normals[groups['boundary:bottom']], nodes,
lamb=lamb, mu=mu, n=n) G_xx = add_rows(G_xx, out['xx'], idx['boundary:free']) G_xy = add_rows(G_xy, out['xy'], idx['boundary:free']) G_xz = add_rows(G_xz, out['xz'], idx['boundary:free']) G_yx = add_rows(G_yx, out['yx'], idx['boundary:free']) G_yy = add_rows(G_yy, out['yy'], idx['boundary:free']) G_yz = add_rows(G_yz, out['yz'], idx['boundary:free']) G_zx = add_rows(G_zx, out['zx'], idx['boundary:free']) G_zy = add_rows(G_zy, out['zy'], idx['boundary:free']) G_zz = add_rows(G_zz, out['zz'], idx['boundary:free']) out = elastic3d_displacement(nodes[idx['boundary:fix']], nodes, lamb=lamb, mu=mu, n=1) G_xx = add_rows(G_xx, out['xx'], idx['boundary:fix']) G_yy = add_rows(G_yy, out['yy'], idx['boundary:fix']) G_zz = add_rows(G_zz, out['zz'], idx['boundary:fix']) G_x = sp.hstack((G_xx, G_xy, G_xz)) G_y = sp.hstack((G_yx, G_yy, G_yz)) G_z = sp.hstack((G_zx, G_zy, G_zz)) G = sp.vstack((G_x, G_y, G_z)) G = G.tocsr() # build the right-hand-side vector d_x = np.zeros((N, )) d_y = np.zeros((N, ))
# The "left hand side" matrices are built with the convenience # functions from *rbf.fdbuild*. Read the documentation for these # functions to better understand this step. A = elastic3d_body_force(nodes[int_idx + free_idx], nodes, lamb=lamb, mu=mu, n=n) A += elastic3d_surface_force(nodes[free_idx], normals, nodes, lamb=lamb, mu=mu, n=n) A += elastic3d_displacement(nodes[fix_idx], nodes, lamb=lamb, mu=mu, n=1) A = vstack(hstack(i) for i in A).tocsr() # Create the "right hand side" vector components for body forces f_x = np.zeros(len(int_idx + free_idx)) f_y = np.zeros(len(int_idx + free_idx)) f_z = body_force * np.ones( len(int_idx + free_idx)) # THIS IS WHERE GRAVITY IS ADDED f = np.hstack((f_x, f_y, f_z)) # Create the "right hand side" vector components for surface tractions # constraints fix_x = np.zeros(len(fix_idx)) fix_y = np.zeros(len(fix_idx)) fix_z = np.zeros(len(fix_idx)) fix = np.hstack((fix_x, fix_y, fix_z)) # Create the "right hand side" vector components for displacement # constraints