def create_particles(self): xb, yb, body_id = create_six_layers() x, y, _rad = create_ball(0.5 * 1e-2, 1.6 * 1e-2, 0.5 * 1e-2, points) _m = np.pi * _rad**2 * self.rho m = np.ones_like(xb) * _m h = np.ones_like(xb) * hdx * self.rad ball = get_particle_array_rigid_body(name='ball', x=xb, y=yb, h=h, m=m, body_id=body_id) add_properties(ball, 'rad_s') # ball.rad_s[:] = 0.05 * 1e-2 ball.rad_s[:] = _rad add_properties( ball, 'tang_disp_x', 'tang_disp_y', 'tang_disp_z', 'tang_disp_x0', 'tang_disp_y0', 'tang_disp_z0', 'tang_velocity_x', 'tang_velocity_y', 'tang_velocity_z', ) xt, yt = create_boundary() _m = np.pi * (1 / 2 * 1e-3)**2 * self.rho m = np.ones_like(xt) * _m h = np.ones_like(xt) * hdx * self.rad wall = get_particle_array_rigid_body( name='wall', x=xt, y=yt, h=h, m=m, ) add_properties(wall, 'rad_s') wall.rad_s[:] = (0.5 * 1e-3) xtw, ytw = create_temp_wall() m = np.ones_like(xtw) * _m h = np.ones_like(xtw) * hdx * self.rad temp_wall = get_particle_array_rigid_body( name='temp_wall', x=xtw, y=ytw, h=h, m=m, ) add_properties(temp_wall, 'rad_s') temp_wall.rad_s[:] = (0.5 * 1e-3) return [ball, wall, temp_wall]
def create_particles(self): nx, ny, nz = 10, 10, 10 dx = 1.0/(nx-1) x, y, z = np.mgrid[0:1:nx*1j, 0:1:ny*1j, 0:1:nz*1j] x = x.flat y = y.flat z = (z - 1).flat m = np.ones_like(x)*dx*dx*rho0 h = np.ones_like(x)*hdx*dx body = get_particle_array_rigid_body( name='body', x=x, y=y, z=z, h=h, m=m, ) body.vc[0] = -5.0 body.vc[2] = -5.0 # Create the tank. nx, ny, nz = 40, 40, 40 dx = 1.0/(nx-1) xmin, xmax, ymin, ymax, zmin, zmax = -2, 2, -2, 2, -2, 2 x, y, z = np.mgrid[xmin:xmax:nx*1j, ymin:ymax:ny*1j, zmin:zmax:nz*1j] interior = ((x < 1.8) & (x > -1.8)) & ((y < 1.8) & (y> -1.8)) & ((z > -1.8) & (z <= 2)) tank = np.logical_not(interior) x = x[tank].flat y = y[tank].flat z = z[tank].flat m = np.ones_like(x)*dx*dx*rho0 h = np.ones_like(x)*hdx*dx tank = get_particle_array_rigid_body( name='tank', x=x, y=y, z=z, h=h, m=m, ) tank.total_mass[0] = np.sum(m) return [body, tank]
def create_particles(self): xb, yb, body_id = create_six_layers() yb = yb - 0.9*1e-2 x, y, _rad = create_ball(0.5 * 1e-2, 1.6 * 1e-2, 0.5 * 1e-2, points) _m = np.pi * _rad**2 * self.rho m = np.ones_like(xb) * _m h = np.ones_like(xb) * hdx * self.rad ball = get_particle_array_rigid_body( name='ball', x=xb, y=yb, h=h, m=m, body_id=body_id) add_properties(ball, 'rad_s') add_properties(ball, 'youngs') add_properties(ball, 'poisson') ball.rad_s[:] = _rad ball.youngs[:] = 69 * 1e9 ball.poisson[:] = 0.30 add_properties( ball, 'tang_disp_x', 'tang_disp_y', 'tang_disp_z', 'tang_disp_x0', 'tang_disp_y0', 'tang_disp_z0', 'tang_velocity_x', 'tang_velocity_y', 'tang_velocity_z', ) xt, yt, nx, ny = create_boundary() # dx is manually given h = np.ones_like(xt) * hdx * 130 * 1e-3 wall = get_particle_array_rigid_body( name='wall', x=xt, y=yt, nx=nx, ny=ny, h=h, ) xtw, ytw, nx, ny = create_temp_wall() h = np.ones_like(xtw) * hdx * self.rad temp_wall = get_particle_array_rigid_body( name='temp_wall', x=xtw, y=ytw, nx=nx, ny=ny, h=h, ) return [ball, wall, temp_wall]
def create_particles(self): xb, yb, _rad = create_ball(0., 0.2 + 0.1 / 2, 0.1 / 2., 30) _m = np.pi * _rad**2 * 2600 m = np.ones_like(xb) * _m v = -np.ones_like(xb) * np.sqrt(2 * 9.81 * 0.3) h = np.ones_like(xb) * hdx * self.rad ball = get_particle_array_rigid_body( name='ball', x=xb, y=yb, v=v, h=h, m=m, ) add_properties(ball, 'rad_s') add_properties(ball, 'youngs') add_properties(ball, 'poisson') ball.rad_s[:] = _rad ball.youngs[:] = 1.6916 * 1e6 ball.poisson[:] = 0.0 add_properties( ball, 'tang_disp_x', 'tang_disp_y', 'tang_disp_z', 'tang_disp_x0', 'tang_disp_y0', 'tang_disp_z0', 'tang_velocity_x', 'tang_velocity_y', 'tang_velocity_z', ) xt, yt, _rad = create_ball(0., 0.1 / 2., 0.1 / 2., 30) _m = np.pi * _rad**2 * 2600 m = np.ones_like(xt) * _m h = np.ones_like(xt) * hdx * self.rad wall = get_particle_array_rigid_body( name='wall', x=xt, y=yt, h=h, m=m, ) add_properties(wall, 'rad_s') wall.rad_s[:] = _rad add_properties(wall, 'youngs') add_properties(wall, 'poisson') wall.youngs[:] = 1.6916 * 1e6 wall.poisson[:] = 0.0 return [ball, wall]
def create_particles(self): dx = 1.0 / 9.0 _x, _y, _z = make_cube(0.5, 0.5, 0.5, dx) _z += 1.0 _id = np.ones(_x.shape, dtype=int) x, y, z, body_id = [], [], [], [] disp = [(0.4, 0, 0), (-0.4, 0, 0), (0.0, 1.0, 0.0), (0.0, -1.0, 0.0)] for i, d in enumerate(disp): x.append(_x + d[0]) y.append(_y + d[1]) z.append(_z + d[2]) body_id.append(_id * i) x = np.concatenate(x) y = np.concatenate(y) z = np.concatenate(z) body_id = np.concatenate(body_id) m = np.ones_like(x) * dx * dx * rho0 h = np.ones_like(x) * hdx * dx # Split this one cube # radius of each sphere constituting in cube rad_s = np.ones_like(x) * dx body = get_particle_array_rigid_body(name='body', x=x, y=y, z=z, h=h, m=m, body_id=body_id, rad_s=rad_s) body.vc[0] = 5.0 body.vc[2] = -5.0 body.vc[6] = -5.0 body.vc[7] = -5.0 body.vc[10] = 5.0 # Create the tank. nx, ny, nz = 40, 40, 40 dx = 1.0 / (nx - 1) xmin, xmax, ymin, ymax, zmin, zmax = -2, 2, -2, 2, -2, 2 x, y, z = np.mgrid[xmin:xmax:nx * 1j, ymin:ymax:ny * 1j, zmin:zmax:nz * 1j] interior = ((x < 1.8) & (x > -1.8)) & ((y < 1.8) & (y > -1.8)) & ( (z > -1.8) & (z <= 2)) tank = np.logical_not(interior) x = x[tank].flat y = y[tank].flat z = z[tank].flat m = np.ones_like(x) * dx * dx * rho0 h = np.ones_like(x) * hdx * dx # radius of each sphere constituting in cube rad_s = np.ones_like(x) * dx tank = get_particle_array_rigid_body(name='tank', x=x, y=y, z=z, h=h, m=m, rad_s=rad_s) tank.total_mass[0] = np.sum(m) return [body, tank]
def create_particles(self): nx, ny = 100,100 dx = 1.0 / (nx-1) x_bob,y_bob,z_bob= numpy.mgrid[-r:r:nx*1j,-(l-r):-(l+r):ny*1j,0:1:1j] x_string,y_string,z_string= numpy.mgrid[0:0:1j*nx,r-l:0:1j*ny,0:1:1j] x = numpy.concatenate((x_bob,x_string),axis=0) y = numpy.concatenate((y_bob,y_string),axis=0) z = numpy.concatenate((z_bob,z_string),axis=0) x = x.flat y = y.flat z = z.flat m = numpy.ones_like(x) * dx * dx * rho0 h = numpy.ones_like(x) * dx *hdx pendulum_bob = get_particle_array_rigid_body(name='bob',x=x,y=y,z=z,m=m,h=h) # remove particle outside the bob indices = [] for i in range(len(x)): if numpy.sqrt(x[i]**2 + (y[i]+l)**2) - r > 1e-10 and x[i] != 0: indices.append(i) pendulum_bob.remove_particles(indices) pendulum_bob.omega[2] = 1 return [pendulum_bob]
def create_particles(self): fluid, boundary = self.geom.create_particles() fpath = join(dirname(__file__), 'sph.vtk.gz') x, y, z = vtk_file_to_points(fpath, cell_centers=False) y -= 0.15 z += 0.05 m = np.ones_like(x) * fluid.m[0] h = np.ones_like(x) * fluid.h[0] rho = np.ones_like(x) * fluid.rho[0] obstacle = get_particle_array_rigid_body(name='obstacle', x=x, y=y, z=z, m=m, h=h, rho=rho, rho0=rho) obstacle.total_mass[0] = np.sum(m) obstacle.add_property('cs') obstacle.add_property('arho') obstacle.set_lb_props(list(obstacle.properties.keys())) obstacle.set_output_arrays([ 'x', 'y', 'z', 'u', 'v', 'w', 'fx', 'fy', 'fz', 'rho', 'm', 'h', 'p', 'tag', 'pid', 'gid' ]) boundary.add_property('V') boundary.add_property('fx') boundary.add_property('fy') boundary.add_property('fz') return [fluid, boundary, obstacle]
def create_particles(self): """Create the circular patch of fluid.""" xf, yf = create_fluid() rho = get_density(yf) m = rho[:] * self.dx * self.dx rho = np.ones_like(xf) * self.ro h = np.ones_like(xf) * self.hdx * self.dx fluid = get_particle_array_wcsph(x=xf, y=yf, h=h, m=m, rho=rho, name="fluid") xt, yt = create_boundary() m = np.ones_like(xt) * 1000 * self.dx * self.dx rho = np.ones_like(xt) * 1000 rad_s = np.ones_like(xt) * 2 / 2. * 1e-3 h = np.ones_like(xt) * self.hdx * self.dx tank = get_particle_array_wcsph(x=xt, y=yt, h=h, m=m, rho=rho, rad_s=rad_s, name="tank") dx = 1 xc, yc = create_sphere(1) m = np.ones_like(xc) * self.solid_rho * dx * 1e-3 * dx * 1e-3 rho = np.ones_like(xc) * self.solid_rho h = np.ones_like(xc) * self.hdx * self.dx rad_s = np.ones_like(xc) * dx / 2. * 1e-3 # add cs property to run the simulation cs = np.zeros_like(xc) cube = get_particle_array_rigid_body(x=xc, y=yc, h=h, m=m, rho=rho, rad_s=rad_s, cs=cs, name="cube") return [fluid, tank, cube]
def get_mantle(): x, y, z = numpy.mgrid[-r2:r2:dx, -r2:r2:dx, -0.002:0.002:dx] x = x.ravel() y = y.ravel() z = z.ravel() d = (x * x + y * y + z * z) keep = numpy.flatnonzero((d <= r2 * r2) * (r1 * r1 <= d)) x = x[keep] y = y[keep] z = z[keep] print('%d Target particles' % len(x)) hf = numpy.ones_like(x) * h mf = numpy.ones_like(x) * dx * dy * dz * ro1 rhof = numpy.ones_like(x) * ro1 csf = numpy.ones_like(x) * cs2 mantle = get_particle_array_rigid_body(name="mantle", x=x, y=y, z=z, h=hf, m=mf, rho=rhof, cs=csf) mantle.omega[2] = 5000000.0 return mantle
def create_particles(self): xb, yb, _rad = create_ball(0., 0.5 + 0.1 / 2, 0.1 / 2., 30) _m = np.pi * _rad**2 * self.rho m = np.ones_like(xb) * _m h = np.ones_like(xb) * hdx * self.rad ball = get_particle_array_rigid_body( name='ball', x=xb, y=yb, h=h, m=m, ) add_properties(ball, 'rad_s') # ball.rad_s[:] = 0.05 * 1e-2 ball.rad_s[:] = _rad add_properties( ball, 'tang_disp_x', 'tang_disp_y', 'tang_disp_z', 'tang_disp_x0', 'tang_disp_y0', 'tang_disp_z0', 'tang_velocity_x', 'tang_velocity_y', 'tang_velocity_z', ) xt, yt, _rad = create_ball(0., 0.1 / 2., 0.1 / 2., 30) _m = np.pi * _rad**2 * self.rho m = np.ones_like(xt) * _m h = np.ones_like(xt) * hdx * self.rad wall = get_particle_array_rigid_body( name='wall', x=xt, y=yt, h=h, m=m, ) add_properties(wall, 'rad_s') wall.rad_s[:] = _rad return [ball, wall]
def get_geometry(dx_s=0.03, dx_f=0.03, hdx=1.3, r_f=100.0, r_s=100.0, wall_l=4.0, wall_h=2.0, fluid_l=1., fluid_h=2., cube_s=0.25): wall_y1 = np.arange(dx_s, wall_h, dx_s) wall_xlayer = np.ones_like(wall_y1) * 2.0 wall_x1 = [] wall_x2 = [] num_layers = 3 for i in range(num_layers): wall_x1.append(wall_xlayer + i * dx_s) wall_x2.append(wall_xlayer - i * dx_s + wall_l / 4.0) wall_x1, wall_x2 = np.ravel(wall_x1), np.ravel(wall_x2) wall_y1 = np.tile(wall_y1, num_layers) wall_y2 = wall_y1 w_center = np.array([wall_l / 2.0, 0.0]) wall_x3, wall_y3 = get_2d_wall(dx_s, w_center, wall_l, num_layers, False) w_center = np.array([2.5, wall_h + dx_s / 2.0]) wall_x4, wall_y4 = get_2d_wall(dx_s, w_center, 1.0, num_layers) wall_x = np.concatenate([wall_x1, wall_x2, wall_x3, wall_x4]) wall_y = np.concatenate([wall_y1, wall_y2, wall_y3, wall_y4]) r1 = np.ones_like(wall_x) * r_s m1 = r1 * dx_s * dx_s h1 = np.ones_like(wall_x) * dx_s * hdx cs1 = np.zeros_like(wall_x) rad1 = np.ones_like(wall_x) * dx_s wall = get_particle_array(name='wall', x=wall_x, y=wall_y, h=h1, rho=r1, m=m1, cs=cs1, rad_s=rad1) f_center = np.array([3.0 * wall_l / 8.0, wall_h / 2.0]) x2, y2 = get_2d_block(dx_f, fluid_l, fluid_h, f_center) r2 = np.ones_like(x2) * r_f m2 = r2 * dx_f * dx_f h2 = np.ones_like(x2) * dx_f * hdx cs2 = np.zeros_like(x2) rad2 = np.ones_like(x2) * dx_f fluid = get_particle_array(name='fluid', x=x2, y=y2, h=h2, rho=r2, m=m2, cs=cs2, rad_s=rad2) center1 = np.array([wall_l / 8.0 + cube_s / 2.0, wall_h / 4.0 + cube_s / 2.0]) cube1_x, cube1_y = get_2d_block(dx_s, cube_s, cube_s, center1) b1 = np.zeros_like(cube1_x, dtype=int) center2 = np.array([3.0 * wall_l / 4.0 + cube_s / 2.0 + 3.0 * dx_s, wall_h + cube_s / 2.0 + (num_layers + 1) * dx_s]) cube2_x, cube2_y = get_2d_block(dx_s, cube_s, cube_s, center2) b2 = np.ones_like(cube2_x, dtype=int) b = np.concatenate([b1, b2]) x3 = np.concatenate([cube1_x, cube2_x]) y3 = np.concatenate([cube1_y, cube2_y]) r3 = np.ones_like(x3) * r_s * 0.5 m3 = r3 * dx_s * dx_s h3 = np.ones_like(x3) * dx_s * hdx cs3 = np.zeros_like(x3) rad3 = np.ones_like(x3) * dx_s cube = get_particle_array_rigid_body( name='cube', x=x3, y=y3, h=h3, cs=cs3, rho=r3, m=m3, rad_s=rad3, body_id=b) remove_overlap_particles(fluid, wall, dx_s, 2) return fluid, wall, cube
def create_particles(self): """Create the circular patch of fluid.""" xf, yf = create_fluid() m = self.ro * self.dx * self.dx rho = self.ro h = self.hdx * self.dx fluid = get_particle_array_wcsph(x=xf, y=yf, h=h, m=m, rho=rho, name="fluid") dx = 2 xt, yt = create_boundary() m = 1000 * self.dx * self.dx rho = 1000 rad_s = 2 / 2. * 1e-3 h = self.hdx * self.dx V = dx * dx * 1e-6 tank = get_particle_array_wcsph(x=xt, y=yt, h=h, m=m, rho=rho, rad_s=rad_s, V=V, name="tank") for name in ['fx', 'fy', 'fz']: tank.add_property(name) dx = 1 xc, yc = create_three_spheres() b_id, rho = properties_of_three_spheres() m = rho * dx * 1e-3 * dx * 1e-3 h = self.hdx * self.dx rad_s = dx / 2. * 1e-3 V = dx * dx * 1e-6 cs = 0.0 cube = get_particle_array_rigid_body(x=xc, y=yc, h=h, m=m, rho=rho, rad_s=rad_s, V=V, cs=cs, body_id=b_id, name="cube") return [fluid, tank, cube]
def create_particles(self): """Create the circular patch of fluid.""" # xf, yf = create_fluid_with_solid_cube() xf, yf = create_fluid() uf = np.zeros_like(xf) vf = np.zeros_like(xf) m = initialize_mass(xf, yf) rho = initialize_density_fluid(xf, yf) h = np.ones_like(xf) * self.hdx * self.dx fluid = get_particle_array_wcsph(x=xf, y=yf, h=h, m=m, rho=rho, u=uf, v=vf, name="fluid") xt, yt = create_boundary(self.dx / 2.) ut = np.zeros_like(xt) vt = np.zeros_like(xt) m = np.ones_like(xt) * 1500 * self.dx * self.dx rho = np.ones_like(xt) * 1000 h = np.ones_like(xt) * self.hdx * self.dx / 2. tank = get_particle_array_wcsph(x=xt, y=yt, h=h, m=m, rho=rho, u=ut, v=vt, name="tank") xc, yc, indices = create_cube() _m = 2120 * self.dx * self.dx / 2. m = np.ones_like(xc) * _m h = np.ones_like(xc) * self.hdx * self.dx / 2. rho = np.ones_like(xc) * 2120 cube = get_particle_array_rigid_body(name="cube", x=xc, y=yc, m=m, h=h, rho=rho) add_properties(cube, 'indices') cube.indices[:] = indices[:] add_properties(cube, 'rad_s') cube.rad_s[:] = 0.5 * 1e-3 add_properties( cube, 'tang_disp_x', 'tang_disp_y', 'tang_disp_z', 'tang_disp_x0', 'tang_disp_y0', 'tang_disp_z0', 'tang_velocity_x', 'tang_velocity_y', 'tang_velocity_z', ) return [fluid, tank, cube]
def create_particles(self): # get the geometry xt, yt, xf, yf = get_fluid_and_dam_geometry( self.dam_length, self.dam_height, self.fluid_length, self.fluid_height, self.dam_layers, self.dam_spacing, self.fluid_spacing, [3 * self.dam_spacing, 3 * self.dam_spacing]) # create fluid particle array m = self.fluid_rho * self.fluid_spacing * self.fluid_spacing rho = self.fluid_rho h = self.hdx * self.fluid_spacing fluid = get_particle_array_wcsph(x=xf, y=yf, h=h, m=m, rho=rho, name="fluid") # create tank particle array m = self.fluid_rho * self.dam_spacing * self.dam_spacing rho = 1000 rad_s = self.dam_spacing / 2. h = self.hdx * self.dam_spacing V = self.dam_spacing**2 tank = get_particle_array_wcsph(x=xt, y=yt, h=h, m=m, rho=rho, rad_s=rad_s, V=V, name="tank") for name in ['fx', 'fy', 'fz']: tank.add_property(name) xc, yc = create_ten_circles(radius=self.sphere_radius, spacing=self.sphere_spacing, fluid_height=self.fluid_height) # get density of each sphere rho = get_rho_of_each_sphere(xc, yc, radius=self.sphere_radius, spacing=self.sphere_spacing) # get bodyid for each sphere body_id = get_body_id_of_each_sphere(xc, yc, radius=self.sphere_radius, spacing=self.sphere_spacing) m = rho * self.sphere_spacing**2 h = self.hdx * self.sphere_spacing rad_s = self.sphere_spacing / 2. V = self.sphere_spacing**2 cs = 0.0 cube = get_particle_array_rigid_body(x=xc, y=yc, h=h, m=m, rho=rho, rad_s=rad_s, V=V, cs=cs, body_id=body_id, name="cube") return [fluid, tank, cube]
def create_particles(self): """Create the circular patch of fluid.""" # xf, yf = create_fluid_with_solid_cube() xf, yf = create_fluid() rho = get_density(yf) m = rho[:] * self.dx * self.dx rho = np.ones_like(xf) * self.ro h = np.ones_like(xf) * self.hdx * self.dx fluid = get_particle_array_wcsph(x=xf, y=yf, h=h, m=m, rho=rho, name="fluid") xt, yt = create_boundary() m = np.ones_like(xt) * 1000 * self.dx * self.dx rho = np.ones_like(xt) * 1000 h = np.ones_like(xt) * self.hdx * self.dx rad_s = np.ones_like(xt) * 2 / 2. * 1e-3 tank = get_particle_array_wcsph(x=xt, y=yt, h=h, m=m, rho=rho, name="tank", rad_s=rad_s) dx = 1 xc, yc = create_cube(1) m = np.ones_like(xc) * 2120 * dx * 1e-3 * dx * 1e-3 rho = np.ones_like(xc) * 2120 h = np.ones_like(xc) * self.hdx * self.dx rad_s = np.ones_like(xc) * dx / 2. * 1e-3 cube = get_particle_array_rigid_body(x=xc, y=yc, h=h, m=m, rho=rho, rad_s=rad_s, name="cube") return [fluid, tank, cube]
def get_inner_core_particles(): x, y, z = numpy.mgrid[ -r:r:dx, -r:r:dx, -0.002:0.002: dx] # -r is the start point; r is the end point of the vector; dx is step # We get 1-D array using ravel() function x = x.ravel() y = y.ravel() z = z.ravel() d = (x * x + y * y + z * z) keep = numpy.flatnonzero( d <= r * r) # this function returns the index of non-zero elements of the array x = x[keep] y = y[keep] z = z[keep] print('%d inner_core particles' % len(x)) hf = numpy.ones_like(x) * h mf = numpy.ones_like(x) * dx * dy * dz * ro2 rhof = numpy.ones_like(x) * ro2 csf = numpy.ones_like(x) * cs2 u = numpy.ones_like(x) * v_s inner_core = get_particle_array_rigid_body(name="inner_core", x=x, y=y, z=z, h=hf, m=mf, rho=rhof, cs=csf, u=u) return inner_core
def create_particles(self): fluid, boundary = self.geom.create_particles() vtl_filename = 'thor.vtk' x, y, z = vtk_file_to_points(vtl_filename, cell_centers=False) # clarification of .stl position difference_x = min(x) #difference_y = min(y) x -= difference_x #y -= difference_y x += 7 z+=1 fluid.z += cloud_height # location of fluid column m = np.ones_like(x)*fluid.m[0] h = np.ones_like(x)*fluid.h[0] rho = np.ones_like(x)*fluid.rho[0] obstacle = get_particle_array_rigid_body( name='obstacle', x=x, y=y, z=z, m=m, h=h, rho=rho, rho0=rho ) obstacle.total_mass[0] = np.sum(m) obstacle.add_property('cs') obstacle.add_property('arho') obstacle.set_lb_props(list(obstacle.properties.keys())) obstacle.set_output_arrays( ['x', 'y', 'z', 'u', 'v', 'w', 'fx', 'fy', 'fz', 'rho', 'm', 'h', 'p', 'tag', 'pid', 'gid'] ) boundary.add_property('V') boundary.add_property('fx') boundary.add_property('fy') boundary.add_property('fz') return [fluid, boundary, obstacle]
def create_particles(self): nx, ny, nz = 10, 10, 10 dx = 1.0 / (nx - 1) x, y, z = np.mgrid[0:1:nx * 1j, 0:1:ny * 1j, 0:1:nz * 1j] x = x.flat y = y.flat z = z.flat m = np.ones_like(x) * dx * dx * rho0 h = np.ones_like(x) * hdx * dx body = get_particle_array_rigid_body( name='body', x=x, y=y, z=z, h=h, m=m, ) body.omega[0] = 5.0 body.omega[1] = 5.0 body.vc[0] = 1.0 body.vc[1] = 1.0 return [body]
def get_wavespaddle_geometry(hdx=1.5, dx_f=0.1, dx_s=0.05, r_f=100., r_s=100., length=3.75, height=0.3, flat_l=1., angle=4.2364, h_fluid=0.2, obstacle_side=0.06): x1, y1, x2, y2 = get_beach_geometry_2d(dx_s, length, height, flat_l, angle, 3) r1 = np.ones_like(x1) * r_s m1 = r1 * dx_s * dx_s h1 = np.ones_like(x1) * hdx * dx_s cs1 = np.zeros_like(x1) rad1 = np.ones_like(x1) * dx_s wall = get_particle_array(name='wall', x=x1, y=y1, rho=r1, m=m1, h=h1, cs=cs1, rad_s=rad1) r2 = np.ones_like(x2) * r_s m2 = r2 * dx_s * dx_s h2 = np.ones_like(x2) * hdx * dx_s paddle = get_particle_array(name='paddle', x=x2, y=y2, rho=r2, m=m2, h=h2) fluid_center = np.array([flat_l - length / 2.0, h_fluid / 2.0]) x_fluid, y_fluid = get_2d_block(dx_f, length, h_fluid, fluid_center) x3 = [] y3 = [] theta = np.pi * angle / 180.0 for i, xi in enumerate(x_fluid): if y_fluid[i] >= np.tan(-theta) * xi: x3.append(xi) y3.append(y_fluid[i]) x3 = np.array(x3) y3 = np.array(y3) r3 = np.ones_like(x3) * r_f m3 = r3 * dx_f * dx_f h3 = np.ones_like(x3) * hdx * dx_f cs3 = np.zeros_like(x3) rad3 = np.ones_like(x3) * dx_f fluid = get_particle_array(name='fluid', x=x3, y=y3, rho=r3, m=m3, h=h3) square_center = np.array([-0.38, 0.16]) x4, y4 = get_2d_block(dx_s, obstacle_side, obstacle_side, square_center) b1 = np.zeros_like(x4, dtype=int) square_center = np.array([-0.7, 0.16]) x5, y5 = get_2d_block(dx_s, obstacle_side, obstacle_side, square_center) b2 = np.ones_like(x5, dtype=int) square_center = np.array([-1.56, 0.22]) x6, y6 = get_2d_block(dx_s, obstacle_side, obstacle_side, square_center) b3 = np.ones_like(x5, dtype=int) * 2 b = np.concatenate([b1, b2, b3]) x4 = np.concatenate([x4, x5, x6]) y4 = np.concatenate([y4, y5, y6]) r4 = np.ones_like(x4) * r_s * 0.5 m4 = r4 * dx_s * dx_s h4 = np.ones_like(x4) * hdx * dx_s cs4 = np.zeros_like(x4) rad4 = np.ones_like(x4) * dx_s obstacle = get_particle_array_rigid_body(name='obstacle', x=x4, y=y4, h=h4, rho=r4, m=m4, cs=cs4, rad_s=rad4, body_id=b) remove_overlap_particles(fluid, wall, dx_s, 2) remove_overlap_particles(fluid, paddle, dx_s, 2) remove_overlap_particles(fluid, obstacle, dx_s, 2) return fluid, wall, paddle, obstacle
def create_particles(self): # create Container nx, ny = 500, 500 dx = 1.0 / (nx -1) x, y, z = numpy.mgrid[-1:27:nx*1j, -1:27:ny*1j, 0:1:1j] interior = ((x > 0) & (x < 26)) & (y > 0) container = numpy.logical_not(interior) x = x[container].flat y = y[container].flat z = z[container].flat container_m = numpy.ones_like(x) * self.container_rho * dx * dx container_h = numpy.ones_like(x) * self.hdx * dx container = get_particle_array_rigid_body(name = 'container' , x = x, y = y , z = z , m = container_m, h = container_h ) container.total_mass[0] = numpy.sum(container_m) # Create Cylinder Arrays r = 0.5 nx , ny = 15 , 15 dx = 1.0 / (nx - 1) _x, _y, _z = make_sphere_2d(dx) _id = numpy.ones_like(_x,dtype=int) n_sphere_particles = len(_x) disp = [] for layer in range(self.nCylinder_layers): yc = layer + r if layer % 2 == 0: for i in range(1): xc = i + r disp.append((xc, yc, 0.0)) else: for i in range(5): xc = i + 2*r disp.append((xc, yc, 0.0)) x, y, z, body_id = [], [], [], [] for i, d in enumerate(disp): x.append(_x + d[0]) y.append(_y + d[1]) z.append(_z + d[2]) body_id.append(_id * i ) x = numpy.concatenate(x) y = numpy.concatenate(y) z = numpy.concatenate(z) body_id = numpy.concatenate(body_id) m = numpy.ones_like(x) * self._cylinder_mass()/n_sphere_particles h = numpy.ones_like(x) * self.hdx * 1.0 / (n_sphere_particles - 1) cylinder = get_particle_array_rigid_body(name='cylinder', x=x, y=y, z=z, m=m, h=h, body_id=body_id ) return [cylinder, container]
def create_particles(self): '''Creates the Container and the Cylinder stack particle arrays. The Dimensions ''' # create Container nx, ny = 700, 700 dx = 1.0 / (nx -1) x, y, z = numpy.mgrid[-1:27:nx*1j, -1:27:ny*1j, 0:1:1j] interior = ((x > 0) & (x < 26)) & (y > 0) container = numpy.logical_not(interior) x = x[container].flat y = y[container].flat z = z[container].flat #x1,y1,z1 = numpy.mgrid[-1:0:100j,-1:26:200j,0:1:1j] #x2,y2,z2 = numpy.mgrid[0:26:200j,-1:0:100j,0:1:1j] #x3,y3,z3 = numpy.mgrid[26:27:100j,-1:26:200j,0:1:1j] #x = numpy.concatenate((x1.flat,x2.flat,x3.flat),axis=0) #y = numpy.concatenate((y1.flat,y2.flat,y3.flat),axis=0) #z = numpy.concatenate((z1.flat,z2.flat,z3.flat),axis=0) container_m = numpy.ones_like(x) * self.container_rho * dx * dx container_h = numpy.ones_like(x) * self.hdx *5* dx E = numpy.ones_like(x)*30e4 nu = numpy.ones_like(x)*0.3 mu = numpy.ones_like(x)*0.45 cm = numpy.asarray([13.0,26.0/3.0,0.0]*len(x)) body_id = numpy.ones_like(x,dtype='int32')*33 constants = {'E':E,'nu':nu,'mu':mu,'cm':cm} container = get_particle_array_rigid_body(name='container',x=x,y=y,z=z, m=container_m,h=container_h,constants=constants,body_id=body_id) container.total_mass[0] = numpy.sum(container_m) # Create Cylinder Arrays r = 0.5 nx , ny = 20, 20 dx = 1.0 / (nx - 1) _x, _y, _z = make_2dCyl(dx) _id = numpy.ones_like(_x,dtype=int) n_sphere_particles = len(_x) disp = [] for layer in range(self.nCylinder_layers): yc = layer + r if layer % 2 == 0: for i in range(6): xc = i + r disp.append((xc, yc, 0.0)) else: for i in range(5): xc = i + 2*r disp.append((xc, yc, 0.0)) self.disp = disp x, y, z, body_id, cm = [], [], [], [], [] for i, d in enumerate(disp): x.append(_x + d[0]) y.append(_y + d[1]) z.append(_z + d[2]) body_id.append(_id * i ) cm += list(len(_x)*d) x = numpy.concatenate(x) y = numpy.concatenate(y) z = numpy.concatenate(z) body_id = numpy.concatenate(body_id) m = numpy.ones_like(x) * self._cylinder_mass()/n_sphere_particles h = numpy.ones_like(x) * self.hdx * 1.0 / (n_sphere_particles - 1) E = numpy.ones_like(x) * 69e5 nu = numpy.ones_like(x) * 0.3 mu = numpy.ones_like(x) * 0.45 Fx = numpy.zeros(33) Fy = numpy.zeros(33) Fz = numpy.zeros(33) checkBit = numpy.zeros(33,dtype="int32") Fmag = numpy.zeros(33) constants = {'E':E, 'nu':nu, 'mu':mu,'cm':cm,'Fx':Fx,'Fy':Fy,'Fz':Fz, 'check_bit':checkBit,'Fmag':Fmag} cylinder = get_particle_array_rigid_body(name='cylinder',x=x,y=y,z=z, m=m,h=h,body_id=body_id,constants=constants) cylinder.total_mass = numpy.asarray(len(disp)*[self._cylinder_mass()]) #cylinder.vc[1::3]=-100.0 return [cylinder, container]
def create_particles(self): """Create the circular patch of fluid.""" # xf, yf = create_fluid_with_solid_cube() xf, yf = create_fluid() rho = get_density(yf) m = rho[:] * self.dx * self.dx rho = np.ones_like(xf) * self.ro h = np.ones_like(xf) * self.hdx * self.dx fluid = get_particle_array_wcsph(x=xf, y=yf, h=h, m=m, rho=rho, name="fluid") xt, yt = create_big_boundary() m = np.ones_like(xt) * 1000 * self.dx * self.dx rho = np.ones_like(xt) * 1000 rad_s = np.ones_like(xt) * 2 / 2. * 1e-3 h = np.ones_like(xt) * self.hdx * self.dx big_tank = get_particle_array_wcsph(x=xt, y=yt, h=h, m=m, rho=rho, rad_s=rad_s, name="big_tank") dx = 1 xc, yc = create_inside_cube() m = np.ones_like(xc) * self.solid_rho * dx * 1e-3 * dx * 1e-3 rho = np.ones_like(xc) * self.solid_rho h = np.ones_like(xc) * self.hdx * self.dx rad_s = np.ones_like(xc) * dx / 2. * 1e-3 # add cs property to run the simulation cs = np.zeros_like(xc) cube = get_particle_array_rigid_body(x=xc, y=yc, h=h, m=m, rho=rho, rad_s=rad_s, cs=cs, name="cube") dx = 1 xc, yc = create_outside_cube() yc = yc + 0.04 xc = xc + 0.02 m = np.ones_like(xc) * self.wood_rho * dx * 1e-3 * dx * 1e-3 rho = np.ones_like(xc) * self.wood_rho h = np.ones_like(xc) * self.hdx * self.dx rad_s = np.ones_like(xc) * dx / 2. * 1e-3 # add cs property to run the simulation cs = np.zeros_like(xc) wood = get_particle_array_rigid_body(x=xc, y=yc, h=h, m=m, rho=rho, rad_s=rad_s, cs=cs, name="wood") xt, yt = create_small_boundary() m = np.ones_like(xt) * 1000 * self.dx * self.dx rho = np.ones_like(xt) * 1000 rad_s = np.ones_like(xt) * 2 / 2. * 1e-3 h = np.ones_like(xt) * self.hdx * self.dx cs = np.zeros_like(xt) small_tank = get_particle_array_rigid_body(x=xt, y=yt, h=h, m=m, rho=rho, rad_s=rad_s, cs=cs, name="small_tank") xc, yc = create_outside_cube() yc = yc + 0.15 m = np.ones_like(xc) * self.wood_rho * dx * 1e-3 * dx * 1e-3 rho = np.ones_like(xc) * self.wood_rho h = np.ones_like(xc) * self.hdx * self.dx rad_s = np.ones_like(xc) * dx / 2. * 1e-3 # add cs property to run the simulation cs = np.zeros_like(xc) outside = get_particle_array_rigid_body(x=xc, y=yc, h=h, m=m, rho=rho, rad_s=rad_s, cs=cs, name="outside") return [fluid, big_tank, small_tank, cube, wood, outside]
def create_particles(self): """Create particle arrays for fluis, ellipsiod and walls.""" # General box _x = np.arange(-self.L / 2 + self.dx / 2, self.L / 2 + self.dx / 2, self.dx) _y = np.arange(-self.L / 2 + self.dx / 2, self.L / 2 + self.dx / 2, self.dx) _z = np.arange(-self.L / 4 + self.dx / 2, self.L / 4 + self.dx / 2, self.dx) x, y, z = np.meshgrid(_x, _y, _z) xf = x.ravel() yf = y.ravel() zf = z.ravel() # Determine the size of dummy region ghost_extend = 3 * self.dx # Create the wall particles at the top _y = np.linspace(self.L / 2 + self.dx / 2, self.L / 2 - self.dx / 2 + ghost_extend, 3) x, y, z = np.meshgrid(_x, _y, _z) xt = x.ravel() yt = y.ravel() zt = z.ravel() # Create the wall particles at the bottom _y = np.linspace(-self.L / 2 + self.dx / 2 - ghost_extend, -self.L / 2 - self.dx / 2, 3) x, y, z = np.meshgrid(_x, _y, _z) xb = x.ravel() yb = y.ravel() zb = z.ravel() # Concatenate the top and bottom arrays xw = np.concatenate((xt, xb)) yw = np.concatenate((yt, yb)) zw = np.concatenate((zt, zb)) # Create particle array for fluid m = self.rho * self.dx**3 h = self.hdx * self.dx rad_s = self.dx / 2 V = self.dx**3 cs = 0.0 fluid = get_particle_array_wcsph(x=xf, y=yf, z=zf, h=h, m=m, rho=self.rho, name="fluid") # Create particle array for walls walls = get_particle_array_wcsph(x=xw, y=yw, z=zw, h=h, m=m, rho=self.rho, rad_s=rad_s, V=V, name="walls") for name in ['fx', 'fy', 'fz']: walls.add_property(name) # Create particle array for ellipsoid cond = (((xf / (self.L / 12))**2 + (yf / (self.L / 4))**2 + (zf / (self.L / 12))**2) <= 1.0) xe, ye, ze = xf[cond], yf[cond], zf[cond] ellipsoid = get_particle_array_rigid_body(x=xe, y=ye, z=ze, h=h, m=m, rho=self.rho, rad_s=rad_s, V=V, cs=cs, body_id=0, name="ellipsoid") ellipsoid.total_mass[0] = np.sum(m) ellipsoid.add_property('cs') ellipsoid.add_property('arho') ellipsoid.set_lb_props(list(ellipsoid.properties.keys())) ellipsoid.set_output_arrays([ 'x', 'y', 'z', 'u', 'v', 'w', 'fx', 'fy', 'fz', 'rho', 'm', 'h', 'p', 'tag', 'pid', 'gid' ]) fluid.remove_particles([i for i, c in enumerate(cond) if c]) fluid.u[:] = fluid.y[:] ellipsoid.u[:] = ellipsoid.y[:] walls.u[:] = walls.y[:] print( fluid.get_number_of_particles(), walls.get_number_of_particles(), ellipsoid.get_number_of_particles(), ) return [fluid, walls, ellipsoid]
def create_particles(self): # get coordinates of tank and fluid tank_len = 150 tank_hei = 150 tank_dep = 150 layers = 2 flu_len = 150 - 2 * layers * self._spacing flu_hei = 52 flu_dep = 150 - 2 * layers * self._spacing xt, yt, zt, xf, yf, zf = get_fluid_and_dam_geometry_3d( d_l=tank_len, d_h=tank_hei, d_d=tank_dep, f_l=flu_len, f_h=flu_hei, f_d=flu_dep, d_layers=2, d_dx=self._spacing, f_dx=self._spacing) # scale it to mm xt, yt, zt, xf, yf, zf = (xt * 1e-3, yt * 1e-3, zt * 1e-3, xf * 1e-3, yf * 1e-3, zf * 1e-3) # get coordinates of cube xc, yc, zc = get_3d_block(20, 20, 20, self._spacing / 2.) xc1, yc1, zc1 = ((xc + 60) * 1e-3, (yc + 120) * 1e-3, (zc + 70) * 1e-3) xc2, yc2, zc2 = ((xc + 4 * self._spacing) * 1e-3, (yc + 120) * 1e-3, (zc + 70) * 1e-3) xc3, yc3, zc3 = ((xc + 100) * 1e-3, (yc + 120) * 1e-3, (zc + 70) * 1e-3) xc, yc, zc = (np.concatenate( (xc1, xc2, xc3)), np.concatenate( (yc1, yc2, yc3)), np.concatenate((zc1, zc2, zc3))) # Create particle array for fluid m = self.ro * self.spacing * self.spacing * self.spacing rho = self.ro h = self.hdx * self.spacing fluid = get_particle_array_wcsph(x=xf, y=yf, z=zf, h=h, m=m, rho=rho, name="fluid") # Create particle array for tank m = 1000 * self.spacing**3 rho = 1000 rad_s = self.spacing / 2. h = self.hdx * self.spacing V = self.spacing**3 tank = get_particle_array_wcsph(x=xt, y=yt, z=zt, h=h, m=m, rho=rho, rad_s=rad_s, V=V, name="tank") for name in ['fx', 'fy', 'fz']: tank.add_property(name) # Create particle array for cube h = self.hdx * self.spacing / 2. # assign density of three spheres rho1 = np.ones_like(xc1) * 2000 rho2 = np.ones_like(xc1) * 800 rho3 = np.ones_like(xc1) * 500 rho = np.concatenate((rho1, rho2, rho3)) # assign body id's body1 = np.ones_like(xc1, dtype=int) * 0 body2 = np.ones_like(xc1, dtype=int) * 1 body3 = np.ones_like(xc1, dtype=int) * 2 body = np.concatenate((body1, body2, body3)) m = rho * (self.spacing / 2.)**3 rad_s = self.spacing / 4. V = (self.spacing / 2.)**3 cs = 0.0 cube = get_particle_array_rigid_body(x=xc, y=yc, z=zc, h=h, m=m, rho=rho, rad_s=rad_s, V=V, cs=cs, body_id=body, name="cube") print( fluid.get_number_of_particles(), tank.get_number_of_particles(), cube.get_number_of_particles(), ) return [fluid, tank, cube]
def create_particles(self): # get both particle array positions # xf, yf, zf, xt, yt, zt = create_hydrostatic_tank(1, 1, 1, 0.01, 2) """Create the circular patch of fluid.""" # xf, yf = create_fluid_with_solid_cube() tank1 = get_tank(length=140 * 1e-3, breadth=140 * 1e-3, height=140 * 1e-3, spacing=3 * 1e-3, layers=2, dim=dim) xt, yt, zt = tank1.get_xyz() ut = np.zeros_like(xt) vt = np.zeros_like(xt) wt = np.zeros_like(xt) m = np.ones_like(xt) * 1500 * tank1.spacing**dim rho = np.ones_like(xt) * 1000 h = np.ones_like(xt) * self.hdx * tank1.spacing rad_s = np.ones_like(xt) * tank1.spacing / 2.0 tank = get_particle_array_wcsph(x=xt, y=yt, z=zt, h=h, m=m, rho=rho, u=ut, v=vt, w=wt, rad_s=rad_s, name="tank") fluid1 = get_fluid(length=140 * 1e-3, breadth=140 * 1e-3, height=100 * 1e-3, spacing=6 * 1e-3, dim=dim) fluid1.trim_tank(tank1) xf, yf, zf = fluid1.get_xyz() uf = np.zeros_like(xf) vf = np.zeros_like(xf) wf = np.zeros_like(xf) rho = np.ones_like(xf) * 1000 m = np.ones_like(xf) * fluid1.spacing**dim * 1000 h = np.ones_like(xf) * self.hdx * fluid1.spacing fluid = get_particle_array_wcsph(x=xf, y=yf, z=zf, h=h, m=m, rho=rho, u=uf, v=vf, w=wf, name="fluid") cube1 = get_cube(length=20 * 1e-3, breadth=20 * 1e-3, height=20 * 1e-3, spacing=3 * 1e-3, left=(60 * 1e-3, 60 * 1e-3, 100 * 1e-3), dim=dim) xb, yb, zb = cube1.get_xyz() ub = np.zeros_like(xb) vb = np.zeros_like(xb) wb = np.zeros_like(xb) rho = np.ones_like(xb) * self.solid_rho m = np.ones_like(xb) * cube1.spacing**dim * self.solid_rho h = np.ones_like(xb) * self.hdx * cube1.spacing cs = np.zeros_like(xb) rad_s = np.ones_like(xb) * cube1.spacing / 2.0 cube = get_particle_array_rigid_body(x=xb, y=yb, z=zb, h=h, m=m, rho=rho, rad_s=rad_s, cs=cs, u=ub, v=vb, w=wb, name="cube") return [fluid, tank, cube]
def create_particles(self): side = 0.1 _x = np.arange(Lx * 0.5 - side, Lx * 0.5 + side, dx) _y = np.arange(0.8, 0.8 + side * 2, dx) x, y = np.meshgrid(_x, _y) x = x.ravel() y = y.ravel() x += 0.25 m = np.ones_like(x) * dx * dx * rho_block h = np.ones_like(x) * hdx * dx rho = np.ones_like(x) * rho_block block = get_particle_array_rigid_body(name='block', x=x, y=y, h=h, m=m, rho=rho) block.total_mass[0] = np.sum(m) block.vc[0] = 1.0 # create all the particles _x = np.arange(-ghost_extent, Lx + ghost_extent, dx) _y = np.arange(-ghost_extent, Ly, dx) x, y = np.meshgrid(_x, _y) x = x.ravel() y = y.ravel() # sort out the fluid and the solid indices = [] for i in range(x.size): if ((x[i] > 0.0) and (x[i] < Lx)): if ((y[i] > 0.0) and (y[i] < H)): indices.append(i) # create the arrays solid = gpa(name='solid', x=x, y=y) # remove the fluid particles from the solid fluid = solid.extract_particles(indices) fluid.set_name('fluid') solid.remove_particles(indices) # remove the lid to generate an open tank indices = [] for i in range(solid.get_number_of_particles()): if solid.y[i] > H: if (0 < solid.x[i] < Lx): indices.append(i) solid.remove_particles(indices) print("Hydrostatic tank :: nfluid = %d, nsolid=%d, dt = %g" % (fluid.get_number_of_particles(), solid.get_number_of_particles(), dt)) ###### ADD PARTICLE PROPS SPH ###### for prop in ('arho', 'cs', 'V', 'fx', 'fy', 'fz'): solid.add_property(prop) block.add_property(prop) ##### INITIALIZE PARTICLE PROPS ##### fluid.rho[:] = rho0 solid.rho[:] = rho0 fluid.rho0[:] = rho0 solid.rho0[:] = rho0 # mass is set to get the reference density of rho0 volume = dx * dx fluid.m[:] = volume * rho0 solid.m[:] = volume * rho0 # smoothing lengths fluid.h[:] = hdx * dx solid.h[:] = hdx * dx # return the particle list return [fluid, solid, block]
def create_particles(self): # xb, yb, body_id = single_layer() # xb, yb, body_id = two_spheres() # xb, yb, body_id = create_six_layers() xb, yb, _rad = create_ball(0.5 * 1e-2, 1.6 * 1e-2, 0.5 * 1e-2, points) yb = yb + 0.08 body_id = np.zeros_like(xb, dtype=int) x, y, _rad = create_ball(0.5 * 1e-2, 1.6 * 1e-2, 0.5 * 1e-2, points) _m = np.pi * _rad * _rad * 2120 m = np.ones_like(xb) * _m h = np.ones_like(xb) * hdx * self.rad * 2 rho = np.ones_like(xb) * 2120 rad_s = np.ones_like(xb) * _rad ball = get_particle_array_rigid_body(name='ball', x=xb, y=yb, h=h, rho=rho, m=m, rad_s=rad_s, body_id=body_id) dx = 1 * 1e-3 xt, yt = create_boundary() _m = np.pi * 1000 * dx * dx m = np.ones_like(xt) * _m rho = np.ones_like(xt) * 1000 h = np.ones_like(xt) * hdx * dx wall = get_particle_array_wcsph( name='wall', x=xt, y=yt, h=h, rho=rho, m=m, ) add_properties(wall, 'rad_s') wall.rad_s[:] = (dx / 2.) xtw, ytw = create_temp_wall() m = np.ones_like(xtw) * _m h = np.ones_like(xtw) * hdx * dx rho = np.ones_like(xtw) * 1000 temp_wall = get_particle_array_wcsph( name='temp_wall', x=xtw, y=ytw, rho=rho, h=h, m=m, ) add_properties(temp_wall, 'rad_s') temp_wall.rad_s[:] = (dx / 2.) xf, yf = create_fluid() rho = np.ones_like(xf) * 1000 m = rho[:] * dx * dx h = np.ones_like(xf) * hdx * dx fluid = get_particle_array_wcsph(x=xf, y=yf, h=h, m=m, rho=rho, name="fluid") return [ball, wall, temp_wall, fluid]