idaholab / moose

Multiphysics Object Oriented Simulation Environment
https://www.mooseframework.org
GNU Lesser General Public License v2.1
1.75k stars 1.05k forks source link

Support modifying `!include` paths via CLI #26487

Open loganharbour opened 9 months ago

loganharbour commented 9 months ago

Reason

It would add flexibility if we could change what file to include via CLI. An example use case is in test specs.

Design

TBD. Supporting something like

some_file = some_file.i
!include ${some_file}

along with

path/to/app-opt -i input.i some_file=some_cooler_file.i

would be the most MOOSE-like design. But, this isn't set in stone.

Impact

Added capability.

loganharbour commented 9 months ago

FYI @maxnezdyur @brandonlangley

lefebvrera commented 9 months ago

Could the variable syntax be less ambiguous to not burden the parser with variable tracking?

E.g.,

!var some_file = some_file.i
!include ${some_file.i}

Or perhaps, this variable creation is only at the 'root' level of the document? The concern is the overhead of the parser identifying and tracking 'variables' for use in include processing needed to complete the parse-tree.

joshuahansel commented 7 months ago

Just copying this from @brandonlangley because after reading this issue, I wasn't sure why this wouldn't work already:

There are currently some hurdles with this since the !include filename happens at WASP processing time to put everything in one tree. But the ${some_file} substitution happens later in MOOSE, so WASP doesn't know about the substitution during !include processing.