# DirectSolver¶

DirectSolver is a linear solver that assembles the system Jacobian and solves the linear system with LU factorization and back substitution. It can handle any system topology. Since it assembles a global Jacobian for all of its subsystems, any linear solver that is assigned in any of its subsystems does not participate in this calculation (though they may be used in other ways such as in subsystem Newton solves.)

Here we calculate the total derivatives of the Sellar system objective with respect to the design variable ‘z’.

```
from openmdao.api import Problem, DirectSolver
from openmdao.test_suite.components.sellar import SellarDerivatives
prob = Problem()
model = prob.model = SellarDerivatives()
model.linear_solver = DirectSolver()
prob.setup()
prob.run_model()
```

NL: NLBGS Converged in 7 iterations

```
wrt = ['z']
of = ['obj']
J = prob.compute_totals(of=of, wrt=wrt, return_format='flat_dict')
print(J['obj', 'z'][0][0])
```

9.61001055699

```
print(J['obj', 'z'][0][1])
```

1.78448533563

## DirectSolver Options¶

Option | Default | Acceptable Values | Acceptable Types | Description |
---|---|---|---|---|

assemble_jac | False | N/A | [‘bool’] | Activates use of assembled jacobian by this solver. |

err_on_singular | True | N/A | N/A | Raise an error if LU decomposition is singular. |

iprint | 1 | N/A | [‘int’] | whether to print output |

Note: Options can be passed as keyword arguments at initialization.