def start():
    # 1. generate system
    gen = CircleBenchmark()
    (n, phi) = (16, 0.5)  # phi=0.5 get radius approx 1
    gen.generate(n=n, phi=phi)
    config_filename = "/home/mahe/Dokumente/Eclipse/pyBDsim/pyBDsim/bedsim/data/test/CircleBenchmark-NewtonsCradle-n%s-phi%s.h5" % (
        n, phi)
    try:
        os.remove(config_filename)  # cleanup
    except FileNotFoundError:
        pass
    #config_filename = "bedsim/data/test/CircleBenchmark-n%s-phi%s.h5" % (n,phi)
    gen.particle_data[0]['velocity'] = [2.0, 0.0]  ###
    distance = sqrt(2 * pi) - 2
    #tol = 0.0001
    tol = 0.0
    gen.particle_data[1]['position'] += [distance - tol, 0.0]  ###
    gen.particle_data[3]['position'] -= [distance - tol, 0.0]  ###
    #gen.particle_data[3]['pinned'] = True ###
    #gen.particle_data['Circle_0']['velocity']=[4.,1.] ###
    gen.save_to_file(config_filename)

    # 2. simulate system
    #sim = Simulation(config_filename=config_filename, system_lifetime=10, brownian_timestep=0.1, saving_timestep=0.02, verbose=True)
    sim = Simulation(config_filename=config_filename,
                     output_filename=config_filename,
                     system_lifetime=10,
                     brownian_timestep=None,
                     saving_timestep=0.02,
                     verbose=True)
    sim.start()

    # 3. animate
    Animate(input_filename=config_filename,
            output_filename=config_filename + ".mp4")
示例#2
0
def start():
    # 1. generate system
    gen = P3EllipseGridPin()
    #(n,k,phi) = (16, 2, 0.6) # 32^2=1024
    n = 5
    phi = 0.70
    gen.generate(n=n, phi=phi)
    config_filename = "bedsim/data/test/EllipseBenchmark-Penrose-n%s-phi%s.h5" % (
        n, phi)
    try:
        os.remove(config_filename)  # cleanup
    except FileNotFoundError:
        pass
    #gen.particle_data[0]['velocity']=[3.,0.5]
    gen.save_to_file(config_filename)

    # 2. simulate system
    #sim = Simulation(config_filename=config_filename, output_filename=config_filename, system_lifetime=10, brownian_timestep=None, saving_timestep=0.02, verbose=True)
    sim = Simulation(config_filename=config_filename,
                     output_filename=config_filename,
                     system_lifetime=10,
                     brownian_timestep=0.1,
                     saving_timestep=0.5,
                     verbose=True)  # 'production' lifetime approx 1000
    #sim = Simulation(config_filename=config_filename, output_filename=config_filename, system_lifetime=10, brownian_timestep=None, saving_timestep=0.02, verbose=True)
    sim.start()

    # 3. animate
    Animate(input_filename=config_filename,
            output_filename=config_filename + ".mp4")
示例#3
0
def start():
    # 1. generate system
    gen = CircleBenchmark()
    (n, phi) = (16, 0.7)
    gen.generate(n=n, phi=phi)
    config_filename = "bedsim/data/test/CircleBenchmark-n%s-phi%s.h5" % (n,
                                                                         phi)
    try:
        os.remove(config_filename)  # cleanup
    except FileNotFoundError:
        pass
    gen.particle_data[0]['velocity'] = [3., 0.5]  ###
    #gen.particle_data['Circle_0']['velocity']=[4.,1.] ###
    gen.save_to_file(config_filename)

    # 2. simulate system
    #sim = Simulation(config_filename=config_filename, output_filename=config_filename, system_lifetime=10, brownian_timestep=0.1, saving_timestep=0.02, verbose=True)
    sim = Simulation(config_filename=config_filename,
                     output_filename=config_filename,
                     system_lifetime=10,
                     brownian_timestep=None,
                     saving_timestep=0.02,
                     verbose=True)
    sim.start()

    # 3. animate
    Animate(input_filename=config_filename,
            output_filename=config_filename + ".mp4")
示例#4
0
def start(path, brownian_timestep, saving_timestep, swelling_rate,
          system_lifetime, packing_fraction, particle_number, aspect_ratio,
          radius, simulation_id, verbose):

    np.random.seed(
        simulation_id)  # set seeding here so that it is easier to see

    ## choose system type
    #gen = EllipseBenchmarkRandom()
    gen = FCCLatticeGenerator()

    ########################
    #    choose process    #
    ########################

    # # A) if system already exists and only simluation of an equilibrated system is wanted:
    # oldfile = '/data/scc/sophia/FreeBROWNIANParticle1-n1372-t1000-phi0.05-k0-tb0.01-ts0.001/Tails/Tail{}.dump'.format(simulation_id)
    # #oldfile = '/home/newton/sophia/Desktop/curr_MASTER/Project/data/Tail.dump'
    #
    # gen.generate(n=particle_number, k=aspect_ratio, phi=packing_fraction, radius = radius, filename=oldfile, simulation_id = simulation_id)
    #
    # config_filename  = "%s/Circle-BrownianNotRescaled-n%s-k%s-phi%s-id%s.h5" % (path, particle_number, aspect_ratio, packing_fraction, simulation_id)
    # try:
    #     os.remove(config_filename) # cleanup
    # except FileNotFoundError:
    #     pass
    # gen.save_to_file(config_filename)
    #
    # sim2 = Simulation(config_filename=config_filename, output_filename=config_filename, system_lifetime=system_lifetime, brownian_timestep= None,  saving_timestep=saving_timestep, swelling_rate = None, packing_fraction = packing_fraction, aspect_ratio = aspect_ratio, verbose=verbose)
    # sim2.start()
    # sys.exit()

    ## B) if system was just generated and has to be equilibrated
    oldfile = None
    gen.generate(n=particle_number,
                 k=aspect_ratio,
                 phi=packing_fraction,
                 radius=radius,
                 filename=oldfile,
                 simulation_id=simulation_id)
    config_filename = "%s/Ellipse-Benchmark-n%s-k%s-phi%s-id%s-equilibrate.h5" % (
        path, particle_number, aspect_ratio, packing_fraction, simulation_id)
    try:
        os.remove(config_filename)  # cleanup
    except FileNotFoundError:
        pass
    gen.save_to_file(config_filename)

    ## START NEWTONIAN EQUILIBRATION
    sim = Simulation(config_filename=config_filename,
                     output_filename=config_filename,
                     system_lifetime=system_lifetime,
                     brownian_timestep=brownian_timestep,
                     saving_timestep=saving_timestep,
                     swelling_rate=None,
                     packing_fraction=packing_fraction,
                     aspect_ratio=aspect_ratio,
                     verbose=verbose)
    sim.start()
    sys.exit()
def start(path, brownian_timestep, saving_timestep, system_lifetime,
          packing_fraction, p3_iterations, simulation_id, verbose):
    # 1. generate system
    gen = P3EllipseGridPin()
    gen.generate(n=p3_iterations, phi=packing_fraction)
    config_filename = "%s/Ellipse-Penrose-n%s-phi%s-id%s.h5" % (
        path, p3_iterations, packing_fraction, simulation_id)
    try:
        os.remove(config_filename)  # cleanup
    except FileNotFoundError:
        pass
    #gen.particle_data[0]['velocity']=[3.,0.5]
    gen.save_to_file(config_filename)

    # 2. simulate system
    sim = Simulation(config_filename=config_filename,
                     output_filename=config_filename,
                     system_lifetime=system_lifetime,
                     brownian_timestep=brownian_timestep,
                     saving_timestep=saving_timestep,
                     verbose=verbose)  # 'production' lifetime approx 1000
    sim.start()
def start():
    # 1. generate system
    gen = EllipseBenchmark()
    #gen = EllipseBenchmarkRandom()
    (n, k, phi) = (25, 2, 0.7)  # 32^2=1024
    gen.generate(n=n, k=k, phi=phi)
    config_filename = "bedsim/data/test/EllipseBenchmark-n%s-k%s-phi%s.h5" % (
        n, k, phi)

    try:
        os.remove(config_filename)  # cleanup
    except FileNotFoundError:
        pass

    #gen.particle_data[0]['velocity']=[3.,0.5]
    #gen.particle_data[0]['pinned'] = True
    gen.save_to_file(config_filename)

    # 2. simulate system
    #sim = Simulation(config_filename=config_filename, output_filename=config_filename, system_lifetime=10, brownian_timestep=None, saving_timestep=0.02, verbose=True)
    #sim = Simulation(config_filename=config_filename, output_filename=config_filename, system_lifetime=10, brownian_timestep=0.1,  saving_timestep=0.02, verbose=True)
    #sim = Simulation(config_filename=config_filename, output_filename=config_filename, system_lifetime=1, brownian_timestep=2,  saving_timestep=0.02, verbose=True)
    sim = Simulation(config_filename=config_filename,
                     output_filename=config_filename,
                     system_lifetime=10,
                     brownian_timestep=0.1,
                     saving_timestep=0.02,
                     verbose=True)
    #sim = Simulation(config_filename=config_filename, output_filename=config_filename, system_lifetime=0.2, brownian_timestep=0.1, saving_timestep=0.001, verbose=True)
    sim.start()

    # 3. animate
    Animate(input_filename=config_filename,
            output_filename=config_filename + ".mp4")

    # 4. determine statistic data
    Statprop(input_filename=config_filename)
    '''