[petsc-users] How to get a matrix and vector for a coupled system of equations?

Rolf Kuiper kuiper at mpia.de
Thu Nov 24 14:24:02 CST 2016


Dear PETSc users,

maybe this is an easy question, but I can’t find the information right away in the user’s guide nor online.

What I am currently doing and which works fine:
To solve a partial differential equation for the quantity q on a parallel distributed grid, which is represented by the Distributed Array MyDA, I am currently creating the associated sparse matrix for the KSP solver via
DAGetMatrix(MyDA, MATMPIAIJ, &MyMatrix);

The solution vector and right hand side vector are created via
DACreateGlobalVector(MyDA, &MyRightHandSideVector);
VecDuplicate(MyRightHandSideVector, &GlobalSolutionVector);

The DA is constructed using DACreate3d() with the corresponding regular structured grid information. 

And here is my problem:
Now, I would like to solve a coupled system of equations for the quantities q1 and q2 on the same grid. I.e., the matrix should just get the double number of rows and columns, the vectors contain twice the number of entries (e.g. first all q1s and then all q2s). And I would like to be sure that the entries of q1 and q2, which are associated with the same grid cell are located on the same processor.
Is there already a pre-defined structures available (such as MATMPIAIJ) within PETSc to enlarge such a single equation to store the entries of coupled equations? Such as
DACreateTwiceTheGlobalVector()?

The equation is (simplified) of the form
d/dt q1 + grad q2 = 0
d/dt q2 + f(q1) = 0
with an arbitrary function f depending on q1.

Thanks a lot for your help in advance,
Rolf
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20161124/9fdbc3d4/attachment.html>


More information about the petsc-users mailing list