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
