Skip to content
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

Enable merged input file support #17989

Closed
dschwen opened this issue Jun 2, 2021 · 9 comments · Fixed by #18035
Closed

Enable merged input file support #17989

dschwen opened this issue Jun 2, 2021 · 9 comments · Fixed by #18035
Assignees
Labels
T: task An enhancement to the software.

Comments

@dschwen
Copy link
Member

dschwen commented Jun 2, 2021

Reason

Per idaholab/moosetools#68 (which is now implemented)

I propose to add multiple input file support to MOOSE. This would internalize the (pending) hit merge functionality in MOOSE, so you could run

./moose-opt -i analysis1.i -i common_stuff.i

This way users could factor out common input block and parameters into a separate file. I'm working on an analysis of a transient with 14 distinct phases, that I'm splitting into 14 different inputs that restart off of each other. About half teh content of those inputs is shared and could be factored out into a separate file, making parameter adjustments in teh common parts a 1 file change, rather than a 14 file change. This would also reduce a source of errors, where forgetting to apply a change in one of the files could break restarts (possibly late in the simulation).

An internal merge functionality would give the user meaningful errors, pointing to the lines in the respective inputs! I.e. the user would be made aware of an error in common_stuff.i:24 or analysis.i:134.

Design

Utilize the HIT Node::name() functionality to recover the input filename when generating paramErrors. Rework MooseApp to remove the assumption of a single input file name. Loop over input files and use the hit::merge function to combine them into a single tree.

Impact

Added functionality and convenience.

@dschwen dschwen added the T: task An enhancement to the software. label Jun 2, 2021
@dschwen dschwen self-assigned this Jun 2, 2021
@dschwen
Copy link
Member Author

dschwen commented Jun 2, 2021

The semantics of specifying multiple -i parameters might be unclear to a new user at first. If the user assumes MOOSE will simply run two independent simulations one after another and is supplying two full input files, they will most certainly encounter a parse error. We should output an info message along the lines of

Merging multiple input files {'analysis1.i', 'common_stuff.i'}.

dschwen added a commit to dschwen/moose that referenced this issue Jun 2, 2021
@cticenhour
Copy link
Member

cticenhour commented Jun 3, 2021

I agree that the semantics would end up being confusing in that case, and like the extra output message to clarify. Why can't we have a single -i flag with a list of inputs to make the command itself cleaner (and maybe easier to understand for some users)?

dschwen added a commit to dschwen/moose that referenced this issue Jun 3, 2021
dschwen added a commit to dschwen/moose that referenced this issue Jun 3, 2021
@dschwen
Copy link
Member Author

dschwen commented Jun 3, 2021

Our command line parser expects one argument (or zero) after each option. I could enable a -i file1.i file2.i syntax with a small modification. I.e. digesting every argument until I find one that starts with a -. How does that sound?

dschwen added a commit to dschwen/moose that referenced this issue Jun 3, 2021
@dschwen
Copy link
Member Author

dschwen commented Jun 3, 2021

Ok, I like that, especially since it was such a small tweak!

dschwen added a commit to dschwen/moose that referenced this issue Jun 3, 2021
@cticenhour
Copy link
Member

Oh, easy - I like it!

dschwen added a commit to dschwen/moose that referenced this issue Jun 7, 2021
dschwen added a commit to dschwen/moose that referenced this issue Jun 7, 2021
dschwen added a commit to dschwen/moose that referenced this issue Jun 7, 2021
dschwen added a commit to dschwen/moose that referenced this issue Jun 7, 2021
dschwen added a commit to dschwen/moose that referenced this issue Jun 7, 2021
dschwen added a commit to dschwen/moose that referenced this issue Jun 7, 2021
dschwen added a commit to dschwen/moose that referenced this issue Jun 8, 2021
dschwen added a commit to dschwen/moose that referenced this issue Jun 8, 2021
dschwen added a commit to dschwen/moose that referenced this issue Jun 8, 2021
dschwen added a commit to dschwen/moose that referenced this issue Jun 8, 2021
dschwen added a commit to dschwen/moose that referenced this issue Jun 8, 2021
dschwen added a commit to dschwen/moose that referenced this issue Jun 8, 2021
dschwen added a commit to dschwen/moose that referenced this issue Jun 8, 2021
dschwen added a commit to dschwen/moose that referenced this issue Jun 8, 2021
dschwen added a commit to dschwen/moose that referenced this issue Jun 8, 2021
dschwen added a commit to dschwen/moose that referenced this issue Jun 8, 2021
dschwen added a commit to dschwen/moose that referenced this issue Jun 8, 2021
dschwen added a commit to dschwen/moose that referenced this issue Jun 8, 2021
dschwen added a commit to dschwen/moose that referenced this issue Jun 8, 2021
dschwen added a commit to dschwen/moose that referenced this issue Jun 8, 2021
dschwen added a commit to dschwen/moose that referenced this issue Jun 9, 2021
dschwen added a commit to dschwen/moose that referenced this issue Jun 9, 2021
dschwen added a commit to dschwen/moose that referenced this issue Jun 9, 2021
dschwen added a commit to dschwen/moose that referenced this issue Jun 9, 2021
dschwen added a commit to dschwen/moose that referenced this issue Jun 9, 2021
dschwen added a commit to dschwen/moose that referenced this issue Jun 9, 2021
dschwen added a commit to dschwen/moose that referenced this issue Jun 9, 2021
dschwen added a commit to dschwen/moose that referenced this issue Jun 9, 2021
dschwen added a commit to dschwen/moose that referenced this issue Jun 9, 2021
dschwen added a commit to dschwen/moose that referenced this issue Jun 9, 2021
dschwen added a commit to dschwen/moose that referenced this issue Jun 9, 2021
dschwen added a commit to dschwen/moose that referenced this issue Jun 9, 2021
dschwen added a commit to dschwen/moose that referenced this issue Jun 9, 2021
dschwen added a commit to dschwen/moose that referenced this issue Jun 9, 2021
dschwen added a commit to dschwen/moose that referenced this issue Jun 9, 2021
dschwen added a commit to dschwen/moose that referenced this issue Jun 9, 2021
dschwen added a commit to dschwen/moose that referenced this issue Jun 9, 2021
dschwen added a commit to dschwen/moose that referenced this issue Jun 9, 2021
@rui-hu
Copy link

rui-hu commented Jun 14, 2021

@dschwen This will be a very useful feature. How the restart would look like for the multiple input simulation?

@lefebvrera
Copy link

@dschwen I know I'm late here, but is there a reason a file import mechanism wasn't an option? Is it a possible option for the future?

E.g., somewhere in analysis1.i there exists

...
include common_stuff.i
...

The nice thing about file imports is it provides embedded traceability of the entire analysis problem as opposed to traceability only at runtime.

So for our tools that assist with validating the semantics of the problem (NEAMS Workbench, Peacock, etc.), they won't require users and reviewers to provide full context (i.e., all input files) because the input itself describes the entire problem via the parts included.

Also, the include could occur in specific contexts (subblocks, etc.) which can enable additional flexibility in the input. E.g., factor out a common block instruction set and after inclusion in a subblock add context-specific instructions.

E.g.,

...
    [xyz]
        include common_xyz.i
        more = data ...
    []
...

From a review's perspective, the input can be quickly identified and opened via typical IDE interactions (CTRL+Left-click, etc.).

@dschwen
Copy link
Member Author

dschwen commented Aug 9, 2021 via email

@dschwen
Copy link
Member Author

dschwen commented Aug 9, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T: task An enhancement to the software.
Projects
None yet
4 participants