Skip to content

Prevent duplicate input parameters in inputs file but allow CLI override#3312

Merged
asalmgren merged 6 commits into
erf-model:developmentfrom
nataraj2:abort_with_nan_info
Jun 17, 2026
Merged

Prevent duplicate input parameters in inputs file but allow CLI override#3312
asalmgren merged 6 commits into
erf-model:developmentfrom
nataraj2:abort_with_nan_info

Conversation

@nataraj2

@nataraj2 nataraj2 commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

This PR adds a call to a routine in main.cpp that will detect if any of the options have been specified multiple times in the inputs file, and if yes, it will abort after printing all the occurences. This prevents accidental multiple inputs specifications by the user in the inputs file. But the user can still do command line override of inputs without getting this error. ie.

<executable> <inputs> max_step=100

will not produce an error even if the inputs file has a max_step entry, but if the inputs file contains

max_step=100
max_step=1

an error of duplicate inputs will be thrown, and aborted.
An example output is

Duplicate input detected:
    Key         : amrex.fpe_trap_invalid
    First line  : 7    Value       : 0
    Second line : 8    Value       : 0

Duplicate input detected:
    Key         : fabarray.mfiter_tile_size
    First line  : 10    Value       : 1024 1024 1024
    Second line : 11    Value       : 1024 1024 1024

Duplicate input detected:
    Key         : geometry.prob_extent
    First line  : 14    Value       : 2070000 2025000 17000
    Second line : 15    Value       : 2070000 2025000 17000
amrex::Abort::0::Duplicate inputs detected in inputs file !!!

@asalmgren asalmgren merged commit 5d41423 into erf-model:development Jun 17, 2026
0 of 47 checks passed
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.

2 participants