linear elliptic vector equation

Tue Aug 18 08:26:34 CDT 2009

```ex19 comes to mind, though it's a bit overkill for what you're doing...

http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/src/snes/examples/tutorials/ex19.c.html

ex19 uses DAs and DMMG, which is kind of like a meta-DA for using
multigrid-style solvers.  Both work well with structured grids.

You may also want to review the PETSc manual section on DA.

A

On Tue, Aug 18, 2009 at 3:30 AM, nicolas aunai <nicolas.aunai at gmail.com>wrote:

> Dear all,
>
>
> I have a simulation code (particle in cell) in which I have to solve a
> linear vector equation 4 times per time step. A typical run consists
> of 50 000 time steps. The grid is rectangular and uniform of size Lx,
> Ly, with nx+1 and ny+1 points in the x and y direction respectively.,
> (nx, ny) could be at max (1024,1024).
>
> The vector equation is the following :
>
> B(x,y) - a*Laplacian(B(x,y)) = S(x,y)
>
>
> Where B and S are 2D vector fields with 3 components (Bx, By, Bz and
> Sx, Sy, Sz), each depending on the x and y coordinates.
>
>
> 'a' is a positive constant, smaller than one, typically a= 0.02
>
> Boundary conditions may depend on for which B component we are solving
> the equation. On the x=cst borders, the boundary is always periodic,
> no matter what component is solved, but on y=cst borders, the boundary
> condition can be either Neumann or Dirichlet.
>
> So far, I have written a small code that creates a vector solution, a
> vector RHS and the matrix operator, and solve a scalar equation of
> this type. Solving my vector equation would then just call 3 times
> this kind of code... but I believe there is another way to deal with
> vector fields and linear systems with Petsc, using DAs no ? Could
> someone explain me how solve this the proper way and/or show me some
> code solving linear system with vector fields ? (is there an example
> in the exercices that I would not have seen ?)
>
>
>
> Thanks a lot
> Nico
>

--