Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Energy chunks vibrate when more or added or removed #238

Closed
KatieWoe opened this issue Mar 27, 2019 · 12 comments
Closed

Energy chunks vibrate when more or added or removed #238

KatieWoe opened this issue Mar 27, 2019 · 12 comments
Assignees
Labels

Comments

@KatieWoe
Copy link
Contributor

Device
Dell Laptop
OS
Win 10
Browser
Edge
Problem Description
For phetsims/qa#298
When there are a large number of chunks present (meaning the water beaker, especially when it is heated) adding and especially removing chunks causes the ones around it to vibrate for a brief time. Only really seen on Edge so far, but it can be replicated in chrome if you use speed=3. Doesn't occur in published version but also very minor. Assigning @arouinfar as well to decide if behavior is acceptable.
Steps to reproduce

  1. Either start sim in Edge or use querry parameter speed=3
  2. Turn on energy chunks
  3. Heat the water beaker until steam appears. Watch energy chunk behavior
  4. Cool beaker until one chunk falls into bucket, then stop
  5. Observe behavior of remaining chunks

Screenshots
dancingwaterchunks

@chrisklus
Copy link
Contributor

I think I've seen this wiggling a few times before. @jbphet can you take a look at this on your Edge?

@chrisklus chrisklus assigned jbphet and unassigned chrisklus Mar 27, 2019
@KatieWoe
Copy link
Contributor Author

On Edge, fps while doing this is about 35

@arouinfar
Copy link
Contributor

Nice find @KatieWoe. If there is some obvious, low-effort solution to address the wiggling (which I doubt), then it'd be nice to address. However, given that Edge is a low-use platform, and the wiggling doesn't seem all that problematic, I would be okay with leaving things be.

@arouinfar arouinfar removed their assignment Mar 28, 2019
@KatieWoe
Copy link
Contributor Author

I did also see it on other platforms on Mac.

@KatieWoe
Copy link
Contributor Author

Behavior in safari is almost more noticeable.

@arouinfar
Copy link
Contributor

I tested on macOS 10.14.3 in Chrome and Safari. The vibration of the energy chunks is definitely noticeable, though not as bad as what I observe when using ?speed=3. I compared to 1.0, and the vibration is not present there.

@jbphet @chrisklus can you review? I think this would be worth some investigation since this is a change from 1.0, and not only limited to low-use platforms.

@arouinfar arouinfar assigned chrisklus and unassigned arouinfar Mar 29, 2019
@KatieWoe
Copy link
Contributor Author

KatieWoe commented Apr 2, 2019

Very noticeable in IE

@jbphet
Copy link
Contributor

jbphet commented Apr 24, 2019

I'm only finding little bits of time to work on this here and there, so I'm going to log a lot of notes so that it's easier to ramp back up each time I take a look.

  • It's vexing to me that the algorithm behaves differently on different platforms, because the algorithm divides up the time delta values that come in into a fixed time step in the internal loop, so it stands to reason that even on a slower platform (with larger delta time values that come less frequently) the behavior should be the same, because the initial positions and the time steps to the algorithm should ultimately be the same. There must be something wrong with either my understanding or the implementation.
  • I can duplicate this on my Dell Win 10 device on Edge 42.17134.1.0. If I change the value of MAX_ENERGY_CHUNK_REDISTRIBUTION_TIME in RectangularThermalModelElement to be much larger, the energy chunks will vibrate basically forever. This would seem to imply that the drag value isn't slowing things down much. Maybe I could modify the drag formula to do more at low velocities. At any rate, it would be informative to gather some data about what the drag vector is looking like in this situation.
  • The oscillation seems to occur primarily with the energy chunks that are at the edges of the slice, not so much with the ones in the middle. Is there some sort of inconsistency between the algorithm being used for wall repulsion versus inter-chunk repulsion?
  • Oscillation in the absence of damping would be perfectly normal, so there is something that is different (or just wrong) with the way damping is working on slower systems.

jbphet added a commit that referenced this issue Aug 5, 2019
…se more "real" values for many of the parameters, see #238
@jbphet
Copy link
Contributor

jbphet commented Aug 5, 2019

I think I've found and corrected the main issue, which was that the reusable force vectors in the distribution algorithm were not being cleared out on each iteration of the force calculations, leading to a buildup that only becomes apparent when longer time steps occurred, which happens on Edge and IE. This has been fixed. I also ended up simplifying the algorithm while I was working on this such that it no longer uses as many "tweaky" variables, since this was making it hard to maintain. As part of this, I started using values for the constants that control the algorithm that are more relatable to the real world.

jbphet added a commit that referenced this issue Aug 5, 2019
…se more "real" values for many of the parameters, see #238

(cherry picked from commit 8721a50)
@jbphet
Copy link
Contributor

jbphet commented Aug 5, 2019

I have cherry picked the commit with the fix to the 1.1 branch. Unassigning for now, and this should be verified for the next release off of either master or the 1.1 branch.

@KatieWoe
Copy link
Contributor Author

Looks much more natural now.

@KatieWoe
Copy link
Contributor Author

KatieWoe commented Sep 4, 2019

To clarify #238 (comment), the shaking still occurs, but is less pronounced and looks more acceptable on the mentioned platforms from what I've seen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants