How to use the dymos.phases.grid_data.GridData function in dymos

To help you get started, we’ve selected a few dymos examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github OpenMDAO / dymos / dymos / phases / simulation / simulation_phase_control_interp_comp.py View on Github external
def initialize(self):
        self.options.declare('control_options', types=dict,
                             desc='Dictionary of options for the dynamic controls')
        self.options.declare('time_units', default=None, allow_none=True, types=string_types,
                             desc='Units of time')
        self.options.declare('grid_data', types=GridData, desc='Container object for grid info')
        self.options.declare('t_eval_per_seg', types=dict,
                             desc='Times within each segment at which interpolation is desired')
        self.options.declare('t_initial', types=(float, np.ndarray),
                             desc='Initial time of the phase.')
        self.options.declare('t_duration', types=(float, np.ndarray),
                             desc='Time duration of the phase.')

        # Save the names of the dynamic controls/parameters
        self._dynamic_names = []
        self._input_names = {}
        self._output_val_names = {}
        self._output_rate_names = {}
        self._output_rate2_names = {}
github OpenMDAO / dymos / dymos / phases / explicit / components / segment / explicit_segment.py View on Github external
def initialize(self):

        self.options.declare('index', types=(int,), desc='the index of this segment in the phase')
        self.options.declare('num_steps', types=(int,),
                             desc='the number of steps taken in the segment')
        self.options.declare('ode_class', desc='The ODE System class')
        self.options.declare('ode_init_kwargs', types=dict, default={},
                             desc='Keyword arguments provided when initializing the ODE System')
        self.options.declare('state_options', types=dict)
        self.options.declare('time_options', types=TimeOptionsDictionary)
        self.options.declare('control_options', types=dict, default={})
        self.options.declare('grid_data', types=GridData, allow_none=True, default=None)
        self.options.declare('design_parameter_options', types=dict, default={})
        self.options.declare('input_parameter_options', types=dict, default={})
        self.options.declare('method', types=str, default='rk4')
        self.options.declare('seg_solver_class', default=NonlinearRK,
                             values=(NonlinearRK, NonlinearBlockGS, NewtonSolver),
                             desc='The nonlinear solver class used to converge the numerical '
                                  'integration of the segment.')
github OpenMDAO / dymos / dymos / phases / optimizer_based / gauss_lobatto_phase.py View on Github external
def __init__(self, num_segments, transcription_order=3, segment_ends=None, compressed=True,
                 **kwargs):
        kwgs = kwargs.copy()
        kwgs.update({'num_segments': num_segments, 'transcription_order': transcription_order,
                    'segment_ends': segment_ends, 'compressed': compressed})

        super(GaussLobattoPhase, self).__init__(**kwgs)

        # Pluck out the kwargs needed to initialize grid_data, potentially needed prior to setup.
        num_segments = num_segments
        transcription_order = transcription_order
        segment_ends = segment_ends
        compressed = compressed
        self.grid_data = GridData(num_segments=num_segments, transcription='gauss-lobatto',
                                  transcription_order=transcription_order,
                                  segment_ends=segment_ends, compressed=compressed)
github OpenMDAO / dymos / dymos / glm / dynamic_interp_comp.py View on Github external
def initialize(self):

        self.options.declare('grid_data', types=GridData,
                             desc='Container object for grid info')

        self.options.declare('control_options', types=dict,
                             desc='Dictionary of control names/options for the phase')

        self.options.declare('time_units', default=None, allow_none=True,
                             types=string_types,
                             desc='Units of the integration variable')

        self.options.declare('normalized_times', types=np.ndarray,
                             desc='Array of timesteps for the ODE solver.')

        self.options.declare(
            'segment_times', types=list,
            desc='Ranges of timesteps corresponding to each segment.'
        )
github OpenMDAO / dymos / dymos / phases / components / control_rate_comp.py View on Github external
def initialize(self):
        self.options.declare(
            'control_options', types=dict,
            desc='Dictionary of options for the dynamic controls')
        self.options.declare(
            'time_units', default=None, allow_none=True, types=string_types,
            desc='Units of time')
        self.options.declare(
            'grid_data', types=GridData,
            desc='Container object for grid info')

        # Save the names of the dynamic controls/parameters
        self._dynamic_names = []
        self._input_names = {}
        self._output_rate_names = {}
        self._output_rate2_names = {}
github OpenMDAO / dymos / dymos / phases / explicit / components / segment / stage_control_comp.py View on Github external
def initialize(self):
        super(StageControlComp, self).initialize()

        self.options.declare('index', types=int, desc='The index of this segment in the phase.')
        self.options.declare('method', types=str, default='rk4')
        self.options.declare('num_steps', types=(int,))
        self.options.declare('control_options', types=dict, desc='Dictionary of options for '
                                                                 'the dynamic controls')
        self.options.declare('time_units', default=None, allow_none=True, types=string_types,
                             desc='Units of time')
        self.options.declare('grid_data', types=GridData, desc='Container object for grid info')

        # Save the names of the dynamic controls/parameters
        self._dynamic_names = []
        self._input_names = {}
        self._output_val_names = {}
        self._output_rate_names = {}
        self._output_rate2_names = {}

        # Save the names of the dynamic controls/parameters
        self._dynamic_names = []
        self._input_names = {}
        self._output_val_names = {}
        self._output_rate_names = {}
        self._output_rate2_names = {}

        # Data structures for storing partial data
github OpenMDAO / dymos / dymos / phases / explicit / explicit_phase.py View on Github external
def __init__(self, num_segments, transcription_order=3, num_steps=10, segment_ends=None,
                 compressed=True, shooting='single', **kwargs):
        kwgs = kwargs.copy()
        kwgs.update({'num_segments': num_segments, 'transcription_order': transcription_order,
                    'segment_ends': segment_ends, 'num_steps': num_steps, 'compressed': compressed,
                     'shooting': shooting})

        super(ExplicitPhase, self).__init__(**kwgs)

        # Pluck out the kwargs needed to initialize grid_data, potentially needed prior to setup.
        num_segments = num_segments
        transcription_order = transcription_order
        segment_ends = segment_ends
        compressed = compressed

        self.grid_data = GridData(num_segments=num_segments, transcription='explicit',
                                  transcription_order=transcription_order,
                                  num_steps_per_segment=num_steps, segment_ends=segment_ends,
                                  compressed=compressed, shooting=shooting)
github OpenMDAO / dymos / dymos / phases / optimizer_based / radau_pseudospectral_phase.py View on Github external
def __init__(self, num_segments, transcription_order=3, segment_ends=None, compressed=True,
                 **kwargs):
        kwgs = kwargs.copy()
        kwgs.update({'num_segments': num_segments, 'transcription_order': transcription_order,
                    'segment_ends': segment_ends, 'compressed': compressed})

        super(RadauPseudospectralPhase, self).__init__(**kwgs)

        # Pluck out the kwargs needed to initialize grid_data, potentially needed prior to setup.
        num_segments = num_segments
        transcription_order = transcription_order
        segment_ends = segment_ends
        compressed = compressed
        self.grid_data = GridData(num_segments=num_segments, transcription='radau-ps',
                                  transcription_order=transcription_order,
                                  segment_ends=segment_ends, compressed=compressed)