Skip to content

When loading an external field from file if the bounds in the file do not include ghost cells an out of bounds array access occurs and corrupts memory. #5588

Open
@clarkse

Description

@clarkse

Description

In RZ/3D modes when loading an external field from a file, the tilebox that is looped over to load into the array is a grown tilebox.

Expected behavior

I expected only internal cells to be interpolated and the ghosts to be filled by setting the boundary conditions after a load.

How to reproduce

This is part of a CI test being developed in PR #5275

I needed to generate an OpenPMD file larger than the total domain to avoid accessing out of bounds array elements in the array that is loaded from file.

The problem arises from growing the tilebox of output in the kernel that interpolates data to the mesh from the file. In WarpXInitData.cpp: WarpX::ReadExternalFieldFromFile (
const std::string& read_fields_from_path, amrex::MultiFab* mf,
const std::string& F_name, const std::string& F_component)

System information

Please check all relevant boxes and provide details.

  • Operating system (name and version):
    • Linux: e.g., Ubuntu 22.04 LTS
    • macOS: e.g., macOS Monterey 12.4
    • Windows: e.g., Windows 11 Pro
  • Version of WarpX: e.g., latest, 24.10, etc.
  • Installation method:
    • Conda
    • Spack
    • PyPI
    • Brew
    • From source with CMake
    • Module system on an HPC cluster
  • Other dependencies: yes/no, describe
  • Computational resources:
    • MPI: e.g., 2 MPI processes
    • OpenMP: e.g., 2 OpenMP threads
    • CPU: e.g., 2 CPUs
    • GPU: e.g., 2 GPUs (NVIDIA, AMD, etc.)

This issue is being generated as a placeholder to discuss appropriate options. E.g. should an error be thrown, extrapolation, or zero filling occur when the total simulation domain exceeds the domain of the input file?

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions