{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "tags": [
     "remove-input",
     "active-ipynb",
     "remove-output"
    ]
   },
   "outputs": [],
   "source": [
    "try:\n",
    "    from openmdao.utils.notebook_utils import notebook_mode\n",
    "except ImportError:\n",
    "    !python -m pip install openmdao[notebooks]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# OpenMDAO Class Structure\n",
    "\n",
    "In the [Basic User Guide](../basic_user_guide/basic_user_guide.md), you have seen how to define a problem composed of\n",
    "a model and a driver. You saw how a model can be built from components of different types and how\n",
    "a driver is used to perform an optimization. Then in the [Advanced User Guide](../advanced_user_guide/advanced_user_guide.md),\n",
    "you learned about solvers and methods for computing derivatives.\n",
    "\n",
    "The following diagram shows the relationship between these various object types (classes) and the\n",
    "functionality that is assigned to each.\n",
    "\n",
    "![OpenMDAO Class Structure](images/openmdao_class_structure.jpg)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Problem\n",
    "The Problem class defines a top-level container, holding all other objects. A problem instance\n",
    "contains the system and its subsystems that constitute the model hierarchy, and also contains a\n",
    "single driver instance. In addition to serving as a container, the problem also provides the user\n",
    "interface for model setup and execution.\n",
    "\n",
    "\n",
    "## System\n",
    "A `System` can be a `Group` or a `Component`.\n",
    "\n",
    "A `Group` contains components, other groups, or a mix of both. The containment relationships\n",
    "between groups and components form a hierarchy tree, where a top-level group contains other groups,\n",
    "which contain other groups, and so on, until we reach the bottom of the tree, which is composed\n",
    "only of components. In addition to managing the data dependencies between its subsystems, groups\n",
    "serve three purposes:\n",
    "\n",
    "1. They help to package sets of components together, e.g., the components for a given discipline.\n",
    "2. They help create namespaces (since all components and variables are named based on their ancestors\n",
    "   in the tree).\n",
    "3. They facilitate the use of hierarchical nonlinear and linear solvers.\n",
    "\n",
    "Instances of the `Component` class provide the lowest-level functionality representing basic calculations.\n",
    "Each component instance maps input values to output values via some calculation. A component instance\n",
    "must be one of two component types: `ExplicitComponent` or `ImplicitComponent`. The difference\n",
    "between these component types is explained in the section on [How OpenMDAO Represents Variables](../basic_user_guide/single_disciplinary_optimization/component_types.ipynb).\n",
    "\n",
    "The hierarchy of groups and components collectively form the model.\n",
    "\n",
    "## Solver\n",
    "Every system may contain two solvers, a `NonlinearSolver` and a `LinearSolver`, which share\n",
    "a common `Solver` base class. Nonlinear solvers are used to converge implicit components or groups\n",
    "with cycles and linear solvers are used when computing derivatives across the model (see [Setting Nonlinear and Linear Solvers](../features/core_features/controlling_solver_behavior/set_solvers.ipynb)). Additional details about the different kinds of solvers\n",
    "can be found in the [OpenMDAO Solvers](solver_api.ipynb) section.\n",
    "\n",
    "## Driver\n",
    "The `Driver` class defines algorithms that iteratively call the model. There are different types\n",
    "of drivers, for example one driver might implement an optimization algorithm while another would execute\n",
    "a design of experiments (DOE). The driver types that are included with OpenMDAO are described in\n",
    "[Drivers](../features/building_blocks/drivers/index.md)."
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
