Ejemplo n.º 1
0
 def simulate(centers):
     world = World()
     fluid = world.add(Fluid(Domain(x=5,
                                    y=4,
                                    boundaries=CLOSED,
                                    bounds=Box(0, [40, 32])),
                             buoyancy_factor=0.1,
                             batch_size=centers.shape[0]),
                       physics=IncompressibleFlow())
     world.add(Inflow(Sphere(center=centers, radius=3), rate=0.2))
     world.add(
         Fan(Sphere(center=centers, radius=5), acceleration=[1.0, 0]))
     world.step(dt=1.5)
     world.step(dt=1.5)
     world.step(dt=1.5)
     assert not math.close(fluid.density.values, 0)
     print()
     return fluid.density.values.batch[0], fluid.velocity.values.batch[
         0]
Ejemplo n.º 2
0
 def test_properties_dict(self):
     world = World()
     world.add(Fluid(Domain(x=16, y=16)), physics=IncompressibleFlow())
     world.add(Inflow(Sphere((8, 8), radius=4)))
     world.add(Fan(Sphere((10, 8), 5), [-1, 0]))
     struct.properties_dict(world.state)