This package contains the OpenMDAO Standard Library. It’s intended to contain all of the plugins that are officially supported and released as part of openmdao.
Psudo package providing a central place to access all of the OpenMDAO datatypes standard library
Bases: object
Pulls Cases from a relational DB (sqlite). It doesn’t support general sql queries, but it does allow for a series of boolean selectors, e.g., ‘x<=y’, that are ANDed together.
Psudo package providing a central place to access all of the OpenMDAO caserecorders standard library
Bases: object
Records Cases to a relational DB (sqlite). Values other than floats, ints or strings are pickled and are opaque to SQL queries.
Retrieve the values of specified variables from a sqlite DB containing Case data.
Returns a dict containing a list of values for each entry, keyed on variable name.
Only data from cases containing ALL of the specified variables will be returned so that all data values with the same index will correspond to the same case.
Based on command line options, display an XY plot using data from a sqlite Case DB.
Display an XY plot using Case data from a sqlite DB.
Psudo package providing a central place to access all of the OpenMDAO components standard library
Bases: openmdao.main.component.Component
A Component wrapper for objects that contain their own internal hierarchy and Component-like interface (set/get/run) but do not provide normal python attribute access.
Returns a trait if a trait with the given pathname exists, possibly creating the trait ‘on-the-fly’. If an attribute exists with the given pathname but no trait is found or can be created, or if pathname references a trait in a parent scope, None will be returned. If no attribute exists with the given pathname within this scope, an AttributeError will be raised.
Expected Improvement calculation for one or more objectives
Expected Improvement calculation for one or more objectives
Base class for an external application that needs to be executed.
Bases: openmdao.main.component.Component
Run an external code as a component.
The command to be executed.
Environment variables required by the command.
Delay between polling for command completion. A value of zero will use an internally computed default.
Resources required to run this component.
Maximum time to wait for command completion. A value of zero implies an infinite wait.
Return code from the command.
True if the command timed-out.
Copy files from directory that match patterns to the current directory and ensure they are writable.
Copy inputs from inputs_dir that match patterns.
This can be useful for resetting problem state.
Copy files from results_dir that match patterns.
This can be useful for workflow debugging when the external code takes a long time to execute.
Metamodel provides basic Meta Modeling capability
Bases: openmdao.main.component.Component
A component that provides general Meta Modeling capability.
See Appendix B for additional information on the MetaModel component.
Socket for the Component or Assembly being encapsulated.
Records training cases
An ISurrogate instance that is used as a template for each output surrogate.
A list of names of variables to be excluded from the public interface.
A list of names of variables to be included in the public interface.
Return the list of names of public inputs that correspond to model inputs.
Return the list of names of public outputs that correspond to model outputs.
Bases: openmdao.main.component.Component
Takes one List input, and splits it into n indvidual outputs. This is a logical demultiplexer.
None
number of items in the array to be demultiplexed
Bases: openmdao.main.component.Component
Takes in n inputs, and exports a length n List with the data. It is a logical multiplexer.
number of inputs to be multiplexed
None
nastran.py defines NastranComponent.
Bases: openmdao.lib.components.external_code.ExternalCode
All Nastran-capable components should be subclasses of NastranComponent.
By subclassing NastranComponent, any component should have easy access to NastranMaker, NastranReplacer, and NastranParser. Your subclass must specify how to handle the input and output variables to NastranComponent by specifying nastran-specific attributes on the traits. All of these attributes are described further in the MSC NastranComponent docs.
Note: This component does nothing with external_files. If you want to deal with that, then do so in your subclass.
Should I delete the temporary files?
If I am deleting temporary files, should I keep the first one?
If I am deleting temporary files, should I keep the last one?
Location of nastran executable.
Arguments to the nastran command.
Input filename with placeholder variables.
Output filename.
Runs the NastranComponent.
We are overiding ExternalCode’s execute function. First, we setup the input file (by running NastranReplacer and then NastranMaker). Next, we run Nastran by calling our parent’s execute function. Finally, we parse the data and set the output variables given to us.
While there are no explicit parameters or return values for this function, it gets all the input it needs from the design variables that are connected to the subclass of NastranComponent. This should be described pretty well in the documentation.
A subclass can override this function to dynamically add variables to NastranMaker.
The return will be ignored. Right after this function exits, the Nastran input file will be written out to a file.
Defines NastranMaker, an intelligent bulk data replacer for Nastran files.
Bases: object
A object that performs specified replacements conforming to the Nastran format.
The goal of NastranMaker is to output a Nastran file with a set of variables replaced. It takes an existing Nastran file and variables. In order to retain as much data as possible, it replaces the variables in long format, allowing for 16 characters, instead of 8.
Records what should be replaced where.
Instead of doing the replacing as we are given the variables to replace, we’d like to do all the replacing at one time. Therefore, this function just records what should be replaced.
name: str
After specifying the substitutions that should be made, write out the finished product.
This changes self.text and then prints self.text to a file. So, calling write_to_file more than once is unnecessary, although it shouldn’t actually change anything. Also note that the unique_int should be unique within the entire file.
Defines NastranParser, an object that provides a way of parsing and accessing the data in the grids in Nastran’s output.
Bases: object
Provides access to the grids of Nastran output.
Get some data from the grid that we parsed previously.
You specify the grid you want with the header and a subcase. If you don’t care about the subcase, set it to None. You can also give it a dictionary of constraints and also specify which columns you’d liked returned. The row_width optional attribute is useful if you have something that looks like:
- ELEMENT ID PRICES
- 1 4.00
- 5.00
- 2 38.30
- 60.00
As you can see, each element has two prices. In this case, if we had a constraint that selected only the second element, we would want both prices returned. Therefore, we would set row_width to 2.
Parse the information!
Try to parse grids and headers from the outfile that was given to us beforehand. The basic idea is that we split the entire file by pages. Nastran conveniently labels sections of the output by pages. Each of these pages is expected to have one grid. We parse it by trying to find location of the columns. This is done completely heuristically because of the inconsistency in Nastran’s output specification.
Defines NastranReplacer, an object which provides a crude and simple search and replace function.
Bases: object
A kind of dummy object that just replaces variables in a text with their corresponding values.
Replace the input_variables in the text with the corresponding values.
Changes self.text. Running this twice should probably error out since it wouldn’t find the variables it was meant to replace.
Defines helpful functions that are used in conjunction with NastranComponent.
Find a string and replace it with another in one big string.
In big_string (probably a line), find old_string and replace it with new_string. Because a lot of Nastran is based on 8-character blocks, this will find the 8-character block currently occupied by old_string and replace that entire block with new_string.
big_string, old_string, new_string: str
Convert thing to a string of a certain length.
This function tries to make the best use of space. For integers and floaters, it will try to get the most signicant digits while staying within length. For everything else, we just try to stick in a string.
Pareto Filter – finds non-dominated cases
Bases: openmdao.main.component.Component
Takes a set of cases and filters out the subset of cases which are pareto optimal. Assumes that smaller values for model responses are better, so all problems must be posed as minimization problems.
CaseIterator with the cases to be filtered to Find the pareto optimal subset.
List of outputs from the case to consider for filtering. Note that only case outputs are allowed as criteria.
Resulting collection of dominated cases.
resulting collection of pareto optimal cases
Bases: openmdao.main.component.Component
Computes the probability that any given point from the primary concept will interesect the pareto frontiers of some other concepts.
Names of responses to maximize expected improvement around. Must be NormalDistribution type.
CaseIterator which contains all the points from the global pareto frontier
CaseIterator which contains a NormalDistribution for each response at a location where you wish to calculate EI.
CaseIterator which contains only Pareto optimal cases belonging to the same model as predicted_values
The probability that a candidate point is close to Pareto intersection
Psudo package providing a central place to access all of the OpenMDAO doegenerators standard library
DOEgenerator that performs a full-factorial Design of Experiments. Plugs into the DOEgenerator socket on a DOEdriver.
Bases: enthought.traits.has_traits.HasTraits
DOEgenerator that performs a full-factorial Design of Experiments. Plugs into the DOEgenerator socket on a DOEdriver.
number of levels of values for each parameter
number of independent parameters in the DOE
Bases: object
Bases: enthought.traits.has_traits.HasTraits
IDOEgenerator which provides a latin hypercube DOE sample set. The Morris-Mitchell sampling criterion of the DOE is optimzied using an evolutionary algorithm.
Vector norm calculation method. ‘1-norm’ is faster, but less accurate
Psudo package providing a central place to access all of the OpenMDAO drivers standard library
solver.py – Solver based on the nonlinear solvers found in Scipy.Optimize.
See Appendix B for additional information on the BroydenSolver.
Bases: openmdao.main.driver.Driver
MIMO Newton-Raphson Solver with Broyden approximation to the Jacobian. Algorithms are based on those found in scipy.optimize.
Nonlinear solvers
These solvers find x for which F(x)=0. Both x and F are multidimensional.
All solvers have the parameter iter (the number of iterations to compute); some of them have other parameters of the solver. See the particular solver for details.
A collection of general-purpose nonlinear multidimensional solvers.
The broyden2 is the best. For large systems, use broyden3; excitingmixing is also very effective. The remaining nonlinear solvers from SciPy are, in their own words, of “mediocre quality,” so they were not implemented.
Algorithm to use. Choose from broyden2, broyden3, and excitingmixing.
Mixing Coefficient.
Maximum Mixing Coefficient (only used with excitingmixing.)
Maximum number of iterations before termination.
Convergence tolerance. If the norm of the independentvector is lower than this, then terminate successfully.
Adds a constraint in the form of a boolean expression string to the driver.
Parameters:
Adds an equality constraint as two strings, a left hand side and a right hand side.
Adds a parameter to the driver.
If neither “low” nor “high” is specified, the min and max will default to the values in the metadata of the variable being referenced. If they are not specified in the metadata and not provided as arguments, a ValueError is raised.
Takes an iterator of tuples of the form (param_name, low, high) and adds the parameters to the driver.
Removes all constraints.
Removes all parameters.
Returns a list of tuples of the form (lhs, rhs, comparator, is_violated)
From SciPy, Broyden’s second method.
Updates inverse Jacobian by an optimal formula. There is NxN matrix multiplication in every iteration.
The best norm(F(x))=0.003 achieved in ~20 iterations.
from scipy, Broyden’s second (sic) method.
Updates inverse Jacobian by an optimal formula. The NxN matrix multiplication is avoided.
The best norm(F(x))=0.003 achieved in ~20 iterations.
from scipy, The excitingmixing method.
J=-1/alpha
The best norm(F(x))=0.005 achieved in ~140 iterations.
Note: SciPy uses 0.1 as the default value for alpha for this algorithm. Ours is set at 0.4, which is appropriate for Broyden2 and Broyden3, so adjust it accordingly if there are problems.
Returns an ordered dict of constraint objects.
Returns an ordered dict of parameter objects.
Return a list of strings containing constraint expressions.
Returns an alphabetized list of parameter names.
Removes the constraint with the given string.
Removes the parameter with the given name.
Pushes the values in the iterator ‘values’ into the corresponding variables in the model.
Bases: openmdao.main.driver.Driver
A base class for Drivers that run sets of cases in a manner similar to the ROSE framework. Concurrent evaluation is supported, with the various evaluations executed across servers obtained from the ResourceAllocationManager.
Something to save Cases to.
Maximum number of times to retry a failed case.
If True, reload the model between executions.
If True, evaluate cases sequentially.
Runs all cases and records results in recorder. Uses setup() and resume() with default arguments.
Resume execution.
Bases: openmdao.lib.drivers.caseiterdriver.CaseIterDriverBase
Run a set of cases provided by an ICaseIterator. Concurrent evaluation is supported, with the various evaluations executed across servers obtained from the ResourceAllocationManager.
Iterator supplying Cases to evaluate.
conmindriver.py - Driver for the CONMIN optimizer.
See Appendix B for additional information on the CONMINDriver.
Bases: openmdao.main.driver.Driver
Driver wrapper of Fortran version of CONMIN.
Todo
Make CONMIN’s handling of user calculated gradients accessible through CONMINdriver
Array designating whether each constraint is linear.
Constraint thickness parameter.
Constraint thickness parameter for linear and side constraints.
Minimum absoluate value of ctl used in optimization.
Minimum absoluate value of ct used in optimization.
Absolute convergence tolerance.
Relative convergence tolerance.
Relative change in parameters when calculating finite difference gradients.
Minimum absolute step in finite difference gradient calculations.
Conjugate gradient restart parameter.
Print information during CONMIN solution. Higher values are more verbose.
Maximum number of iterations before termination.
Number of consecutive iterations to indicate convergence (relative or absolute).
Linear objective function flag.
User-defined gradient flag (not yet supported).
Scaling control parameter – controls scaling of decision variables.
Participation coefficient - penalty parameter that pushes designs towards the feasible region.
List of extra variables tooutput in the recorder.
Array of scaling factors for the parameters.
Mean value of the push-off factor in the method of feasible directions.
Adds a constraint in the form of a boolean expression string to the driver.
Adds an inequality constraint as three strings; a left hand side, a comparator (‘<’,’>’,’<=’, or ‘>=’), and a right hand side.
Sets the objective of this driver to be the specified expression. If there is a preexisting objective in this driver, it is replaced.
Adds a parameter to the driver.
If neither “low” nor “high” is specified, the min and max will default to the values in the metadata of the variable being referenced. If they are not specified in the metadata and not provided as arguments, a ValueError is raised.
Takes an iterator of tuples of the form (param_name, low, high) and adds the parameters to the driver.
Removes all constraints.
Removes all parameters.
Returns a list of constraint values
Returns the value of the evaluated objective.
Returns an ordered dict of inequality constraint objects.
Returns the objective object.
Returns an ordered dict of parameter objects.
Return a list of strings containing constraint expressions.
Returns the expression string for the objective.
Returns an alphabetized list of parameter names.
Removes the constraint with the given string.
Removes the parameter with the given name.
Pushes the values in the iterator ‘values’ into the corresponding variables in the model.
doedriver.py – Driver that executes a Design of Experiments.
See Appendix B for additional information on the DOEdriver.
Bases: openmdao.lib.drivers.caseiterdriver.CaseIterDriverBase
Driver for Design of Experiments
Iterator supplying normalized DOE values
A list of outputs to be saved with each case.
Adds a parameter to the driver.
If neither “low” nor “high” is specified, the min and max will default to the values in the metadata of the variable being referenced. If they are not specified in the metadata and not provided as arguments, a ValueError is raised.
Takes an iterator of tuples of the form (param_name, low, high) and adds the parameters to the driver.
Removes all parameters.
Returns an ordered dict of parameter objects.
Returns an alphabetized list of parameter names.
Removes the parameter with the given name.
Pushes the values in the iterator ‘values’ into the corresponding variables in the model.
A simple Pyevolve-based driver for OpenMDAO
See Appendix B for additional information on the Genetic driver.
Bases: openmdao.main.driver.Driver
Genetic algorithm for the OpenMDAO framework, based on the Pyevolve Genetic algorithm module.
The crossover rate used when two parent genomes reproduce to form a child genome.
Controls the use of elitism in the creation of new generations.
The maximum number of generations the algorithm will evolve to before stopping.
The mutation rate applied to population members.
Sets the optimization to either minimize or maximize the objective function.
The size of the population in each generation.
Random seed for the optimizer. Set to a specific value for repeatable results; otherwise leave as None for truly random seeding.
The selection method used to pick population members who will survive for breeding into the next generation.
The genome with the best score from the optimization.
Sets the objective of this driver to be the specified expression. If there is a preexisting objective in this driver, it is replaced.
Adds a parameter to the driver.
If neither “low” nor “high” is specified, the min and max will default to the values in the metadata of the variable being referenced. If they are not specified in the metadata and not provided as arguments, a ValueError is raised.
Takes an iterator of tuples of the form (param_name, low, high) and adds the parameters to the driver.
Removes all parameters.
Returns the value of the evaluated objective.
Returns the objective object.
Returns an ordered dict of parameter objects.
Returns the expression string for the objective.
Returns an alphabetized list of parameter names.
Removes the parameter with the given name.
Pushes the values in the iterator ‘values’ into the corresponding variables in the model.
A simple iteration driver. Basically runs a workflow, passing the output to the input for the next iteration. Relative change and number of iterations are used as termination criteria.
Bases: openmdao.main.driver.Driver
A simple fixed point iteration driver, which runs a workflow and passes the value from the output to the input for the next iteration. Relative change and number of iterations are used as termination criterea.
Maximum number of iterations before termination.
Absolute convergence tolerance between iterations.
loop output to pass to input.
loop input, taken from the input.
newsumtdriver.py - Driver for the NEWSUMT optimizer.
(See Appendix B for additional information on the NEWSUMTDriver.)
Bases: openmdao.main.driver.Driver
Driver wrapper of Fortran version of NEWSUMT.
Todo
Make NEWSUMT’s handling of user calculated gradients accessible through NEWSUMTdriver.
Todo
Check to see if this itmax variable is needed. NEWSUMT might handle it for us.
Convergence criteria of the golden section algorithm used for the one dimensional minimization.
Convergence criteria of the unconstrained minimization.
Convergence criteria for the overall process.
Step size of the finite difference steps for each design variable.
Initial value of the transition parameter.
Flag for finite difference gradient control. If 0, all gradients computed by user analysis program. If > 0, use default finite difference stepsize of 0.1. If < 0, use user defined finite difference stepsize. FDCV must be specified. If 1, gradient of objective function computed by differences. If 2, gradient of all constraints computed by differences. If 3, gradient of nonlinear constraints computed by finite differences. If 4, combination of 1 and 2. If 5, combination of 1 and 3.
Array designating whether each constraint is linear.
Array indicating what kind of side constraint (aka lower and upper bounds ): 0=no bounds, 1=lower bounds only, 2= upper bounds only, 3= lower and upper bounds.
Maximum number of iterations before termination.
Print information during NEWSUMT solution. Higher values are more verbose. If 0, print initial and final designs only.
If 1, linear objective function.
Maximum allowable number of golden section iterations used for 1D minimization.
Maximum allowable number of one dimensional minimizations.
Maximum allowable number of unconstrained minimizations.
Flag for penalty multiplier. If 0, initial value computed by NEWSUMT. If 1, initial value set by ra.
Number of design variables.
Number of constraints considered.
Penalty multiplier. Required if mflag=1
Penalty multiplier decrease ratio. Required if mflag=1.
Lower bound of penalty multiplier. Required if mflag=1.
Maximum bound imposed on the initial step size of the one-dimensional minimization.
Adds a constraint in the form of a boolean expression string to the driver.
Adds an equality constraint as two strings, a left hand side and a right hand side.
Adds an inequality constraint as three strings; a left hand side, a comparator (‘<’,’>’,’<=’, or ‘>=’), and a right hand side.
Sets the objective of this driver to be the specified expression. If there is a preexisting objective in this driver, it is replaced.
Adds a parameter to the driver.
If neither “low” nor “high” is specified, the min and max will default to the values in the metadata of the variable being referenced. If they are not specified in the metadata and not provided as arguments, a ValueError is raised.
Takes an iterator of tuples of the form (param_name, low, high) and adds the parameters to the driver.
Removes all constraints.
Removes all parameters.
Returns a list of tuples of the form (lhs, rhs, comparator, is_violated) from evalution of equality constraints.
Returns a list of tuples of the form (lhs, rhs, comparator, is_violated) from evalution of inequality constraints.
Returns the value of the evaluated objective.
Returns an ordered dict of equality constraint objects.
Returns an ordered dict of inequality constraint objects.
Returns the objective object.
Returns an ordered dict of parameter objects.
Return a list of strings containing constraint expressions.
Returns the expression string for the objective.
Returns an alphabetized list of parameter names.
Removes the constraint with the given string.
Removes the parameter with the given name.
Pushes the values in the iterator ‘values’ into the corresponding variables in the model.
A simple driver that runs cases from a CaseIterator and records them with a CaseRecorder
Bases: openmdao.main.driver.Driver
A Driver that sequentially runs a set of cases provided by an ICaseIterator and records the results in a CaseRecorder. This is intended for test cases or very simple models only. For a more full- featured Driver with similar functionality, see CaseIteratorDriver.
For each case coming from the iterator, the workflow will be executed once.
Source of Cases.
Where Case results are recorded.
Psudo package providing a central place to access all of the OpenMDAO surrogatemodels standard library
Surrogate model based on Kriging
Bases: enthought.traits.has_traits.HasTraits
Returns a NormalDistribution centered around the value, with a standard deviation of 0.
Psudo package containing providing a central place to access all of the OpenMDAO datatypes standard library
implements
on_trait_change
Interface
TraitError
TraitType
Trait for numpy array variables, with optional units.
Bases: enthought.traits.trait_numeric.Array
A variable wrapper for a numpy array with optional units. The unit applies to the entire array.
Bases: object
A DomainObj represents a (possibly multi-zoned) mesh and data related to that mesh.
Add zones from other to self, retaining names where possible.
Add a Zone. Returns the added zone.
Test if self and other are equivalent.
Convert to cartesian coordinate system.
Convert to cylindrical coordinate system.
Remove a zone. Returns the removed zone.
Rename a zone.
Translate coordinates.
Trait for enumerations, with optional alias list.
Support for files, either as File or external files.
Bases: enthought.traits.trait_handlers.TraitType
A trait wrapper for a FileRef object. For input files legal_types may be set to a list of expected ‘content_type’ strings. Then upon assignment the actual ‘content_type’ must match one of the legal_types strings. Also for input files, if local_path is set, then upon assignent the associated file will be copied to that path.
Trait for floating point variables, with optional min, max, and units.
Bases: enthought.traits.trait_handlers.TraitType
A Variable wrapper for floating point number valid within a specified range of values.
Bases: object
Contains solution variables for a Zone. All variables have the same shape and grid location.
Add a numpy.ndarray of scalar data and bind to name. Returns the added array.
Add a Vector and bind to name. Returns the added vector.
Test if self and other are equivalent.
Convert to cartesian coordinate system.
Convert to cylindrical coordinate system.
Number of ghost cells for each index direction.
Position at which data is located.
Bases: openmdao.lib.datatypes.domain.vector.Vector
Coordinate data for a Zone.
Test if self and other are equivalent.
Convert to cartesian coordinate system.
Convert to cylindrical coordinate system.
Translate coordinates.
Number of ghost cells for each index direction.
Trait for floating point variables, with optional min and max.
Functions to read and write a DomainObj in Plot3D format. Many function arguments are common:
Default argument values are set for a typical 3D multiblock single-precision Fortran unformatted file. When writing, zones are assumed in Cartesian coordinates with data located at the vertices.
Returns a DomainObj initialized from Plot3D grid_file and f_file. Variables are assigned to names of the form f_N.
Returns a DomainObj initialized from Plot3D grid_file.
Returns a DomainObj initialized from Plot3D grid_file and q_file. Q variables are assigned to ‘density’, ‘momentum’, and ‘energy_stagnation_density’. Scalars are assigned to ‘mach’, ‘alpha’, ‘reynolds’, and ‘time’.
Returns a list of zone dimensions from Plot3D grid_file.
Writes domain to grid_file and f_file in Plot3D format. If varnames is None, then all arrays and then all vectors are written.
Writes domain to grid_file in Plot3D format.
Writes domain to grid_file and q_file in Plot3D format. Requires ‘density’, ‘momentum’, and ‘energy_stagnation_density’ variables as well as ‘mach’, ‘alpha’, ‘reynolds’, and ‘time’ scalars.
Register a surface probe function.
Calculate metrics on mesh surfaces. Currently only supports 3D structured grids with cell-centered data.
Returns a list of metric values in the order of the variables list.
Bases: object
Vector data for a FlowSolution. In cartesian coordinates, array indexing order is x,y,z; so an ‘i-face’ is a y,z surface. In cylindrical coordinates, array indexing order is z,r,t; so an ‘i-face’ is a r,t surface.
Test if self and other are equivalent.
Convert to cartesian coordinate system.
Bases: object
One zone in a possibly multi-zone DomainObj.
Test if self and other are equivalent.
Convert to cartesian coordinate system.
Convert to cylindrical coordinate system.
Translate coordinates.
Coordinate system in use.