phetsims / molecule-polarity

"Molecule Polarity" is an educational simulation in HTML5, by PhET Interactive Simulations.
GNU General Public License v3.0
2 stars 6 forks source link

Nonpolar molecule rotation in electric field extremely slow #128

Closed Nancy-Salpepi closed 3 years ago

Nancy-Salpepi commented 3 years ago

Test device iPad

Operating System iPados 14.7.1

Browser safari

Problem description https://github.com/phetsims/qa/issues/680

After creating a linear nonpolar molecule, when the molecule is positioned horizontally in the electric field, it can sometimes take over 10 minutes for the molecule to move to a vertical position (see highlighted times in screen shots). I noticed that by slightly moving the A or C atom, with the molecule still appearing to be linear, the speed of rotation can be changed. I was also able to reproduce this with my Mac 11 + chrome, but with some difficulty (video).

Steps to reproduce

  1. Select the "Three Atoms" screen
  2. In the view box, check all available options and turn on the electric field
  3. Move the sliders for the electronegativity of atoms A and C to the second tick mark
  4. Move the slider for the electronegativity of atom B to the second tick mark after the halfway point
  5. Move either atom A or atom C so that the molecule appears linear with no molecular dipole moment
  6. Use atom B to rotate the molecule to the horizontal position

Visuals iPad: You can see in the screenshot that is was 9:25 when I placed the molecule in a horizontal position

IMG_2186

The time was 9:43 when it reached a vertical position. IMG_2187

In this video, you can see that I was able to adjust the molecule so that the speed is so slow it doesn't even look like it is moving. (The gif was too large so I made a movie of my movie!) https://drive.google.com/file/d/1oVsjkNXy3hS8WScrBqzEll5KPo1OQyej/view?usp=sharing

Troubleshooting information: !!!!! DO NOT EDIT !!!!! Name: ‪Molecule Polarity‬ URL: https://phet-dev.colorado.edu/html/molecule-polarity/1.2.0-dev.3/phet/molecule-polarity_all_phet.html Version: 1.2.0-dev.3 2021-07-26 23:04:53 UTC Features missing: applicationcache, applicationcache, touch Flags: pixelRatioScaling User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36 Language: en-US Window: 1167x687 Pixel Ratio: 2/1 WebGL: WebGL 1.0 (OpenGL ES 2.0 Chromium) GLSL: WebGL GLSL ES 1.0 (OpenGL ES GLSL ES 1.0 Chromium) Vendor: WebKit (WebKit WebGL) Vertex: attribs: 16 varying: 31 uniform: 1024 Texture: size: 16384 imageUnits: 16 (vertex: 16, combined: 80) Max viewport: 16384x16384 OES_texture_float: true Dependencies JSON: {}

pixelzoom commented 3 years ago

@Nancy-Salpepi thanks for reporting.

The molecule rotates into alignment with the electric field at an angular velocity that is linearly proportional to the magnitude of the molecule's dipole. So the greater the magnitude of the molecule dipole, the faster the molecule will rotate into alignment with the electric field. In the case you've configured, the molecule dipole has a very small magnitude, so it therefore has a very small angular velocity, and will take a long time to rotate into place. This is not a bug, it's physically accurate.

The change in angle is computed in MPModel.js, in the updateMoleculeOrientation method:

// magnitude of angular velocity is proportional to molecular dipole magnitude
const deltaDipoleAngle = Math.abs( Utils.linear( 0, MPConstants.ELECTRONEGATIVITY_RANGE.getLength(), 0, MAX_RADIANS_PER_STEP, dipole.magnitude ) );

where ELECTRONEGATIVITY_RANGE is [2,4] and MAX_RADIANS_PER_STEP is MAX_RADIANS_PER_STEP is 0.17 radians. So at it's fastest, the molecule will rotate ~36 degrees per animation frame.

Options:

(1) Do nothing. The current behavior is physically accurate, and is therefore a good learning experience. If it's rotating too slowly, make the molecule dipole larger and it will rotate faster.

(2) Change the computation of deltaDipoleAngle so that any non-zero molecule dipole has some minimum angular velocity. Use a value that results in a slow rotation, but doesn't take 10 minutes to rotate into alignment with the electric field. This will NOT be physically accurate, as molecules with different (small) molecule dipoles will have the same angular velocity.

My recommendation is option (1).

@arouinfar how would you like to proceed?

arouinfar commented 3 years ago

Nice find @Nancy-Salpepi!

@pixelzoom I'm in favor of option (1). I tested things out in Studio so I could see the value of moleculePolarity.threeAtomsScreen.model.molecule.bondAngleABCProperty. It's actually a bit tricky to set the angle close enough to 180 degrees to get the minutes-long rotation.

I've added this to the issue for the Teacher Tips, so we can close.