Skip to content

ERF boundary file (erfbdy)#3264

Draft
wiersema1 wants to merge 42 commits into
erf-model:developmentfrom
wiersema1:erfbdy
Draft

ERF boundary file (erfbdy)#3264
wiersema1 wants to merge 42 commits into
erf-model:developmentfrom
wiersema1:erfbdy

Conversation

@wiersema1
Copy link
Copy Markdown
Contributor

BLUF

This PR introduces the ERF boundary data (erfbdy) file format, AMReX-native storage of boundary data FABs for real data cases using the wrfinput and metgrid pathways.

Summary

  • Preprocessing Mode: ERF can be run as a preprocessor (set max_steps = 0) to generate erfbdy and a checkpoint file.
  • Reduces Memory Consumption: Keeps only the minimum required boundary data times in memory.
  • Improves I/O Performance: Eliminates the periodic need to open, read, and close wrfbdy NetCDF files during time integration.
  • Enables Restart Capability: Resolves restart issues with the metgrid pathway.
  • Maintains Compatibility: Works with the metgrid and wrfinput pathways. The capability for as-needed reading and processing of wrfbdy is retained as an option.

Directory Structure

The erfbdy file uses a hierarchical directory structure:

erfbdy/
├── Header                          # Metadata: ntimes, nvars, real_width, time stamps, domain box
└── Time_XXXXXX/                    # One directory per boundary time
    ├── BdyData_xlo_varN            # X-lo boundary data (binary FArrayBox format)
    ├── BdyData_xhi_varN            # X-hi boundary data (binary FArrayBox format)
    ├── BdyData_ylo_varN            # Y-lo boundary data (binary FArrayBox format)
    └── BdyData_yhi_varN            # Y-hi boundary data (binary FArrayBox format)

New Input Parameters

Parameter Type Default Mandatory Description
erf.erfbdy_file String "erfbdy" No Name of the erfbdy directory
erf.write_erfbdy Boolean true (for clean starts)
false (for restarts)
No Write erfbdy file during initialization
erf.real_width Integer 0 Yes (for metgrid/wrfinput) Total width of lateral boundary nudging region

Notes:

  • erf.real_width must be specified when using erf.init_type = "metgrid" or erf.init_type = "wrfinput".
  • erf.write_erfbdy automatically defaults to true for clean starts with erf.init_type of "metgrid" or "wrfinput" and false for restarts or other erf.init_type.
  • erf.write_erfbdy can be set to false for init_type = wrfinput to process boundary data on-the-fly, but must remain true for erf.init_type = metgrid if using model restarts.

Technical Details

New source files added in Source/IO/:

  • ERF_ReadFromERFBdy.H/cpp: Functions to read erfbdy header metadata and time slices.
  • ERF_WriteERFBdy.H/cpp: Functions to initialize and write erfbdy files.

Resolves

This PR resolves restart failures with init_type = metgrid by ensuring boundary data is properly managed across checkpoint/restart cycles. Previously, metgrid initialization could not be restarted because boundary data state was not preserved.

Testing

  • init_type = "metgrid"
    • clean start (with erfbdy)
      • real_width = 1
      • real_width = 10
    • restart at chk_00000 (with erfbdy)
    • restart at chk_27000 (with erfbdy)
    • clean start (without erfbdy)
    • restart (after deleting erfbdy) throws expected error
  • init_type = "wrfinput"
    • clean start (with erfbdy)
    • restart at chk_00000 (with erfbdy)
    • restart at chk_27000 (with erfbdy)
    • clean start (without erfbdy)
    • restart at chk_27000 (without erfbdy)

wiersema1 and others added 30 commits April 29, 2026 12:24
…. This allows for the minimum number of boundary data times to be stored in memory. Stored boundary times are updated by reading from the boundary file as-needed during the run. This capability enables ERF to be run as a preprocessor by setting max_steps=0, which will initialize the simulation and produce checkpoint and boundary files. These features are working in serial for init_type="metgrid".
…metgrid being parsed from the global attr SIMULATION_START_DATE to the variable Times.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants