Setup Your Model

After you have built up a model by defining variables and components, organizing them into a hierarchy, and connecting them together, you then need to call the setup() method to have the framework do some initialization work in preparation for execution. You can control some details of that initialization with the arguments that you pass into setup(), and it is important to note that you cannot set or get any variable values, nor run until after you call setup().

Problem.setup(vector_class=None, check=False, logger=None, mode='rev', force_alloc_complex=False, distributed_vector_class=<class 'openmdao.vectors.petsc_vector.PETScVector'>, local_vector_class=<class 'openmdao.vectors.default_vector.DefaultVector'>)[source]

Set up the model hierarchy.

When setup is called, the model hierarchy is assembled, the processors are allocated (for MPI), and variables and connections are all assigned. This method traverses down the model hierarchy to call setup on each subsystem, and then traverses up te model hierarchy to call configure on each subsystem.

Parameters:
vector_class : type

Reference to an actual <Vector> class; not an instance. This is deprecated. Use distributed_vector_class instead.

check : boolean

whether to run config check after setup is complete.

logger : object

Object for logging config checks if check is True.

mode : string

Derivatives calculation mode, ‘fwd’ for forward, and ‘rev’ for reverse (adjoint). Default is ‘rev’.

force_alloc_complex : bool

Force allocation of imaginary part in nonlinear vectors. OpenMDAO can generally detect when you need to do this, but in some cases (e.g., complex step is used after a reconfiguration) you may need to set this to True.

distributed_vector_class : type

Reference to the <Vector> class or factory function used to instantiate vectors and associated transfers involved in interprocess communication.

local_vector_class : type

Reference to the <Vector> class or factory function used to instantiate vectors and associated transfers involved in intraprocess communication.

Returns:
self : <Problem>

this enables the user to instantiate and setup in one line.

Tags

Driver, SetGet