示例#1
0
    num_bodies = bodies.size
    Nblobs = sum([x.Nblobs for x in bodies])

    # Save bodies information
    with open(output_name + '.bodies_info', 'w') as f:
        f.write('num_of_body_types  ' + str(num_of_body_types) + '\n')
        f.write('body_names         ' + str(body_names) + '\n')
        f.write('body_types         ' + str(body_types) + '\n')
        f.write('num_bodies         ' + str(num_bodies) + '\n')
        f.write('num_blobs          ' + str(Nblobs) + '\n')

    # Create integrator
    if scheme.find('rollers') == -1:
        integrator = QuaternionIntegrator(bodies,
                                          Nblobs,
                                          scheme,
                                          tolerance=read.solver_tolerance,
                                          domain=read.domain)
    else:
        integrator = QuaternionIntegratorRollers(
            bodies,
            Nblobs,
            scheme,
            tolerance=read.solver_tolerance,
            domain=read.domain,
            mobility_vector_prod_implementation=read.
            mobility_vector_prod_implementation)
        integrator.calc_one_blob_forces = partial(
            multi_bodies_functions.calc_one_blob_forces,
            g=g,
            repulsion_strength_wall=read.repulsion_strength_wall,
  # Set some more variables
  num_of_body_types = len(body_types)
  num_bodies = bodies.size
  Nblobs = sum([x.Nblobs for x in bodies])

  # Save bodies information
  with open(output_name + '.bodies_info', 'w') as f:
    f.write('num_of_body_types  ' + str(num_of_body_types) + '\n')
    f.write('body_names         ' + str(body_names) + '\n')
    f.write('body_types         ' + str(body_types) + '\n')
    f.write('num_bodies         ' + str(num_bodies) + '\n')
    f.write('num_blobs          ' + str(Nblobs) + '\n')

  # Create integrator
  if scheme.find('rollers') == -1:
    integrator = QuaternionIntegrator(bodies, Nblobs, scheme, tolerance = read.solver_tolerance, domain = read.domain) 
  else:
    integrator = QuaternionIntegratorRollers(bodies, Nblobs, scheme, tolerance = read.solver_tolerance, domain = read.domain, 
                                             mobility_vector_prod_implementation = read.mobility_vector_prod_implementation) 
    integrator.calc_one_blob_forces = partial(multi_bodies_functions.calc_one_blob_forces,
                                              g = g,
                                              tilt_angle = read.theta,
                                              repulsion_strength_wall = read.repulsion_strength_wall, 
                                              debye_length_wall = read.debye_length_wall)
    integrator.calc_blob_blob_forces = partial(multi_bodies_functions.calc_blob_blob_forces,
                                               g = 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)