Wrapping particles more than once around the global longitudes

Post any defects you find in the HYSPLIT software here. The HYSPLIT Developers carefully monitor this list and will work diligently to repair any reported problems. When posting a bug report, please specify both the HYSPLIT version and operating system you are using.
Post Reply
mneish
Posts: 7
Joined: November 1st, 2024, 12:34 pm
Registered HYSPLIT User: No

Wrapping particles more than once around the global longitudes

Post by mneish »

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:

Code: Select all

72,73c72,73
<      IF(I1.GT.NXP)THEN
<         I1=1
---
>      DO WHILE (I1.GT.NXP)
>         I1=I1-NXP
75,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 DO
adv3nt.f patch:

Code: Select all

76,77c76,77
<      IF(I1.GT.NXP)THEN
<         I1=1
---
>      DO WHILE(I1.GT.NXP)
>         I1=I1-NXP
79,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 DO
Thanks,
Mike
Post Reply

Return to “Bugs”