[petsc-users] Accessing 'halo' matrix entries?

Oliver Henrich ohenrich at epcc.ed.ac.uk
Thu Jun 11 08:15:11 CDT 2015

Dear PETSc-Team,

I am trying to solve a Poisson equation with a mixed periodic-Dirichlet boundary condition. What I have in mind is e.g. a compressible flow with a total pressure difference imposed between the two sides of the system, but otherwise periodic, and periodic boundary conditions along the remaining two dimensions. Another example would be an electrostatic system with dielectric contrast in an external electric field / potential difference.

For clarity, if x = 0  (N+1) is the left (right) halo site at the boundary and x = 1 (N) is the leftmost (rightmost) site in the physical domain: 

psi(x = 0)  =  psi(x = N) - dpsi
psi(x = N+1) = psi(1) + dpsi

I know it is possible to solve this with a double Poisson solve, which I try to avoid for performance reasons.

It is also possible to solve this by modifying the matrix with a master-slave approach that imposes the constraint. This requires defining a transformation matrix that acts on the matrix, the solution vector and the righthand side of the problem.

The core of the problem I have is that the pressure or potential difference should not be between the leftmost and rightmost site in the physical domain (a standard Dirichlet BC), but between the left- or rightmost site in the physical domain and the corresponding halo site at the opposite side of the system. It should be possible to do this if the entries of the transformation matrix that act on the halo sites can be accessed and modified. 

Is anything like this possible in PETSc?

Best regards and many thanks,

Dr Oliver Henrich
Edinburgh Parallel Computing Centre
School of Physics and Astronomy
University of Edinburgh
King's Buildings, JCMB
Edinburgh EH9 3FD
United Kingdom

Tel: +44 (0)131 650 5818
Fax: +44 (0)131 650 6555

The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336

More information about the petsc-users mailing list