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

Sim crashes if you try to draw a line in a 0 V area #186

Open
KatieWoe opened this issue Jul 1, 2020 · 3 comments
Open

Sim crashes if you try to draw a line in a 0 V area #186

KatieWoe opened this issue Jul 1, 2020 · 3 comments
Assignees
Labels

Comments

@KatieWoe
Copy link
Contributor

KatieWoe commented Jul 1, 2020

For phetsims/qa#508. Likely not connected to Studio. Seems to be possible due to the Snap to Grid feature, which means that reproducing in published may not be possible, even if it occurs there.
If you set up a situation where there are charges on the screen that perfectly cancel each other and create a 0 V area, and then try to draw an equipotential line there, the sim will crash. If you try to put sensor nodes there an arrow will appear when it shouldn't as well.
Steps:

  1. Turn on the grid and snap to grid options
  2. Put a red charge on a thick line intersection
  3. Put a blue charge two thick line intersections away
  4. Two intersections down, put a blue and red charge to cancel them out
  5. Put the sensor/equipotential line drawer in the middle of these charges
  6. Try to draw a line

zerovoltcrash

@KatieWoe
Copy link
Contributor Author

KatieWoe commented Jul 1, 2020

On published, I might have managed to recreate this situation, though it is hard to tell if the voltage is exactly zero. If it is, then in published it makes an odd line, but does not crash.
inpublished

@zepumph
Copy link
Member

zepumph commented Jul 1, 2020

Thanks for the report, this should be worked on next time the sim is in active dev.

@zepumph zepumph removed their assignment Jul 1, 2020
@veillette
Copy link
Contributor

veillette commented Oct 1, 2020

With the snap to grid, it is much easier to come up with highly symmetric charge configurations as above. In addition, it is possible to locate the equipotential tool at very symmetric places. From a pedagogical point of view, this is highly desirable to generate the configurations. However, from a computational point of view, these points are often maximum, minimum or saddle points of the electric potential.

To draw the equipotential line, the current algorithm looks for a direction perpendicular to the electric field. If the electric field is zero, then the algorithm fails.

Without the snap to grid feature, it is difficult to create locations where the E field vanishes to zero and even if you do, it is virtually impossible to set the equipotential tool at that particular location (even a tiny E field of 10^-15 would be sufficient for the algorithm).

This bug is not related to Studio as @KatieWoe pointed out. The bug is in principle present in the published version of charges and fields but because the snap to grid doesn't exist it would be extremely difficult to reproduce.

In order to enable a snap to grid feature, a more robust method method to draw equipotential needs to be implemented.

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