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

Oliver Henrich ohenrich at epcc.ed.ac.uk
Mon Jun 15 05:20:16 CDT 2015


Dear Barry and Matthew,

Many thanks for your input, which is much appreciated.

Just to avoid confusing you with pressure: What I want to solve is an electrostatic Poisson equation for a charge distribution with variable permittivity. 

The electric field consists of two parts, an externally imposed and constant one along one coordinate direction with magnitude E_ex=dpsi / N and a part E_int due to the local charge distribution which varies and obeys the Poisson equation. Hence the charges rho(x=0) should ‘see’ a potential psi(x=-1) = psi(x=N-1) - dpsi on their left and the charges rho(x=N-1) should ‘see’ a potential psi(N) = psi(x=0) + dpsi on their right.

You suggest to modify the right hand side at b(x=0) and b(x=N-1). But what I don’t understand is how this could lead to the desired offset between psi(x=-1) and psi(x=N-1) and between psi(x=N) and psi(x=0), so between sites outside and inside the physical domain. Please correct me if I’m wrong, but wouldn’t modifying the right hand side in the way you suggest only allow me to have the offset between psi(x=0) and psi(x=N-1)?

Kind regards and thanks again for your help.
Oliver

 

On 11 Jun 2015, at 20:07, Barry Smith <bsmith at mcs.anl.gov> wrote:

> 
>> On Jun 11, 2015, at 8:15 AM, Oliver Henrich <ohenrich at epcc.ed.ac.uk> wrote:
>> 
>> 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.
>> 
> 
>   If I understand correctly this does't affect the MATRIX at all, since the dpsi is a constant. So aren't you just solving with a "regular periodic" matrix but a modified right hand side?
> 
>   Note in PETSc indexing which starts at 0 (not one) and ends with N-1 what you wrote above should be 
> 
> psi(x=-1) = psi(x=N-1) - dpsi
> psi(x=N) = psi(0) + dpsi
> 
> Now x=-1 and x=N don't exist in the matrix (only in ghosted vectors) so b(0) = b(0) + od*dpsi   and b(N-1) = b(N-1) - od*dpsi where od is the "off diagonal" entry of the Poisson matrix and b() is the "normal" right hand side
> 

--
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