Usage of PETSc's 'Mat' type

  1. J(v, v) computes a scalar product according to the domain decomposition of J. It is basically a weighted local scalar product, followed by a reduction. See line 43 of this parallel example vs. line 28 of this sequential example.
  2. Given one distributed matrix Mat A, you can create a new distributed matrix B following the same column and row distribution using a local matrix Loc with the syntax Mat B(A, Loc). If you have a different column and row distribution, here A for the rows, C for the columns, and Loc is a rectangular matrix, you create a distributed rectangular matrix using the syntax Mat B(A, C, Loc). See this Stokes example where there is a different column and row distribution (for velocity and pressure unknowns).

Here is some more materials if you are interested: Pierre Jolivet introduction to parallel FreeFEM part 1 - YouTube + Pierre Jolivet introduction to parallel FreeFEM part 2 - YouTube.
Don’t hesitate if you have other questions.

2 Likes