LANL-Seismoacoustics / infraGA

Methods to simulate propagation of infrasound in the limit of geometric acoustics
Other
22 stars 7 forks source link

Unexpected Behavior When Running infraga-accel-sph-rngdep #4

Open m4lv4r3z opened 1 year ago

m4lv4r3z commented 1 year ago

Hello,

Thanks for putting together InfragA! I’m a new user and I ran into a slight issue when running the infraga-accel-sph-rngdep executable with mpirun.

I’ve put together a case where I use the following:

  1. example* met files
  2. example_lat.loc and example_lon.loc
  3. latlon-grid.dat

I then run the following: mpirun -np 1 infraga-accel-sph-rngdep -prop example example_lat.loc example_lon.loc src_lat=40.0 src_lon=-102.5 azimuth=-90.0 write_rays=true topo_file=latlon-grid.dat

The output is

    ##############################################
    ####   Running infraga-accel-sph-rngdep   ####
    ####              Propagation             ####
    ##############################################

    Interpolating atmosphere data in 'example*' and topography data in 'latlon-grid.dat'...
          ERROR: Invalid terrain file (latlon-grid.dat)

    Setting grid node at (35, -110) with profile example0.met
    Setting grid node at (35, -106.67) with profile example1.met
    Setting grid node at (35, -103.33) with profile example2.met
    ...

I opened /src/atmo/atmo_io.sph.rngdep.mpi.cpp and I noticed that lines 278-280 are triggered if file_in.is_open() returns false or null (I’m not sure)

I compared this to lines 271-274 of /src/atmo/atmo_io.3d.rngdep.mpi.cpp. Line 271 here opens the input file stream with file_in.open(topo_file). The call to file_in.open(topo_file) is not in atmo_io.sph.rngdep.mpi.cpp, so the file isn’t opened (I think).

Does InfraGA not support spherical range dependent topology?

Adding file_in.open(topo_file) to line 277 of /src/atmo/atmo_io.sph.rngdep.mpi.cpp and recompiling allows it to open the file, but results in the following:

        WARNING!!!  Specified atmosphere grid and topogrpahy grid have no overlap.  Check grid definitions.

This new issue seems to be related to the geoac::lat_max and geoac::lon_min not being set.

Any ideas? Maybe I missed something in the documentation?

Thanks!

m4lv4r3z commented 1 year ago

I think I’ve made some progress on this…

Line 282 of /src/atmo/atmo_io.sph.rngdep.mpi.cpp has a call to file_in.open(topo_file). By introducing a call to file_in.open(topo_file) above the conditional (line 278), the topo file is actually opened, which triggers the “else” part of the conditional. In the case where line 282 is kept, it causes issues with geoac::lat_max and geoac::lon_min. The fix is to move the call to file_in.open(topo_file) from line 282 to line 277. Thus, the topo file is only opened once, which results in geoac::lat_max and geoac::lon_min having appropriate values.

However, I ran into another issue… With these changes, InfraGA runs all the way to the end (right before the call to mpi_finalize), then hits the following error:

 *** Error in `infraga-accel-sph-rngdep': corrupted size vs. prev_size: 0x00000000016a58f0 ***

I recompiled with additional flags (-ggdb -O0) and passed infraga-accel-sph-rngdep to gdb and back traced the error to

    interp::clear (spline=...) at src/util/interpolation.cpp:1050
    clear_region () at src/atmo/atmo_io.sph.rngdep.mpi.cpp:531
    run_prop (inputs=0x7fffffffcfd8, count=10) at src/main.infraga.sph.rngdep.mpi.cpp:571
    main (argc=10, argv=0x7fffffffcfd8) at src/main.infraga.sph.rngdep.mpi.cpp:1003

The hack “fix” is to comment out line 571 of src/main.infraga.sph.rngdep.mpi.cpp. I don’t think this is a good approach, but I’m not sure what the best course of action is to rectify this issue. Any suggestions?