[petsc-users] how to translate a FEM problem to PETSc

Matthew Knepley knepley at gmail.com
Tue Jun 25 10:59:18 CDT 2013


On Tue, Jun 25, 2013 at 4:56 PM, Ted Sariyski <tsariysk at craft-tech.com>wrote:

> Hi,
>
> I wrote an unstructured vector finite element electromagnetic solver,
> which among other modules, includes domain decomposition and (complex)
> GMRES solver. Now I am working on improvements and I would like to migrate
> the code to PETSc. I am new with PETSc. I am still working through the
> examples, trying to figure out a 'proper' entry point for integration. My
> current understanding is that domain decomposition and the assembly will
> remain outside PETSs. I already have the global-to-local/local-to-**global
> data structures built. My difficulty is to figure out how to translate them
> to PETSc compliant format. I'll highly appreciate if somebody points me to
> examples illustrating how to translate a FEM problem to PETSc.
>

Let me outline some options, and give you my recommendations:

  a) Use PETSc linear algebra

This means using PETSc vectors, which is very easy, and using PETSc
matrices, which is just a little harder. There is a description of this in
previous tutorials in the "PETSc Integration" section. Once you use PETSc
linear algebra, you have access to all Krylov solvers, and some
preconditioners like ILU or Chebychev. This is a fine way to proceed, but
does not integrate well with any multilevel solvers except AMG.

  b) Create your own DMShell

The DM class is used to organize assembly and hierarchy. Our solvers take a
DM (KSPSetDM, SNESSetDM, TSSetDM), and can use it to form the residual
vector and Jacobian matrix. You can provide your own local-to-global
mappings to the DM, so that more of the assembly organization is absorbed
into the PETSc. This may simpligy your code, and also allow multilevel
features in the future. Also, if you decide later to manage the grid using
PETSc, this is the form it would take.

   Thanks,

       Matt


> Thanks in advance,
> --Ted Sariyski
> Combustion Research and Flow Technology, Inc.
>



-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20130625/bd518a5c/attachment-0001.html>


More information about the petsc-users mailing list