[petsc-users] Neumann BC in src/ksp/ksp/example/tutorial/ex29.c

Matthew Knepley knepley at gmail.com
Fri Sep 2 07:14:24 CDT 2011


On Thu, Sep 1, 2011 at 9:47 PM, Alan Wei <zhenglun.wei at gmail.com> wrote:

> Dear All,
>     I hope you're having a nice day.
>     I'm still working on this Poisson solver example, and I still have a
> little confusion on the boundary condition. I wonder if I have a 17*17 grid.
> (index i = 0~16 and j = 0~16, solving for variable 'u')
> 1) If a Dirichlet BC applied on the left boundary, i.e. u= 1, is that all
> values with u[i= 0][]  = 1 or with u[i= -1][]  = 1 (where, u[i=-1][] are
> ghost grids left next to grid of u[i= 0][]).
>

Unless you define the boundary as PERIODIC or GHOSTED, the -1 does not
exist. I set Dirichlet conditions at 0 and M-1.


> 2) If a Neumann BC applied on the right boundary, i.e. du/dx = 0, is that
> (u[i=16][]-u[i=15][])/dx= or  (u[i=17][]-u[i=16][])/dx = 0 (where u[i =17][]
> are ghost grids right next to grid of u[i = 16][]).
>    Thank you so much.
>

Same answer.

    Matt


> best,
> Alan
>
>


-- 
What most experimenters take for granted before they begin their experiments
is infinitely more interesting than any results to which their experiments
lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20110902/bea6b143/attachment-0001.htm>


More information about the petsc-users mailing list