Changing Matrix components PETSc Parallel

I don’t understand your code.

  1. Why are you calling metisdual()?
  2. Why are you assembling a square Mat (B) with a rectangular matrix (vB)?

Does it mean creating a Mat B having the same number of rows as A?

No, it means creating a restricted Mat, i.e., a distributed fespace with fewer degrees of freedom.
So if you want to mix P2 and P1, you’ll need to make sure you are using the appropriate initial Mat.

How can I transfer the matrix vB to Mat B?

You should not do this, vB is rectangular, B is square, that does not make sense.

I’m attaching a working testCode.edp (815 Bytes).

2 Likes