<html aria-label="message body"><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;">Please have a look at PR #968<div><div style="display: block;"><div style="-webkit-user-select: all; -webkit-user-drag: element; display: inline-block;" class="apple-rich-link" draggable="true" role="link" data-url="https://github.com/MITgcm/MITgcm/pull/968"><a style="border-radius:10px;font-family:-apple-system, Helvetica, Arial, sans-serif;display:block;-webkit-user-select:none;width:300px;user-select:none;-webkit-user-modify:read-only;user-modify:read-only;overflow:hidden;text-decoration:none;" class="lp-rich-link" rel="nofollow" href="https://github.com/MITgcm/MITgcm/pull/968" dir="ltr" role="button" draggable="false" width="300"><table style="table-layout:fixed;border-collapse:collapse;width:300px;background-color:#DCDCDD;font-family:-apple-system, Helvetica, Arial, sans-serif;" class="lp-rich-link-emailBaseTable" cellpadding="0" cellspacing="0" border="0" width="300"><tbody><tr><td vertical-align="center" align="center"><img style="width:300px;filter:brightness(0.97);height:150px;" width="300" height="150" draggable="false" class="lp-rich-link-mediaImage" alt="968.png" src="cid:41BC78C5-E158-4CA7-B010-F07C12104743"></td></tr><tr><td vertical-align="center"><table bgcolor="#DCDCDD" cellpadding="0" cellspacing="0" width="300" style="table-layout:fixed;font-family:-apple-system, Helvetica, Arial, sans-serif;background-color:rgba(220, 220, 221, 1);-apple-color-filter:initial;" class="lp-rich-link-captionBar"><tbody><tr><td style="padding:8px 0px 8px 0px;" class="lp-rich-link-captionBar-textStackItem"><div style="max-width:100%;margin:0px 16px 0px 16px;overflow:hidden;" class="lp-rich-link-captionBar-textStack"><div style="word-wrap:break-word;font-weight:500;font-size:12px;overflow:hidden;text-overflow:ellipsis;text-align:left;" class="lp-rich-link-captionBar-textStack-topCaption-leading"><a rel="nofollow" href="https://github.com/MITgcm/MITgcm/pull/968" style="text-decoration: none" draggable="false"><font color="#272727" style="color: rgba(0, 0, 0, 0.847059);">Fix pkg/shelfice `saltFreeze=0`-bug by mjlosch · Pull Request #968 · MITgcm/MITgcm</font></a></div><div style="word-wrap:break-word;font-weight:400;font-size:11px;overflow:hidden;text-overflow:ellipsis;text-align:left;" class="lp-rich-link-captionBar-textStack-bottomCaption-leading"><a rel="nofollow" href="https://github.com/MITgcm/MITgcm/pull/968" style="text-decoration: none" draggable="false"><font color="#808080" style="color: rgba(0, 0, 0, 0.498039);">github.com</font></a></div></div></td></tr></tbody></table></td></tr></tbody></table></a></div></div></div><div style="display: block;"><br></div><div style="display: block;">@Dimitry, it would be great, if you could try this code in your little test, and also review it in github.</div><div style="display: block;"><br></div><div style="display: block;">M</div><div><div><br><blockquote type="cite"><div>On 21. Jan 2026, at 21:25, Martin Losch <Martin.Losch@awi.de> wrote:</div><br class="Apple-interchange-newline"><div>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><div style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;">I’ll take care of it.<div>M<br id="lineBreakAtBeginningOfMessage"><div><br><blockquote type="cite"><div>On 21. Jan 2026, at 19:49, Dimitris Menemenlis <dmenemenlis@gmail.com> wrote:</div><br class="Apple-interchange-newline"><div>
<div style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;">Hi Martin, for time being I added your suggested modification to our local repo:<div><a href="https://github.com/MITgcm-contrib/llc_hires/blob/master/trillium/llc_4320/code/shelfice_thermodynamics.F">https://github.com/MITgcm-contrib/llc_hires/blob/master/trillium/llc_4320/code/shelfice_thermodynamics.F</a></div><div><br></div><div>But yes, I think this probably needs to make its way back to the main branch.</div><div>Will you take care of the PR?  Or shall I try to figure out how to submit one?</div><div><br></div><div>D.</div><div><br id="lineBreakAtBeginningOfMessage"><div><br><blockquote type="cite"><div>On Jan 21, 2026, at 1:04 AM, Martin Losch <Martin.Losch@awi.de> wrote:</div><br class="Apple-interchange-newline"><div><div style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;">Do you think that this should be a PR?<div><br></div><div>Martin<br id="lineBreakAtBeginningOfMessage"><div><br><blockquote type="cite"><div>On 20. Jan 2026, at 18:38, Dimitris Menemenlis <dmenemenlis@gmail.com> wrote:</div><br class="Apple-interchange-newline"><div>
<div style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;">Hi Martin, I just tested your modification below in my baby set-up and it works fine.<div><br></div><div>You just need to add a “-d 0” in "IF ( saltFreeze .EQ. 0. _d 0 ) THEN"<div><br></div><div>Thanks for quick response.</div><div><br></div><div>D.</div><div><br></div><div>P.S.: I still owe you a response for the “Supercooled waters” post.  I don’t know how you and Oliver and Jean-Michel are so efficient!</div><div><br></div><div>P.P.S.: Happy New Year and belated Merry Christmas to you and family.</div><div><br></div><div><br><blockquote type="cite"><div>On Jan 20, 2026, at 5:37 AM, Martin Losch <Martin.Losch@awi.de> wrote:</div><br class="Apple-interchange-newline"><div><div style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;">Hi Dimitris and Kayhan,<div><br></div><div>great catch. I suggest a different fix: Even though it’s unlikely, we may want to allow saltFreeze=0. So If sLoc = 0, then we have freshWaterFlux = rUnit2mass * shiTransCoeffS(i,j,bi,bj) * ( 1. _d 0 - 0. / 0. ) and could drop the part in the parentheses, i.e.</div><div><br></div><div><div>            IF ( saltFreeze .EQ. 0. _d ) THEN</div><div>             freshWaterFlux = rUnit2mass</div><div>     &            * shiTransCoeffS(i,j,bi,bj)</div><div>            ELSE</div><div>             freshWaterFlux = rUnit2mass</div><div>     &            * shiTransCoeffS(i,j,bi,bj)</div><div>     &            * ( 1. _d 0 - sLoc(I,J) / saltFreeze )</div><div>            ENDIF</div></div><div><br></div><div>What do you think? Does that work for you?</div><div><br></div><div>Martin</div><div><div><div><br><blockquote type="cite"><div>On 20. Jan 2026, at 00:46, Dimitris Menemenlis <dimitris.menemenlis@sjsu.edu> wrote:</div><br class="Apple-interchange-newline"><div><div style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;">shelfice_thermodynamics.F can crash when the line<br>           saltFreeze = (- bqe - SQRT(discrim))*recip_aqe<br>returns 0, so that<br>           freshWaterFlux = rUnit2mass<br>    &           * shiTransCoeffS(i,j,bi,bj)<br>    &           * ( 1. _d 0 - sLoc(I,J) / saltFreeze )<br>returns NaN.<br><br>This appears to be a consequence of "sLoc(I,J)  = 0”<br>One possible fix is to add:<br>         sLoc(I,J) = MAX(salt(I,J,K,bi,bj), 0.1 _d 0)<br><br>>>>>>>><br><br><div>Kayhan Momeni, from his ongoing llc4320 simulation has extracted all the model state variables</div><div>at the time step before (3205150) and during (3205151) the first NaN:</div><div><a href="https://nasa-ext.box.com/s/5ah3cffma49vkvfwgjsown7ytgs8i5i1">https://nasa-ext.box.com/s/5ah3cffma49vkvfwgjsown7ytgs8i5i1</a></div><div><br></div><div>I have created a small (17x17x173) regional set-up that (approximately) recreates this crash:</div><div><a href="https://nasa-ext.box.com/s/varcd6iu3ilg44bzly9hnzee1wnigfod">https://nasa-ext.box.com/s/varcd6iu3ilg44bzly9hnzee1wnigfod</a></div><div><a href="https://nasa-ext.box.com/s/bpq9p9yksksdhgr2knofj9fsqj0ntv5x">https://nasa-ext.box.com/s/bpq9p9yksksdhgr2knofj9fsqj0ntv5x</a></div><div><a href="https://nasa-ext.box.com/s/atgqgp43st6o4u4976gfr5not465zbdr">https://nasa-ext.box.com/s/atgqgp43st6o4u4976gfr5not465zbdr</a></div><div><br></div><div>I have verified that the small set-up is able to reproduce the SHICE_fwFlux NaN, the white grid cell at center of:</div><div><a href="https://nasa-ext.box.com/s/trhs4kd8vpt9tx4t8riq934olrks3h30">https://nasa-ext.box.com/s/trhs4kd8vpt9tx4t8riq934olrks3h30</a></div><div><br></div><div>All of the above are under: <a href="https://nasa-ext.box.com/s/q4sx5w4bnwui4v1afec9k2kb41ejml3v">https://nasa-ext.box.com/s/q4sx5w4bnwui4v1afec9k2kb41ejml3v</a></div><div><br></div></div>_______________________________________________<br>MITgcm-support mailing list<br>MITgcm-support@mitgcm.org<br>http://mailman.mitgcm.org/mailman/listinfo/mitgcm-support<br></div></blockquote></div><br></div></div></div>_______________________________________________<br>MITgcm-support mailing list<br>MITgcm-support@mitgcm.org<br>http://mailman.mitgcm.org/mailman/listinfo/mitgcm-support<br></div></blockquote></div><br></div></div>_______________________________________________<br>MITgcm-support mailing list<br>MITgcm-support@mitgcm.org<br>http://mailman.mitgcm.org/mailman/listinfo/mitgcm-support<br></div></blockquote></div><br></div></div>_______________________________________________<br>MITgcm-support mailing list<br>MITgcm-support@mitgcm.org<br>http://mailman.mitgcm.org/mailman/listinfo/mitgcm-support<br></div></blockquote></div><br></div></div>_______________________________________________<br>MITgcm-support mailing list<br>MITgcm-support@mitgcm.org<br>http://mailman.mitgcm.org/mailman/listinfo/mitgcm-support<br></div></blockquote></div><br></div></div>_______________________________________________<br>MITgcm-support mailing list<br>MITgcm-support@mitgcm.org<br>http://mailman.mitgcm.org/mailman/listinfo/mitgcm-support<br></div></blockquote></div><br></div></body></html>