idaholab / moose

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

VSCode plugin could output fill-in template #27510

Open GiudGiud opened 2 weeks ago

GiudGiud commented 2 weeks ago

Motivation

Some objects, like actions and physics, have a longer list of parameters. It would be much easier if a template to be filled could be spawned by the VSCode plugin, rather than relying on auto-complete to fetch the required parameters one by one

Design

Some command (maybe ctrl T?) could spawn all the required parameters of an object, with an empty field to fill.

(another idea: Alternatively, we could spawn these templates by parameter groups)

The parameters should be sorted by parameter group for readability, and parameter groups would be separated by a line break. Maybe the name of the parameter group would be included as a header for the group of parameters. Maybe users could decide how 'verbose' the templates should be

Achieving something like this:

    # General control parameters
    compressibility =
    add_energy_equation =

    # Material property parameters
    density = 
    dynamic_viscosity =
    thermal_conductivity = 
    specific_heat = 

    # Initial condition parameters
    initial_velocity = 
    initial_pressure = 
    initial_temperature = 

    # Boundary condition parameters
    inlet_boundaries = 
    momentum_inlet_types = 
    momentum_inlet_function = 
    energy_inlet_types = 'heatflux'
    energy_inlet_function = 
    wall_boundaries = 
    momentum_wall_types = 
    energy_wall_types = 
    energy_wall_function = 
    outlet_boundaries = 
    momentum_outlet_types =
    pressure_function = 

    # Ambient convection parameters
    ambient_convection_alpha =
    ambient_temperature =

    # Numerical scheme
    mass_advection_interpolation =
    momentum_advection_interpolation = 
    energy_advection_interpolation =

NB: the action being what it is, most of these parameters are actually not required. But the physics have more required parameters due to not turning off equations with booleans

One question: do we include parameters with a default already? I think it could be confusing. For example for the NSFVAction, if 'add_scalar_equation' is kept to false, then spawning the ten parameters for the scalar equation in the input would not be great. If we spawn parameters-to-fill by parameter groups rather than all-the-required-ones-at-once, then I could see us adding the pre-filled parameters with defaults

Impact

Better usability. Easier time using these large actions

@brandonlangley @dschwen @loganharbour

brandonlangley commented 2 weeks ago

Added this to the NEAMS LSP / Frontend project and pinging @lefebvrera here too.