phetsims / build-a-nucleus

"Build a Nucleus" is an educational simulation in HTML5, by PhET Interactive Simulations.
GNU General Public License v3.0
0 stars 5 forks source link

Sim freezes if you make an atom above uranium #42

Closed KatieWoe closed 1 year ago

KatieWoe commented 2 years ago

Test device Dell Operating System Win 11 Browser Chrome Problem description For https://github.com/phetsims/qa/issues/823. It is possible to briefly make Neptunium-237 by beta- decaying Uranium-237. This isotope is listed as not forming, even though it does according to https://energyeducation.ca/simulations/nuclear/nuclidechart.html, it just isn't part of the sim. The sim then reverts to Uranium-237 and the sim completely freezes with the console error below. Steps to reproduce

  1. Make U-237
  2. Press the B- decay button

Visuals simfreeze

simfreeze

Troubleshooting information:

!!!!! DO NOT EDIT !!!!! Name: ‪Build a Nucleus‬ URL: https://phet-dev.colorado.edu/html/build-a-nucleus/1.0.0-dev.17/phet/build-a-nucleus_all_phet.html Version: 1.0.0-dev.17 2022-08-02 23:09:01 UTC Features missing: applicationcache, applicationcache, touch Flags: pixelRatioScaling User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36 Language: en-US Window: 1280x649 Pixel Ratio: 1.5/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: 30 uniform: 4096 Texture: size: 16384 imageUnits: 16 (vertex: 16, combined: 32) Max viewport: 32767x32767 OES_texture_float: true Dependencies JSON: {}
Luisav1 commented 2 years ago

@ariel-phet because it completely freezes the sim and can break it, @Luisav1 will fix it for the prototype.

Luisav1 commented 2 years ago

@ariel-phet disallow beta minus decay for U237 for the prototype by disabling the button. But bring this up in the design meeting because it could be confusing. @chrisklus or instead of does not form say does not form naturally and revert back to U237 after the beta decay. @ariel-phet or sim limit reached. Or add note in teacher tips that we're only showing isotopes that occur naturally.

Luisav1 commented 2 years ago

Thanks @KatieWoe! This was fixed temporarily in the commit above by disabling the beta minus decay button for Uranium - 237. However, this is a temporary solution for the prototype and we plan to bring this to the design meeting, for a permanent solution.

Nancy-Salpepi commented 2 years ago

Temporary fix looks good for version 1.0.0-rc.8. Keeping open for more permanent solution.

zepumph commented 1 year ago

@Luisav1 and I updated the documentation. This seems like a reasonable "hollywooding", and we haven't received any complaints yet. We feel ready to close this issue. Let's confirm with @ariel-phet in case he has more ideas about this.

zepumph commented 1 year ago

From design meeting today, let's try to not have this crash, and see if it is a problem with code, or if we need more design-based decision.

zepumph commented 1 year ago

With this patch we were able to provide an experience in which we beta minus decay into Neptunium - 237, and then it says "does not form" before bringing us back to Uranium. This seems bad, but it is a start.

From here @Luisav1 will look up the actual decays for Neptonium to see if there is an easier, more graceful way of cutting off the number of protons at 93 instead of 92.

```diff Subject: [PATCH] use BackgroundNode for "Nuclear Shell Model" background rect, https://github.com/phetsims/build-a-nucleus/issues/107 --- Index: build-a-nucleus/js/decay/model/DecayModel.ts IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/build-a-nucleus/js/decay/model/DecayModel.ts b/build-a-nucleus/js/decay/model/DecayModel.ts --- a/build-a-nucleus/js/decay/model/DecayModel.ts (revision 66cedadf5051e17a73c0f64657771f6495aa7ddf) +++ b/build-a-nucleus/js/decay/model/DecayModel.ts (date 1690842528569) @@ -83,7 +83,7 @@ // Disallow having more protons that Uranium. Though this is not scientifically accurate, it keeps the model in // the confines of 92 protons. See https://github.com/phetsims/build-a-nucleus/issues/42 if ( protonCount === 92 && neutronCount === 145 && decayType === DecayType.BETA_MINUS_DECAY ) { - return false; + // return false; } return decays.find( decay => Object.keys( decay ).includes( decayType.name ) ) !== undefined; Index: build-a-nucleus/js/common/BANConstants.ts IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/build-a-nucleus/js/common/BANConstants.ts b/build-a-nucleus/js/common/BANConstants.ts --- a/build-a-nucleus/js/common/BANConstants.ts (revision 66cedadf5051e17a73c0f64657771f6495aa7ddf) +++ b/build-a-nucleus/js/common/BANConstants.ts (date 1690841417176) @@ -39,7 +39,7 @@ HALF_LIFE_NUMBER_LINE_END_EXPONENT: 24, // the maximum number of protons and neutrons for each screen - DECAY_MAX_NUMBER_OF_PROTONS: 92, + DECAY_MAX_NUMBER_OF_PROTONS: 93, DECAY_MAX_NUMBER_OF_NEUTRONS: 146, CHART_MAX_NUMBER_OF_PROTONS: 10, CHART_MAX_NUMBER_OF_NEUTRONS: 12, Index: shred/js/AtomIdentifier.ts IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/shred/js/AtomIdentifier.ts b/shred/js/AtomIdentifier.ts --- a/shred/js/AtomIdentifier.ts (revision 0329c953c4040668af729a057c9a0106dd9a31fd) +++ b/shred/js/AtomIdentifier.ts (date 1690841357155) @@ -608,7 +608,8 @@ [ 118 ], [ 116, 118, 119, 120, 121, 122, 124 ], [ 122, 124 ], - [ 124, 125, 126 ] + [ 124, 125, 126 ], + [ 144 ] ]; const numNeutronsInMostStableIsotope = [ @@ -10770,7 +10771,8 @@ 'A': 100, 'SF': 0.0000545 } - } + }, + 93: { 144: {} } }; /* eslint-enable quote-props */ @@ -14069,7 +14071,8 @@ 144: 7.39063E+14, 145: 583372.8, 146: 1.40996E+17 - } + }, + 93: {} }; @@ -14224,6 +14227,8 @@ doesExist: function( numProtons: number, numNeutrons: number ): boolean { const isStable = this.isStable( numProtons, numNeutrons ); const halfLife = this.getNuclideHalfLife( numProtons, numNeutrons ); + + // It either needs to have a half life or be stable return !( !isStable && halfLife === undefined ); },
Luisav1 commented 1 year ago

After some investigation, we could go up to 94 protons and 146 neutrons without needing to "hollywood" anything and cut off decays. This is visually shown in the chart below from where our original data is here. image

Luisav1 commented 1 year ago

The sim now goes up to 94 protons. We want to double check with @ariel-phet how this looks and works.

zepumph commented 1 year ago

@ariel-phet and I discussed today at design meeting, and the plan sounds great! We will assign @ariel-phet once we play with it ourselves a bit.

Luisav1 commented 1 year ago

@zepumph and I tested out the sim a bit when going up to 94 protons. @ariel-phet Could you please review the changes and let us know any thoughts you may have? Thanks!

Luisav1 commented 1 year ago

Meeting with @ariel-phet, this new bound to 146 neutrons and 94 protons is a good stopping point. Closing.