Tools (#2) - [SIREN] 'create_bathymetry' segmentation fault (#1) - Message List

[SIREN] 'create_bathymetry' segmentation fault
 solved

Hello, I try to create a nested grid in a parent model grid using SIREN. create_coordinates.exe works as expected, and generates 1_coordinates.nc which I subsequently use in create_bathymetry.nam Bathy_coarse.nc is just the file bathy_meter.nc that I created by interpolating the gebco bathymetry, and when I use it in the coarse model, it runs fine:

ncdump -h bathy_coarse.nc
netcdf bathy_coarse { dimensions:
  x = 576 ; y = 282 ;
variables:
  double nav_lon(y, x) ; 
   double nav_lat(y, x) ; 
   double Bathymetry(y, x) ; 
   double longitude(x) ; 
   double latitude(y) ;
}

But create_bathymetry.exe throws a segmentation fault. This is the line where the segmentation fault happens:

libpthread.so.0    00002B77002818D0  Unknown               Unknown  Unknown
create_bathy.exe   000000000050D92A  iom_mpp_mp_iom_mp         588  iom_mpp.f90
create_bathy.exe   000000000050A88E  iom_mpp_mp_iom_mp         411  iom_mpp.f90
create_bathy.exe   000000000048182B  grid_mp_grid__get        1225  grid.f90
create_bathy.exe   000000000047CDE5  grid_mp_grid__get         543  grid.f90
create_bathy.exe   000000000040C2CC  MAIN                      413  create_bathy.f90

So in gridget_info_mpp → grid_get_pivot → iom_mpp_read_var(td_mpp, 'latitude') → iom_mppread_var_value → the assignment to td_var%d_value(…)

Here is my namelist:

&namlog
  cn_logfile="bathy_out.log"
  cn_verbosity='info'
  in_maxerror=100
/
&namcfg
  cn_varcfg="./cfg/variable.cfg"
/
&namcrs
  cn_coord0='coordinates.nc'
  in_perio0=
/
&namfin
  cn_coord1='1_coordinates.nc'
/
&namvar
  cn_varfile='Bathymetry:bathy_coarse.nc   '
  cn_varinfo=
/
&namnst
  in_rhoi=5
  in_rhoj=5
/
&namout
  cn_fileout="1_bathy_meter.nc"
/

In case it helps, I stored the coarse bathymetry online ( http://tempsend.com/E67356FDBC ).

Thanks,

Luc

  • Message #1

    I tracked the flow of the code and found the error…

    The subroutine iom__read_var_name directs to different subroutines that do the actual reading, depending on the type of file to read.

    Only 2 cases are implemented in iom.f90, cdf and dimg. But I had a netcdf4 file, and td_file%c_type was equal to cdf4, not cdf. Therefor, iom__read_var_name did nothing and the returning variable tl_var had sizes 0 0 0 0 , leading to the seg fault when putting these values into td_var.

    I added a new case in iom__read_var_name, cdf4, which does exactly the same as when the file type is cdf. Of course the netcdf library must be netcdf4.

    It works now.

    • Message #2

      you're right, SIREN is not yet netcdf4 compliant. However if it's work, it's fine.

      Maybe to avoid other issue like this one, you should force td_file%c_type='cdf' in iom_cdf.f90 (iom_cdf__get_info) for netcdf4 case, Instead of adding CASE('cdf4') every time you need it.

Attachments

No attachments created.