Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I understand how to implement a discrete 2D poisson solution with Dirchlet boundary conditions. Using http://en.wikipedia.org/wiki/Discrete_Poisson_equation#On_a_two-dimensional_rectangular_grid , you just replace any of the u_i,j that are on the source side of the boundary with the boundary values that you have. However, I don't understand how to implement the Neumann boundary condition. If you want to "match" the external derivative, wouldn't you have to just set the nodes that are on the target side of the boundary to a value that makes the derivative between the source boundary pixel and the target boundary pixel equal the derivative outside the boundary? If you do this, haven't you just simply "filled in" one node around the boundary and provided a slightly smaller version of the Dirchlet problem?

Can anyone explain this?

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

well, not exactly

for Neumann BCs, you don't fill in any values, you just supply a relation between the values of the points on the boundary and the points right next to them. think of this as having 2 different governing equations, one of them which is valid inside the boundary, and the other is valid only on the boundary.

when you discretize your system, you get a relation between the values u_ij, u_i+1j, u_i-1j, u_ij+1,u_ij-1, etc..., that depends on your governing equation, now, this relation is valid INSIDE the domain only

if for instance, you want to enforce the first derivative with respect to x to be equal to q, you write

u_0j - u_1j = q*delta_x, this is itself a governing equation but is only valid between the values i = 0 and 1

so in your system, you have to alter the equations you are solving so that you have two equations instead of one, this is very simple to implement because the BC equation is always simpler than the governing equation

in fact, the same thing holds for Dirichlet BCs, but in that case, your boundary equation is even simpler, it does not involve u at i = 1 at all, it is simply

u_0j = p

where p is the prescribed Dirichlet condition, you can choose that your implementation solves this "second kind of equation" along with the governing equation as well, but this is trivial because it will try to solve u_0j = p just to give you u_0j = p

hope that this helps :)

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.