Jump to content

How to calculate acceleration of particles in a FLIP simulation?


magneto

Recommended Posts

Hi,

I am following a tutorial where you are isolating only the fastest particles to create spray. Then in DOPs, you use a SOP Solver to merge these particles to the previous frame. So they accumulate. I was just using the velocity attribute of particles (v), but realized my particles accumulated to much greater numbers than it's supposed to, like 50x more.

The author was using a Timeshift SOP and then subtracting the v attribute values.

A fast particle will likely to stay fast for a while so I was merging the same particle in different positions many times, instead of just once like him, since it's highly unlikely the particle will jump too fast at each frame from the previous frame.

So is using Timeshift SOP to do this the best way? It doesn't work for frame 1 though because of using $F-1 for Timeshift. Is that ok? What about doing this and just using P, instead of v? Is that not more accurate?

Also what we are actually calculating here is acceleration not velocity, right?

Thanks :)

Link to comment
Share on other sites

if you do difference of P between frames you are calculating velocity, if difference of v then it is accelration

Timeshift SOP is ok, but you need to keep in mind that if you don't have constant point count you need to match particles by id while calculating the difference

and you should compare this and next frame, not previous, because you are interested in acceleration for this frame

so that will work even for first frame

other thing you can do is store old v in some temp attribute during sim and after every timestep subtract it from newly computed one to get accel(don't forget to account for timestep scale) and store v to temp attrib for again

this approach will give you accel from previous to this timestep, so not completely accurate, and considering that v is already 1 timestep behind, accel will be 2, but anyway this may be more accuare than timeshift since you are using timestep difference not frame difference, for usual usage it doesn't matter that much anyway

Link to comment
Share on other sites

Thanks anim, it's very helpful. Mine is a constant point cloud but if it's not, how can I match the particles? By sorting particles by id at each frame?

Can I use Gas Linear Comination to store the old_v? I remember it has timestep options I think. If I were to do this using Gas Wrangle, how can I account timestep?

Also you are doing this at the post solve step of say a FLIP solver?

Thanks again.

Link to comment
Share on other sites

to get point number of particle with matching id use findattribval() VEX function or corresponding VOP node then use that pointnum to import values from that matching point

you can use Gas Linear Combination if you want (one for computing accel (doing previousv-v and total coefficient of 1 with 1/Timestep mode), second one for storing v to previousv)

you'll get accel normalized to s to get it in f just further divide by fps

in Gas Wrangle it would be:

v@accel = (@v - v@__previousv)/@Timeinc;
v@__previousv = @v;[/CODE]

  • Like 1
Link to comment
Share on other sites

Thanks anim, because that sort of confused me and I wasn't sure why that difference was there.

Another small question if you don't mind. I want to experiment with the microsolvers like Gas Linear Combination, etc, but is there an easy way to just use a simple geometry like a Grid and then change its colors, point positions, etc? I tried using P, and used "Geometry" for the Reference parameter, but it didn't do anything when I added values to it.

I added new fields (scalar, vector) to the Grid and changed the values using Gas Linear Combination, but I can't see the current values like I can when I am check the Details View in SOP context. It shows nothing that list the current values in DOPs. I wanted to numerically see my float/vector values as I change them. I guess it's very different in DOPs. I just wanted to experiment with them in a simple and direct way.

@CeeGee: Whitewater source sounds great. Is that the one used in Ocean tools? I have to check those, but probably beyond my understanding right now :(

Link to comment
Share on other sites

Thanks Skybar. When you said both fields and geo, do you mean FLIP object + solver, or something else? Or FLIP/Pyro + Multi Solver?

I meant that FLIP is both particles and fields combined, and pyro is just fields. Depending on what you want to learn it might be easier to start with Pyro.

Link to comment
Share on other sites

Its setup by shelf, when you go inside you can see vorticty, acceleration setup, you can just extract them from otl and use on your flip sim, this is what i did for my. Curvature and Vorticity.

Thanks, I will study the subnet created by that shelf too then. It might reveal some good workflows for me. If you did those yourself for your FLIP sim, then should the built-in FLIP sim not come with those setup by default as well, to make it more streamlined? It does seem like a commonly used workflow.

I meant that FLIP is both particles and fields combined, and pyro is just fields. Depending on what you want to learn it might be easier to start with Pyro.

Thanks, I see what you mean now. I will experiment with FLIP then because I want to work with particles, rather than just fields :)

Link to comment
Share on other sites

...

is there an easy way to just use a simple geometry like a Grid and then change its colors, point positions, etc? I tried using P, and used "Geometry" for the Reference parameter, but it didn't do anything when I added values to it.

I added new fields (scalar, vector) to the Grid and changed the values using Gas Linear Combination, but I can't see the current values like I can when I am check the Details View in SOP context. It shows nothing that list the current values in DOPs. I wanted to numerically see my float/vector values as I change them. I guess it's very different in DOPs. I just wanted to experiment with them in a simple and direct way.

...

Gas Linear Combination DOP works with any attributes or fields so it can change P on your Geometry, I may post some example when I get home

for visualisation on fields you can use Vector/Scalar Field Visualisation DOP which have different options

or just bring the field to SOPs, Volume Slice it as points and display as attribute values directly in viewport, you can lock that viewport so you can always see that while still playing with the dop setup in different scene viewer

  • Like 1
Link to comment
Share on other sites

Thanks anim, that would be extremely helpful. I couldn't get P to work. But when you bring the attribute to SOPs, do you do it using the DOP I/O? I am gonna try that as well.

Also when bringing a surface geometry into DOPs, we are using a scalar attribute. Is that because we are thinking of the surface as an SDF volume? That is effectively used to collide with particles, etc than an actual geometry?

Link to comment
Share on other sites

I usually use object merge to get simple data from dops, but Dop Import, Dop Import Fields or Dop I/O work as well and are easier to use for multiple data, I just noticed back in the old days that the object merge was the fastest, not sure how they compare now

for bringing geometry to DOPs I usually use SOP Geometry DOP, but if you are bringing SDF then you can use SOP Scalar Field DOP

Edited by anim
  • Like 1
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...