Run Your Model#

Once setup() is done, you can then execute your model with run_model()

run_model() will execute one pass through your model.

Examples

A basic setup() executing a single pass through the model.

import openmdao.api as om
from openmdao.test_suite.components.paraboloid import Paraboloid

prob = om.Problem()
model = prob.model

model.add_subsystem('comp', Paraboloid(), promotes=['x', 'y', 'f_xy'])

prob.setup()

prob.set_val('x', 2.)
prob.set_val('y', 10.)
prob.run_model()
print(prob.get_val('f_xy'))
[214.]
prob.set_val('x', 0.)
prob.set_val('y', 0.)
prob.run_model()
print(prob.get_val('f_xy'))
[22.]
prob.setup()

prob.set_val('x', 4.)
prob.set_val('y', 8.)
prob.run_model()
print(prob.get_val('f_xy'))
[174.]