dymos icon indicating copy to clipboard operation
dymos copied to clipboard

Allow enforcement of boundary constraints as residuals.

Open robfalck opened this issue 1 year ago • 0 comments

Proposed feature.

Sometimes users desire to satisfy boundary constraints without the need of an optimizer. Using the solve_segments option to have a nonlinear solver converge the dynamics should obviate the need for an optimizer in enforcing boundary constraints.

However, currently the only way to do this is to pass the resulting boundary value outside of the phase to a BalanceComp or some other implicit component, and have that component drive the residual by using an implicit variable that is then in-turn used as a parameter or time input to the phase.

This requires a nonlinear solver to exist around a large portion of the problem which is likely less performant than minimizing the scope of the nonlinear solver. Instead, this issue proposes a sibling method to add_boundary_constraint called add_boundary_residual. It takes the form:

def add_boundary_residual(expr, var, loc, **kwargs)
    """ Impose a boundary residual that drives the given expression to zero at the given location by varying the given variable.

    Parameters
    -----------
    expr : str
        An expression whose value is to be driven to zero.
    var : str
        The variable used to drive the expression to zero.  Must be one of the phase parameters, `t_initial`, or `t_duration`.
    loc : str
        One of `'initial'` or `'final'`.
    """"

Internally, dymos will compute the expression in the time series, and pass the appropriate initial or final value to a balance component which then feeds the specified implicit variable back to the parameter component.

Example

TBD

robfalck avatar Nov 09 '22 14:11 robfalck