Segmentation fault

Post any questions or comments regarding the LINUX version of HYSPLIT. This includes the model execution, GUIs, results, or graphics. Be sure to mention the version of LINUX you are using.
Post Reply
croc
Posts: 23
Joined: January 22nd, 2015, 10:25 am
Registered HYSPLIT User: Yes

Segmentation fault

Post by croc »

Dear Hysplit user Forum,
I think I might have found a bug in the hyts_std code v. 5.3.0 for linux. Computing
backtrajectories for South Pole station using GDAS 0.5 meteo files I get the following
at the standard error:

HYSPLIT - Initialization
HYSPLIT version: hysplit.v5.3.0
Last Changed Date: 2023-11-14
NOTICE: using namelist file SETUP.CFG
*WARNING*: metini - vertical velocity missing, switching to divergence
Input data file: 1 1 GHDA
*WARNING*: metini - vertical velocity missing, switching to divergence
Input data file: 1 2 GHDA
*WARNING*: metini - vertical velocity missing, switching to divergence
Input data file: 1 3 GHDA
*WARNING*: metini - vertical velocity missing, switching to divergence
Input data file: 1 4 GHDA
*WARNING*: metini - vertical velocity missing, switching to divergence
Input data file: 1 5 GHDA
*WARNING*: metini - vertical velocity missing, switching to divergence
Input data file: 1 6 GHDA
*WARNING*: metini - vertical velocity missing, switching to divergence
Input data file: 1 7 GHDA
*WARNING*: metini - vertical velocity missing, switching to divergence
Input data file: 1 8 GHDA
*WARNING*: metini - vertical velocity missing, switching to divergence
Input data file: 1 9 GHDA
*WARNING*: metini - vertical velocity missing, switching to divergence
Input data file: 1 10 GHDA
*WARNING*: metini - vertical velocity missing, switching to divergence
Input data file: 1 11 GHDA
Calculation Started ... please be patient
WARNING: advpol.f could not move off pole point

Program received signal SIGSEGV: Segmentation fault - invalid memory reference.

Backtrace for this error:
#0 0x7f355191bbd0 in ???
#1 0x7f355191ae25 in ???
#2 0x7f3551602d5f in ???
at ./signal/../sysdeps/unix/sysv/linux/x86_64/sigaction.c:0
#3 0x565311d0b964 in zindex_
at /home/croc/hysplit/hysplit.v5.3.0/tags/hysplit.v5.3.0/library/hysplit/zindex.f:127
#4 0x565311cfbea1 in adviec_
at /home/croc/hysplit/hysplit.v5.3.0/tags/hysplit.v5.3.0/library/hysplit/adviec.f:133
#5 0x565311cb4032 in advpnt_
at /home/croc/hysplit/hysplit.v5.3.0/tags/hysplit.v5.3.0/library/hysplit/advpnt.f:1197
#6 0x565311c8d9f9 in hymodelt
at ../source/hymodelt.F:1217
#7 0x565311c89452 in main
at ../source/hymodelt.F:144
Segmentation fault


The related CONTROL file is:
07 11 30 14
1 #NUMBER OF STARTING LOCATIONS
-89.997 -24.8 1000 #STARTING 1: LATITUDE LONGITUDE HEIGHT (m-agl)
-240 #TOTAL RUN TIME (backwards)
0 #VERTICAL MOTION CALCULATION METHOD
20000 #TOP OF MODEL DOMAIN (m-AGL)
11 #NUMBER OF INPUT DATA GRIDS
/home/croc/hysplit/meteo//
20071130_gdas0p5
/home/croc/hysplit/meteo//
20071129_gdas0p5
/home/croc/hysplit/meteo//
20071128_gdas0p5
/home/croc/hysplit/meteo//
20071127_gdas0p5
/home/croc/hysplit/meteo//
20071126_gdas0p5
/home/croc/hysplit/meteo//
20071125_gdas0p5
/home/croc/hysplit/meteo//
20071124_gdas0p5
/home/croc/hysplit/meteo//
20071123_gdas0p5
/home/croc/hysplit/meteo//
20071122_gdas0p5
/home/croc/hysplit/meteo//
20071121_gdas0p5
/home/croc/hysplit/meteo//
20071120_gdas0p5
./
tdump

The SETUP.CFG is:
&SETUP
khmax = 240,
tm_mixd = 1,
kagl = 0,
/

I will try to debug by myself but I would appreciate any help you could give me.
Regards,

Stefano
croc
Posts: 23
Joined: January 22nd, 2015, 10:25 am
Registered HYSPLIT User: Yes

Re: Segmentation fault

Post by croc »

I can confirm the same problem with the latest version and the same input files:

HYSPLIT - Initialization
HYSPLIT version: hysplit.v5.3.2
Last Changed Date: 2024-02-01
NOTICE: using namelist file SETUP.CFG
*WARNING*: metini - vertical velocity missing, switching to divergence
Input data file: 1 1 GHDA
*WARNING*: metini - vertical velocity missing, switching to divergence
Input data file: 1 2 GHDA
*WARNING*: metini - vertical velocity missing, switching to divergence
Input data file: 1 3 GHDA
*WARNING*: metini - vertical velocity missing, switching to divergence
Input data file: 1 4 GHDA
*WARNING*: metini - vertical velocity missing, switching to divergence
Input data file: 1 5 GHDA
*WARNING*: metini - vertical velocity missing, switching to divergence
Input data file: 1 6 GHDA
*WARNING*: metini - vertical velocity missing, switching to divergence
Input data file: 1 7 GHDA
*WARNING*: metini - vertical velocity missing, switching to divergence
Input data file: 1 8 GHDA
*WARNING*: metini - vertical velocity missing, switching to divergence
Input data file: 1 9 GHDA
*WARNING*: metini - vertical velocity missing, switching to divergence
Input data file: 1 10 GHDA
*WARNING*: metini - vertical velocity missing, switching to divergence
Input data file: 1 11 GHDA
Calculation Started ... please be patient
WARNING: advpol.f could not move off pole point

Program received signal SIGSEGV: Segmentation fault - invalid memory reference.

Backtrace for this error:
#0 0x7f6c41b09bd0 in ???
#1 0x7f6c41b08e25 in ???
#2 0x7f6c417f0d5f in ???
at ./signal/../sysdeps/unix/sysv/linux/x86_64/sigaction.c:0
#3 0x55ba42eab964 in zindex_
at /home/croc/hysplit/hysplit.v5.3.2/tags/hysplit.v5.3.2/library/hysplit/zindex.f:127
#4 0x55ba42e9bea1 in adviec_
at /home/croc/hysplit/hysplit.v5.3.2/tags/hysplit.v5.3.2/library/hysplit/adviec.f:133
#5 0x55ba42e54032 in advpnt_
at /home/croc/hysplit/hysplit.v5.3.2/tags/hysplit.v5.3.2/library/hysplit/advpnt.f:1197
#6 0x55ba42e2d9f9 in hymodelt
at ../source/hymodelt.F:1217
#7 0x55ba42e29452 in main
at ../source/hymodelt.F:144
Segmentation fault
alicec
Posts: 438
Joined: February 8th, 2016, 12:56 pm
Registered HYSPLIT User: Yes

Re: Segmentation fault

Post by alicec »

Thanks, I have reproduced the problem and will get back to you shortly
alicec
Posts: 438
Joined: February 8th, 2016, 12:56 pm
Registered HYSPLIT User: Yes

Re: Segmentation fault

Post by alicec »

Thanks for the error report.

1. The segmentation fault is because the way the cyclic global boundary conditions are implemented fails when the trajectory is very near the pole on a latitude longitude grid and the velocity is large. On a latitude longitude grid the trajectory does not go 'over' the pole. Instead, as it nears the pole, it travels the 'u' (East-West) direction until it gets to the position in which the 'v' velocity (North-South) is away from the pole. Hysplit converts velocity in m/s to grid cell per minute and because the grid cell size in the 'u' direction very near the pole is very small, this grid cell size per minute can become very large and the trajectory will travel through many many grid cells in even the smallest time step of 1 minute. Currently the global boundary conditions do not consider a trajectory ending up at more than 2xNXP where NXP is the number of grid cells. For instance on a global 1 degree grid you might have NXP=360. If the trajectory ends up at 370, then HYSPLIT would compute that it is actually in grid square 370-NXP=10 when implementing the cyclic boundary conditions. However, in some cases near the pole you might have the trajectory ending up in grid square more than 2*NXP. Then the cyclic boundary condition fails to place the trajectory back on the grid.

The solution is to implement a loop in the cyclic boundary condition to subtract NXP until the position is less than NXP and the trajectory is back on the grid. After a little more testing, we will implement this in the next update.

Another related issue is that if DELT is not set in the SETUP.CFG file, then HYSPLIT will choose a timestep that it thinks appropriate. However, we may need to look at how this is being chosen when the trajectory is near the pole and I would suggest that you set DELT=1 in SETUP.CFG for trajectories near the pole.

2. Another non-related issue that you may be having that is not related to the segmentation fault is that the gdas half degree data you are using does not have vertical velocity in it. If HYSPLIT does not find vertical velocity in the file and 0 is set for vertical motion method, then it will automatically switch to using option 5 - divergence to calculate vertical velocity. However the divergence method does not work well at the poles for a latitude longitude grid. So you should switch to using a meteorological dataset which does have vertical velocity or switch to using a different vertical motion option.
See point 5 in https://www.ready.noaa.gov/hysplitusersguide/S310.htm
croc
Posts: 23
Joined: January 22nd, 2015, 10:25 am
Registered HYSPLIT User: Yes

Re: Segmentation fault

Post by croc »

Dear alicec,
thanks for confirming the error, the valuable suggestions and the
fix you are working on.

As a matter of fact, setting DELT=1. does allow to propagate the
problematic trajectory.

Nevertheless, I was quite worried by your considerations about the
vertical motion methods. I actually noticed hysplit warnings about
the vertical velocity missing fields and the switching to divergence
but I did not know its problems at the poles for a latitude longitude grid.
I am afraid to be stick to the GDAS0p5 meteo data since, as far as I know,
they are the highest resolution meteo data freely available on the ARL
ftp site on a global grid or at least on the southern hemisphere (aren't
they?). Could you please suggest a more appropriate vertical motion method
to compute backtrajectories nearby the south pole? I tried for quite a long
time to look for it in the literature but with scarce luck.

Regards,
alicec
Posts: 438
Joined: February 8th, 2016, 12:56 pm
Registered HYSPLIT User: Yes

Re: Segmentation fault

Post by alicec »

Usually the divergence method works well to estimate the vertical velocity but it just does not work near the pole on
a regular latitude longitude grid.

Which vertical motion method may be most appropriate depends a lot on your application.
For instance what heights are you looking at?
This is a classic article that explains some of the differences
https://www.sciencedirect.com/science/a ... 1097004573

You might want to look at several vertical motion methods as well as use the GDAS 1 degree dataset.

You could also use ERA5 data which you would have to download from the Climate Data Store and then convert to ARL format.
https://cds.climate.copernicus.eu/cdsap ... b=overview
If you search the forum there is some more info on how to do this as well as information here
https://github.com/amcz/hysplit_metdata
croc
Posts: 23
Joined: January 22nd, 2015, 10:25 am
Registered HYSPLIT User: Yes

Re: Segmentation fault

Post by croc »

Dear alicec,
thanks for your considerations and suggestions. I am presently calculating
backtrajectories reaching the soil around the South Pole.

I have already planned to implement the automatic download and
conversion of ERA5 meteo files, which I tested a few months
ago. I will keep in mind the need of including also the
vertical velocity field.

Regards,
Post Reply

Return to “HYSPLIT for LINUX”