1- from pyCubbyFlow import * # lgtm [py/polluting-import]
1+ from pyCubbyFlow import (
2+ APICSolver3 ,
3+ FDMMGPCGSolver3 ,
4+ Frame ,
5+ GridFractionalSinglePhasePressureSolver3 ,
6+ Logging ,
7+ RigidBodyCollider3 ,
8+ Sphere3 ,
9+ VolumeParticleEmitter3 ,
10+ )
211import numpy as np
312import matplotlib .pyplot as plt
413import matplotlib .animation as animation
@@ -18,8 +27,7 @@ def main():
1827
1928 # Setup emitter
2029 sphere = Sphere3 (center = (0.5 , 1.0 , 0.5 ), radius = 0.15 )
21- emitter = VolumeParticleEmitter3 (
22- implicitSurface = sphere , spacing = 1.0 / (2 * resX ))
30+ emitter = VolumeParticleEmitter3 (implicitSurface = sphere , spacing = 1.0 / (2 * resX ))
2331 solver .particleEmitter = emitter
2432
2533 # Setup collider
@@ -30,8 +38,10 @@ def main():
3038 # Visualization
3139 fig = plt .figure (figsize = (3 , 6 ))
3240 ax = fig .add_axes ([0 , 0 , 1 , 1 ], frameon = False )
33- ax .set_xlim (0 , 1 ), ax .set_xticks ([])
34- ax .set_ylim (0 , 2 ), ax .set_yticks ([])
41+ ax .set_xlim (0 , 1 )
42+ ax .set_xticks ([])
43+ ax .set_ylim (0 , 2 )
44+ ax .set_yticks ([])
3545
3646 # Make first frame
3747 frame = Frame (0 , 1.0 / ANIM_FPS )
@@ -48,13 +58,14 @@ def updateFig(*args):
4858 frame .Advance ()
4959 pos = np .array (solver .particleSystemData .positions , copy = False )
5060 scat .set_offsets (np .vstack ((pos [:, 0 ], pos [:, 1 ])).transpose ())
51- return scat ,
61+ return ( scat ,)
5262
53- animation .FuncAnimation (fig , updateFig , frames = ANIM_NUM_FRAMES ,
54- interval = 1 , blit = True )
63+ animation .FuncAnimation (
64+ fig , updateFig , frames = ANIM_NUM_FRAMES , interval = 1 , blit = True
65+ )
5566 plt .show ()
5667
5768
58- if __name__ == ' __main__' :
69+ if __name__ == " __main__" :
5970 Logging .Mute ()
6071 main ()
0 commit comments