idaholab / moose

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

Add ability to override parameters when using included files #27564

Closed brandonlangley closed 5 days ago

brandonlangley commented 1 week ago

Motivation

It is desirable to specify collections of default settings common to many problems with a shared input file.

And then include those default settings while also overriding some values in problem-specific inputs, e.g.,

problem_specific_values.i:

!include common_default_settings.i

[Functions]
  [heat-input-ref]
    expression = '${fparse new_expression}'
  []
[]

common_default_settings.i

[Functions]
  [heat-input-ref]
    type = ParsedFunction
    expression = '0.'
  []
[]

But this is not possible and fails with the following error due to the same parameter being specified twice:

*** ERROR ***
common_default_settings.i:4.5: parameter 'Functions/heat-input-ref/expression' supplied multiple times
problem_specific_values.i:5.5: parameter 'Functions/heat-input-ref/expression' supplied multiple times

Design

Allow choosing which parameter setting takes precedence with conflicting specifications in included files.

Impact

Improved flexibility in including files of common default settings and overriding specific values as needed.