Version: 5.4.2
In global domain, when particles are near the poles, sometimes particles can wrap around the longitude band more than once. There's already some code in adv2nt and adv3nt to handle wrapping a single time, but if the particle has wrapped more than once it fails, and the XF interpolation factor falls far outside the 0..1 range giving strange results such as negative density.
I worked around the issue by turning the "IF" statement for wrapping into a "DO WHILE"... e.g.
adv2nt.f patch:adv3nt.f patch:Thanks,
Mike
In global domain, when particles are near the poles, sometimes particles can wrap around the longitude band more than once. There's already some code in adv2nt and adv3nt to handle wrapping a single time, but if the particle has wrapped more than once it fails, and the XF interpolation factor falls far outside the 0..1 range giving strange results such as negative density.
I worked around the issue by turning the "IF" statement for wrapping into a "DO WHILE"... e.g.
adv2nt.f patch:
CODE:
72,73c72,73< IF(I1.GT.NXP)THEN< I1=1---> DO WHILE (I1.GT.NXP)> I1=I1-NXP75,79c75,79< END IF< IF(I1.LT.1)THEN< I1=NXP< XF=NXP+XF< END IF---> END DO> DO WHILE (I1.LT.1)> I1=I1+NXP> XF=XF+NXP> END DOCODE:
76,77c76,77< IF(I1.GT.NXP)THEN< I1=1---> DO WHILE(I1.GT.NXP)> I1=I1-NXP79,83c79,83< END IF< IF(I1.LT.1)THEN< I1=NXP< XF=NXP+XF< END IF---> END DO> DO WHILE(I1.LT.1)> I1=I1+NXP> XF=XF+NXP> END DOMike
Statistics: Posted by mneish — September 12th, 2025, 11:16 am