## Re: [Libmesh-users] Non-homogeneous Neumann Boundary Condition

 Re: [Libmesh-users] Non-homogeneous Neumann Boundary Condition From: John Peterson - 2009-09-02 03:30:54 ```On Tue, Sep 1, 2009 at 6:59 PM, Ted Kord wrote: > Thanks guys but the alterations in code that you gave are not working > either. > > This is the actual equation I'm trying to solve: > > d/dx (x * du/dx) = 2/x^2                   on  the domain   1 <  x < 2 > > subject to these boundary conditions: > > u(1) = 2 > (-x * du/dx) = 0.5   @ x = 2 > The boundary terms are x u'(2) v(2) - x u'(1) v(1) where v is a test function. At the x=1 end we enforce the Dirichlet condition via the penalty method. At the x=2 end, We replace x u'(2) by -0.5. There is no integral in the usual sense since this is 1D, so all you really need to do is subtract 0.5 from the equation corresponding to the rightmost endpoint to implement that BC. You can also do the same thing by creating a zero-dimensional quadrature rule and using it to "integrate" that boundary term, as the folks above have suggested. -- John ```