[petsc-users] How to get a matrix and vector for a coupled system of equations?
Dave May
dave.mayhem23 at gmail.com
Thu Nov 24 15:30:32 CST 2016
When you create the DMDA, set the number of DOFs (degrees of freedom) per
point to be 2 instead of 1.
You must be using and ancient version of petsc given the function names you
quoted. Consider upgrading to 3.7
Thanks,
Dave
On Thu, 24 Nov 2016 at 20:24, Rolf Kuiper <kuiper at mpia.de> wrote:
> 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/b39576f2/attachment.html>
More information about the petsc-users
mailing list