[petsc-users] 3D Poisson Solver with a Periodic Boundary Condition in One Direction?

Barry Smith bsmith at mcs.anl.gov
Tue May 15 11:23:06 CDT 2012


  Alan,

   Sorry, we don't have exactly that example. But you can start with src/ksp/ksp/examples/tutorials/ex45.c change the 2nd, 3rd, or 4th argument to DMDA_BOUNDARY_PERIODIC then in ComputeMatrix() remove the appropriate values
from if (i==0 || j==0 || k==0 || i==mx-1 || j==my-1 || k==mz-1){   so, for example, if you make the problem periodic in x then remove the i == 0 and i == mx-1 cases

   Barry



On May 14, 2012, at 10:43 AM, Zhenglun (Alan) Wei wrote:

> Dear All,
>    I hope you're having a nice day.
>    I wonder if there is any example in PETSc to solve 3D Poisson equation with the periodic boundary condition in one direction. 2D is fine if there is no 3D example.
> 
> thanks,
> Alan



More information about the petsc-users mailing list