Esempio n. 1
0
def FillBoundaries():
    #walls
    bottom = shapes.Rhomboid(corner=[0, 0, 0],
                             a=[boxX, 0, 0],
                             b=[0, boxY, 0],
                             c=[0, 0, 1],
                             direction=1)
    oif.output_vtk_rhomboid(rhom_shape=bottom,
                            out_file=vtk_directory + "/bottom.vtk")

    top = shapes.Rhomboid(corner=[0, 0, boxZ - 1],
                          a=[boxX, 0, 0],
                          b=[0, boxY, 0],
                          c=[0, 0, 1],
                          direction=1)
    oif.output_vtk_rhomboid(rhom_shape=top,
                            out_file=vtk_directory + "/top.vtk")

    left = shapes.Rhomboid(corner=[0, boxY - 1, 1],
                           a=[boxX, 0, 0],
                           b=[0, 1, 0],
                           c=[0, 0, boxZ - 2],
                           direction=1)
    oif.output_vtk_rhomboid(rhom_shape=left,
                            out_file=vtk_directory + "/left.vtk")

    right = shapes.Rhomboid(corner=[0, 0, 1],
                            a=[boxX, 0, 0],
                            b=[0, 1, 0],
                            c=[0, 0, boxZ - 2],
                            direction=1)
    oif.output_vtk_rhomboid(rhom_shape=right,
                            out_file=vtk_directory + "/right.vtk")

    # obstacles = shapes.Rhomboid(corner=[rhom_x0, 0, 0], a=[rhom_x, 0, 0], b=[0, rhom_y, 0], c=[0, 0, rhom_z], direction = 1)
    # oif.output_vtk_rhomboid(rhom_shape=obstacles, out_file=vtk_directory + "/obstacles.vtk")

    boundaries.append(bottom)
    boundaries.append(top)
    boundaries.append(left)
    boundaries.append(right)
    # boundaries.append(obstacles)

    # obstacles20 = shapes.Rhomboid(corner=[40, 0, 0], a=[20, 0, 0], b=[0, 20, 0], c=[0, 0, 20], direction = 1)
    # oif.output_vtk_rhomboid(rhom_shape=obstacles20, out_file=vtk_directory + "/obstacles20.vtk")

    # obstacles10 = shapes.Rhomboid(corner=[40, 0, 0], a=[20, 0, 0], b=[0, 20, 0], c=[0, 0, 10], direction = 1)
    # oif.output_vtk_rhomboid(rhom_shape=obstacles10, out_file=vtk_directory + "/obstacles10.vtk")

    #cylinders
    # for id, pos in enumerate(obst_centers):
    #     boundaries.append(shapes.Cylinder(center=pos, axis=[0.0, 0.0, 1.0], length=boxZ, radius=obst_radius, direction=1))
    #     output_vtk_cylinder(center=pos, axis=[0.0, 0.0, 1.0], length=boxZ/2, radius=obst_radius, n=50,out_file=vtk_directory + "/cylinder" + str(id) + ".vtk")
    return 0
Esempio n. 2
0
# fluid
lbf = espressomd.lb.LBFluid(agrid=1, dens=1.0, visc=1.5, tau=0.1,
                            ext_force_density=[0.002, 0.0, 0.0])
system.actors.add(lbf)
system.thermostat.set_lb(LB_fluid=lbf, gamma=1.5)

# creating boundaries and obstacles in the channel
# OutputVtk writes a file
# lbboundaries created boundaries for fluid
# constraints created boundaries for the cells

boundaries = []

# bottom of the channel
bottom_shape = shapes.Rhomboid(corner=[0.0, 0.0, 0.0], a=[boxX, 0.0, 0.0],
                               b=[0.0, boxY, 0.0], c=[0.0, 0.0, 1.0],
                               direction=1)
boundaries.append(bottom_shape)
output_vtk_rhomboid(
    bottom_shape, out_file=output_path + "/wallBottom.vtk")

# top of the channel
top_shape = shapes.Rhomboid(corner=[0.0, 0.0, boxZ - 1], a=[boxX, 0.0, 0.0],
                            b=[0.0, boxY, 0.0], c=[0.0, 0.0, 1.0], direction=1)
boundaries.append(top_shape)
output_vtk_rhomboid(
    top_shape, out_file=output_path + "/wallTop.vtk")

# front wall of the channel
front_shape = shapes.Rhomboid(corner=[0.0, 0.0, 0.0], a=[boxX, 0.0, 0.0],
                              b=[0.0, 1.0, 0.0], c=[0.0, 0.0, boxZ], direction=1)
# save script and arguments
shutil.copyfile(str(sys.argv[0]), directory + "/" + str(sys.argv[0]))
out_file = open(directory + "/parameters"+str(sim_id)+".txt", "a")
for arg in sys.argv:
    out_file.write(str(arg) + " ")
out_file.write("\n")
out_file.write("boxX "+str(boxX)+"\n")
out_file.write("boxY "+str(boxY)+"\n")
out_file.write("boxZ "+str(boxZ)+"\n")
out_file.close()

# create boundaries
boundaries = []

# bottom of the channel
tmp_shape = shapes.Rhomboid(corner=[0.0, 0.0, 0.0], a=[boxX, 0.0, 0.0], b=[0.0, boxY, 0.0], c=[0.0, 0.0, 1.0],
                          direction=1)
boundaries.append(tmp_shape)
oif.output_vtk_rhomboid(rhom_shape=tmp_shape, out_file=directory+"/vtk/wallBottom.vtk")

# top of the channel
tmp_shape = shapes.Rhomboid(corner=[0.0, 0.0, boxZ-1], a=[boxX, 0.0, 0.0], b=[0.0, boxY, 0.0], c=[0.0, 0.0, 1.0],
                            direction=1)
boundaries.append(tmp_shape)
oif.output_vtk_rhomboid(rhom_shape=tmp_shape, out_file=directory+"/vtk/wallTop.vtk")

# front wall of the channel
tmp_shape = shapes.Rhomboid(corner=[0.0, 0.0, 0.0], a=[boxX, 0.0, 0.0], b=[0.0, 1.0, 0.0], c=[0.0, 0.0, boxZ],
                            direction=1)
boundaries.append(tmp_shape)
oif.output_vtk_rhomboid(rhom_shape=tmp_shape, out_file=directory+"/vtk/wallFront.vtk")