[MITgcm-support] shelfice_thermodynamics.F crash

Martin Losch Martin.Losch at awi.de
Wed Jan 21 04:04:34 EST 2026


Do you think that this should be a PR?

Martin

> On 20. Jan 2026, at 18:38, Dimitris Menemenlis <dmenemenlis at gmail.com> wrote:
> 
> Hi Martin, I just tested your modification below in my baby set-up and it works fine.
> 
> You just need to add a “-d 0” in "IF ( saltFreeze .EQ. 0. _d 0 ) THEN"
> 
> Thanks for quick response.
> 
> D.
> 
> 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!
> 
> P.P.S.: Happy New Year and belated Merry Christmas to you and family.
> 
> 
>> On Jan 20, 2026, at 5:37 AM, Martin Losch <Martin.Losch at awi.de> wrote:
>> 
>> Hi Dimitris and Kayhan,
>> 
>> 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.
>> 
>>             IF ( saltFreeze .EQ. 0. _d ) THEN
>>              freshWaterFlux = rUnit2mass
>>      &            * shiTransCoeffS(i,j,bi,bj)
>>             ELSE
>>              freshWaterFlux = rUnit2mass
>>      &            * shiTransCoeffS(i,j,bi,bj)
>>      &            * ( 1. _d 0 - sLoc(I,J) / saltFreeze )
>>             ENDIF
>> 
>> What do you think? Does that work for you?
>> 
>> Martin
>> 
>>> On 20. Jan 2026, at 00:46, Dimitris Menemenlis <dimitris.menemenlis at sjsu.edu> wrote:
>>> 
>>> shelfice_thermodynamics.F can crash when the line
>>>            saltFreeze = (- bqe - SQRT(discrim))*recip_aqe
>>> returns 0, so that
>>>            freshWaterFlux = rUnit2mass
>>>     &           * shiTransCoeffS(i,j,bi,bj)
>>>     &           * ( 1. _d 0 - sLoc(I,J) / saltFreeze )
>>> returns NaN.
>>> 
>>> This appears to be a consequence of "sLoc(I,J)  = 0”
>>> One possible fix is to add:
>>>          sLoc(I,J) = MAX(salt(I,J,K,bi,bj), 0.1 _d 0)
>>> 
>>> >>>>>>>
>>> 
>>> Kayhan Momeni, from his ongoing llc4320 simulation has extracted all the model state variables
>>> at the time step before (3205150) and during (3205151) the first NaN:
>>> https://nasa-ext.box.com/s/5ah3cffma49vkvfwgjsown7ytgs8i5i1
>>> 
>>> I have created a small (17x17x173) regional set-up that (approximately) recreates this crash:
>>> https://nasa-ext.box.com/s/varcd6iu3ilg44bzly9hnzee1wnigfod
>>> https://nasa-ext.box.com/s/bpq9p9yksksdhgr2knofj9fsqj0ntv5x
>>> https://nasa-ext.box.com/s/atgqgp43st6o4u4976gfr5not465zbdr
>>> 
>>> I have verified that the small set-up is able to reproduce the SHICE_fwFlux NaN, the white grid cell at center of:
>>> https://nasa-ext.box.com/s/trhs4kd8vpt9tx4t8riq934olrks3h30
>>> 
>>> All of the above are under: https://nasa-ext.box.com/s/q4sx5w4bnwui4v1afec9k2kb41ejml3v
>>> 
>>> _______________________________________________
>>> MITgcm-support mailing list
>>> MITgcm-support at mitgcm.org
>>> http://mailman.mitgcm.org/mailman/listinfo/mitgcm-support
>> 
>> _______________________________________________
>> MITgcm-support mailing list
>> MITgcm-support at mitgcm.org
>> http://mailman.mitgcm.org/mailman/listinfo/mitgcm-support
> 
> _______________________________________________
> MITgcm-support mailing list
> MITgcm-support at mitgcm.org
> http://mailman.mitgcm.org/mailman/listinfo/mitgcm-support

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.mitgcm.org/pipermail/mitgcm-support/attachments/20260121/facb321c/attachment.html>


More information about the MITgcm-support mailing list