# functions to better understand this step. G_xx = sp.csr_matrix((N, N)) G_xy = sp.csr_matrix((N, N)) G_xz = sp.csr_matrix((N, N)) G_yx = sp.csr_matrix((N, N)) G_yy = sp.csr_matrix((N, N)) G_yz = sp.csr_matrix((N, N)) G_zx = sp.csr_matrix((N, N)) G_zy = sp.csr_matrix((N, N)) G_zz = sp.csr_matrix((N, N)) out = elastic3d_body_force(nodes[idx['interior']], nodes, lamb=lamb, mu=mu, n=n) G_xx = add_rows(G_xx, out['xx'], idx['interior']) G_xy = add_rows(G_xy, out['xy'], idx['interior']) G_xz = add_rows(G_xz, out['xz'], idx['interior']) G_yx = add_rows(G_yx, out['yx'], idx['interior']) G_yy = add_rows(G_yy, out['yy'], idx['interior']) G_yz = add_rows(G_yz, out['yz'], idx['interior']) G_zx = add_rows(G_zx, out['zx'], idx['interior']) G_zy = add_rows(G_zy, out['zy'], idx['interior']) G_zz = add_rows(G_zz, out['zz'], idx['interior']) out = elastic3d_body_force(nodes[idx['boundary:free']], nodes, lamb=lamb,
# find normal vectors to each free surface node simplex_normals = simplex_outward_normals(vert,smp) free_normals = simplex_normals[smpid[free_idx]] # find the normal vectors to each roller node roller_normals = simplex_normals[smpid[roller_idx]] # find two orthogonal vectors that are parallel to the surface at each # roller node. This is used to determine the directions along which # traction forces will be constrained. Note that any two orthogonal # vectors that are parallel to the surface would do. roller_parallels1,roller_parallels2 = find_orthogonals(roller_normals) # add ghost nodes next to free and roller nodes dx = np.min(neighbors(nodes,2)[1][:,1]) nodes = np.vstack((nodes,nodes[free_idx] + dx*free_normals)) nodes = np.vstack((nodes,nodes[roller_idx] + dx*roller_normals)) # build the "left hand side" matrices for body force constraints 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)
G_xz = sp.csc_matrix((node_count, node_count)) G_yx = sp.csc_matrix((node_count, node_count)) G_yy = sp.csc_matrix((node_count, node_count)) G_yz = sp.csc_matrix((node_count, node_count)) G_zx = sp.csc_matrix((node_count, node_count)) G_zy = sp.csc_matrix((node_count, node_count)) G_zz = sp.csc_matrix((node_count, node_count)) # build the "left hand side" matrices for body force constraints on # the interior nodes out = elastic3d_body_force( nodes[groups['interior']], nodes, lamb=lamb, mu=mu, n=stencil_size, basis=basis, order=poly_order) G_xx = add_rows(G_xx, out['xx'], groups['interior']) G_xy = add_rows(G_xy, out['xy'], groups['interior']) G_xz = add_rows(G_xz, out['xz'], groups['interior']) G_yx = add_rows(G_yx, out['yx'], groups['interior']) G_yy = add_rows(G_yy, out['yy'], groups['interior']) G_yz = add_rows(G_yz, out['yz'], groups['interior']) G_zx = add_rows(G_zx, out['zx'], groups['interior']) G_zy = add_rows(G_zy, out['zy'], groups['interior']) G_zz = add_rows(G_zz, out['zz'], groups['interior'])