paroto.systems.torch.electrodes =============================== .. py:module:: paroto.systems.torch.electrodes .. autoapi-nested-parse:: Electrodes system: graphite ablation and surface temperature. Classes ------- .. autoapisummary:: paroto.systems.torch.electrodes.ElectrodesSystem paroto.systems.torch.electrodes.GeometryParams Module Contents --------------- .. py:class:: ElectrodesSystem(**kwargs) Bases: :py:obj:`openmdao.api.Group` Electrodes system with selectable ablation model. Supports different fidelity levels for electrode ablation physics: - SimpleAblationModel (Low fidelity, empirical) - DEFAULT - HeatFluxAblationModel (Medium fidelity, empirical) Inputs ------ arc_current : float Arc current (A) surface_heat_flux : float Surface heat flux from arc (W/m^2) thermal_diameter : float Thermal diameter of the arc (m) electrode_radius : float Electrode radius at contact point (m) graphite_sublimation_temp : float Graphite sublimation temperature (K) graphite_heat_capacity : float Graphite specific heat capacity (J/(kg·K)) Outputs ------ ablation_rate : float Mass ablation rate (kg/s) surface_temperature : float Electrode surface temperature (K) electrode_surface_area : float Effective electrode surface area (m^2) geometry_params : float Geometry parameter for downstream components (m) .. py:method:: initialize() Declare options for model selection. .. py:method:: setup() Set up the group with selected ablation model. .. py:method:: configure() Configure this group to assign children settings. This method may optionally be overidden by your Group's method. You may only use this method to change settings on your children subsystems. This includes setting solvers in cases where you want to override the defaults. You can assume that the full hierarchy below your level has been instantiated and has already called its own configure methods. Available attributes: name pathname comm options system hieararchy with attribute access .. py:method:: set_input_defaults(name, val=_UNDEFINED, units=None, src_shape=None) Specify metadata to be assumed when multiple inputs are promoted to the same name. :param name: Promoted input name. :type name: :py:class:`str` :param val: Value to assume for the promoted input. :type val: :py:class:`object` :param units: Units to assume for the promoted input. :type units: :py:class:`str` or :py:obj:`None` :param src_shape: Assumed shape of any connected source or higher level promoted input. :type src_shape: :py:class:`int` or :py:class:`tuple` .. py:method:: is_explicit(is_comp=True) Return True if this Group contains only explicit systems and has no cycles. :param is_comp: If True, return True if this is an explicit component. If False, return True if this is an explicit component or group. :type is_comp: :py:class:`bool` :returns: True if this is an explicit component. :rtype: :py:class:`bool` .. py:method:: set_initial_values() Set all input and output variables to their declared initial values. .. py:method:: get_indep_vars(local, include_discrete=False) Return a dict of independant variables contained in this group or any of its subgroups. :param local: If True, return only the variables local to the current process. :type local: :py:class:`bool` :param include_discrete: If True, include discrete variables in the returned dict. :type include_discrete: :py:class:`bool` :returns: Dict of all independant variables in this group and their corresponding metadata. :rtype: :py:class:`dict` .. py:method:: promotes(subsys_name, any=None, inputs=None, outputs=None, src_indices=None, flat_src_indices=None, src_shape=None) Promote a variable in the model tree. :param subsys_name: The name of the child subsystem whose inputs/outputs are being promoted. :type subsys_name: :py:class:`str` :param any: A Sequence of variable names (or tuples) to be promoted, regardless of if they are inputs or outputs. This is equivalent to the items passed via the `promotes=` argument to add_subsystem. If given as a tuple, we use the "promote as" standard of "('real name', 'promoted name')*[]:". :type any: :py:class:`Sequence` of :py:class:`str` or :py:class:`tuple` :param inputs: A Sequence of input names (or tuples) to be promoted. Tuples are used for the "promote as" capability. :type inputs: :py:class:`Sequence` of :py:class:`str` or :py:class:`tuple` :param outputs: A Sequence of output names (or tuples) to be promoted. Tuples are used for the "promote as" capability. :type outputs: :py:class:`Sequence` of :py:class:`str` or :py:class:`tuple` :param src_indices: This argument applies only to promoted inputs. The global indices of the source variable to transfer data from. A value of None implies this input depends on all entries of source. Default is None. The shapes of the target and src_indices must match, and form of the entries within is determined by the value of 'flat_src_indices'. :type src_indices: :py:class:`int` or :py:class:`list` of :py:class:`ints` or :py:class:`tuple` of :py:class:`ints` or :py:class:`int ndarray` or :py:class:`Iterable` or :py:obj:`None` :param flat_src_indices: This argument applies only to promoted inputs. If True, each entry of src_indices is assumed to be an index into the flattened source. Otherwise each entry must be a tuple or list of size equal to the number of dimensions of the source. :type flat_src_indices: :py:class:`bool` :param src_shape: Assumed shape of any connected source or higher level promoted input. :type src_shape: :py:class:`int` or :py:class:`tuple` .. py:method:: add_subsystem(name, subsys, promotes=None, promotes_inputs=None, promotes_outputs=None, min_procs=1, max_procs=None, proc_weight=1.0, proc_group=None) Add a subsystem. :param name: Name of the subsystem being added. :type name: :py:class:`str` :param subsys: An instantiated, but not-yet-set up system object. :type subsys: :py:class:`` :param promotes: A list of variable names specifying which subsystem variables to 'promote' up to this group. If an entry is a tuple of the form (old_name, new_name), this will rename the variable in the parent group. :type promotes: :py:class:`iter` of :py:class:`(str` or :py:class:`tuple)`, *optional* :param promotes_inputs: A list of input variable names specifying which subsystem input variables to 'promote' up to this group. If an entry is a tuple of the form (old_name, new_name), this will rename the variable in the parent group. :type promotes_inputs: :py:class:`iter` of :py:class:`(str` or :py:class:`tuple)`, *optional* :param promotes_outputs: A list of output variable names specifying which subsystem output variables to 'promote' up to this group. If an entry is a tuple of the form (old_name, new_name), this will rename the variable in the parent group. :type promotes_outputs: :py:class:`iter` of :py:class:`(str` or :py:class:`tuple)`, *optional* :param min_procs: Minimum number of MPI processes usable by the subsystem. Defaults to 1. :type min_procs: :py:class:`int` :param max_procs: Maximum number of MPI processes usable by the subsystem. A value of None (the default) indicates there is no maximum limit. :type max_procs: :py:class:`int` or :py:obj:`None` :param proc_weight: Weight given to the subsystem when allocating available MPI processes to all subsystems. Default is 1.0. :type proc_weight: :py:class:`float` :param proc_group: Name of a processor group such that any system with that processor group name within the same parent group will be allocated on the same mpi process(es). If this is not None, then any other systems sharing the same proc_group must have identical values of min_procs, max_procs, and proc_weight or an exception will be raised. :type proc_group: :py:class:`str` or :py:obj:`None` :returns: The subsystem that was passed in. This is returned to enable users to instantiate and add a subsystem at the same time, and get the reference back. :rtype: :py:class:`` .. py:method:: add_recorder(recorder, recurse=False) Add a recorder to the system. :param recorder: A recorder instance. :type recorder: :py:class:`` :param recurse: Flag indicating if the recorder should be added to all the subsystems. :type recurse: :py:class:`bool` .. py:method:: connect(src_name, tgt_name, src_indices=None, flat_src_indices=None) Connect source src_name to target tgt_name in this namespace. :param src_name: Name of the source variable to connect. :type src_name: :py:class:`str` :param tgt_name: Name of the target variable(s) to connect. :type tgt_name: :py:class:`str` or :py:class:`[str`, :py:class:`... ]` or :py:class:`(str`, :py:class:`...)` :param src_indices: The global indices of the source variable to transfer data from. The shapes of the target and src_indices must match, and form of the entries within is determined by the value of 'flat_src_indices'. :type src_indices: :py:class:`int` or :py:class:`list` of :py:class:`ints` or :py:class:`tuple` of :py:class:`ints` or :py:class:`int ndarray` or :py:class:`Iterable` or :py:obj:`None` :param flat_src_indices: If True, each entry of src_indices is assumed to be an index into the flattened source. Otherwise it must be a tuple or list of size equal to the number of dimensions of the source. :type flat_src_indices: :py:class:`bool` .. py:method:: set_order(new_order) Specify a new execution order for subsystems in this group. :param new_order: List of system names in desired new execution order. :type new_order: :py:class:`list` of :py:class:`str` .. py:method:: run_linearize(sub_do_ln=True, driver=None) Compute jacobian / factorization. This calls _linearize, but with the model assumed to be in an unscaled state. :param sub_do_ln: Flag indicating if the children should call linearize on their linear solvers. :type sub_do_ln: :py:class:`bool` :param driver: If this system is the top level system and approx derivatives have not been initialized, the driver for this model must be supplied in order to properly initialize the approximations. :type driver: :py:class:`Driver` or :py:obj:`None` .. py:method:: guess_nonlinear(inputs, outputs, residuals, discrete_inputs=None, discrete_outputs=None) Provide initial guess for states. Override this method to set the initial guess for states. :param inputs: Unscaled, dimensional input variables read via inputs[key]. :type inputs: :py:class:`Vector` :param outputs: Unscaled, dimensional output variables read via outputs[key]. :type outputs: :py:class:`Vector` :param residuals: Unscaled, dimensional residuals written to via residuals[key]. :type residuals: :py:class:`Vector` :param discrete_inputs: If not None, dict containing discrete input values. :type discrete_inputs: :py:class:`dict` or :py:obj:`None` :param discrete_outputs: If not None, dict containing discrete output values. :type discrete_outputs: :py:class:`dict` or :py:obj:`None` .. py:method:: approx_totals(method='fd', step=None, form=None, step_calc=None) Approximate derivatives for a Group using the specified approximation method. :param method: The type of approximation that should be used. Valid options include: 'fd': Finite Difference, 'cs': Complex Step. :type method: :py:class:`str` :param step: Step size for approximation. Defaults to None, in which case, the approximation method provides its default value. :type step: :py:class:`float` :param form: Form for finite difference, can be 'forward', 'backward', or 'central'. Defaults to None, in which case, the approximation method provides its default value. :type form: :py:class:`str` :param step_calc: Step type for computing the size of the finite difference step. It can be 'abs' for absolute, 'rel_avg' for a size relative to the absolute value of the vector input, or 'rel_element' for a size relative to each value in the vector input. In addition, it can be 'rel_legacy' for a size relative to the norm of the vector. For backwards compatibilty, it can be 'rel', which is now equivalent to 'rel_avg'. Defaults to None, in which case the approximation method provides its default value. :type step_calc: :py:class:`str` .. py:method:: compute_sys_graph(comps_only=False, add_edge_info=True) Compute a dependency graph for subsystems in this group. Variable connection information is stored in each edge of the system graph if comps_only is True and add_edge_info is True. :param comps_only: If True, return a graph of all components within this group or any of its descendants. No sub-groups will be included. Otherwise, a graph containing only direct children (both Components and Groups) of this group will be returned. :type comps_only: :py:class:`bool (False)` :param add_edge_info: If True and comps_only is also True, store variable connection information in each edge of the system graph. :type add_edge_info: :py:class:`bool (True)` :returns: A directed graph containing names of subsystems and their connections. :rtype: :py:class:`DiGraph` .. py:property:: model_options Get the model options from self._problem_meta. The user may change the contents of model_options to impact values sent to subsystems of this Group. :returns: The model options metadata provided by the associated Problem object. :rtype: :py:class:`dict` .. py:method:: get_design_vars(recurse=True, get_sizes=True, use_prom_ivc=True) Get the DesignVariable settings from this system. Retrieve all design variable settings from the system and, if recurse is True, all of its subsystems. :param recurse: If True, recurse through the subsystems and return the path of all design vars relative to the this Group. :type recurse: :py:class:`bool` :param get_sizes: If True, compute the size of each design variable. :type get_sizes: :py:class:`bool`, *optional* :param use_prom_ivc: Use promoted names for inputs, else convert to absolute source names. :type use_prom_ivc: :py:class:`bool` :returns: The design variables defined in the current system and, if recurse=True, its subsystems. :rtype: :py:class:`dict` .. py:method:: get_responses(recurse=True, get_sizes=True, use_prom_ivc=False) Get the response variable settings from this system. Retrieve all response variable settings from the system as a dict, keyed by either absolute variable name, promoted name, or alias name, depending on the value of use_prom_ivc and whether the original key was a promoted output, promoted input, or an alias. :param recurse: If True, recurse through the subsystems and return the path of all responses relative to the this system. :type recurse: :py:class:`bool`, *optional* :param get_sizes: If True, compute the size of each response. :type get_sizes: :py:class:`bool`, *optional* :param use_prom_ivc: Translate ivc names to their promoted input names. :type use_prom_ivc: :py:class:`bool` :returns: The responses defined in the current system and, if recurse=True, its subsystems. :rtype: :py:class:`dict` .. py:attribute:: name :value: '' .. py:attribute:: pathname :value: None .. py:attribute:: options .. py:attribute:: recording_options .. py:attribute:: iter_count :value: 0 .. py:attribute:: iter_count_apply :value: 0 .. py:attribute:: iter_count_without_approx :value: 0 .. py:attribute:: cite :value: '' .. py:attribute:: matrix_free .. py:attribute:: under_complex_step :value: False .. py:attribute:: under_finite_difference :value: False .. py:property:: comm Return the wrapped MPI communicator object for the system. :returns: Wrapped MPI communicator object. :rtype: :py:class:`DebugComm` .. py:property:: under_approx Return True if under complex step or finite difference. :returns: True if under CS or FD. :rtype: :py:class:`bool` .. py:property:: msginfo Our instance pathname, if available, or our class name. For use in error messages. :returns: Either our instance pathname or class name. :rtype: :py:class:`str` .. py:method:: abs_meta_iter(iotype, local=True, cont=True, discrete=False) Iterate over absolute variable names and their metadata for this System. By setting appropriate values for 'cont' and 'discrete', yielded variable names can be continuous only, discrete only, or both. :param iotype: Either 'input' or 'output'. :type iotype: :py:class:`str` :param local: If True, include only names of local variables. Default is True. :type local: :py:class:`bool` :param cont: If True, include names of continuous variables. Default is True. :type cont: :py:class:`bool` :param discrete: If True, include names of discrete variables. Default is False. :type discrete: :py:class:`bool` :Yields: :py:class:`str`, :py:class:`dict` .. py:method:: set_output_solver_options(name, lower=_UNDEFINED, upper=_UNDEFINED, ref=_UNDEFINED, ref0=_UNDEFINED, res_ref=_UNDEFINED) Set solver output options. Allows the user to set output solver options after the output has been defined and metadata set using the add_ouput method. :param name: Name of the variable in this system's namespace. :type name: :py:class:`str` :param lower: Lower bound(s) in user-defined units. It can be (1) a float, (2) an array_like consistent with the shape arg (if given), or (3) an array_like matching the shape of val, if val is array_like. A value of None means this output has no lower bound. Default is None. :type lower: :py:class:`float` or :py:class:`list` or :py:class:`tuple` or :py:class:`ndarray` or :py:obj:`None` :param upper: Upper bound(s) in user-defined units. It can be (1) a float, (2) an array_like consistent with the shape arg (if given), or (3) an array_like matching the shape of val, if val is array_like. A value of None means this output has no upper bound. Default is None. :type upper: :py:class:`float` or :py:class:`list` or :py:class:`tuple` or :py:class:`ndarray` or :py:obj:`None` :param ref: Scaling parameter. The value in the user-defined units of this output variable when the scaled value is 1. Default is 1. :type ref: :py:class:`float` :param ref0: Scaling parameter. The value in the user-defined units of this output variable when the scaled value is 0. Default is 0. :type ref0: :py:class:`float` :param res_ref: Scaling parameter. The value in the user-defined res_units of this output's residual when the scaled value is 1. Default is None, which means residual scaling matches output scaling. :type res_ref: :py:class:`float` .. py:method:: set_design_var_options(name, lower=_UNDEFINED, upper=_UNDEFINED, scaler=_UNDEFINED, adder=_UNDEFINED, ref=_UNDEFINED, ref0=_UNDEFINED) Set options for design vars in the model. Can be used to set the options outside of setting them when calling add_design_var :param name: Name of the variable in this system's namespace. :type name: :py:class:`str` :param lower: Lower boundary for the input. :type lower: :py:class:`float` or :py:class:`ndarray`, *optional* :param upper: Upper boundary for the input. :type upper: :py:class:`upper` or :py:class:`ndarray`, *optional* :param scaler: Value to multiply the model value to get the scaled value for the driver. scaler is second in precedence. adder and scaler are an alterantive to using ref and ref0. :type scaler: :py:class:`float` or :py:class:`ndarray`, *optional* :param adder: Value to add to the model value to get the scaled value for the driver. adder is first in precedence. adder and scaler are an alterantive to using ref and ref0. :type adder: :py:class:`float` or :py:class:`ndarray`, *optional* :param ref: Value of design var that scales to 1.0 in the driver. :type ref: :py:class:`float` or :py:class:`ndarray`, *optional* :param ref0: Value of design var that scales to 0.0 in the driver. :type ref0: :py:class:`float` or :py:class:`ndarray`, *optional* .. py:method:: set_constraint_options(name, ref=_UNDEFINED, ref0=_UNDEFINED, equals=_UNDEFINED, lower=_UNDEFINED, upper=_UNDEFINED, adder=_UNDEFINED, scaler=_UNDEFINED, alias=_UNDEFINED) Set options for constraints in the model. Can be used to set options that were set using add_constraint. :param name: Name of the response variable in the system, or alias if given. :type name: :py:class:`str` :param ref: Value of response variable that scales to 1.0 in the driver. :type ref: :py:class:`float` or :py:class:`ndarray`, *optional* :param ref0: Value of response variable that scales to 0.0 in the driver. :type ref0: :py:class:`float` or :py:class:`ndarray`, *optional* :param equals: Equality constraint value for the variable. :type equals: :py:class:`float` or :py:class:`ndarray`, *optional* :param lower: Lower boundary for the variable. :type lower: :py:class:`float` or :py:class:`ndarray`, *optional* :param upper: Upper boundary for the variable. :type upper: :py:class:`float` or :py:class:`ndarray`, *optional* :param adder: Value to add to the model value to get the scaled value for the driver. adder is first in precedence. adder and scaler are an alterantive to using ref and ref0. :type adder: :py:class:`float` or :py:class:`ndarray`, *optional* :param scaler: Value to multiply the model value to get the scaled value for the driver. scaler is second in precedence. adder and scaler are an alterantive to using ref and ref0. :type scaler: :py:class:`float` or :py:class:`ndarray`, *optional* :param alias: Alias for this response. Necessary when adding multiple constraints on different indices or slices of a single variable. :type alias: :py:class:`str`, *optional* .. py:method:: set_objective_options(name, ref=_UNDEFINED, ref0=_UNDEFINED, adder=_UNDEFINED, scaler=_UNDEFINED, alias=_UNDEFINED) Set options for objectives in the model. Can be used to set options after they have been set by add_objective. :param name: Name of the response variable in the system, or alias if given. :type name: :py:class:`str` :param ref: Value of response variable that scales to 1.0 in the driver. :type ref: :py:class:`float` or :py:class:`ndarray`, *optional* :param ref0: Value of response variable that scales to 0.0 in the driver. :type ref0: :py:class:`float` or :py:class:`ndarray`, *optional* :param adder: Value to add to the model value to get the scaled value for the driver. adder is first in precedence. adder and scaler are an alterantive to using ref and ref0. :type adder: :py:class:`float` or :py:class:`ndarray`, *optional* :param scaler: Value to multiply the model value to get the scaled value for the driver. scaler is second in precedence. adder and scaler are an alterantive to using ref and ref0. :type scaler: :py:class:`float` or :py:class:`ndarray`, *optional* :param alias: Alias for this response. Used to disambiguate variable names when adding multiple objectives on different indices or slices of a single variable. Deprecated. :type alias: :py:class:`str` .. py:method:: get_source(name) Return the source variable connected to the given named variable. The name can be a promoted name or an absolute name. If the given variable is an input, the absolute name of the connected source will be returned. If the given variable itself is a source, its own absolute name will be returned. :param name: Absolute or promoted name of the variable. :type name: :py:class:`str` :returns: The absolute name of the source variable. :rtype: :py:class:`str` .. py:method:: use_fixed_coloring(coloring=STD_COLORING_FNAME(), recurse=True) Use a precomputed coloring for this System. :param coloring: A coloring filename. If no arg is passed, filename will be determined automatically. :type coloring: :py:class:`str` :param recurse: If True, set fixed coloring in all subsystems that declare a coloring. Ignored if a specific coloring is passed in. :type recurse: :py:class:`bool` .. py:method:: declare_coloring(wrt=_DEFAULT_COLORING_META['wrt_patterns'], method=_DEFAULT_COLORING_META['method'], form=None, step=None, per_instance=_DEFAULT_COLORING_META['per_instance'], num_full_jacs=_DEFAULT_COLORING_META['num_full_jacs'], tol=_DEFAULT_COLORING_META['tol'], orders=_DEFAULT_COLORING_META['orders'], perturb_size=_DEFAULT_COLORING_META['perturb_size'], min_improve_pct=_DEFAULT_COLORING_META['min_improve_pct'], show_summary=_DEFAULT_COLORING_META['show_summary'], show_sparsity=_DEFAULT_COLORING_META['show_sparsity']) Set options for deriv coloring of a set of wrt vars matching the given pattern(s). :param wrt: The name or names of the variables that derivatives are taken with respect to. This can contain input names, output names, or glob patterns. :type wrt: :py:class:`str` or :py:class:`list` of :py:class:`str` :param method: Method used to compute derivative: "fd" for finite difference, "cs" for complex step. :type method: :py:class:`str` :param form: Finite difference form, can be "forward", "central", or "backward". Leave undeclared to keep unchanged from previous or default value. :type form: :py:class:`str` :param step: Step size for finite difference. Leave undeclared to keep unchanged from previous or default value. :type step: :py:class:`float` :param per_instance: If True, a separate coloring will be generated for each instance of a given class. Otherwise, only one coloring for a given class will be generated and all instances of that class will use it. :type per_instance: :py:class:`bool` :param num_full_jacs: Number of times to repeat partial jacobian computation when computing sparsity. :type num_full_jacs: :py:class:`int` :param tol: Tolerance used to determine if an array entry is nonzero during sparsity determination. :type tol: :py:class:`float` :param orders: Number of orders above and below the tolerance to check during the tolerance sweep. :type orders: :py:class:`int` :param perturb_size: Size of input/output perturbation during generation of sparsity. :type perturb_size: :py:class:`float` :param min_improve_pct: If coloring does not improve (decrease) the number of solves more than the given percentage, coloring will not be used. :type min_improve_pct: :py:class:`float` :param show_summary: If True, display summary information after generating coloring. :type show_summary: :py:class:`bool` :param show_sparsity: If True, plot sparsity with coloring info after generating coloring. :type show_sparsity: :py:class:`bool` .. py:method:: uses_approx() Return True if the system uses approximations to compute derivatives. :returns: True if the system uses approximations to compute derivatives, False otherwise. :rtype: :py:class:`bool` .. py:method:: compute_sparsity(direction=None, num_iters=2, perturb_size=1e-09) Compute the sparsity of the partial jacobian. :param direction: Compute derivatives in fwd or rev mode, or whichever is based based on input and output sizes if value is None. Note that only fwd is possible when using finite difference. :type direction: :py:class:`str` :param num_iters: Number of times to compute the full jacobian. :type num_iters: :py:class:`int` :param perturb_size: Size of relative perturbation. If base value is 0.0, perturbation is absolute. :type perturb_size: :py:class:`float` :returns: * :py:class:`coo_matrix` -- The sparsity matrix. * :py:class:`dict` -- Metadata about the sparsity computation. .. py:method:: subjac_sparsity_iter(sparsity, wrt_matches=None) Iterate over sparsity for each subjac in the jacobian. :param sparsity: Sparsity matrix to use. :type sparsity: :py:class:`coo_matrix` :param wrt_matches: Only include row vars that are contained in this set. :type wrt_matches: :py:class:`set` or :py:obj:`None` :Yields: * :py:class:`str` -- Name of 'of' variable. * :py:class:`str` -- Name of 'wrt' variable. * :py:class:`ndarray` -- Row indices of the non-zero elements local to the subjac. * :py:class:`ndarray` -- Column indices of the non-zero elements local to the subjac. * :py:class:`tuple` -- Shape of the subjac. .. py:method:: sparsity_matches_fd(direction=None, outstream=sys.stdout) Compare the sparsity computed by this system vs. the sparsity computed using fd. Note that some systems use fd to compute their sparsity, so no difference will ever be found even if the sparsity is somehow incorrect. :param direction: Compute derivatives in fwd or rev mode, or whichever is based based on input and output sizes if value is None. Note that only fwd is possible when using finite difference. :type direction: :py:class:`str` or :py:obj:`None` :param outstream: Stream where output will be written. If None, no output will be written. The output is a text visualization of the sparsity difference. :type outstream: :py:class:`file-like` :returns: True if they match, False otherwise. :rtype: :py:class:`bool` .. py:method:: get_coloring_fname(mode) Return the full pathname to a coloring file. :param mode: The type of coloring file desired. Must be either 'input' or 'output'. :type mode: :py:class:`str` :returns: Full pathname of the coloring file. :rtype: :py:class:`pathlib.Path` .. py:method:: get_nonlinear_vectors() Return the inputs, outputs, and residuals vectors. :returns: Yields the inputs, outputs, and residuals nonlinear vectors. :rtype: :py:class:`(inputs`, :py:class:`outputs`, :py:class:`residuals)` .. py:method:: get_linear_vectors() Return the linear inputs, outputs, and residuals vectors. :returns: **(inputs, outputs, residuals)** -- Yields the linear inputs, outputs, and residuals vectors. :rtype: :py:class:`tuple` of :py:class:` instances` .. py:property:: nonlinear_solver Get the nonlinear solver for this system. .. py:property:: linear_solver Get the linear solver for this system. .. py:method:: set_solver_print(level=2, depth=1e+99, type_='all', debug_print=None) Control printing for solvers and subsolvers in the model. :param level: Iprint level. Set to 2 to print residuals each iteration; set to 1 to print just the iteration totals; set to 0 to disable all printing except for failures, and set to -1 to disable all printing including failures. A value of None will leave solving printing unchanged, which is useful when using this method to enable or disable debug printing only. :type level: :py:class:`int` or :py:obj:`None` :param depth: How deep to recurse. For example, you can set this to 0 if you only want to print the top level linear and nonlinear solver messages. Default prints everything. :type depth: :py:class:`int` :param type_: Type of solver to set: 'LN' for linear, 'NL' for nonlinear, or 'all' for all. :type type_: :py:class:`str` :param debug_print: If None, leave solver debug printing unchanged, otherwise turn it on or off depending on whether debug_print is True or False. Note debug_print is only applied to nonlinear solvers. :type debug_print: :py:class:`bool` or :py:obj:`None` .. py:method:: system_iter(include_self=False, recurse=True, typ=None, depth_first=False) Yield a generator of local subsystems of this system. :param include_self: If True, include this system in the iteration. :type include_self: :py:class:`bool` :param recurse: If True, iterate over the whole tree under this system. :type recurse: :py:class:`bool` :param typ: If not None, only yield Systems that match that are instances of the given type. :type typ: :py:class:`type` :param depth_first: If recurse is True, this specifies whether subsystems are returned in depth-first order (if True) or bredth-first order (if False). :type depth_first: :py:class:`bool` :Yields: :py:class:`type` or :py:obj:`None` .. py:method:: add_design_var(name, lower=None, upper=None, ref=None, ref0=None, indices=None, adder=None, scaler=None, units=None, parallel_deriv_color=None, cache_linear_solution=False, flat_indices=False) Add a design variable to this system. :param name: Promoted name of the design variable in the system. :type name: :py:class:`str` :param lower: Lower boundary for the input. :type lower: :py:class:`float` or :py:class:`ndarray`, *optional* :param upper: Upper boundary for the input. :type upper: :py:class:`upper` or :py:class:`ndarray`, *optional* :param ref: Value of design var that scales to 1.0 in the driver. :type ref: :py:class:`float` or :py:class:`ndarray`, *optional* :param ref0: Value of design var that scales to 0.0 in the driver. :type ref0: :py:class:`float` or :py:class:`ndarray`, *optional* :param indices: If an input is an array, these indicate which entries are of interest for this particular design variable. These may be positive or negative integers. :type indices: :py:class:`iter` of :py:class:`int`, *optional* :param adder: Value to add to the model value to get the scaled value for the driver. adder is first in precedence. adder and scaler are an alterantive to using ref and ref0. :type adder: :py:class:`float` or :py:class:`ndarray`, *optional* :param scaler: Value to multiply the model value to get the scaled value for the driver. scaler is second in precedence. adder and scaler are an alterantive to using ref and ref0. :type scaler: :py:class:`float` or :py:class:`ndarray`, *optional* :param units: Units to convert to before applying scaling. :type units: :py:class:`str`, *optional* :param parallel_deriv_color: If specified, this design var will be grouped for parallel derivative calculations with other variables sharing the same parallel_deriv_color. :type parallel_deriv_color: :py:class:`str` :param cache_linear_solution: If True, store the linear solution vectors for this variable so they can be used to start the next linear solution with an initial guess equal to the solution from the previous linear solve. :type cache_linear_solution: :py:class:`bool` :param flat_indices: If True, interpret specified indices as being indices into a flat source array. :type flat_indices: :py:class:`bool` .. rubric:: Notes The response can be scaled using ref and ref0. The argument :code:`ref0` represents the physical value when the scaled value is 0. The argument :code:`ref` represents the physical value when the scaled value is 1. .. py:method:: add_response(name, type_, lower=None, upper=None, equals=None, ref=None, ref0=None, indices=None, index=None, units=None, adder=None, scaler=None, linear=False, parallel_deriv_color=None, cache_linear_solution=False, flat_indices=None, alias=None) Add a response variable to this system. The response can be scaled using ref and ref0. The argument :code:`ref0` represents the physical value when the scaled value is 0. The argument :code:`ref` represents the physical value when the scaled value is 1. :param name: Promoted name of the response variable in the system. :type name: :py:class:`str` :param type_: The type of response. Supported values are 'con' and 'obj'. :type type_: :py:class:`str` :param lower: Lower boundary for the variable. :type lower: :py:class:`float` or :py:class:`ndarray`, *optional* :param upper: Upper boundary for the variable. :type upper: :py:class:`upper` or :py:class:`ndarray`, *optional* :param equals: Equality constraint value for the variable. :type equals: :py:class:`equals` or :py:class:`ndarray`, *optional* :param ref: Value of response variable that scales to 1.0 in the driver. :type ref: :py:class:`float` or :py:class:`ndarray`, *optional* :param ref0: Value of response variable that scales to 0.0 in the driver. :type ref0: :py:class:`upper` or :py:class:`ndarray`, *optional* :param indices: If variable is an array, these indicate which entries are of interest for this particular response. :type indices: :py:class:`sequence` of :py:class:`int`, *optional* :param index: If variable is an array, this indicates which entry is of interest for this particular response. :type index: :py:class:`int`, *optional* :param units: Units to convert to before applying scaling. :type units: :py:class:`str`, *optional* :param adder: Value to add to the model value to get the scaled value for the driver. adder is first in precedence. adder and scaler are an alterantive to using ref and ref0. :type adder: :py:class:`float` or :py:class:`ndarray`, *optional* :param scaler: Value to multiply the model value to get the scaled value for the driver. scaler is second in precedence. adder and scaler are an alterantive to using ref and ref0. :type scaler: :py:class:`float` or :py:class:`ndarray`, *optional* :param linear: Set to True if constraint is linear. Default is False. :type linear: :py:class:`bool` :param parallel_deriv_color: If specified, this design var will be grouped for parallel derivative calculations with other variables sharing the same parallel_deriv_color. :type parallel_deriv_color: :py:class:`str` :param cache_linear_solution: If True, store the linear solution vectors for this variable so they can be used to start the next linear solution with an initial guess equal to the solution from the previous linear solve. :type cache_linear_solution: :py:class:`bool` :param flat_indices: If True, interpret specified indices as being indices into a flat source array. :type flat_indices: :py:class:`bool` :param alias: Alias for this response. Necessary when adding multiple responses on different indices of the same variable. :type alias: :py:class:`str` or :py:obj:`None` .. py:method:: add_constraint(name, lower=None, upper=None, equals=None, ref=None, ref0=None, adder=None, scaler=None, units=None, indices=None, linear=False, parallel_deriv_color=None, cache_linear_solution=False, flat_indices=False, alias=None) Add a constraint variable to this system. :param name: Name of the response variable in the system. :type name: :py:class:`str` :param lower: Lower boundary for the variable. :type lower: :py:class:`float` or :py:class:`ndarray`, *optional* :param upper: Upper boundary for the variable. :type upper: :py:class:`float` or :py:class:`ndarray`, *optional* :param equals: Equality constraint value for the variable. :type equals: :py:class:`float` or :py:class:`ndarray`, *optional* :param ref: Value of response variable that scales to 1.0 in the driver. :type ref: :py:class:`float` or :py:class:`ndarray`, *optional* :param ref0: Value of response variable that scales to 0.0 in the driver. :type ref0: :py:class:`float` or :py:class:`ndarray`, *optional* :param adder: Value to add to the model value to get the scaled value for the driver. adder is first in precedence. adder and scaler are an alterantive to using ref and ref0. :type adder: :py:class:`float` or :py:class:`ndarray`, *optional* :param scaler: Value to multiply the model value to get the scaled value for the driver. scaler is second in precedence. adder and scaler are an alternative to using ref and ref0. :type scaler: :py:class:`float` or :py:class:`ndarray`, *optional* :param units: Units to convert to before applying scaling. :type units: :py:class:`str`, *optional* :param indices: If variable is an array, these indicate which entries are of interest for this particular response. These may be positive or negative integers. :type indices: :py:class:`sequence` of :py:class:`int`, *optional* :param linear: Set to True if constraint is linear. Default is False. :type linear: :py:class:`bool` :param parallel_deriv_color: If specified, this design var will be grouped for parallel derivative calculations with other variables sharing the same parallel_deriv_color. :type parallel_deriv_color: :py:class:`str` :param cache_linear_solution: If True, store the linear solution vectors for this variable so they can be used to start the next linear solution with an initial guess equal to the solution from the previous linear solve. :type cache_linear_solution: :py:class:`bool` :param flat_indices: If True, interpret specified indices as being indices into a flat source array. :type flat_indices: :py:class:`bool` :param alias: Alias for this response. Necessary when adding multiple constraints on different indices or slices of a single variable. :type alias: :py:class:`str` .. rubric:: Notes The response can be scaled using ref and ref0. The argument :code:`ref0` represents the physical value when the scaled value is 0. The argument :code:`ref` represents the physical value when the scaled value is 1. The arguments (:code:`lower`, :code:`upper`, :code:`equals`) can not be strings or variable names. .. py:method:: add_objective(name, ref=None, ref0=None, index=None, units=None, adder=None, scaler=None, parallel_deriv_color=None, cache_linear_solution=False, flat_indices=False, alias=None) Add a response variable to this system. :param name: Name of the response variable in the system. :type name: :py:class:`str` :param ref: Value of response variable that scales to 1.0 in the driver. :type ref: :py:class:`float` or :py:class:`ndarray`, *optional* :param ref0: Value of response variable that scales to 0.0 in the driver. :type ref0: :py:class:`float` or :py:class:`ndarray`, *optional* :param index: If variable is an array, this indicates which entry is of interest for this particular response. This may be a positive or negative integer. :type index: :py:class:`int`, *optional* :param units: Units to convert to before applying scaling. :type units: :py:class:`str`, *optional* :param adder: Value to add to the model value to get the scaled value for the driver. adder is first in precedence. adder and scaler are an alterantive to using ref and ref0. :type adder: :py:class:`float` or :py:class:`ndarray`, *optional* :param scaler: Value to multiply the model value to get the scaled value for the driver. scaler is second in precedence. adder and scaler are an alterantive to using ref and ref0. :type scaler: :py:class:`float` or :py:class:`ndarray`, *optional* :param parallel_deriv_color: If specified, this design var will be grouped for parallel derivative calculations with other variables sharing the same parallel_deriv_color. :type parallel_deriv_color: :py:class:`str` :param cache_linear_solution: If True, store the linear solution vectors for this variable so they can be used to start the next linear solution with an initial guess equal to the solution from the previous linear solve. :type cache_linear_solution: :py:class:`bool` :param flat_indices: If True, interpret specified indices as being indices into a flat source array. :type flat_indices: :py:class:`bool` :param alias: Alias for this response. Necessary when adding multiple objectives on different indices or slices of a single variable. :type alias: :py:class:`str` .. rubric:: Notes The objective can be scaled using scaler and adder, where .. math:: x_{scaled} = scaler(x + adder) or through the use of ref/ref0, which map to scaler and adder through the equations: .. math:: 0 = scaler(ref_0 + adder) 1 = scaler(ref + adder) which results in: .. math:: adder = -ref_0 scaler = \frac{1}{ref + adder} .. py:method:: get_constraints(recurse=True, get_sizes=True, use_prom_ivc=True) Get the Constraint settings from this system. Retrieve the constraint settings for the current system as a dict, keyed by variable name. :param recurse: If True, recurse through the subsystems and return the path of all constraints relative to the this system. :type recurse: :py:class:`bool`, *optional* :param get_sizes: If True, compute the size of each constraint. :type get_sizes: :py:class:`bool`, *optional* :param use_prom_ivc: Translate ivc names to their promoted input names. :type use_prom_ivc: :py:class:`bool` :returns: The constraints defined in the current system. :rtype: :py:class:`dict` .. py:method:: get_objectives(recurse=True, get_sizes=True, use_prom_ivc=True) Get the Objective settings from this system. Retrieve all objectives settings from the system as a dict, keyed by variable name. :param recurse: If True, recurse through the subsystems and return the path of all objective relative to the this system. :type recurse: :py:class:`bool`, *optional* :param get_sizes: If True, compute the size of each objective. :type get_sizes: :py:class:`bool`, *optional* :param use_prom_ivc: Translate ivc names to their promoted input names. :type use_prom_ivc: :py:class:`bool` :returns: The objectives defined in the current system. :rtype: :py:class:`dict` .. py:method:: run_apply_nonlinear() Compute residuals. This calls _apply_nonlinear, but with the model assumed to be in an unscaled state. .. py:method:: get_io_metadata(iotypes=('input', 'output'), metadata_keys=None, includes=None, excludes=None, is_indep_var=None, is_design_var=None, tags=None, get_remote=False, rank=None, return_rel_names=True) Retrieve metadata for a filtered list of variables. :param iotypes: Will contain either 'input', 'output', or both. Defaults to both. :type iotypes: :py:class:`str` or :py:class:`iter` of :py:class:`str` :param metadata_keys: Names of metadata entries to be retrieved or None, meaning retrieve all available 'allprocs' metadata. If 'val' or 'src_indices' are required, their keys must be provided explicitly since they are not found in the 'allprocs' metadata and must be retrieved from local metadata located in each process. :type metadata_keys: :py:class:`iter` of :py:class:`str` or :py:obj:`None` :param includes: Collection of glob patterns for pathnames of variables to include. Default is None, which includes all variables. :type includes: :py:class:`str`, :py:class:`iter` of :py:class:`str` or :py:obj:`None` :param excludes: Collection of glob patterns for pathnames of variables to exclude. Default is None. :type excludes: :py:class:`str`, :py:class:`iter` of :py:class:`str` or :py:obj:`None` :param is_indep_var: If None (the default), do no additional filtering of the inputs. If True, list only inputs connected to an output tagged `openmdao:indep_var`. If False, list only inputs _not_ connected to outputs tagged `openmdao:indep_var`. :type is_indep_var: :py:class:`bool` or :py:obj:`None` :param is_design_var: If None (the default), do no additional filtering of the inputs. If True, list only inputs connected to outputs that are driver design variables. If False, list only inputs _not_ connected to outputs that are driver design variables. :type is_design_var: :py:class:`bool` or :py:obj:`None` :param tags: User defined tags that can be used to filter what gets listed. Only inputs with the given tags will be listed. Default is None, which means there will be no filtering based on tags. :type tags: :py:class:`str` or :py:class:`iter` of :py:class:`strs` :param get_remote: If True, retrieve variables from other MPI processes as well. :type get_remote: :py:class:`bool` :param rank: If None, and get_remote is True, retrieve values from all MPI process to all other MPI processes. Otherwise, if get_remote is True, retrieve values from all MPI processes only to the specified rank. :type rank: :py:class:`int` or :py:obj:`None` :param return_rel_names: If True, the names returned will be relative to the scope of this System. Otherwise they will be absolute names. :type return_rel_names: :py:class:`bool` :returns: A dict of metadata keyed on name, where name is either absolute or relative based on the value of the `return_rel_names` arg, and metadata is a dict containing entries based on the value of the metadata_keys arg. Every metadata dict will always contain two entries, 'prom_name' and 'discrete', to indicate a given variable's promoted name and whether or not it is discrete. :rtype: :py:class:`dict` .. py:method:: list_vars(val=True, prom_name=True, residuals=False, residuals_tol=None, units=False, shape=False, global_shape=False, bounds=False, scaling=False, desc=False, print_arrays=False, tags=None, print_tags=False, includes=None, excludes=None, is_indep_var=None, is_design_var=None, all_procs=False, list_autoivcs=False, out_stream=_DEFAULT_OUT_STREAM, print_min=False, print_max=False, print_mean=False, return_format='list') Write a list of inputs and outputs sorted by component in execution order. :param val: When True, display output values. Default is True. :type val: :py:class:`bool`, *optional* :param prom_name: When True, display the promoted name of the variable. Default is True. :type prom_name: :py:class:`bool`, *optional* :param residuals: When True, display residual values. Default is False. :type residuals: :py:class:`bool`, *optional* :param residuals_tol: If set, limits the output of list_outputs to only variables where the norm of the resids array is greater than the given 'residuals_tol'. Default is None. :type residuals_tol: :py:class:`float`, *optional* :param units: When True, display units. Default is False. :type units: :py:class:`bool`, *optional* :param shape: When True, display/return the shape of the value. Default is False. :type shape: :py:class:`bool`, *optional* :param global_shape: When True, display/return the global shape of the value. Default is False. :type global_shape: :py:class:`bool`, *optional* :param bounds: When True, display/return bounds (lower and upper). Default is False. :type bounds: :py:class:`bool`, *optional* :param scaling: When True, display/return scaling (ref, ref0, and res_ref). Default is False. :type scaling: :py:class:`bool`, *optional* :param desc: When True, display/return description. Default is False. :type desc: :py:class:`bool`, *optional* :param print_arrays: When False, in the columnar display, just display norm of any ndarrays with size > 1. The norm is surrounded by vertical bars to indicate that it is a norm. When True, also display full values of the ndarray below the row. Format is affected by the values set with numpy.set_printoptions Default is False. :type print_arrays: :py:class:`bool`, *optional* :param tags: User defined tags that can be used to filter what gets listed. Only outputs with the given tags will be listed. Default is None, which means there will be no filtering based on tags. :type tags: :py:class:`str` or :py:class:`list` of :py:class:`strs` :param print_tags: When true, display tags in the columnar display. :type print_tags: :py:class:`bool` :param includes: Collection of glob patterns for pathnames of variables to include. Default is None, which includes all output variables. :type includes: :py:obj:`None`, :py:class:`str`, or :py:class:`iter` of :py:class:`str` :param excludes: Collection of glob patterns for pathnames of variables to exclude. Default is None. :type excludes: :py:obj:`None`, :py:class:`str`, or :py:class:`iter` of :py:class:`str` :param is_indep_var: If None (the default), do no additional filtering of the inputs. If True, list only outputs tagged `openmdao:indep_var`. If False, list only outputs that are _not_ tagged `openmdao:indep_var`. :type is_indep_var: :py:class:`bool` or :py:obj:`None` :param is_design_var: If None (the default), do no additional filtering of the inputs. If True, list only inputs connected to outputs that are driver design variables. If False, list only inputs _not_ connected to outputs that are driver design variables. :type is_design_var: :py:class:`bool` or :py:obj:`None` :param all_procs: When True, display output on all processors. Default is False. :type all_procs: :py:class:`bool`, *optional* :param list_autoivcs: If True, include auto_ivc outputs in the listing. Defaults to False. :type list_autoivcs: :py:class:`bool` :param out_stream: Where to send human readable output. Default is sys.stdout. Set to None to suppress. :type out_stream: :py:class:`file-like` :param print_min: When true, if the output value is an array, print its smallest value. :type print_min: :py:class:`bool` :param print_max: When true, if the output value is an array, print its largest value. :type print_max: :py:class:`bool` :param print_mean: When true, if the output value is an array, print its mean value. :type print_mean: :py:class:`bool` :param return_format: Indicates the desired format of the return value. Can have value of 'list' or 'dict'. If 'list', the return value is a list of (name, metadata) tuples. if 'dict', the return value is a dictionary mapping {name: metadata}. :type return_format: :py:class:`str` :returns: **list of (name, metadata) or dict of {name** -- List or dict of output names and other optional information about those outputs. :rtype: :py:class:`metadata```}`` .. py:method:: list_inputs(val=True, prom_name=True, units=False, shape=False, global_shape=False, desc=False, hierarchical=True, print_arrays=False, tags=None, print_tags=False, includes=None, excludes=None, is_indep_var=None, is_design_var=None, all_procs=False, out_stream=_DEFAULT_OUT_STREAM, print_min=False, print_max=False, print_mean=False, return_format='list') Write a list of input names and other optional information to a specified stream. :param val: When True, display/return input values. Default is True. :type val: :py:class:`bool`, *optional* :param prom_name: When True, display/return the promoted name of the variable. Default is True. :type prom_name: :py:class:`bool`, *optional* :param units: When True, display/return units. Default is False. :type units: :py:class:`bool`, *optional* :param shape: When True, display/return the shape of the value. Default is False. :type shape: :py:class:`bool`, *optional* :param global_shape: When True, display/return the global shape of the value. Default is False. :type global_shape: :py:class:`bool`, *optional* :param desc: When True, display/return description. Default is False. :type desc: :py:class:`bool`, *optional* :param hierarchical: When True, human readable output shows variables in hierarchical format. :type hierarchical: :py:class:`bool`, *optional* :param print_arrays: When False, in the columnar display, just display norm of any ndarrays with size > 1. The norm is surrounded by vertical bars to indicate that it is a norm. When True, also display full values of the ndarray below the row. Format is affected by the values set with numpy.set_printoptions Default is False. :type print_arrays: :py:class:`bool`, *optional* :param tags: User defined tags that can be used to filter what gets listed. Only inputs with the given tags will be listed. Default is None, which means there will be no filtering based on tags. :type tags: :py:class:`str` or :py:class:`list` of :py:class:`strs` :param print_tags: When true, display tags in the columnar display. :type print_tags: :py:class:`bool` :param includes: Collection of glob patterns for pathnames of variables to include. Default is None, which includes all input variables. :type includes: :py:obj:`None`, :py:class:`str`, or :py:class:`iter` of :py:class:`str` :param excludes: Collection of glob patterns for pathnames of variables to exclude. Default is None. :type excludes: :py:obj:`None`, :py:class:`str`, or :py:class:`iter` of :py:class:`str` :param is_indep_var: If None (the default), do no additional filtering of the inputs. If True, list only inputs connected to an output tagged `openmdao:indep_var`. If False, list only inputs _not_ connected to outputs tagged `openmdao:indep_var`. :type is_indep_var: :py:class:`bool` or :py:obj:`None` :param is_design_var: If None (the default), do no additional filtering of the inputs. If True, list only inputs connected to outputs that are driver design variables. If False, list only inputs _not_ connected to outputs that are driver design variables. :type is_design_var: :py:class:`bool` or :py:obj:`None` :param all_procs: When True, display output on all ranks. Default is False, which will display output only from rank 0. :type all_procs: :py:class:`bool`, *optional* :param out_stream: Where to send human readable output. Default is sys.stdout. Set to None to suppress. :type out_stream: :py:class:`file-like object` :param print_min: When true, if the input value is an array, print its smallest value. :type print_min: :py:class:`bool` :param print_max: When true, if the input value is an array, print its largest value. :type print_max: :py:class:`bool` :param print_mean: When true, if the input value is an array, print its mean value. :type print_mean: :py:class:`bool` :param return_format: Indicates the desired format of the return value. Can have value of 'list' or 'dict'. If 'list', the return value is a list of (name, metadata) tuples. if 'dict', the return value is a dictionary mapping {name: metadata}. :type return_format: :py:class:`str` :returns: **list of (name, metadata) or dict of {name** -- List or dict of input names and other optional information about those inputs. :rtype: :py:class:`metadata```}`` .. py:method:: list_outputs(explicit=True, implicit=True, val=True, prom_name=True, residuals=False, residuals_tol=None, units=False, shape=False, global_shape=False, bounds=False, scaling=False, desc=False, hierarchical=True, print_arrays=False, tags=None, print_tags=False, includes=None, excludes=None, is_indep_var=None, is_design_var=None, all_procs=False, list_autoivcs=False, out_stream=_DEFAULT_OUT_STREAM, print_min=False, print_max=False, print_mean=False, return_format='list') Write a list of output names and other optional information to a specified stream. :param explicit: Include outputs from explicit components. Default is True. :type explicit: :py:class:`bool`, *optional* :param implicit: Include outputs from implicit components. Default is True. :type implicit: :py:class:`bool`, *optional* :param val: When True, display output values. Default is True. :type val: :py:class:`bool`, *optional* :param prom_name: When True, display the promoted name of the variable. Default is True. :type prom_name: :py:class:`bool`, *optional* :param residuals: When True, display residual values. Default is False. :type residuals: :py:class:`bool`, *optional* :param residuals_tol: If set, limits the output of list_outputs to only variables where the norm of the resids array is greater than the given 'residuals_tol'. Default is None. :type residuals_tol: :py:class:`float`, *optional* :param units: When True, display units. Default is False. :type units: :py:class:`bool`, *optional* :param shape: When True, display/return the shape of the value. Default is False. :type shape: :py:class:`bool`, *optional* :param global_shape: When True, display/return the global shape of the value. Default is False. :type global_shape: :py:class:`bool`, *optional* :param bounds: When True, display/return bounds (lower and upper). Default is False. :type bounds: :py:class:`bool`, *optional* :param scaling: When True, display/return scaling (ref, ref0, and res_ref). Default is False. :type scaling: :py:class:`bool`, *optional* :param desc: When True, display/return description. Default is False. :type desc: :py:class:`bool`, *optional* :param hierarchical: When True, human readable output shows variables in hierarchical format. :type hierarchical: :py:class:`bool`, *optional* :param print_arrays: When False, in the columnar display, just display norm of any ndarrays with size > 1. The norm is surrounded by vertical bars to indicate that it is a norm. When True, also display full values of the ndarray below the row. Format is affected by the values set with numpy.set_printoptions Default is False. :type print_arrays: :py:class:`bool`, *optional* :param tags: User defined tags that can be used to filter what gets listed. Only outputs with the given tags will be listed. Default is None, which means there will be no filtering based on tags. :type tags: :py:class:`str` or :py:class:`list` of :py:class:`strs` :param print_tags: When true, display tags in the columnar display. :type print_tags: :py:class:`bool` :param includes: Collection of glob patterns for pathnames of variables to include. Default is None, which includes all output variables. :type includes: :py:obj:`None`, :py:class:`str`, or :py:class:`iter` of :py:class:`str` :param excludes: Collection of glob patterns for pathnames of variables to exclude. Default is None. :type excludes: :py:obj:`None`, :py:class:`str`, or :py:class:`iter` of :py:class:`str` :param is_indep_var: If None (the default), do no additional filtering of the inputs. If True, list only outputs tagged `openmdao:indep_var`. If False, list only outputs that are _not_ tagged `openmdao:indep_var`. :type is_indep_var: :py:class:`bool` or :py:obj:`None` :param is_design_var: If None (the default), do no additional filtering of the inputs. If True, list only inputs connected to outputs that are driver design variables. If False, list only inputs _not_ connected to outputs that are driver design variables. :type is_design_var: :py:class:`bool` or :py:obj:`None` :param all_procs: When True, display output on all processors. Default is False. :type all_procs: :py:class:`bool`, *optional* :param list_autoivcs: If True, include auto_ivc outputs in the listing. Defaults to False. :type list_autoivcs: :py:class:`bool` :param out_stream: Where to send human readable output. Default is sys.stdout. Set to None to suppress. :type out_stream: :py:class:`file-like` :param print_min: When true, if the output value is an array, print its smallest value. :type print_min: :py:class:`bool` :param print_max: When true, if the output value is an array, print its largest value. :type print_max: :py:class:`bool` :param print_mean: When true, if the output value is an array, print its mean value. :type print_mean: :py:class:`bool` :param return_format: Indicates the desired format of the return value. Can have value of 'list' or 'dict'. If 'list', the return value is a list of (name, metadata) tuples. if 'dict', the return value is a dictionary mapping {name: metadata}. :type return_format: :py:class:`str` :returns: **list of (name, metadata) or dict of {name** -- List or dict of output names and other optional information about those outputs. :rtype: :py:class:`metadata```}`` .. py:method:: list_options(include_default=True, include_solvers=True, out_stream=_DEFAULT_OUT_STREAM, return_format='list') Write a list of output names and other optional information to a specified stream. :param include_default: When True, include the built-in openmdao system options. Default is True. :type include_default: :py:class:`bool` :param include_solvers: When True, include options from nonlinear_solver and linear_solver. :type include_solvers: :py:class:`bool` :param out_stream: Where to send human readable output. Default is sys.stdout. Set to None to suppress. :type out_stream: :py:class:`file-like` :param return_format: Indicates the desired format of the return value. Can have value of 'list' or 'dict'. If 'list', the return value is a list of tuples of the form: (pathname, system options , nonlinear solver options, linear solver options) if 'dict', the return value is a dictionary with the pathname as key, and a dictionary as the value. The dictionary contains 'options', 'nonlinear_solver', and 'linear_solver' keys, each of which isa dictionary of options. :type return_format: :py:class:`str` :returns: List of tuples, one for each subsystem sorted by execution order. Each tuple contains the pathname string, a dictionary of system options, a dictionary of nonlinear solver options (only if include_solvers is True) or None, and a dictionary of nonlinear solver options (only if include_solvers is True) or None. :rtype: :py:class:`list` of :py:class:`tuple` .. py:method:: run_solve_nonlinear() Compute outputs. This calls _solve_nonlinear, but with the model assumed to be in an unscaled state. .. py:method:: run_apply_linear(mode, scope_out=None, scope_in=None) Compute jac-vec product. This calls _apply_linear, but with the model assumed to be in an unscaled state. :param mode: 'fwd' or 'rev'. :type mode: :py:class:`str` :param scope_out: Set of absolute output names in the scope of this mat-vec product. If None, all are in the scope. :type scope_out: :py:class:`set` or :py:obj:`None` :param scope_in: Set of absolute input names in the scope of this mat-vec product. If None, all are in the scope. :type scope_in: :py:class:`set` or :py:obj:`None` .. py:method:: run_solve_linear(mode) Apply inverse jac product. This calls _solve_linear, but with the model assumed to be in an unscaled state. :param mode: 'fwd' or 'rev'. :type mode: :py:class:`str` .. py:method:: check_config(logger) Perform optional error checks. :param logger: The object that manages logging output. :type logger: :py:class:`object` .. py:method:: load_model_options() Load the relevant model options from `Problem._metadata['model_options']`. This method examines each path filter and corresponding options in self._problem_meta['model_options']. If this System's pathname matches the given path filter, it will assume the value for each given option which it possesses. .. py:method:: record_iteration() Record an iteration of the current System. .. py:method:: get_reports_dir() Get the path to the directory where the report files should go. If it doesn't exist, it will be created. :returns: The path to the directory where reports should be written. :rtype: :py:class:`str` .. py:method:: get_outputs_dir(*subdirs, mkdir=False) Get the path under which all output files of this system are to be placed. :param \*subdirs: Subdirectories nested under the relevant problem output directory. To create {prob_output_dir}/a/b one would pass `system.get_outputs_dir('a', 'b')`. :type \*subdirs: :py:class:`str` :param mkdir: If True, attempt to create this directory if it does not exist. :type mkdir: :py:class:`bool` :returns: The path of the outputs directory for the problem. :rtype: :py:class:`pathlib.Path` .. py:method:: cleanup() Clean up resources prior to exit. .. py:method:: get_val(name, units=None, indices=None, get_remote=False, rank=None, vec_name='nonlinear', kind=None, flat=False, from_src=True, copy=False) Get an output/input/residual variable. Function is used if you want to specify display units. :param name: Promoted or relative variable name in the root system's namespace. :type name: :py:class:`str` :param units: Units to convert to before return. :type units: :py:class:`str`, *optional* :param indices: Indices or slice to return. :type indices: :py:class:`int` or :py:class:`list` of :py:class:`ints` or :py:class:`tuple` of :py:class:`ints` or :py:class:`int ndarray` or :py:class:`Iterable` or :py:obj:`None`, *optional* :param get_remote: If True, retrieve the value even if it is on a remote process. Note that if the variable is remote on ANY process, this function must be called on EVERY process in the Problem's MPI communicator. If False, only retrieve the value if it is on the current process, or only the part of the value that's on the current process for a distributed variable. If None and the variable is remote or distributed, a RuntimeError will be raised. :type get_remote: :py:class:`bool` or :py:obj:`None` :param rank: If not None, only gather the value to this rank. :type rank: :py:class:`int` or :py:obj:`None` :param vec_name: Name of the vector to use. Defaults to 'nonlinear'. :type vec_name: :py:class:`str` :param kind: Kind of variable ('input', 'output', or 'residual'). If None, returned value will be either an input or output. :type kind: :py:class:`str` or :py:obj:`None` :param flat: If True, return the flattened version of the value. :type flat: :py:class:`bool` :param from_src: If True, retrieve value of an input variable from its connected source. :type from_src: :py:class:`bool` :param copy: If True, return a copy of the value. If False, return a reference to the value. :type copy: :py:class:`bool`, *optional* :returns: The value of the requested output/input variable. :rtype: :py:class:`object` .. py:method:: set_val(name, val, units=None, indices=None) Set an input or output variable. :param name: Promoted or relative variable name in the system's namespace. :type name: :py:class:`str` :param val: Value to assign to this variable. :type val: :py:class:`object` :param units: Units of the value. :type units: :py:class:`str`, *optional* :param indices: Indices or slice to set. :type indices: :py:class:`int` or :py:class:`list` of :py:class:`ints` or :py:class:`tuple` of :py:class:`ints` or :py:class:`int ndarray` or :py:class:`Iterable` or :py:obj:`None`, *optional* .. py:method:: convert2units(name, val, units) Convert the given value to the specified units. :param name: Name of the variable. :type name: :py:class:`str` :param val: The value of the variable. :type val: :py:class:`float` or :py:class:`ndarray` of :py:class:`float` :param units: The units to convert to. :type units: :py:class:`str` :returns: The value converted to the specified units. :rtype: :py:class:`float` or :py:class:`ndarray` of :py:class:`float` .. py:method:: convert_from_units(name, val, units) Convert the given value from the specified units to those of the named variable. :param name: Name of the variable. :type name: :py:class:`str` :param val: The value of the variable. :type val: :py:class:`float` or :py:class:`ndarray` of :py:class:`float` :param units: The units to convert to. :type units: :py:class:`str` :returns: The value converted to the specified units. :rtype: :py:class:`float` or :py:class:`ndarray` of :py:class:`float` .. py:method:: convert_units(name, val, units_from, units_to) Wrap the utility convert_units and give a good error message. :param name: Name of the variable. :type name: :py:class:`str` :param val: The value of the variable. :type val: :py:class:`float` or :py:class:`ndarray` of :py:class:`float` :param units_from: The units to convert from. :type units_from: :py:class:`str` :param units_to: The units to convert to. :type units_to: :py:class:`str` :returns: The value converted to the specified units. :rtype: :py:class:`float` or :py:class:`ndarray` of :py:class:`float` .. py:method:: total_local_size(io) Return the total local size of the given variable. :param io: Either 'input' or 'output'. :type io: :py:class:`str` :returns: The total local size of the given input or output vector. :rtype: :py:class:`int` .. py:method:: best_partial_deriv_direction() Return the best direction for partial deriv calculations based on input and output sizes. :returns: The best direction for derivative calculations, 'fwd' or 'rev'. :rtype: :py:class:`str` .. py:method:: get_promotions(inprom=None, outprom=None) Return all promotions for the given promoted variable(s). In other words, how and where did promotions occur to convert absolute variable names into the given promoted name(s) at the current System level. :param inprom: The promoted input variable name. :type inprom: :py:class:`str` or :py:obj:`None` :param outprom: The promoted output variable name. :type outprom: :py:class:`str` or :py:obj:`None` :returns: Dictionary keyed on system pathname containing input and/or output promotion lists for each System where promotions occurred to produce the given promoted variable(s). :rtype: :py:class:`dict` .. py:method:: load_case(case) Pull all input and output variables from a Case into this System. Override this method if the System requires special handling when loading a case. :param case: A Case from a CaseReader, or a dictionary with key 'inputs' mapped to the output of problem.model.list_inputs and key 'outputs' mapped to the output of prob.model.list_outputs. Both list_inputs and list_outputs should be called with `prom_name=True` and `return_format='dict'`. :type case: :py:class:`Case` or :py:class:`dict` .. py:method:: comm_info_iter() Yield comm size for this system and all subsystems. :Yields: :py:class:`tuple` -- A tuple of the form (abs_name, comm_size). .. py:method:: dist_size_iter(io, top_comm) Yield names and distributed ranges of all local and remote variables in this system. :param io: Either 'input' or 'output'. :type io: :py:class:`str` :param top_comm: The top-level MPI communicator. :type top_comm: :py:class:`MPI.Comm` or :py:obj:`None` :Yields: :py:class:`tuple` -- A tuple of the form ((abs_name, rank), start, end). .. py:method:: get_var_dup_info(name, io) Return information about how the given variable is duplicated across MPI processes. :param name: Name of the variable. :type name: :py:class:`str` :param io: Either 'input' or 'output'. :type io: :py:class:`str` :returns: A tuple of the form (is_duplicated, num_zeros, is_distributed). :rtype: :py:class:`tuple` .. py:method:: get_var_sizes(name, io) Return the sizes of the given variable on all procs. :param name: Name of the variable. :type name: :py:class:`str` :param io: Either 'input' or 'output'. :type io: :py:class:`str` :returns: Array of sizes of the variable on all procs. :rtype: :py:class:`ndarray` .. py:method:: get_self_statics() Override this in derived classes if compute_primal references static values. Do NOT include self._discrete_inputs in the returned tuple. Include things like self.options['opt_name'], etc., that are used in compute_primal but are assumed to be constant during derivative computation. Return value MUST be a tuple. Don't forget the trailing comma if tuple has only one item. Return value MUST be hashable. The order of these values doesn't matter. They are only checked (by computing their hash) to see if they have changed since the last time compute_primal was jitted, and if so, compute_primal will be re-jitted. :returns: Tuple containing all static values required by compute_primal. :rtype: :py:class:`tuple` .. py:method:: run_validation() Run validate method on all systems below this system. The validate method on each system can be used to check any final input / output values after a run. .. py:method:: validate(inputs, outputs, discrete_inputs=None, discrete_outputs=None) Check any final input / output values after a run. The model is assumed to be in an unscaled state. An inherited component may choose to either override this function or ignore it. Any errors or warnings raised in this method will be collected and all printed / raised together. :param inputs: Unscaled, dimensional input variables read via inputs[key]. :type inputs: :py:class:`Vector` :param outputs: Unscaled, dimensional output variables read via outputs[key]. :type outputs: :py:class:`Vector` :param discrete_inputs: If not None, dict-like object containing discrete input values. :type discrete_inputs: :py:class:`dict-like` or :py:obj:`None` :param discrete_outputs: If not None, dict-like object containing discrete output values. :type discrete_outputs: :py:class:`dict-like` or :py:obj:`None` .. py:class:: GeometryParams(**kwargs) Bases: :py:obj:`openmdao.api.ExplicitComponent` Geometry parameters for downstream components. Inputs ------ electrode_radius : float Electrode radius at contact point (m) Outputs ------- geometry_params : float Geometry parameter for downstream components (m) .. py:method:: setup() Define inputs and outputs. .. py:method:: compute(inputs, outputs) Compute geometry parameters. .. py:method:: compute_partials(inputs, partials) Compute partial derivatives. .. py:property:: nonlinear_solver Get the nonlinear solver for this system. .. py:property:: linear_solver Get the linear solver for this system. .. py:method:: add_output(name, val=1.0, shape=None, units=None, res_units=None, desc='', lower=None, upper=None, ref=1.0, ref0=0.0, res_ref=None, tags=None, shape_by_conn=False, copy_shape=None, compute_shape=None, units_by_conn=False, compute_units=None, copy_units=None, distributed=None, primal_name=None) Add an output variable to the component. For ExplicitComponent, res_ref defaults to the value in res unless otherwise specified. :param name: Name of the variable in this component's namespace. :type name: :py:class:`str` :param val: The initial value of the variable being added in user-defined units. Default is 1.0. :type val: :py:class:`float` or :py:class:`list` or :py:class:`tuple` or :py:class:`ndarray` :param shape: Shape of this variable, only required if val is not an array. Default is None. :type shape: :py:class:`int` or :py:class:`tuple` or :py:class:`list` or :py:obj:`None` :param units: Units in which the output variables will be provided to the component during execution. Default is None, which means it has no units. :type units: :py:class:`str` or :py:obj:`None` :param res_units: Units in which the residuals of this output will be given to the user when requested. Default is None, which means it has no units. :type res_units: :py:class:`str` or :py:obj:`None` :param desc: Description of the variable. :type desc: :py:class:`str` :param lower: Lower bound(s) in user-defined units. It can be (1) a float, (2) an array_like consistent with the shape arg (if given), or (3) an array_like matching the shape of val, if val is array_like. A value of None means this output has no lower bound. Default is None. :type lower: :py:class:`float` or :py:class:`list` or :py:class:`tuple` or :py:class:`ndarray` or :py:obj:`None` :param upper: Upper bound(s) in user-defined units. It can be (1) a float, (2) an array_like consistent with the shape arg (if given), or (3) an array_like matching the shape of val, if val is array_like. A value of None means this output has no upper bound. Default is None. :type upper: :py:class:`float` or :py:class:`list` or :py:class:`tuple` or :py:class:`ndarray` or :py:obj:`None` :param ref: Scaling parameter. The value in the user-defined units of this output variable when the scaled value is 1. Default is 1. :type ref: :py:class:`float` :param ref0: Scaling parameter. The value in the user-defined units of this output variable when the scaled value is 0. Default is 0. :type ref0: :py:class:`float` :param res_ref: Scaling parameter. The value in the user-defined res_units of this output's residual when the scaled value is 1. Default is None, which means residual scaling matches output scaling. :type res_ref: :py:class:`float` :param tags: User defined tags that can be used to filter what gets listed when calling list_inputs and list_outputs and also when listing results from case recorders. :type tags: :py:class:`str` or :py:class:`list` of :py:class:`strs` :param shape_by_conn: If True, shape this output to match its connected input(s). :type shape_by_conn: :py:class:`bool` :param copy_shape: If a str, that str is the name of a variable. Shape this output to match that of the named variable. :type copy_shape: :py:class:`str` or :py:obj:`None` :param compute_shape: If a function, that function is called to determine the shape of this output. :type compute_shape: :py:class:`function` or :py:obj:`None` :param units_by_conn: If True, units are computed by the connected input(s). :type units_by_conn: :py:class:`bool` :param compute_units: If a function, that function is called to determine the units of this output. :type compute_units: :py:class:`function` or :py:obj:`None` :param copy_units: If a str, that str is the name of a variable. Units this output to match that of the named variable. :type copy_units: :py:class:`str` or :py:obj:`None` :param distributed: If True, this variable is a distributed variable, so it can have different sizes/values across MPI processes. :type distributed: :py:class:`bool` :param primal_name: Valid python name to represent the variable in compute_primal if 'name' is not a valid python name. :type primal_name: :py:class:`str` or :py:obj:`None` :returns: Metadata for added variable. :rtype: :py:class:`dict` .. py:method:: compute_jacvec_product(inputs, d_inputs, d_outputs, mode, discrete_inputs=None) Compute jac-vector product. The model is assumed to be in an unscaled state. If mode is: 'fwd': d_inputs \|-> d_outputs 'rev': d_outputs \|-> d_inputs :param inputs: Unscaled, dimensional input variables read via inputs[key]. :type inputs: :py:class:`Vector` :param d_inputs: See inputs; product must be computed only if var_name in d_inputs. :type d_inputs: :py:class:`Vector` :param d_outputs: See outputs; product must be computed only if var_name in d_outputs. :type d_outputs: :py:class:`Vector` :param mode: Either 'fwd' or 'rev'. :type mode: :py:class:`str` :param discrete_inputs: If not None, dict containing discrete input values. :type discrete_inputs: :py:class:`dict` or :py:obj:`None` .. py:method:: is_explicit(is_comp=True) Return True if this is an explicit component. :param is_comp: If True, return True if this is an explicit component. If False, return True if this is an explicit component or group. :type is_comp: :py:class:`bool` :returns: True if this is an explicit component. :rtype: :py:class:`bool` .. py:method:: compute_fd_sparsity(method='fd', num_full_jacs=2, perturb_size=1e-09) Use finite difference to compute a sparsity matrix. :param method: The type of finite difference to perform. Valid options are 'fd' for forward difference, or 'cs' for complex step. :type method: :py:class:`str` :param num_full_jacs: Number of times to repeat jacobian computation using random perturbations. :type num_full_jacs: :py:class:`int` :param perturb_size: Size of the random perturbation. :type perturb_size: :py:class:`float` :returns: The sparsity matrix. :rtype: :py:class:`coo_matrix` .. py:method:: setup_partials() Declare partials. This is meant to be overridden by component classes. All partials should be declared here since this is called after all size/shape information is known for all variables. .. py:property:: checking Return True if check_partials or check_totals is executing. :returns: True if we're running within check_partials or check_totals. :rtype: :py:class:`bool` .. py:method:: add_input(name, val=1.0, shape=None, units=None, desc='', tags=None, shape_by_conn=False, copy_shape=None, compute_shape=None, units_by_conn=False, copy_units=None, compute_units=None, require_connection=False, distributed=None, primal_name=None) Add an input variable to the component. :param name: Name of the variable in this component's namespace. :type name: :py:class:`str` :param val: The initial value of the variable being added in user-defined units. Default is 1.0. :type val: :py:class:`float` or :py:class:`list` or :py:class:`tuple` or :py:class:`ndarray` or :py:class:`Iterable` :param shape: Shape of this variable, only required if val is not an array. Default is None. :type shape: :py:class:`int` or :py:class:`tuple` or :py:class:`list` or :py:obj:`None` :param units: Units in which this input variable will be provided to the component during execution. Default is None, which means it is unitless. :type units: :py:class:`str` or :py:obj:`None` :param desc: Description of the variable. :type desc: :py:class:`str` :param tags: User defined tags that can be used to filter what gets listed when calling list_inputs and list_outputs. :type tags: :py:class:`str` or :py:class:`list` of :py:class:`strs` :param shape_by_conn: If True, shape this input to match its connected output. :type shape_by_conn: :py:class:`bool` :param copy_shape: If a str, that str is the name of a variable. Shape this input to match that of the named variable. :type copy_shape: :py:class:`str` or :py:obj:`None` :param compute_shape: A function taking a dict arg containing names and shapes of this component's outputs and returning the shape of this input. :type compute_shape: :py:class:`function` :param units_by_conn: If True, set units of this input to match its connected output. :type units_by_conn: :py:class:`bool` :param copy_units: If a str, that str is the name of a variable. Set the units of this input to match those of the named variable. :type copy_units: :py:class:`str` or :py:obj:`None` :param compute_units: A function taking a dict arg containing names and PhysicalUnits of this component's outputs and returning the PhysicalUnits of this input. :type compute_units: :py:class:`function` :param require_connection: If True and this input is not a design variable, it must be connected to an output. :type require_connection: :py:class:`bool` :param distributed: If True, this variable is a distributed variable, so it can have different sizes/values across MPI processes. :type distributed: :py:class:`bool` :param primal_name: Valid python name to represent the variable in compute_primal if 'name' is not a valid python name. :type primal_name: :py:class:`str` or :py:obj:`None` :returns: Metadata for added variable. :rtype: :py:class:`dict` .. py:method:: add_discrete_input(name, val, desc='', tags=None, primal_name=None) Add a discrete input variable to the component. :param name: Name of the variable in this component's namespace. :type name: :py:class:`str` :param val: The initial value of the variable being added. :type val: :py:class:`a picklable object` :param desc: Description of the variable. :type desc: :py:class:`str` :param tags: User defined tags that can be used to filter what gets listed when calling list_inputs and list_outputs. :type tags: :py:class:`str` or :py:class:`list` of :py:class:`strs` :param primal_name: Valid python name to represent the variable in compute_primal if 'name' is not a valid python name. :type primal_name: :py:class:`str` or :py:obj:`None` :returns: Metadata for added variable. :rtype: :py:class:`dict` .. py:method:: add_discrete_output(name, val, desc='', tags=None, primal_name=None) Add an output variable to the component. :param name: Name of the variable in this component's namespace. :type name: :py:class:`str` :param val: The initial value of the variable being added. :type val: :py:class:`a picklable object` :param desc: Description of the variable. :type desc: :py:class:`str` :param tags: User defined tags that can be used to filter what gets listed when calling list_inputs and list_outputs. :type tags: :py:class:`str` or :py:class:`list` of :py:class:`strs` or :py:class:`set` of :py:class:`strs` :param primal_name: Valid python name to represent the variable in compute_primal if 'name' is not a valid python name. :type primal_name: :py:class:`str` or :py:obj:`None` :returns: Metadata for added variable. :rtype: :py:class:`dict` .. py:method:: declare_partials(of, wrt, dependent=True, rows=None, cols=None, val=None, method='exact', step=None, form=None, step_calc=None, minimum_step=None, diagonal=None) Declare information about this component's subjacobians. :param of: The name of the residual(s) that derivatives are being computed for. May also contain a glob pattern. :type of: :py:class:`str` or :py:class:`iter` of :py:class:`str` :param wrt: The name of the variables that derivatives are taken with respect to. This can contain the name of any input or output variable. May also contain a glob pattern. :type wrt: :py:class:`str` or :py:class:`iter` of :py:class:`str` :param dependent: If False, specifies no dependence between the output(s) and the input(s). This is only necessary in the case of a sparse global jacobian, because if 'dependent=False' is not specified and declare_partials is not called for a given pair, then a dense matrix of zeros will be allocated in the sparse global jacobian for that pair. In the case of a dense global jacobian it doesn't matter because the space for a dense subjac will always be allocated for every pair. :type dependent: :py:class:`bool(True)` :param rows: Row indices for each nonzero entry. For sparse subjacobians only. :type rows: :py:class:`ndarray` of :py:class:`int` or :py:obj:`None` :param cols: Column indices for each nonzero entry. For sparse subjacobians only. :type cols: :py:class:`ndarray` of :py:class:`int` or :py:obj:`None` :param val: Value of subjacobian. If rows and cols are not None, this will contain the values found at each (row, col) location in the subjac. :type val: :py:class:`float` or :py:class:`ndarray` of :py:class:`float` or :py:class:`scipy.sparse` :param method: The type of approximation that should be used. Valid options include: 'fd': Finite Difference, 'cs': Complex Step, 'exact': use the component defined analytic derivatives. Default is 'exact'. :type method: :py:class:`str` :param step: Step size for approximation. Defaults to None, in which case the approximation method provides its default value. :type step: :py:class:`float` :param form: Form for finite difference, can be 'forward', 'backward', or 'central'. Defaults to None, in which case the approximation method provides its default value. :type form: :py:class:`str` :param step_calc: Step type for computing the size of the finite difference step. It can be 'abs' for absolute, 'rel_avg' for a size relative to the absolute value of the vector input, or 'rel_element' for a size relative to each value in the vector input. In addition, it can be 'rel_legacy' for a size relative to the norm of the vector. For backwards compatibilty, it can be 'rel', which is now equivalent to 'rel_avg'. Defaults to None, in which case the approximation method provides its default value. :type step_calc: :py:class:`str` :param minimum_step: Minimum step size allowed when using one of the relative step_calc options. :type minimum_step: :py:class:`float` :param diagonal: If True, the subjacobian is a diagonal matrix. :type diagonal: :py:class:`bool` :returns: Metadata dict for the specified partial(s). :rtype: :py:class:`dict` .. py:method:: declare_coloring(wrt=_DEFAULT_COLORING_META['wrt_patterns'], method=_DEFAULT_COLORING_META['method'], form=None, step=None, per_instance=_DEFAULT_COLORING_META['per_instance'], num_full_jacs=_DEFAULT_COLORING_META['num_full_jacs'], tol=_DEFAULT_COLORING_META['tol'], orders=_DEFAULT_COLORING_META['orders'], perturb_size=_DEFAULT_COLORING_META['perturb_size'], min_improve_pct=_DEFAULT_COLORING_META['min_improve_pct'], show_summary=_DEFAULT_COLORING_META['show_summary'], show_sparsity=_DEFAULT_COLORING_META['show_sparsity']) Set options for deriv coloring of a set of wrt vars matching the given pattern(s). :param wrt: The name or names of the variables that derivatives are taken with respect to. This can contain input names, output names, or glob patterns. :type wrt: :py:class:`str` or :py:class:`list` of :py:class:`str` :param method: Method used to compute derivative: "fd" for finite difference, "cs" for complex step. :type method: :py:class:`str` :param form: Finite difference form, can be "forward", "central", or "backward". Leave undeclared to keep unchanged from previous or default value. :type form: :py:class:`str` :param step: Step size for finite difference. Leave undeclared to keep unchanged from previous or default value. :type step: :py:class:`float` :param per_instance: If True, a separate coloring will be generated for each instance of a given class. Otherwise, only one coloring for a given class will be generated and all instances of that class will use it. :type per_instance: :py:class:`bool` :param num_full_jacs: Number of times to repeat partial jacobian computation when computing sparsity. :type num_full_jacs: :py:class:`int` :param tol: Tolerance used to determine if an array entry is nonzero during sparsity determination. :type tol: :py:class:`float` :param orders: Number of orders above and below the tolerance to check during the tolerance sweep. :type orders: :py:class:`int` :param perturb_size: Size of input/output perturbation during generation of sparsity. :type perturb_size: :py:class:`float` :param min_improve_pct: If coloring does not improve (decrease) the number of solves more than the given percentage, coloring will not be used. :type min_improve_pct: :py:class:`float` :param show_summary: If True, display summary information after generating coloring. :type show_summary: :py:class:`bool` :param show_sparsity: If True, display sparsity with coloring info after generating coloring. :type show_sparsity: :py:class:`bool` .. py:method:: set_check_partial_options(wrt, method='fd', form=None, step=None, step_calc=None, minimum_step=None, directional=False) Set options that will be used for checking partial derivatives. :param wrt: The name or names of the variables that derivatives are taken with respect to. This can contain the name of any input or output variable. May also contain a glob pattern. :type wrt: :py:class:`str` or :py:class:`list` of :py:class:`str` :param method: Method for check: "fd" for finite difference, "cs" for complex step. :type method: :py:class:`str` :param form: Finite difference form for check, can be "forward", "central", or "backward". Leave undeclared to keep unchanged from previous or default value. :type form: :py:class:`str` :param step: Step size for finite difference check. Leave undeclared to keep unchanged from previous or default value. :type step: :py:class:`float` :param step_calc: Step type for computing the size of the finite difference step. It can be 'abs' for absolute, 'rel_avg' for a size relative to the absolute value of the vector input, or 'rel_element' for a size relative to each value in the vector input. In addition, it can be 'rel_legacy' for a size relative to the norm of the vector. For backwards compatibilty, it can be 'rel', which is now equivalent to 'rel_avg'. Defaults to None, in which case the approximation method provides its default value.. :type step_calc: :py:class:`str` :param minimum_step: Minimum step size allowed when using one of the relative step_calc options. :type minimum_step: :py:class:`float` :param directional: Set to True to perform a single directional derivative for each vector variable in the pattern named in wrt. :type directional: :py:class:`bool` .. py:method:: compute_fd_jac(jac, method='fd') Force the use of finite difference to compute a jacobian. This can be used to compute sparsity for a component that computes derivatives analytically in order to check the accuracy of the declared sparsity. :param jac: The Jacobian object that will contain the computed jacobian. :type jac: :py:class:`Jacobian` :param method: The type of finite difference to perform. Valid options are 'fd' for forward difference, or 'cs' for complex step. :type method: :py:class:`str` .. py:method:: check_sparsity(method='fd', max_nz=90.0, out_stream=_DEFAULT_OUT_STREAM) Check the sparsity of the computed jacobian against the declared sparsity. Check is skipped if one of the dimensions of the jacobian is 1 or if the percentage of nonzeros in the computed jacobian is greater than max_nz%. :param method: The type of finite difference to perform. Valid options are 'fd' for forward difference, or 'cs' for complex step. :type method: :py:class:`str` :param max_nz: If the percentage of nonzeros in a sub-jacobian exceeds this, no warning is issued if the computed sparsity does not match the declared sparsity. :type max_nz: :py:class:`float` :param out_stream: Where to send the output. If None, output will be suppressed. :type out_stream: :py:class:`file-like object` :returns: A list of tuples, one for each subjacobian that has a mismatch between the computed sparsity and the declared sparsity. Each tuple has the form (of, wrt, computed_rows, computed_cols, declared_rows, declared_cols, shape, pct_nonzero). :rtype: :py:class:`list` .. py:method:: check_partials(out_stream=_DEFAULT_OUT_STREAM, compact_print=False, abs_err_tol=0.0, rel_err_tol=1e-06, method='fd', step=None, form='forward', step_calc='abs', minimum_step=1e-12, force_dense=True, show_only_incorrect=False, show_worst=True, rich_print=True) Check partial derivatives comprehensively for this component. :param out_stream: Where to send human readable output. By default it goes to stdout. Set to None to suppress. :type out_stream: :py:class:`file-like object` :param compact_print: Set to True to just print the essentials, one line per input-output pair. :type compact_print: :py:class:`bool` :param abs_err_tol: Threshold value for absolute error. Errors about this value will have a '*' displayed next to them in output, making them easy to search for. Default is 1.0E-6. :type abs_err_tol: :py:class:`float` :param rel_err_tol: Threshold value for relative error. Errors about this value will have a '*' displayed next to them in output, making them easy to search for. Note at times there may be a significant relative error due to a minor absolute error. Default is 1.0E-6. :type rel_err_tol: :py:class:`float` :param method: Method, 'fd' for finite difference or 'cs' for complex step. Default is 'fd'. :type method: :py:class:`str` :param step: Step size(s) for approximation. Default is None, which means 1e-6 for 'fd' and 1e-40 for 'cs'. :type step: :py:obj:`None`, :py:class:`float`, or :py:class:`list/tuple` of :py:class:`float` :param form: Form for finite difference, can be 'forward', 'backward', or 'central'. Default 'forward'. :type form: :py:class:`str` :param step_calc: Step type for computing the size of the finite difference step. It can be 'abs' for absolute, 'rel_avg' for a size relative to the absolute value of the vector input, or 'rel_element' for a size relative to each value in the vector input. In addition, it can be 'rel_legacy' for a size relative to the norm of the vector. For backwards compatibilty, it can be 'rel', which is now equivalent to 'rel_avg'. Defaults to None, in which case the approximation method provides its default value. :type step_calc: :py:class:`str` :param minimum_step: Minimum step size allowed when using one of the relative step_calc options. :type minimum_step: :py:class:`float` :param force_dense: If True, analytic derivatives will be coerced into arrays. Default is True. :type force_dense: :py:class:`bool` :param show_only_incorrect: Set to True if output should print only the subjacs found to be incorrect. :type show_only_incorrect: :py:class:`bool`, *optional* :param show_worst: Set to False to suppress the display of the worst subjac. :type show_worst: :py:class:`bool`, *optional* :param rich_print: If True, print using rich if available. :type rich_print: :py:class:`bool`, *optional* :returns: Where derivs_dict is a dict, where the top key is the component pathname. Under the top key, the subkeys are the (of, wrt) keys of the subjacs. Within the (of, wrt) entries are the following keys: 'tol violation', 'magnitude', 'J_fd', 'J_fwd', 'J_rev', 'vals_at_max_error', and 'rank_inconsistent'. For 'J_fd', 'J_fwd', 'J_rev' the value is a numpy array representing the computed Jacobian for the three different methods of computation. For 'tol violation' and 'vals_at_max_error' the value is a tuple containing values for forward - fd, reverse - fd, forward - reverse. For 'magnitude' the value is a tuple indicating the maximum magnitude of values found in Jfwd, Jrev, and Jfd. The boolean 'rank_inconsistent' indicates if the derivative wrt a serial variable is inconsistent across MPI ranks. worst is either None or a tuple of the form (error, table_row, header) where error is the max error found, table_row is the formatted table row containing the max error, and header is the formatted table header. 'worst' is not None only if compact_print is True. :rtype: :py:class:`tuple` of :py:class:`the form (derivs_dict`, :py:class:`worst)` .. py:method:: get_declare_partials_calls(sparsity=None) Return a string containing declare_partials() calls based on the subjac sparsity. :param sparsity: Sparsity matrix to use. If None, compute_sparsity will be called to compute it. :type sparsity: :py:class:`coo_matrix` or :py:obj:`None` :returns: A string containing a declare_partials() call for each nonzero subjac. This string may be cut and pasted into a component's setup() method. :rtype: :py:class:`str` .. py:attribute:: name :value: '' .. py:attribute:: pathname :value: None .. py:attribute:: options .. py:attribute:: recording_options .. py:attribute:: iter_count :value: 0 .. py:attribute:: iter_count_apply :value: 0 .. py:attribute:: iter_count_without_approx :value: 0 .. py:attribute:: cite :value: '' .. py:attribute:: matrix_free .. py:attribute:: under_complex_step :value: False .. py:attribute:: under_finite_difference :value: False .. py:property:: comm Return the wrapped MPI communicator object for the system. :returns: Wrapped MPI communicator object. :rtype: :py:class:`DebugComm` .. py:property:: under_approx Return True if under complex step or finite difference. :returns: True if under CS or FD. :rtype: :py:class:`bool` .. py:property:: msginfo Our instance pathname, if available, or our class name. For use in error messages. :returns: Either our instance pathname or class name. :rtype: :py:class:`str` .. py:method:: abs_meta_iter(iotype, local=True, cont=True, discrete=False) Iterate over absolute variable names and their metadata for this System. By setting appropriate values for 'cont' and 'discrete', yielded variable names can be continuous only, discrete only, or both. :param iotype: Either 'input' or 'output'. :type iotype: :py:class:`str` :param local: If True, include only names of local variables. Default is True. :type local: :py:class:`bool` :param cont: If True, include names of continuous variables. Default is True. :type cont: :py:class:`bool` :param discrete: If True, include names of discrete variables. Default is False. :type discrete: :py:class:`bool` :Yields: :py:class:`str`, :py:class:`dict` .. py:method:: set_output_solver_options(name, lower=_UNDEFINED, upper=_UNDEFINED, ref=_UNDEFINED, ref0=_UNDEFINED, res_ref=_UNDEFINED) Set solver output options. Allows the user to set output solver options after the output has been defined and metadata set using the add_ouput method. :param name: Name of the variable in this system's namespace. :type name: :py:class:`str` :param lower: Lower bound(s) in user-defined units. It can be (1) a float, (2) an array_like consistent with the shape arg (if given), or (3) an array_like matching the shape of val, if val is array_like. A value of None means this output has no lower bound. Default is None. :type lower: :py:class:`float` or :py:class:`list` or :py:class:`tuple` or :py:class:`ndarray` or :py:obj:`None` :param upper: Upper bound(s) in user-defined units. It can be (1) a float, (2) an array_like consistent with the shape arg (if given), or (3) an array_like matching the shape of val, if val is array_like. A value of None means this output has no upper bound. Default is None. :type upper: :py:class:`float` or :py:class:`list` or :py:class:`tuple` or :py:class:`ndarray` or :py:obj:`None` :param ref: Scaling parameter. The value in the user-defined units of this output variable when the scaled value is 1. Default is 1. :type ref: :py:class:`float` :param ref0: Scaling parameter. The value in the user-defined units of this output variable when the scaled value is 0. Default is 0. :type ref0: :py:class:`float` :param res_ref: Scaling parameter. The value in the user-defined res_units of this output's residual when the scaled value is 1. Default is None, which means residual scaling matches output scaling. :type res_ref: :py:class:`float` .. py:method:: set_design_var_options(name, lower=_UNDEFINED, upper=_UNDEFINED, scaler=_UNDEFINED, adder=_UNDEFINED, ref=_UNDEFINED, ref0=_UNDEFINED) Set options for design vars in the model. Can be used to set the options outside of setting them when calling add_design_var :param name: Name of the variable in this system's namespace. :type name: :py:class:`str` :param lower: Lower boundary for the input. :type lower: :py:class:`float` or :py:class:`ndarray`, *optional* :param upper: Upper boundary for the input. :type upper: :py:class:`upper` or :py:class:`ndarray`, *optional* :param scaler: Value to multiply the model value to get the scaled value for the driver. scaler is second in precedence. adder and scaler are an alterantive to using ref and ref0. :type scaler: :py:class:`float` or :py:class:`ndarray`, *optional* :param adder: Value to add to the model value to get the scaled value for the driver. adder is first in precedence. adder and scaler are an alterantive to using ref and ref0. :type adder: :py:class:`float` or :py:class:`ndarray`, *optional* :param ref: Value of design var that scales to 1.0 in the driver. :type ref: :py:class:`float` or :py:class:`ndarray`, *optional* :param ref0: Value of design var that scales to 0.0 in the driver. :type ref0: :py:class:`float` or :py:class:`ndarray`, *optional* .. py:method:: set_constraint_options(name, ref=_UNDEFINED, ref0=_UNDEFINED, equals=_UNDEFINED, lower=_UNDEFINED, upper=_UNDEFINED, adder=_UNDEFINED, scaler=_UNDEFINED, alias=_UNDEFINED) Set options for constraints in the model. Can be used to set options that were set using add_constraint. :param name: Name of the response variable in the system, or alias if given. :type name: :py:class:`str` :param ref: Value of response variable that scales to 1.0 in the driver. :type ref: :py:class:`float` or :py:class:`ndarray`, *optional* :param ref0: Value of response variable that scales to 0.0 in the driver. :type ref0: :py:class:`float` or :py:class:`ndarray`, *optional* :param equals: Equality constraint value for the variable. :type equals: :py:class:`float` or :py:class:`ndarray`, *optional* :param lower: Lower boundary for the variable. :type lower: :py:class:`float` or :py:class:`ndarray`, *optional* :param upper: Upper boundary for the variable. :type upper: :py:class:`float` or :py:class:`ndarray`, *optional* :param adder: Value to add to the model value to get the scaled value for the driver. adder is first in precedence. adder and scaler are an alterantive to using ref and ref0. :type adder: :py:class:`float` or :py:class:`ndarray`, *optional* :param scaler: Value to multiply the model value to get the scaled value for the driver. scaler is second in precedence. adder and scaler are an alterantive to using ref and ref0. :type scaler: :py:class:`float` or :py:class:`ndarray`, *optional* :param alias: Alias for this response. Necessary when adding multiple constraints on different indices or slices of a single variable. :type alias: :py:class:`str`, *optional* .. py:method:: set_objective_options(name, ref=_UNDEFINED, ref0=_UNDEFINED, adder=_UNDEFINED, scaler=_UNDEFINED, alias=_UNDEFINED) Set options for objectives in the model. Can be used to set options after they have been set by add_objective. :param name: Name of the response variable in the system, or alias if given. :type name: :py:class:`str` :param ref: Value of response variable that scales to 1.0 in the driver. :type ref: :py:class:`float` or :py:class:`ndarray`, *optional* :param ref0: Value of response variable that scales to 0.0 in the driver. :type ref0: :py:class:`float` or :py:class:`ndarray`, *optional* :param adder: Value to add to the model value to get the scaled value for the driver. adder is first in precedence. adder and scaler are an alterantive to using ref and ref0. :type adder: :py:class:`float` or :py:class:`ndarray`, *optional* :param scaler: Value to multiply the model value to get the scaled value for the driver. scaler is second in precedence. adder and scaler are an alterantive to using ref and ref0. :type scaler: :py:class:`float` or :py:class:`ndarray`, *optional* :param alias: Alias for this response. Used to disambiguate variable names when adding multiple objectives on different indices or slices of a single variable. Deprecated. :type alias: :py:class:`str` .. py:method:: initialize() Perform any one-time initialization run at instantiation. .. py:method:: get_source(name) Return the source variable connected to the given named variable. The name can be a promoted name or an absolute name. If the given variable is an input, the absolute name of the connected source will be returned. If the given variable itself is a source, its own absolute name will be returned. :param name: Absolute or promoted name of the variable. :type name: :py:class:`str` :returns: The absolute name of the source variable. :rtype: :py:class:`str` .. py:method:: use_fixed_coloring(coloring=STD_COLORING_FNAME(), recurse=True) Use a precomputed coloring for this System. :param coloring: A coloring filename. If no arg is passed, filename will be determined automatically. :type coloring: :py:class:`str` :param recurse: If True, set fixed coloring in all subsystems that declare a coloring. Ignored if a specific coloring is passed in. :type recurse: :py:class:`bool` .. py:method:: uses_approx() Return True if the system uses approximations to compute derivatives. :returns: True if the system uses approximations to compute derivatives, False otherwise. :rtype: :py:class:`bool` .. py:method:: compute_sparsity(direction=None, num_iters=2, perturb_size=1e-09) Compute the sparsity of the partial jacobian. :param direction: Compute derivatives in fwd or rev mode, or whichever is based based on input and output sizes if value is None. Note that only fwd is possible when using finite difference. :type direction: :py:class:`str` :param num_iters: Number of times to compute the full jacobian. :type num_iters: :py:class:`int` :param perturb_size: Size of relative perturbation. If base value is 0.0, perturbation is absolute. :type perturb_size: :py:class:`float` :returns: * :py:class:`coo_matrix` -- The sparsity matrix. * :py:class:`dict` -- Metadata about the sparsity computation. .. py:method:: subjac_sparsity_iter(sparsity, wrt_matches=None) Iterate over sparsity for each subjac in the jacobian. :param sparsity: Sparsity matrix to use. :type sparsity: :py:class:`coo_matrix` :param wrt_matches: Only include row vars that are contained in this set. :type wrt_matches: :py:class:`set` or :py:obj:`None` :Yields: * :py:class:`str` -- Name of 'of' variable. * :py:class:`str` -- Name of 'wrt' variable. * :py:class:`ndarray` -- Row indices of the non-zero elements local to the subjac. * :py:class:`ndarray` -- Column indices of the non-zero elements local to the subjac. * :py:class:`tuple` -- Shape of the subjac. .. py:method:: sparsity_matches_fd(direction=None, outstream=sys.stdout) Compare the sparsity computed by this system vs. the sparsity computed using fd. Note that some systems use fd to compute their sparsity, so no difference will ever be found even if the sparsity is somehow incorrect. :param direction: Compute derivatives in fwd or rev mode, or whichever is based based on input and output sizes if value is None. Note that only fwd is possible when using finite difference. :type direction: :py:class:`str` or :py:obj:`None` :param outstream: Stream where output will be written. If None, no output will be written. The output is a text visualization of the sparsity difference. :type outstream: :py:class:`file-like` :returns: True if they match, False otherwise. :rtype: :py:class:`bool` .. py:method:: get_coloring_fname(mode) Return the full pathname to a coloring file. :param mode: The type of coloring file desired. Must be either 'input' or 'output'. :type mode: :py:class:`str` :returns: Full pathname of the coloring file. :rtype: :py:class:`pathlib.Path` .. py:method:: get_nonlinear_vectors() Return the inputs, outputs, and residuals vectors. :returns: Yields the inputs, outputs, and residuals nonlinear vectors. :rtype: :py:class:`(inputs`, :py:class:`outputs`, :py:class:`residuals)` .. py:method:: get_linear_vectors() Return the linear inputs, outputs, and residuals vectors. :returns: **(inputs, outputs, residuals)** -- Yields the linear inputs, outputs, and residuals vectors. :rtype: :py:class:`tuple` of :py:class:` instances` .. py:method:: set_solver_print(level=2, depth=1e+99, type_='all', debug_print=None) Control printing for solvers and subsolvers in the model. :param level: Iprint level. Set to 2 to print residuals each iteration; set to 1 to print just the iteration totals; set to 0 to disable all printing except for failures, and set to -1 to disable all printing including failures. A value of None will leave solving printing unchanged, which is useful when using this method to enable or disable debug printing only. :type level: :py:class:`int` or :py:obj:`None` :param depth: How deep to recurse. For example, you can set this to 0 if you only want to print the top level linear and nonlinear solver messages. Default prints everything. :type depth: :py:class:`int` :param type_: Type of solver to set: 'LN' for linear, 'NL' for nonlinear, or 'all' for all. :type type_: :py:class:`str` :param debug_print: If None, leave solver debug printing unchanged, otherwise turn it on or off depending on whether debug_print is True or False. Note debug_print is only applied to nonlinear solvers. :type debug_print: :py:class:`bool` or :py:obj:`None` .. py:method:: system_iter(include_self=False, recurse=True, typ=None, depth_first=False) Yield a generator of local subsystems of this system. :param include_self: If True, include this system in the iteration. :type include_self: :py:class:`bool` :param recurse: If True, iterate over the whole tree under this system. :type recurse: :py:class:`bool` :param typ: If not None, only yield Systems that match that are instances of the given type. :type typ: :py:class:`type` :param depth_first: If recurse is True, this specifies whether subsystems are returned in depth-first order (if True) or bredth-first order (if False). :type depth_first: :py:class:`bool` :Yields: :py:class:`type` or :py:obj:`None` .. py:method:: add_design_var(name, lower=None, upper=None, ref=None, ref0=None, indices=None, adder=None, scaler=None, units=None, parallel_deriv_color=None, cache_linear_solution=False, flat_indices=False) Add a design variable to this system. :param name: Promoted name of the design variable in the system. :type name: :py:class:`str` :param lower: Lower boundary for the input. :type lower: :py:class:`float` or :py:class:`ndarray`, *optional* :param upper: Upper boundary for the input. :type upper: :py:class:`upper` or :py:class:`ndarray`, *optional* :param ref: Value of design var that scales to 1.0 in the driver. :type ref: :py:class:`float` or :py:class:`ndarray`, *optional* :param ref0: Value of design var that scales to 0.0 in the driver. :type ref0: :py:class:`float` or :py:class:`ndarray`, *optional* :param indices: If an input is an array, these indicate which entries are of interest for this particular design variable. These may be positive or negative integers. :type indices: :py:class:`iter` of :py:class:`int`, *optional* :param adder: Value to add to the model value to get the scaled value for the driver. adder is first in precedence. adder and scaler are an alterantive to using ref and ref0. :type adder: :py:class:`float` or :py:class:`ndarray`, *optional* :param scaler: Value to multiply the model value to get the scaled value for the driver. scaler is second in precedence. adder and scaler are an alterantive to using ref and ref0. :type scaler: :py:class:`float` or :py:class:`ndarray`, *optional* :param units: Units to convert to before applying scaling. :type units: :py:class:`str`, *optional* :param parallel_deriv_color: If specified, this design var will be grouped for parallel derivative calculations with other variables sharing the same parallel_deriv_color. :type parallel_deriv_color: :py:class:`str` :param cache_linear_solution: If True, store the linear solution vectors for this variable so they can be used to start the next linear solution with an initial guess equal to the solution from the previous linear solve. :type cache_linear_solution: :py:class:`bool` :param flat_indices: If True, interpret specified indices as being indices into a flat source array. :type flat_indices: :py:class:`bool` .. rubric:: Notes The response can be scaled using ref and ref0. The argument :code:`ref0` represents the physical value when the scaled value is 0. The argument :code:`ref` represents the physical value when the scaled value is 1. .. py:method:: add_response(name, type_, lower=None, upper=None, equals=None, ref=None, ref0=None, indices=None, index=None, units=None, adder=None, scaler=None, linear=False, parallel_deriv_color=None, cache_linear_solution=False, flat_indices=None, alias=None) Add a response variable to this system. The response can be scaled using ref and ref0. The argument :code:`ref0` represents the physical value when the scaled value is 0. The argument :code:`ref` represents the physical value when the scaled value is 1. :param name: Promoted name of the response variable in the system. :type name: :py:class:`str` :param type_: The type of response. Supported values are 'con' and 'obj'. :type type_: :py:class:`str` :param lower: Lower boundary for the variable. :type lower: :py:class:`float` or :py:class:`ndarray`, *optional* :param upper: Upper boundary for the variable. :type upper: :py:class:`upper` or :py:class:`ndarray`, *optional* :param equals: Equality constraint value for the variable. :type equals: :py:class:`equals` or :py:class:`ndarray`, *optional* :param ref: Value of response variable that scales to 1.0 in the driver. :type ref: :py:class:`float` or :py:class:`ndarray`, *optional* :param ref0: Value of response variable that scales to 0.0 in the driver. :type ref0: :py:class:`upper` or :py:class:`ndarray`, *optional* :param indices: If variable is an array, these indicate which entries are of interest for this particular response. :type indices: :py:class:`sequence` of :py:class:`int`, *optional* :param index: If variable is an array, this indicates which entry is of interest for this particular response. :type index: :py:class:`int`, *optional* :param units: Units to convert to before applying scaling. :type units: :py:class:`str`, *optional* :param adder: Value to add to the model value to get the scaled value for the driver. adder is first in precedence. adder and scaler are an alterantive to using ref and ref0. :type adder: :py:class:`float` or :py:class:`ndarray`, *optional* :param scaler: Value to multiply the model value to get the scaled value for the driver. scaler is second in precedence. adder and scaler are an alterantive to using ref and ref0. :type scaler: :py:class:`float` or :py:class:`ndarray`, *optional* :param linear: Set to True if constraint is linear. Default is False. :type linear: :py:class:`bool` :param parallel_deriv_color: If specified, this design var will be grouped for parallel derivative calculations with other variables sharing the same parallel_deriv_color. :type parallel_deriv_color: :py:class:`str` :param cache_linear_solution: If True, store the linear solution vectors for this variable so they can be used to start the next linear solution with an initial guess equal to the solution from the previous linear solve. :type cache_linear_solution: :py:class:`bool` :param flat_indices: If True, interpret specified indices as being indices into a flat source array. :type flat_indices: :py:class:`bool` :param alias: Alias for this response. Necessary when adding multiple responses on different indices of the same variable. :type alias: :py:class:`str` or :py:obj:`None` .. py:method:: add_constraint(name, lower=None, upper=None, equals=None, ref=None, ref0=None, adder=None, scaler=None, units=None, indices=None, linear=False, parallel_deriv_color=None, cache_linear_solution=False, flat_indices=False, alias=None) Add a constraint variable to this system. :param name: Name of the response variable in the system. :type name: :py:class:`str` :param lower: Lower boundary for the variable. :type lower: :py:class:`float` or :py:class:`ndarray`, *optional* :param upper: Upper boundary for the variable. :type upper: :py:class:`float` or :py:class:`ndarray`, *optional* :param equals: Equality constraint value for the variable. :type equals: :py:class:`float` or :py:class:`ndarray`, *optional* :param ref: Value of response variable that scales to 1.0 in the driver. :type ref: :py:class:`float` or :py:class:`ndarray`, *optional* :param ref0: Value of response variable that scales to 0.0 in the driver. :type ref0: :py:class:`float` or :py:class:`ndarray`, *optional* :param adder: Value to add to the model value to get the scaled value for the driver. adder is first in precedence. adder and scaler are an alterantive to using ref and ref0. :type adder: :py:class:`float` or :py:class:`ndarray`, *optional* :param scaler: Value to multiply the model value to get the scaled value for the driver. scaler is second in precedence. adder and scaler are an alternative to using ref and ref0. :type scaler: :py:class:`float` or :py:class:`ndarray`, *optional* :param units: Units to convert to before applying scaling. :type units: :py:class:`str`, *optional* :param indices: If variable is an array, these indicate which entries are of interest for this particular response. These may be positive or negative integers. :type indices: :py:class:`sequence` of :py:class:`int`, *optional* :param linear: Set to True if constraint is linear. Default is False. :type linear: :py:class:`bool` :param parallel_deriv_color: If specified, this design var will be grouped for parallel derivative calculations with other variables sharing the same parallel_deriv_color. :type parallel_deriv_color: :py:class:`str` :param cache_linear_solution: If True, store the linear solution vectors for this variable so they can be used to start the next linear solution with an initial guess equal to the solution from the previous linear solve. :type cache_linear_solution: :py:class:`bool` :param flat_indices: If True, interpret specified indices as being indices into a flat source array. :type flat_indices: :py:class:`bool` :param alias: Alias for this response. Necessary when adding multiple constraints on different indices or slices of a single variable. :type alias: :py:class:`str` .. rubric:: Notes The response can be scaled using ref and ref0. The argument :code:`ref0` represents the physical value when the scaled value is 0. The argument :code:`ref` represents the physical value when the scaled value is 1. The arguments (:code:`lower`, :code:`upper`, :code:`equals`) can not be strings or variable names. .. py:method:: add_objective(name, ref=None, ref0=None, index=None, units=None, adder=None, scaler=None, parallel_deriv_color=None, cache_linear_solution=False, flat_indices=False, alias=None) Add a response variable to this system. :param name: Name of the response variable in the system. :type name: :py:class:`str` :param ref: Value of response variable that scales to 1.0 in the driver. :type ref: :py:class:`float` or :py:class:`ndarray`, *optional* :param ref0: Value of response variable that scales to 0.0 in the driver. :type ref0: :py:class:`float` or :py:class:`ndarray`, *optional* :param index: If variable is an array, this indicates which entry is of interest for this particular response. This may be a positive or negative integer. :type index: :py:class:`int`, *optional* :param units: Units to convert to before applying scaling. :type units: :py:class:`str`, *optional* :param adder: Value to add to the model value to get the scaled value for the driver. adder is first in precedence. adder and scaler are an alterantive to using ref and ref0. :type adder: :py:class:`float` or :py:class:`ndarray`, *optional* :param scaler: Value to multiply the model value to get the scaled value for the driver. scaler is second in precedence. adder and scaler are an alterantive to using ref and ref0. :type scaler: :py:class:`float` or :py:class:`ndarray`, *optional* :param parallel_deriv_color: If specified, this design var will be grouped for parallel derivative calculations with other variables sharing the same parallel_deriv_color. :type parallel_deriv_color: :py:class:`str` :param cache_linear_solution: If True, store the linear solution vectors for this variable so they can be used to start the next linear solution with an initial guess equal to the solution from the previous linear solve. :type cache_linear_solution: :py:class:`bool` :param flat_indices: If True, interpret specified indices as being indices into a flat source array. :type flat_indices: :py:class:`bool` :param alias: Alias for this response. Necessary when adding multiple objectives on different indices or slices of a single variable. :type alias: :py:class:`str` .. rubric:: Notes The objective can be scaled using scaler and adder, where .. math:: x_{scaled} = scaler(x + adder) or through the use of ref/ref0, which map to scaler and adder through the equations: .. math:: 0 = scaler(ref_0 + adder) 1 = scaler(ref + adder) which results in: .. math:: adder = -ref_0 scaler = \frac{1}{ref + adder} .. py:method:: get_design_vars(recurse=True, get_sizes=True, use_prom_ivc=True) Get the DesignVariable settings from this system. Retrieve all design variable settings from the system and, if recurse is True, all of its subsystems. :param recurse: If True, recurse through the subsystems of a group and return the path of all design vars relative to the this system. :type recurse: :py:class:`bool` :param get_sizes: If True, compute the size of each design variable. :type get_sizes: :py:class:`bool`, *optional* :param use_prom_ivc: Use promoted names for inputs, else convert to absolute source names. :type use_prom_ivc: :py:class:`bool` :returns: The design variables defined in the current system and, if recurse=True, its subsystems. :rtype: :py:class:`dict` .. py:method:: get_responses(recurse=True, get_sizes=True, use_prom_ivc=False) Get the response variable settings from this system. Retrieve all response variable settings from the system as a dict, keyed by either absolute variable name, promoted name, or alias name, depending on the value of use_prom_ivc and whether the original key was a promoted output, promoted input, or an alias. :param recurse: If True, recurse through the subsystems and return the path of all responses relative to the this system. :type recurse: :py:class:`bool`, *optional* :param get_sizes: If True, compute the size of each response. :type get_sizes: :py:class:`bool`, *optional* :param use_prom_ivc: Translate ivc names to their promoted input names. :type use_prom_ivc: :py:class:`bool` :returns: The responses defined in the current system and, if recurse=True, its subsystems. :rtype: :py:class:`dict` .. py:method:: get_constraints(recurse=True, get_sizes=True, use_prom_ivc=True) Get the Constraint settings from this system. Retrieve the constraint settings for the current system as a dict, keyed by variable name. :param recurse: If True, recurse through the subsystems and return the path of all constraints relative to the this system. :type recurse: :py:class:`bool`, *optional* :param get_sizes: If True, compute the size of each constraint. :type get_sizes: :py:class:`bool`, *optional* :param use_prom_ivc: Translate ivc names to their promoted input names. :type use_prom_ivc: :py:class:`bool` :returns: The constraints defined in the current system. :rtype: :py:class:`dict` .. py:method:: get_objectives(recurse=True, get_sizes=True, use_prom_ivc=True) Get the Objective settings from this system. Retrieve all objectives settings from the system as a dict, keyed by variable name. :param recurse: If True, recurse through the subsystems and return the path of all objective relative to the this system. :type recurse: :py:class:`bool`, *optional* :param get_sizes: If True, compute the size of each objective. :type get_sizes: :py:class:`bool`, *optional* :param use_prom_ivc: Translate ivc names to their promoted input names. :type use_prom_ivc: :py:class:`bool` :returns: The objectives defined in the current system. :rtype: :py:class:`dict` .. py:method:: run_apply_nonlinear() Compute residuals. This calls _apply_nonlinear, but with the model assumed to be in an unscaled state. .. py:method:: get_io_metadata(iotypes=('input', 'output'), metadata_keys=None, includes=None, excludes=None, is_indep_var=None, is_design_var=None, tags=None, get_remote=False, rank=None, return_rel_names=True) Retrieve metadata for a filtered list of variables. :param iotypes: Will contain either 'input', 'output', or both. Defaults to both. :type iotypes: :py:class:`str` or :py:class:`iter` of :py:class:`str` :param metadata_keys: Names of metadata entries to be retrieved or None, meaning retrieve all available 'allprocs' metadata. If 'val' or 'src_indices' are required, their keys must be provided explicitly since they are not found in the 'allprocs' metadata and must be retrieved from local metadata located in each process. :type metadata_keys: :py:class:`iter` of :py:class:`str` or :py:obj:`None` :param includes: Collection of glob patterns for pathnames of variables to include. Default is None, which includes all variables. :type includes: :py:class:`str`, :py:class:`iter` of :py:class:`str` or :py:obj:`None` :param excludes: Collection of glob patterns for pathnames of variables to exclude. Default is None. :type excludes: :py:class:`str`, :py:class:`iter` of :py:class:`str` or :py:obj:`None` :param is_indep_var: If None (the default), do no additional filtering of the inputs. If True, list only inputs connected to an output tagged `openmdao:indep_var`. If False, list only inputs _not_ connected to outputs tagged `openmdao:indep_var`. :type is_indep_var: :py:class:`bool` or :py:obj:`None` :param is_design_var: If None (the default), do no additional filtering of the inputs. If True, list only inputs connected to outputs that are driver design variables. If False, list only inputs _not_ connected to outputs that are driver design variables. :type is_design_var: :py:class:`bool` or :py:obj:`None` :param tags: User defined tags that can be used to filter what gets listed. Only inputs with the given tags will be listed. Default is None, which means there will be no filtering based on tags. :type tags: :py:class:`str` or :py:class:`iter` of :py:class:`strs` :param get_remote: If True, retrieve variables from other MPI processes as well. :type get_remote: :py:class:`bool` :param rank: If None, and get_remote is True, retrieve values from all MPI process to all other MPI processes. Otherwise, if get_remote is True, retrieve values from all MPI processes only to the specified rank. :type rank: :py:class:`int` or :py:obj:`None` :param return_rel_names: If True, the names returned will be relative to the scope of this System. Otherwise they will be absolute names. :type return_rel_names: :py:class:`bool` :returns: A dict of metadata keyed on name, where name is either absolute or relative based on the value of the `return_rel_names` arg, and metadata is a dict containing entries based on the value of the metadata_keys arg. Every metadata dict will always contain two entries, 'prom_name' and 'discrete', to indicate a given variable's promoted name and whether or not it is discrete. :rtype: :py:class:`dict` .. py:method:: list_vars(val=True, prom_name=True, residuals=False, residuals_tol=None, units=False, shape=False, global_shape=False, bounds=False, scaling=False, desc=False, print_arrays=False, tags=None, print_tags=False, includes=None, excludes=None, is_indep_var=None, is_design_var=None, all_procs=False, list_autoivcs=False, out_stream=_DEFAULT_OUT_STREAM, print_min=False, print_max=False, print_mean=False, return_format='list') Write a list of inputs and outputs sorted by component in execution order. :param val: When True, display output values. Default is True. :type val: :py:class:`bool`, *optional* :param prom_name: When True, display the promoted name of the variable. Default is True. :type prom_name: :py:class:`bool`, *optional* :param residuals: When True, display residual values. Default is False. :type residuals: :py:class:`bool`, *optional* :param residuals_tol: If set, limits the output of list_outputs to only variables where the norm of the resids array is greater than the given 'residuals_tol'. Default is None. :type residuals_tol: :py:class:`float`, *optional* :param units: When True, display units. Default is False. :type units: :py:class:`bool`, *optional* :param shape: When True, display/return the shape of the value. Default is False. :type shape: :py:class:`bool`, *optional* :param global_shape: When True, display/return the global shape of the value. Default is False. :type global_shape: :py:class:`bool`, *optional* :param bounds: When True, display/return bounds (lower and upper). Default is False. :type bounds: :py:class:`bool`, *optional* :param scaling: When True, display/return scaling (ref, ref0, and res_ref). Default is False. :type scaling: :py:class:`bool`, *optional* :param desc: When True, display/return description. Default is False. :type desc: :py:class:`bool`, *optional* :param print_arrays: When False, in the columnar display, just display norm of any ndarrays with size > 1. The norm is surrounded by vertical bars to indicate that it is a norm. When True, also display full values of the ndarray below the row. Format is affected by the values set with numpy.set_printoptions Default is False. :type print_arrays: :py:class:`bool`, *optional* :param tags: User defined tags that can be used to filter what gets listed. Only outputs with the given tags will be listed. Default is None, which means there will be no filtering based on tags. :type tags: :py:class:`str` or :py:class:`list` of :py:class:`strs` :param print_tags: When true, display tags in the columnar display. :type print_tags: :py:class:`bool` :param includes: Collection of glob patterns for pathnames of variables to include. Default is None, which includes all output variables. :type includes: :py:obj:`None`, :py:class:`str`, or :py:class:`iter` of :py:class:`str` :param excludes: Collection of glob patterns for pathnames of variables to exclude. Default is None. :type excludes: :py:obj:`None`, :py:class:`str`, or :py:class:`iter` of :py:class:`str` :param is_indep_var: If None (the default), do no additional filtering of the inputs. If True, list only outputs tagged `openmdao:indep_var`. If False, list only outputs that are _not_ tagged `openmdao:indep_var`. :type is_indep_var: :py:class:`bool` or :py:obj:`None` :param is_design_var: If None (the default), do no additional filtering of the inputs. If True, list only inputs connected to outputs that are driver design variables. If False, list only inputs _not_ connected to outputs that are driver design variables. :type is_design_var: :py:class:`bool` or :py:obj:`None` :param all_procs: When True, display output on all processors. Default is False. :type all_procs: :py:class:`bool`, *optional* :param list_autoivcs: If True, include auto_ivc outputs in the listing. Defaults to False. :type list_autoivcs: :py:class:`bool` :param out_stream: Where to send human readable output. Default is sys.stdout. Set to None to suppress. :type out_stream: :py:class:`file-like` :param print_min: When true, if the output value is an array, print its smallest value. :type print_min: :py:class:`bool` :param print_max: When true, if the output value is an array, print its largest value. :type print_max: :py:class:`bool` :param print_mean: When true, if the output value is an array, print its mean value. :type print_mean: :py:class:`bool` :param return_format: Indicates the desired format of the return value. Can have value of 'list' or 'dict'. If 'list', the return value is a list of (name, metadata) tuples. if 'dict', the return value is a dictionary mapping {name: metadata}. :type return_format: :py:class:`str` :returns: **list of (name, metadata) or dict of {name** -- List or dict of output names and other optional information about those outputs. :rtype: :py:class:`metadata```}`` .. py:method:: list_inputs(val=True, prom_name=True, units=False, shape=False, global_shape=False, desc=False, hierarchical=True, print_arrays=False, tags=None, print_tags=False, includes=None, excludes=None, is_indep_var=None, is_design_var=None, all_procs=False, out_stream=_DEFAULT_OUT_STREAM, print_min=False, print_max=False, print_mean=False, return_format='list') Write a list of input names and other optional information to a specified stream. :param val: When True, display/return input values. Default is True. :type val: :py:class:`bool`, *optional* :param prom_name: When True, display/return the promoted name of the variable. Default is True. :type prom_name: :py:class:`bool`, *optional* :param units: When True, display/return units. Default is False. :type units: :py:class:`bool`, *optional* :param shape: When True, display/return the shape of the value. Default is False. :type shape: :py:class:`bool`, *optional* :param global_shape: When True, display/return the global shape of the value. Default is False. :type global_shape: :py:class:`bool`, *optional* :param desc: When True, display/return description. Default is False. :type desc: :py:class:`bool`, *optional* :param hierarchical: When True, human readable output shows variables in hierarchical format. :type hierarchical: :py:class:`bool`, *optional* :param print_arrays: When False, in the columnar display, just display norm of any ndarrays with size > 1. The norm is surrounded by vertical bars to indicate that it is a norm. When True, also display full values of the ndarray below the row. Format is affected by the values set with numpy.set_printoptions Default is False. :type print_arrays: :py:class:`bool`, *optional* :param tags: User defined tags that can be used to filter what gets listed. Only inputs with the given tags will be listed. Default is None, which means there will be no filtering based on tags. :type tags: :py:class:`str` or :py:class:`list` of :py:class:`strs` :param print_tags: When true, display tags in the columnar display. :type print_tags: :py:class:`bool` :param includes: Collection of glob patterns for pathnames of variables to include. Default is None, which includes all input variables. :type includes: :py:obj:`None`, :py:class:`str`, or :py:class:`iter` of :py:class:`str` :param excludes: Collection of glob patterns for pathnames of variables to exclude. Default is None. :type excludes: :py:obj:`None`, :py:class:`str`, or :py:class:`iter` of :py:class:`str` :param is_indep_var: If None (the default), do no additional filtering of the inputs. If True, list only inputs connected to an output tagged `openmdao:indep_var`. If False, list only inputs _not_ connected to outputs tagged `openmdao:indep_var`. :type is_indep_var: :py:class:`bool` or :py:obj:`None` :param is_design_var: If None (the default), do no additional filtering of the inputs. If True, list only inputs connected to outputs that are driver design variables. If False, list only inputs _not_ connected to outputs that are driver design variables. :type is_design_var: :py:class:`bool` or :py:obj:`None` :param all_procs: When True, display output on all ranks. Default is False, which will display output only from rank 0. :type all_procs: :py:class:`bool`, *optional* :param out_stream: Where to send human readable output. Default is sys.stdout. Set to None to suppress. :type out_stream: :py:class:`file-like object` :param print_min: When true, if the input value is an array, print its smallest value. :type print_min: :py:class:`bool` :param print_max: When true, if the input value is an array, print its largest value. :type print_max: :py:class:`bool` :param print_mean: When true, if the input value is an array, print its mean value. :type print_mean: :py:class:`bool` :param return_format: Indicates the desired format of the return value. Can have value of 'list' or 'dict'. If 'list', the return value is a list of (name, metadata) tuples. if 'dict', the return value is a dictionary mapping {name: metadata}. :type return_format: :py:class:`str` :returns: **list of (name, metadata) or dict of {name** -- List or dict of input names and other optional information about those inputs. :rtype: :py:class:`metadata```}`` .. py:method:: list_outputs(explicit=True, implicit=True, val=True, prom_name=True, residuals=False, residuals_tol=None, units=False, shape=False, global_shape=False, bounds=False, scaling=False, desc=False, hierarchical=True, print_arrays=False, tags=None, print_tags=False, includes=None, excludes=None, is_indep_var=None, is_design_var=None, all_procs=False, list_autoivcs=False, out_stream=_DEFAULT_OUT_STREAM, print_min=False, print_max=False, print_mean=False, return_format='list') Write a list of output names and other optional information to a specified stream. :param explicit: Include outputs from explicit components. Default is True. :type explicit: :py:class:`bool`, *optional* :param implicit: Include outputs from implicit components. Default is True. :type implicit: :py:class:`bool`, *optional* :param val: When True, display output values. Default is True. :type val: :py:class:`bool`, *optional* :param prom_name: When True, display the promoted name of the variable. Default is True. :type prom_name: :py:class:`bool`, *optional* :param residuals: When True, display residual values. Default is False. :type residuals: :py:class:`bool`, *optional* :param residuals_tol: If set, limits the output of list_outputs to only variables where the norm of the resids array is greater than the given 'residuals_tol'. Default is None. :type residuals_tol: :py:class:`float`, *optional* :param units: When True, display units. Default is False. :type units: :py:class:`bool`, *optional* :param shape: When True, display/return the shape of the value. Default is False. :type shape: :py:class:`bool`, *optional* :param global_shape: When True, display/return the global shape of the value. Default is False. :type global_shape: :py:class:`bool`, *optional* :param bounds: When True, display/return bounds (lower and upper). Default is False. :type bounds: :py:class:`bool`, *optional* :param scaling: When True, display/return scaling (ref, ref0, and res_ref). Default is False. :type scaling: :py:class:`bool`, *optional* :param desc: When True, display/return description. Default is False. :type desc: :py:class:`bool`, *optional* :param hierarchical: When True, human readable output shows variables in hierarchical format. :type hierarchical: :py:class:`bool`, *optional* :param print_arrays: When False, in the columnar display, just display norm of any ndarrays with size > 1. The norm is surrounded by vertical bars to indicate that it is a norm. When True, also display full values of the ndarray below the row. Format is affected by the values set with numpy.set_printoptions Default is False. :type print_arrays: :py:class:`bool`, *optional* :param tags: User defined tags that can be used to filter what gets listed. Only outputs with the given tags will be listed. Default is None, which means there will be no filtering based on tags. :type tags: :py:class:`str` or :py:class:`list` of :py:class:`strs` :param print_tags: When true, display tags in the columnar display. :type print_tags: :py:class:`bool` :param includes: Collection of glob patterns for pathnames of variables to include. Default is None, which includes all output variables. :type includes: :py:obj:`None`, :py:class:`str`, or :py:class:`iter` of :py:class:`str` :param excludes: Collection of glob patterns for pathnames of variables to exclude. Default is None. :type excludes: :py:obj:`None`, :py:class:`str`, or :py:class:`iter` of :py:class:`str` :param is_indep_var: If None (the default), do no additional filtering of the inputs. If True, list only outputs tagged `openmdao:indep_var`. If False, list only outputs that are _not_ tagged `openmdao:indep_var`. :type is_indep_var: :py:class:`bool` or :py:obj:`None` :param is_design_var: If None (the default), do no additional filtering of the inputs. If True, list only inputs connected to outputs that are driver design variables. If False, list only inputs _not_ connected to outputs that are driver design variables. :type is_design_var: :py:class:`bool` or :py:obj:`None` :param all_procs: When True, display output on all processors. Default is False. :type all_procs: :py:class:`bool`, *optional* :param list_autoivcs: If True, include auto_ivc outputs in the listing. Defaults to False. :type list_autoivcs: :py:class:`bool` :param out_stream: Where to send human readable output. Default is sys.stdout. Set to None to suppress. :type out_stream: :py:class:`file-like` :param print_min: When true, if the output value is an array, print its smallest value. :type print_min: :py:class:`bool` :param print_max: When true, if the output value is an array, print its largest value. :type print_max: :py:class:`bool` :param print_mean: When true, if the output value is an array, print its mean value. :type print_mean: :py:class:`bool` :param return_format: Indicates the desired format of the return value. Can have value of 'list' or 'dict'. If 'list', the return value is a list of (name, metadata) tuples. if 'dict', the return value is a dictionary mapping {name: metadata}. :type return_format: :py:class:`str` :returns: **list of (name, metadata) or dict of {name** -- List or dict of output names and other optional information about those outputs. :rtype: :py:class:`metadata```}`` .. py:method:: list_options(include_default=True, include_solvers=True, out_stream=_DEFAULT_OUT_STREAM, return_format='list') Write a list of output names and other optional information to a specified stream. :param include_default: When True, include the built-in openmdao system options. Default is True. :type include_default: :py:class:`bool` :param include_solvers: When True, include options from nonlinear_solver and linear_solver. :type include_solvers: :py:class:`bool` :param out_stream: Where to send human readable output. Default is sys.stdout. Set to None to suppress. :type out_stream: :py:class:`file-like` :param return_format: Indicates the desired format of the return value. Can have value of 'list' or 'dict'. If 'list', the return value is a list of tuples of the form: (pathname, system options , nonlinear solver options, linear solver options) if 'dict', the return value is a dictionary with the pathname as key, and a dictionary as the value. The dictionary contains 'options', 'nonlinear_solver', and 'linear_solver' keys, each of which isa dictionary of options. :type return_format: :py:class:`str` :returns: List of tuples, one for each subsystem sorted by execution order. Each tuple contains the pathname string, a dictionary of system options, a dictionary of nonlinear solver options (only if include_solvers is True) or None, and a dictionary of nonlinear solver options (only if include_solvers is True) or None. :rtype: :py:class:`list` of :py:class:`tuple` .. py:method:: run_solve_nonlinear() Compute outputs. This calls _solve_nonlinear, but with the model assumed to be in an unscaled state. .. py:method:: run_apply_linear(mode, scope_out=None, scope_in=None) Compute jac-vec product. This calls _apply_linear, but with the model assumed to be in an unscaled state. :param mode: 'fwd' or 'rev'. :type mode: :py:class:`str` :param scope_out: Set of absolute output names in the scope of this mat-vec product. If None, all are in the scope. :type scope_out: :py:class:`set` or :py:obj:`None` :param scope_in: Set of absolute input names in the scope of this mat-vec product. If None, all are in the scope. :type scope_in: :py:class:`set` or :py:obj:`None` .. py:method:: run_solve_linear(mode) Apply inverse jac product. This calls _solve_linear, but with the model assumed to be in an unscaled state. :param mode: 'fwd' or 'rev'. :type mode: :py:class:`str` .. py:method:: run_linearize(sub_do_ln=True) Compute jacobian / factorization. This calls _linearize, but with the model assumed to be in an unscaled state. :param sub_do_ln: Flag indicating if the children should call linearize on their linear solvers. :type sub_do_ln: :py:class:`bool` .. py:method:: check_config(logger) Perform optional error checks. :param logger: The object that manages logging output. :type logger: :py:class:`object` .. py:method:: load_model_options() Load the relevant model options from `Problem._metadata['model_options']`. This method examines each path filter and corresponding options in self._problem_meta['model_options']. If this System's pathname matches the given path filter, it will assume the value for each given option which it possesses. .. py:method:: add_recorder(recorder, recurse=False) Add a recorder to the system. :param recorder: A recorder instance. :type recorder: :py:class:`` :param recurse: Flag indicating if the recorder should be added to all the subsystems. :type recurse: :py:class:`bool` .. py:method:: record_iteration() Record an iteration of the current System. .. py:method:: get_reports_dir() Get the path to the directory where the report files should go. If it doesn't exist, it will be created. :returns: The path to the directory where reports should be written. :rtype: :py:class:`str` .. py:method:: get_outputs_dir(*subdirs, mkdir=False) Get the path under which all output files of this system are to be placed. :param \*subdirs: Subdirectories nested under the relevant problem output directory. To create {prob_output_dir}/a/b one would pass `system.get_outputs_dir('a', 'b')`. :type \*subdirs: :py:class:`str` :param mkdir: If True, attempt to create this directory if it does not exist. :type mkdir: :py:class:`bool` :returns: The path of the outputs directory for the problem. :rtype: :py:class:`pathlib.Path` .. py:method:: cleanup() Clean up resources prior to exit. .. py:method:: get_val(name, units=None, indices=None, get_remote=False, rank=None, vec_name='nonlinear', kind=None, flat=False, from_src=True, copy=False) Get an output/input/residual variable. Function is used if you want to specify display units. :param name: Promoted or relative variable name in the root system's namespace. :type name: :py:class:`str` :param units: Units to convert to before return. :type units: :py:class:`str`, *optional* :param indices: Indices or slice to return. :type indices: :py:class:`int` or :py:class:`list` of :py:class:`ints` or :py:class:`tuple` of :py:class:`ints` or :py:class:`int ndarray` or :py:class:`Iterable` or :py:obj:`None`, *optional* :param get_remote: If True, retrieve the value even if it is on a remote process. Note that if the variable is remote on ANY process, this function must be called on EVERY process in the Problem's MPI communicator. If False, only retrieve the value if it is on the current process, or only the part of the value that's on the current process for a distributed variable. If None and the variable is remote or distributed, a RuntimeError will be raised. :type get_remote: :py:class:`bool` or :py:obj:`None` :param rank: If not None, only gather the value to this rank. :type rank: :py:class:`int` or :py:obj:`None` :param vec_name: Name of the vector to use. Defaults to 'nonlinear'. :type vec_name: :py:class:`str` :param kind: Kind of variable ('input', 'output', or 'residual'). If None, returned value will be either an input or output. :type kind: :py:class:`str` or :py:obj:`None` :param flat: If True, return the flattened version of the value. :type flat: :py:class:`bool` :param from_src: If True, retrieve value of an input variable from its connected source. :type from_src: :py:class:`bool` :param copy: If True, return a copy of the value. If False, return a reference to the value. :type copy: :py:class:`bool`, *optional* :returns: The value of the requested output/input variable. :rtype: :py:class:`object` .. py:method:: set_val(name, val, units=None, indices=None) Set an input or output variable. :param name: Promoted or relative variable name in the system's namespace. :type name: :py:class:`str` :param val: Value to assign to this variable. :type val: :py:class:`object` :param units: Units of the value. :type units: :py:class:`str`, *optional* :param indices: Indices or slice to set. :type indices: :py:class:`int` or :py:class:`list` of :py:class:`ints` or :py:class:`tuple` of :py:class:`ints` or :py:class:`int ndarray` or :py:class:`Iterable` or :py:obj:`None`, *optional* .. py:method:: convert2units(name, val, units) Convert the given value to the specified units. :param name: Name of the variable. :type name: :py:class:`str` :param val: The value of the variable. :type val: :py:class:`float` or :py:class:`ndarray` of :py:class:`float` :param units: The units to convert to. :type units: :py:class:`str` :returns: The value converted to the specified units. :rtype: :py:class:`float` or :py:class:`ndarray` of :py:class:`float` .. py:method:: convert_from_units(name, val, units) Convert the given value from the specified units to those of the named variable. :param name: Name of the variable. :type name: :py:class:`str` :param val: The value of the variable. :type val: :py:class:`float` or :py:class:`ndarray` of :py:class:`float` :param units: The units to convert to. :type units: :py:class:`str` :returns: The value converted to the specified units. :rtype: :py:class:`float` or :py:class:`ndarray` of :py:class:`float` .. py:method:: convert_units(name, val, units_from, units_to) Wrap the utility convert_units and give a good error message. :param name: Name of the variable. :type name: :py:class:`str` :param val: The value of the variable. :type val: :py:class:`float` or :py:class:`ndarray` of :py:class:`float` :param units_from: The units to convert from. :type units_from: :py:class:`str` :param units_to: The units to convert to. :type units_to: :py:class:`str` :returns: The value converted to the specified units. :rtype: :py:class:`float` or :py:class:`ndarray` of :py:class:`float` .. py:method:: total_local_size(io) Return the total local size of the given variable. :param io: Either 'input' or 'output'. :type io: :py:class:`str` :returns: The total local size of the given input or output vector. :rtype: :py:class:`int` .. py:method:: best_partial_deriv_direction() Return the best direction for partial deriv calculations based on input and output sizes. :returns: The best direction for derivative calculations, 'fwd' or 'rev'. :rtype: :py:class:`str` .. py:method:: get_promotions(inprom=None, outprom=None) Return all promotions for the given promoted variable(s). In other words, how and where did promotions occur to convert absolute variable names into the given promoted name(s) at the current System level. :param inprom: The promoted input variable name. :type inprom: :py:class:`str` or :py:obj:`None` :param outprom: The promoted output variable name. :type outprom: :py:class:`str` or :py:obj:`None` :returns: Dictionary keyed on system pathname containing input and/or output promotion lists for each System where promotions occurred to produce the given promoted variable(s). :rtype: :py:class:`dict` .. py:method:: load_case(case) Pull all input and output variables from a Case into this System. Override this method if the System requires special handling when loading a case. :param case: A Case from a CaseReader, or a dictionary with key 'inputs' mapped to the output of problem.model.list_inputs and key 'outputs' mapped to the output of prob.model.list_outputs. Both list_inputs and list_outputs should be called with `prom_name=True` and `return_format='dict'`. :type case: :py:class:`Case` or :py:class:`dict` .. py:method:: comm_info_iter() Yield comm size for this system and all subsystems. :Yields: :py:class:`tuple` -- A tuple of the form (abs_name, comm_size). .. py:method:: dist_size_iter(io, top_comm) Yield names and distributed ranges of all local and remote variables in this system. :param io: Either 'input' or 'output'. :type io: :py:class:`str` :param top_comm: The top-level MPI communicator. :type top_comm: :py:class:`MPI.Comm` or :py:obj:`None` :Yields: :py:class:`tuple` -- A tuple of the form ((abs_name, rank), start, end). .. py:method:: get_var_dup_info(name, io) Return information about how the given variable is duplicated across MPI processes. :param name: Name of the variable. :type name: :py:class:`str` :param io: Either 'input' or 'output'. :type io: :py:class:`str` :returns: A tuple of the form (is_duplicated, num_zeros, is_distributed). :rtype: :py:class:`tuple` .. py:method:: get_var_sizes(name, io) Return the sizes of the given variable on all procs. :param name: Name of the variable. :type name: :py:class:`str` :param io: Either 'input' or 'output'. :type io: :py:class:`str` :returns: Array of sizes of the variable on all procs. :rtype: :py:class:`ndarray` .. py:method:: get_self_statics() Override this in derived classes if compute_primal references static values. Do NOT include self._discrete_inputs in the returned tuple. Include things like self.options['opt_name'], etc., that are used in compute_primal but are assumed to be constant during derivative computation. Return value MUST be a tuple. Don't forget the trailing comma if tuple has only one item. Return value MUST be hashable. The order of these values doesn't matter. They are only checked (by computing their hash) to see if they have changed since the last time compute_primal was jitted, and if so, compute_primal will be re-jitted. :returns: Tuple containing all static values required by compute_primal. :rtype: :py:class:`tuple` .. py:method:: run_validation() Run validate method on all systems below this system. The validate method on each system can be used to check any final input / output values after a run. .. py:method:: validate(inputs, outputs, discrete_inputs=None, discrete_outputs=None) Check any final input / output values after a run. The model is assumed to be in an unscaled state. An inherited component may choose to either override this function or ignore it. Any errors or warnings raised in this method will be collected and all printed / raised together. :param inputs: Unscaled, dimensional input variables read via inputs[key]. :type inputs: :py:class:`Vector` :param outputs: Unscaled, dimensional output variables read via outputs[key]. :type outputs: :py:class:`Vector` :param discrete_inputs: If not None, dict-like object containing discrete input values. :type discrete_inputs: :py:class:`dict-like` or :py:obj:`None` :param discrete_outputs: If not None, dict-like object containing discrete output values. :type discrete_outputs: :py:class:`dict-like` or :py:obj:`None`