"Michael Thomas" <firstname.lastname@example.org> wrote in message <email@example.com>... > The errors you are encountering are common errors inherent to most finite > element method implementations. Refining your mesh will reduce the > spreading of the contour lines in your grad(u) plot, and improve the > accuracy of grad(u) linearly with the mesh size. The finer the mesh, the > closer you will get to 0 at x=0. The PDE toolbox uses linearly interpolated > basis functions which results in a second order accurate method. Each > grad(u) you apply to the final solution results in roughly a loss of > accuracy of one order, so when you recalculate div(grad(u)), you will see > order unity errors. The results I get are really better than I would have > expected (a little better than unity, but not much). The 2.5 you see at the > edge is from interpolating the results a couple of times to get back the > second derivative. The solution is as expected. The errors introduced by > pdegrad are also expected as they are inherent to the FEM implementation. > What you are seeing is errors introduced by post-processing the solution. > > The bad news is, you are going to need a clever way to determine > div(grad(u)), or restructure/define your problem, if you have any hope of > finding an accurate solution since it is needed for your coefficients. > > One suggestion is to use higher order interpolants, but that would mean > writing your own FEM implementation. Most methods for accurately > differentiating solutions to Poisson type problems are pretty complicated > mathematically (using Green's second identity and such), making the > implementation that much more difficult. Most of these methods also have > pretty significant problems near the boundaries. I would work on redefining > the problem to try to eliminate the need for second derivatives in your > coefficients. > > Good luck. > > Mike > > "Dana Edgell" <firstname.lastname@example.org> wrote in message > news:eea9590.-1@WebX.raydaftYaTP... > > I want to solve a nonlinear system problem using the PDE toolbox where > some of the coefficients c depend on grad(u) and grad(grad(u)). Before > attempting this I was examining the output of the PDE function pdegrad for a > very simple case and found some disturbing results. > > > > > > For > > - a simple box geometry x= 0 to 1, y=0 to pi/2 > > - boundary conditions: right side dirichlet u=0; all other sides neumann > grad(u)=0 > > - elliptic equation grad(grad(u))=5 i.e. c=1, f=5, a=0, d=0 > > > > > > pdetool seems to give the correct solution BUT when plotting grad(u) which > should be equal to 5x there is an obvious problem > > > > > > - at the x=0 and x=1 boundaries. The grad(u) at x=0 should be zero but it > is not. > > - A contour plot of grad(u) should be all evenly spaced lines but at both > the x=0 and x=1 boundaries, the contour lines are noticably farther apart. > > - grad(grad(u)) calculated via pdegrad should be 5 throughout the space, > however, at x=0 and x=1 grad(grad(u)) = 2.5 eaxactly half of the correct > value. > > > > > > The above are basically all the same problem, the function pdegrad (and > the grad(u) calculated by the pdetool plotting presumably using the same > function) give an incorrect answer at x=0 and x=1. This is particularly > disturbing as grad(u)=0 at x=0 is a boundary condition. > > However, given that grad(u) (or ux) seems to be correct in the bulk of the > solution space I assume that the problem is being solved correctly using the > correct boundary conditions. > > > > > > Does anyone have a solution to my problem? How can I use coefficients that > depend on grad(u) (and hopefully grad(grad(u)) if pdegrad gives incorrect > answers at the edges? > > > > > > Thanks > > Dana Edgell > >
I understand that this post was created a long time ago but I am facing a similar problem with pdegrad. I am solving a coupled fluid flow problem and therefore share the gradient at the boundary (which is evaluated using pdegrad) at each iteration. Though each fluid flow domain is solved with 2nd order accuracy, the coupled solution is only 1st order accurate because of pdegrad. Have you found any solution to the problem?