OpenMDAO
raw JSON → 3.43.0 verified Fri May 01 auth: no python
OpenMDAO is an open-source high-performance computing framework for multidisciplinary analysis and optimization. It enables efficient decomposition of coupled systems into components, automatic differentiation, and parallel computing. Current version 3.43.0, requires Python >=3.10. Release cadence is approximately monthly.
pip install openmdao Common errors
error ImportError: cannot import name 'IndepVarComp' from 'openmdao.api' ↓
cause openmdao.api is deprecated; import path changed.
fix
Use 'from openmdao.core.indepvarcomp import IndepVarComp' or keep openmdao.api but this will break in future versions.
error NameError: name 'ExecComp' is not defined ↓
cause Forgot to import ExecComp; it's not a built-in.
fix
Add 'from openmdao.components.exec_comp import ExecComp' or use 'om.ExecComp' if using openmdao.api.
error ValueError: The model is already set up. Cannot change configuration after setup. ↓
cause Attempting to modify model after setup() call.
fix
Make all model changes before calling setup(). If needed, create a new Problem instance.
Warnings
breaking OpenMDAO 3.x removed support for Python 2.7 and 3.6. Upgrade code to Python >=3.10. ↓
fix Ensure Python interpreter is 3.10 or higher; update deprecated API calls.
breaking The 'openmdao.api' module is deprecated as of OpenMDAO 3.31.0. Direct imports from submodules are now preferred. ↓
fix Replace 'from openmdao.api import X' with the explicit import path (e.g., 'from openmdao.core.problem import Problem').
deprecated The 'openmdao.core.component.Component' base class has been renamed to 'ExplicitComponent' and 'ImplicitComponent'. Using the old name issues a deprecation warning and will be removed. ↓
fix Use 'from openmdao.core.explicitcomponent import ExplicitComponent' or 'from openmdao.core.implicitcomponent import ImplicitComponent' instead.
gotcha Do not modify a model's structure (add/remove subsystems) after calling setup() or run_model() unless you call final_setup() again. Doing so can cause crashes or undefined behavior. ↓
fix Either restructure before setup() or use a new Problem instance.
gotcha Solver tolerances and options must be set before calling setup() if you want them to take effect. Setting them after setup may be silently ignored. ↓
fix Set solver options on the system's solver object before prob.setup().
Install
pip install openmdao[all] Imports
- Problem wrong
from openmdao.api import Problemcorrectfrom openmdao.core.problem import Problem - IndepVarComp wrong
from openmdao.api import IndepVarCompcorrectfrom openmdao.core.indepvarcomp import IndepVarComp - ExplicitComponent wrong
from openmdao.api import ExplicitComponentcorrectfrom openmdao.core.explicitcomponent import ExplicitComponent
Quickstart
import openmdao.api as om
prob = om.Problem()
prob.model.add_subsystem('indep', om.IndepVarComp('x', 1.0), promotes=['x'])
prob.model.add_subsystem('comp', om.ExecComp('y=x+1'), promotes=['*'])
prob.setup()
prob.run_model()
print(prob.get_val('y'))