Setup Your Model
Setup Your Model¶
After you have built 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
and it is important to note that you cannot set or get any variable values, nor run until after
setup(check=False, logger=None, mode='auto', force_alloc_complex=False, distributed_vector_class=None, local_vector_class=<class 'openmdao.vectors.default_vector.DefaultVector'>, derivatives=True)
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 the model hierarchy to call configure on each subsystem.
- checkNone, bool, list of str, or the strs ‘all’
Determines what config checks, if any, are run after setup is complete. If None or False, no checks are run If True, the default checks (‘out_of_order’, ‘system’, ‘solvers’, ‘dup_inputs’, ‘missing_recorders’, ‘unserializable_options’, ‘comp_has_no_outputs’, ‘auto_ivc_warnings’) are run If list of str, run those config checks If ‘all’, all the checks (‘auto_ivc_warnings’, ‘comp_has_no_outputs’, ‘cycles’, ‘dup_inputs’, ‘missing_recorders’, ‘all_unserializable_options’, ‘out_of_order’, ‘promotions’, ‘solvers’, ‘system’, ‘unconnected_inputs’) are run.
Object for logging config checks if check is True.
Derivatives calculation mode, ‘fwd’ for forward, and ‘rev’ for reverse (adjoint). Default is ‘auto’, which will pick ‘fwd’ or ‘rev’ based on the direction resulting in the smallest number of linear solves required to compute derivatives.
If True, sufficient memory will be allocated to allow nonlinear vectors to store complex values while operating under complex step.
Reference to the <Vector> class or factory function used to instantiate vectors and associated transfers involved in interprocess communication.
Reference to the <Vector> class or factory function used to instantiate vectors and associated transfers involved in intraprocess communication.
If True, perform any memory allocations necessary for derivative computation.
This enables the user to instantiate and setup in one line.