I am new to FreeFEM and I am figuring out how to use FreeFEM with the PETSc interface. Now I am learning about the Mat type of the PETSc package, but I do not fully understand all the functions that come with it. I am following the tutorial with examples by Pierre Jolivet (this one) and in the tutorial there are two specific opertations of which I am not sure what it does. The first one is real[int] v; Mat J; J(v, v);
What does the J(v, v) operation do? (and is there any place where I could read about this?) I saw in the tutorial something about the weighted dot product, but what would determine the weight?
The second one is a way of creating a new mat as: Mat A, C; matrix Loc; Mat B(A, C, Loc);
Again, what does this do? And how can I find out what this does? Is there any documentation on this or a way of searching for it in the source code?
Thanks in advance for any help. If anyone has any other good tutorials that can help me in understanding the FreeFEM-PETSc interface please let me know.
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.
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).