ex19 comes to mind, though it&#39;s a bit overkill for what you&#39;re doing...<br><br><a href="http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/src/snes/examples/tutorials/ex19.c.html">http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/src/snes/examples/tutorials/ex19.c.html</a><br>
<br>ex19 uses DAs and DMMG, which is kind of like a meta-DA for using multigrid-style solvers.  Both work well with structured grids.<br><br>You may also want to review the PETSc manual section on DA.<br><br>A<br><br><div class="gmail_quote">
On Tue, Aug 18, 2009 at 3:30 AM, nicolas aunai <span dir="ltr">&lt;<a href="mailto:nicolas.aunai@gmail.com">nicolas.aunai@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Dear all,<br>
<br>
<br>
I have a simulation code (particle in cell) in which I have to solve a<br>
linear vector equation 4 times per time step. A typical run consists<br>
of 50 000 time steps. The grid is rectangular and uniform of size Lx,<br>
Ly, with nx+1 and ny+1 points in the x and y direction respectively.,<br>
(nx, ny) could be at max (1024,1024).<br>
<br>
The vector equation is the following :<br>
<br>
B(x,y) - a*Laplacian(B(x,y)) = S(x,y)<br>
<br>
<br>
Where B and S are 2D vector fields with 3 components (Bx, By, Bz and<br>
Sx, Sy, Sz), each depending on the x and y coordinates.<br>
<br>
<br>
&#39;a&#39; is a positive constant, smaller than one, typically a= 0.02<br>
<br>
Boundary conditions may depend on for which B component we are solving<br>
the equation. On the x=cst borders, the boundary is always periodic,<br>
no matter what component is solved, but on y=cst borders, the boundary<br>
condition can be either Neumann or Dirichlet.<br>
<br>
So far, I have written a small code that creates a vector solution, a<br>
vector RHS and the matrix operator, and solve a scalar equation of<br>
this type. Solving my vector equation would then just call 3 times<br>
this kind of code... but I believe there is another way to deal with<br>
vector fields and linear systems with Petsc, using DAs no ? Could<br>
someone explain me how solve this the proper way and/or show me some<br>
code solving linear system with vector fields ? (is there an example<br>
in the exercices that I would not have seen ?)<br>
<br>
<br>
<br>
Thanks a lot<br>
Nico<br>
</blockquote></div><br><br clear="all"><br>-- <br>Aron Jamil Ahmadia<br>Assistant Research Scientist<br>King Abdullah University of Science and Technology<br>