velocity = np.zeros((2*num_bodies, 3)) # If scheme == mobility solve mobility problem if read.scheme == 'mobility': start_time = time.time() # Get blobs coordinates r_vectors_blobs = multi_bodies.get_blobs_r_vectors(bodies, Nblobs) # Use the code to compute force-torques on bodies if a file was not given if read.force_file is None: force_torque = multi_bodies_functions.force_torque_calculator_sort_by_bodies(bodies, r_vectors_blobs, g = read.g, repulsion_strength_wall = read.repulsion_strength_wall, debye_length_wall = read.debye_length_wall, repulsion_strength = read.repulsion_strength, debye_length = read.debye_length, periodic_length = read.periodic_length, omega_one_roller = read.omega_one_roller) # Set right hand side System_size = Nblobs * 3 + num_bodies * 6 RHS = np.reshape(np.concatenate([slip, -force_torque]), (System_size)) # If prescribed velocity modify RHS offset = 0 for k, b in enumerate(bodies): if b.prescribed_kinematics is True: # Add K*U to Right Hand side KU = np.dot(b.calc_K_matrix(), b.calc_prescribed_velocity()) RHS[3*offset : 3*(offset+b.Nblobs)] += KU.flatten()
####################################################################### for k, b in enumerate(bodies): bodies[k].location[2] -= 2.0 factor = (2 + dist) / 3.0 bodies[k].location *= factor bodies[k].location[2] += height print(bodies[k].location) ####################################################################### r_vectors_blobs = get_blobs_r_vectors(bodies, Nblobs) slip = np.zeros((Nblobs, 3)) force_torque = multi_bodies_functions.force_torque_calculator_sort_by_bodies( bodies, r_vectors_blobs, g=read.g, part=1, comp=0, sign=-1.0, repulsion_strength_wall=read.repulsion_strength_wall, debye_length_wall=read.debye_length_wall, repulsion_strength=read.repulsion_strength, debye_length=read.debye_length, periodic_length=read.periodic_length) print force_torque # Set right hand side System_size = Nblobs * 3 + num_bodies * 6 RHS = np.reshape(np.concatenate([slip, -force_torque]), (System_size)) # Set linear operators linear_operator_partial = partial(linear_operator_rigid, bodies=bodies,
else: velocity = np.zeros((2*num_bodies, 3)) # If scheme == mobility solve mobility problem if read.scheme == 'mobility': start_time = time.time() # Get blobs coordinates r_vectors_blobs = multi_bodies.get_blobs_r_vectors(bodies, Nblobs) # Use the code to compute force-torques on bodies if a file was not given if read.force_file is None: force_torque = multi_bodies_functions.force_torque_calculator_sort_by_bodies(bodies, r_vectors_blobs, g = read.g, repulsion_strength_wall = read.repulsion_strength_wall, debye_length_wall = read.debye_length_wall, repulsion_strength = read.repulsion_strength, debye_length = read.debye_length, periodic_length = read.periodic_length) # Set right hand side System_size = Nblobs * 3 + num_bodies * 6 RHS = np.reshape(np.concatenate([slip, -force_torque]), (System_size)) # Set linear operators linear_operator_partial = partial(multi_bodies.linear_operator_rigid, bodies=bodies, r_vectors=r_vectors_blobs, eta=read.eta, a=read.blob_radius) A = spla.LinearOperator((System_size, System_size), matvec = linear_operator_partial, dtype='float64') # Set preconditioner mobility_inv_blobs = [] mobility_bodies = np.empty((len(bodies), 6, 6))