firedrake.matrix_free package

Submodules

firedrake.matrix_free.operators module

class firedrake.matrix_free.operators.ImplicitMatrixContext(a, row_bcs=[], col_bcs=[], fc_params=None, appctx=None)[source]

Bases: object

createSubMatrix(mat, row_is, col_is, target=None)[source]
duplicate(mat, copy)[source]
getDiagonal(mat, vec)[source]
getInfo(mat, info=None)[source]
missingDiagonal(mat)[source]
mult(mat, X, Y)[source]
multTranspose(mat, Y, X)[source]

EquationBC makes multTranspose different from mult.

Decompose M^T into bundles of columns associated with the rows of M corresponding to cell, facet, edge, and vertice equations (if exist) and add up their contributions.

                       Domain
    ( a a a a 0 a a )    |
    ( a a a a 0 a a )    |
    ( a a a a 0 a a )    |   EBC1
M = ( b b b b b b b )    |    |   EBC2 DBC1
    ( 0 0 0 0 1 0 0 )    |    |    |    |
    ( c c c c 0 c c )    |         |
    ( c c c c 0 c c )    |         |

Multiplication algorithm:
To avoid copys, use same y, and update it from left
(deepest ebc) to right (least deep ebc or domain).
 * below can be any number

        ( a a a b 0 c c )  ( y0 )
        ( a a a b 0 c c )  ( y1 )
        ( a a a b 0 c c )  ( y2 )
M^T y = ( a a a b 0 c c )  ( y3 )
        ( 0 0 0 0 1 0 0 )  ( y4 )
        ( a a a b 0 c c )  ( y5 )
        ( a a a b 0 c c )  ( y6 )

        ( 0 0 0 0 c c c )  ( *  )  Matrix is uniform
        ( 0 0 0 0 c c c )  ( *  )  on facet2 (EBC2)
        ( 0 0 0 0 c c c )  ( *  )
      = ( 0 0 0 0 c c c )  ( *  )  Initial y
        ( 0 0 0 0 c c c )  ( 0  )
        ( 0 0 0 0 c c c )  ( y5 )
        ( 0 0 0 0 c c c )  ( y6 )

           ( 0 0 0 b b 0 0 )  ( *  ) Matrix is uniform
           ( 0 0 0 b b 0 0 )  ( *  ) on facet1 (EBC1)
           ( 0 0 0 b b 0 0 )  ( *  )
         + ( 0 0 0 b b 0 0 )  ( y3 ) Update y
           ( 0 0 0 b b 0 0 )  ( 0  )
           ( 0 0 0 b b 0 0 )  ( *  )
           ( 0 0 0 b b 0 0 )  ( *  )

           ( a a a a a a a )  ( y0 ) Matrix is uniform
           ( a a a a a a a )  ( y1 ) on domain
           ( a a a a a a a )  ( y2 )
         + ( a a a a a a a )  ( 0  ) Update y
           ( a a a a a a a )  ( 0  )
           ( a a a a a a a )  ( 0  )
           ( a a a a a a a )  ( 0  )

           ( 0  )
           ( 0  ) Update y replace at the end (DBC1)
           ( 0  )
         + ( 0  )
           ( y4 )
           ( 0  )
           ( 0  )
on_diag = True

This class gives the Python context for a PETSc Python matrix.

Parameters:
  • a – The bilinear form defining the matrix

  • row_bcs – An iterable of the :class.`.DirichletBC`s that are imposed on the test space. We distinguish between row and column boundary conditions in the case of submatrices off of the diagonal.

  • col_bcs – An iterable of the :class.`.DirichletBC`s that are imposed on the trial space.

  • fcparams – A dictionary of parameters to pass on to the form compiler.

  • appctx – Any extra user-supplied context, available to preconditioners and the like.

view(mat, viewer=None)[source]

Module contents