Jump to content

Attempt to speed up smoke sim by writing out collision sdf


mikelyndon

Recommended Posts

Hey guys,

So I've posted this on SESI but after 3 days I'm not getting any responses. Hopefully someone here can help me figure this one out.

I'm in the process of creating a smoke sim that interacts with a lot of rbd objects. Now the simulation for the rbd objects has been approved and therefore the animation of the objects has been written out and will always be the same when making changes to the smoke sim. Because there are so many object a lot of time is spent on each frame calculating the collision sdf. At least 50% of sim time for each frame is spent on calculating this data. I'm still in the process of tweaking the smoke sim but every time I run the sim it has to recalculate the collision sdf. So my theory is to run the simulation once to write out the collision data and then read that data back in for all subsequent simulations in order to speed up the iteration process. But for some reason the sim takes the same amount of time and sometimes longer when I read in the data from a file. If someone could explain why this is so I would be extremely grateful.

Below are some numbers for running the sim without writing out data. I limited the performance filter to only highlight items that take longer than a second.

4.57 sec solve smoke/Solver/t_tempsubstep_pyrosolver1_multisolver1_1/buildcollisionmask_pyrosolver1_multisolver1_1_pyrosolver1_t_tempsubstep_3_pyrosolver1_collisions_0 (GAS_BuildCollisionMask)

2.80 sec solve smoke/Solver/t_tempsubstep_pyrosolver1_multisolver1_1/project_1_pyrosolver1_multisolver1_1_pyrosolver1_t_tempsubstep_10_pyrosolver1_velocity_project_1_pyrosolver1_merge1_0 (GAS_ProjectNonDivergent)

0.00 ms 5912 port foreground (persp1)

(434 hidden events)

End Frame 2: 9.30 sec 0.11 Hz

Unaccounted Time: 66.56 ms

Average of 812: 1.36 sec 0.74 Hz

The numbers below show the sim when I read in the collision and collisionvel fields from disk.

Start Frame 2:

5.61 sec solve smoke/Solver/t_tempsubstep_pyrosolver1_multisolver1_1/project_1_pyrosolver1_multisolver1_1_pyrosolver1_t_tempsubstep_10_pyrosolver1_velocity_project_1_pyrosolver1_merge1_0 (GAS_ProjectNonDivergent)

0.00 ms 5943 port foreground (persp1)

(402 hidden events)

End Frame 2: 9.39 sec 0.11 Hz

Unaccounted Time: 86.85 ms

Average of 820: 1.52 sec 0.66 Hz

And in case you want to look at my file I've attached an example.

Thanks in advance for any help or ideas.

Mike

save_collision.hipnc

Link to comment
Share on other sites

I'll have a look at your file in a bit...

Collisions are slow and often don't give you the look that you want.

I normally use a point cloud lookup of the velocity in a gasfield vop : vel_pcl.hip

no need to create sdf or volumes :)

- note : the [$FF] in the pointcloud file name is a bit buggy and sometime doesn't reload the file. to fix this, change the filename in the gasfield vop then set the same name in the sop output.

Edited by bunker
  • Like 1
Link to comment
Share on other sites

Hey guys,

Thanks for the responses.

The reason I'm not using the file mode in the collisions > volume tab is because the smoke and pyro solvers create their own sdf's for the sim. The sdf created in the rbd object node is ignored. I spent almost half a day playing with those exact same settings before I figured that out. :)

Bunker, I've had a look at your setup. It's quite a nice way to avoid creating the sdf all together but I found the sim times to be almost identical but the point cloud solution doesn't handle small object to well in that the force applied to the smoke looks more like one big object rather than smaller objects.

I'm still busy doing some tests and I'll post some videos later to show the difference between each solution.

I think I've discovered where my method is falling short. It has to do with creating the divergence and pressure fields. If I can figure out how to write these two fields out and correctly read them back in, it might just work. But I have a feeling those two fields need to change if I make changes to any of the smoke settings.

Link to comment
Share on other sites

The reason I'm not using the file mode in the collisions > volume tab is because the smoke and pyro solvers create their own sdf's for the sim. The sdf created in the rbd object node is ignored.

How about the one in the Source Apply node that gets automatically added in a pyro setup from the shelf tools? You can save it from there too. Sorry, perhaps I misunderstand you somewhere.

Link to comment
Share on other sites

You can change the pointcloud lookup radius in the gasfield vop to get finer details.

Since you're using spheres, you should create one point per sphere and set the lookup

radius to be the radius of the sphere, this should be the most efficient way.

Are you using up-resing for your sim ?

PS : yes, writing divergence and pressure is useless

Edited by bunker
Link to comment
Share on other sites

How about the one in the Source Apply node that gets automatically added in a pyro setup from the shelf tools? You can save it from there too. Sorry, perhaps I misunderstand you somewhere.

I had a look at the Source Apply node but the sdf generation and collision information in there is for the source object(the one creating the fluid) and not for the collision objects.

You can change the pointcloud lookup radius in the gasfield vop to get finer details.

I changed the lookup radius and it definitely gave a better result in terms of details. The spheres was just an example though. The actual sim would be interacting with voronoi fracture pieces. More importantly, I did some comparisons in time difference. At a lower resolution of 30 uniform divisions the difference in time using the rbd collision sdf or your method Bunker was negligible but when I went up to a uniform division value of 60 the rbd solution took 2:22 while the point cloud method took about 3:46. Now granted you might not be seeing the same kind of difference but I'm on an older macbook pro at the moment and no longer have access to a beefy 8-core machine(sigh). So maybe with a faster machine this wouldn't be so much of a problem. :)

Are you using up-resing for your sim ?

At this point I haven't even started looking at up-resing the sim. The goal for me at this point is to find the most efficient way to iterate as many times as necessary to get the basic sim looking right. I know that once that's working the up-res is relatively straight forward. Yes, there is still some tweaking to do but the low res should be at a certain level.

I'm also trying to better understand the process that the solvers are working through. Going back to my initial problem of writing out the collision and collisionvel fields. I don't understand why when reading these fields back in the time taken to calculate the divergence and pressure fields doubles.

save_collision_v02.hipnc

point_cloud_collision_60.mov

rbd_points_collision_60.mov

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...