## Re: [Libmesh-users] Neumann condition implementation

 Re: [Libmesh-users] Neumann condition implementation From: Roy Stogner - 2008-06-01 14:48:49 ```On Sun, 1 Jun 2008, Maxime Debon wrote: > Trying to implement a Neumann condition at the upper boundary of a 1D > transient problem, I am facing an interesting case. In fact, changing > the size of the domain, modifying the value Xmax of the upper > boundary, alters the result. > > //-------------------------------------------------------// > for (unsigned int i=0; i { > Number valueNeumann= 1.0; > Fe(i) += JxW_face[qp]*valueNeumann*phi_face[i][qp]; > } > //-------------------------------------------------------// > > To illustrate, the value of the first derivative at the boundary is > effectively 1.0 only when the value of Xmax is 133.3333. Elsewhere, > the derivative is too small when Xmax > 133.33 and to big when Xmax < > 133.33. > Using a second order Lagrange element, I may forget a correction term > to evaluate the surface integral. No correction term should be needed; libMesh should get phi_face right regardless of what element type you use. But my first question would be: are you sure the solution is sufficiently converged? Remember, Neumann conditions are only enforced weakly, so if you try to impose a boundary derivative of 1.0 this way, all you'll get is a formulation whose boundary derivative converges to 1.0 as your mesh size goes to zero. On coarser meshes, the finite element formulation can satisfy the boundary condition less accurately as part of an attempt to simultaneously satisfy the interior PDE more accurately. It's possible that your magic number of Xmax = 400/3 is just a fluke that gives you superconvergence at the boundary for your PDE and mesh. If I haven't correctly guessed what the problem is, could you boil it down to a short test case for us? --- Roy ```