Skip to content

Potential undefined behavior with read_flat_grid #1639

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
13 tasks
ews-ffarella opened this issue Jun 4, 2025 · 1 comment
Open
13 tasks

Potential undefined behavior with read_flat_grid #1639

ews-ffarella opened this issue Jun 4, 2025 · 1 comment
Labels
bug:amr-wind Something isn't working

Comments

@ews-ffarella
Copy link

ews-ffarella commented Jun 4, 2025

Bug description

Yesterday, I think I canceled the IO operation when writing my terrain file. Instead of being 60mb, it was just 1mb. Trying out my terrain refinement, I just couldn't get the results I had before. Cost me a couple of hours of debugging
Short story: I think we should check that we actually are not at eof when reading the values. There must be a bug somewhere because basically, only half of my terrain was read.

https://github.com/Exawind/amr-wind/blob/main/amr-wind/utilities/io_utils.cpp#L13

Another common grid format is the Arcgis ASCII grid. https://gdal.org/en/stable/drivers/raster/aaigrid.html

It is a very simple format for raster data. Switching to this would make amr-wind more compatible with conventional GIS formats.

The drawback is that the cell size in x any y are constant, but I think that most users are ok with that

One would need to add:

TerrainDrag.file_format = AAIGRID / native?

This could be reused when specifying z0 and forest parameters. Thw current implementation / format is however much more memory friendly for small areas.

Steps to reproduce

Steps to reproduce the behavior:

  1. Compiler used
    • GCC
    • LLVM
    • oneapi (Intel)
    • nvcc (NVIDIA)
    • rocm (AMD)
    • with MPI
    • other:
  2. Operating system
    • Linux
    • OSX
    • Windows
    • other (do tell ;)):
  3. Hardware:
    • CPU
    • GPU
  4. Machine details ():
<!-- name, modules loaded, environment variables, etc -->
  1. Input file attachments
  2. Error (paste or attach):
<!-- error output -->
  1. If this is a segfault, a stack trace from a debug build (paste or attach):
<!-- stack trace -->

Expected behavior

AMR-Wind information

==============================================================================
                AMR-Wind (https://github.com/exawind/amr-wind)

  AMR-Wind version :: v1.4.0-17-g250778a3-DIRTY
  AMR-Wind Git SHA :: 250778a3306e96b46afc117fc722491acaeb6176-DIRTY
  AMReX version    :: 24.03-36-g748f8dfea597

  Exec. time       :: Fri May 10 09:51:15 2024
  Build time       :: May  8 2024 20:36:21
  C++ compiler     :: Clang 17.0.6

  MPI              :: OFF
  GPU              :: OFF
  OpenMP           :: OFF

  No additional third-party libraries enabled

           This software is released under the BSD 3-clause license.
 See https://github.com/Exawind/amr-wind/blob/development/LICENSE for details.
------------------------------------------------------------------------------

Additional context

@ews-ffarella ews-ffarella added the bug:amr-wind Something isn't working label Jun 4, 2025
@hgopalan
Copy link
Contributor

hgopalan commented Jun 4, 2025

We will discuss this internally and get back to you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug:amr-wind Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants