[Math] How to apply Neuman boundary condition to Finite-Element-Method problems

na.numerical-analysis

I have a 2D rectangular domain. The governing equation on this domain is Laplace equation:

$\nabla^2 f = 0$

In the left edge there is Neumann boundary conditon :
$\frac{\partial f}{\partial n} = -a$

n is the normal vector to the domain's boundary(here on the left edge it's equal to the negative direction of x axis) and 'a' is a given date and it's a constant.

There is a Dirichlet boundary condition at the bottom edge and there is no boundary condition on right and top edge.

My problem is how to apply that Neumann boundary condition. I'm using finite element method (with first order triangulation)

As you may know, in finite element method first we make stiffness matrix (or global coefficient matrix from local coefficient matrix). Then we apply our governing equation(here the Laplace equation).

Best Answer

You need to modify right-hand vector b of an equation Kx = b, where K is your stiffness matrix.

Here's how to do it, depending on which edge is on von Neumann boundary:

  • edge 1-2 (i.e. connecting local nodes 1 and 2),

    l = sqrt(x21*x21 + y21*y21);
    b[node1] += a * l / 2.0f;
    b[node2] += a * l / 2.0f;
    b[node3] += 0;
    
  • edge 1-3,

    l = sqrt(x13*x13 + y13*y13);
    b[node1] += a * l / 2.0f;
    b[node2] += 0;
    b[node3] += a * l / 2.0f;
    
  • edge 2-3,

    l = sqrt(x32*x32 + y32*y32);
    b[node1] += 0;
    b[node2] += a * l / 2.0f;
    b[node3] += a * l / 2.0f;