Difference between LUSolver and solve

A LUSolver uses a direct method: (LU factorization) to solve linear systems of the form Ax = b.
The normal backend of the LUSolvers is PETSc, which has the following options (depending on how you have installed petsc):

  • “default”
  • “umfpack”
  • “mumps”
  • “pastix”
  • “superlu”
  • “superlu_dist”
  • “petsc”
    The solver does not reassemble the matrix K when solve is called.

In your specific code, you also use assemble_system, which applies Dirichlet conditions in a symmetric fashion by applying lifting. See for instance: https://hal.archives-ouvertes.fr/hal-03741809/ for a description of the lifting procedure.

The solve method takes in ufl-forms. This means that these has to be compiled (or searched for in cache) to get the integration kernels. Boundary conditions are applied in a non-symmetric fashion (by making an identity row in the matrix, and setting the bc directly in the rhs vector).
The solve method creates a LinearVariationalSolver, that can use either direct methods (such as those above) or iterative methods with preconditioners.

1 Like