[petsc-users] Example for solving system of pde with snes

Jed Brown jed at jedbrown.org
Sun Sep 10 07:43:22 CDT 2017


Praveen C <cpraveen at gmail.com> writes:

> Dear all
>
> I am solving 3 coupled first order PDE in 2-D with SNES. The stencil is
> (3+1+3) in both directions due to weno scheme. I want to use matrix-free
> gmres. For preconditioner, I will use first order scheme with stencil
> (1+1+1) in both directions. I am using DMDA.
>
> Two things that I am looking for are:
>
> How to setup the matrix ?
>
> Since I have 3 variables at each grid point, how to fill the jacobian
> matrix.

I would recommend using a MatSetValuesBlocked interface.  For a finite
difference method, you'd typically set one block row at a time.  So
you'll create a 3x15 array and call MatSetValuesBlockedStencil
indicating the stencils for the one block row and five block columns.

> Is there an existing example that comes close to this situation. My search
> was not fruitful.

There are finite element examples, like SNES ex48.c, but I'm not sure if
there is a SNES FD example.

> Thank you
> praveen
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20170910/1ef8a906/attachment.sig>


More information about the petsc-users mailing list