idaholab / moose

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

Allow FullSolveMultiapp to read in multiple input files and concatenate them. #25543

Open lynnmunday opened 1 year ago

lynnmunday commented 1 year ago

Reason

The forward and adjoint input files for an optimization problem are nearly the same except for a few small differences in boundary conditions and reporters. The forward and adjoint simulations are run as sub-apps. I would like to seperate the common parts of the input file into a separate input file and then have fullSolveMultiapp combine them like the command line option.

Design

Have an option for fullsolvemultiapp to do something like this:

[MultiApps]
  [forward]
    type = FullSolveMultiApp
    input_files = 'common.i forward.i' 
    execute_on = FORWARD
  []
  [adjoint]
    type = FullSolveMultiApp
    input_files = 'common.i adjoint.i'
    execute_on = ADJOINT
  []
[]

Impact

FullSolveMultiapp can already read in multiple input files but this is for using a different input file for different 'points'.

lindsayad commented 1 year ago

Does @zachmprince's multi-system design not work for your cases?

vincentlaboure commented 1 year ago

Note that you can already have input_files provide multiple input files based on the various positions (see an example here).

So you would probably want a different syntax from the one described above.

zachmprince commented 1 year ago

They SteadyAndAdjoint stuff I put in would definitely work here. But Lynn is suggesting something that would be important elsewhere I believe. One example is having two subapps that share the same mesh generation block. Not sure what the best design would be to allow the input combination like that. Maybe having a parameter in MultiApp like merge_inputs? So it treats it as a single "position" but combines the inputs.

YaqiWang commented 1 year ago

Possibly can just make input_files as a two-d vector of file names. The syntax would be input_files='common.i,forward.i'.