jagurs-admin / jagurs

JAGURS is a tsunami simulation code solving linear/nonlinear long-wave/Boussinesq equations with/without effects of elastic deformation of the Earth due to tsunami load and vertical profile of seawater density stratification. This code was paralleled by using OpenMP and MPI.
Other
50 stars 18 forks source link

Copy2Coarse Segmentation Fault for nested Grids #8

Closed wmszeliga closed 2 years ago

wmszeliga commented 2 years ago

Nested grid files sometimes cause a seg fault in the copy2coarse subroutine immediately after the "Computing rupture effects" step. I haven't figured out the exact circumstances but I've attempted to put together a minimum working example. The example distributed with the source code in the input directory works. I'm attaching a zip file containing a script to create two bathymetry grid files from the GEBCO 2020 bathymetry file (not included) along with the appropriate parameter files, and an log file showing the segmentation fault. Removing the SD02 entry from gridfile.dat and re-running the code produces valid output. Retaining the SD02 entry in gridfile.dat causes a segmentation fault. The bathymetry grid files are created with GMT 6.2.0, the jagurs code is at commit 5b50e8d5. seg_fault_example.zip

jagurs-admin commented 2 years ago

Thank you for using JAGURS. The ratio of grid interval between coarse and fine domains should be 3:1. Please modify like below to make the nested systems. Regards,

!/usr/bin/bash

SOURCE="GEBCO_2020.nc" OUTPUT1="bathy.SD01.grd" OUTPUT2="bathy.SD02.grd"

Pacific

PACIFIC_AREA=100/300/0/45

Hawaii

HAWAII_AREA=199/206/18/23

TMP1=$(mktemp --suffix=.grd TMP.XXXXX) TMP2=$(mktemp --suffix=.grd TMP.XXXXX)

Make the whole ocean grid

gmt grdconvert $SOURCE -R$PACIFIC_AREA -G${TMP1}=cf gmt grdsample $TMP1 -R$PACIFIC_AREA -I15m -G${TMP2}=cf -V -T gmt grdmath $TMP2 -1 MUL = ${OUTPUT1}=cf -V

Make a higher resolution grid off the coast of Chile

gmt grdconvert $SOURCE -R${HAWAII_AREA} -G${TMP1}=cf -V gmt grdsample $TMP1 -I5m -G${TMP2} -V -T gmt grdmath $TMP2 -1 MUL = ${OUTPUT2}=cf -V

rm $TMP1 $TMP2

wmszeliga commented 2 years ago

Thanks! That works. Choosing -I45c and -I15c (another factor of 3) also works.

Cheers, Walter