Daniel,

Hi all -- I'm writing a library that involves solving a nonlinear elliptic
PDE, which I'll write as f(u) = 0. There is an exact solution for this PDE for
a certain simplified geometry. To test everything, I check that my numerical
solution is tolerably close to the analytic solution, with both bilinear and
biquadratic elements, and on a mesh that has been adaptively refined in part
of the domain. This all works fine.

The PDE can be derived from an action principle, i.e. there's a convex
functional P such that f = dP. I've decided to reimplement some of my code to
explicitly use the action principle, so I wrote a routine to calculate P. The
action is analytically computable for the exact solution I'm already using to
test the code, so this is already one unit test. However, I decided to take it
a step further, and check that the nonlinear differential operator f is the
derivative of P, and that its linearization df is the Hessian operator of P.
To check that, I take some vector field u, another vector field v, and check 
that

  P(u + h * v) = P(u) + h*f(u) . v + h^2 * (df(u)v) . v / 2 + O(h^3)

> [...]

I agree it makes not very much sense, but that often points to a misunderstanding rather than a bug. So let me poke:

* In the formula above, P(.) is a functional, I assume, i.e., it takes a function and returns a number, right?
* If so, what exactly does
    f(u) . v
actually mean? How do you compute this?
* Same for the second derivatives?


This test passes in the simple geometry with both bilinear and biquadratic
elements, but *not* for an adaptively refined mesh. The errors in both the
local linear approximation to the action functional and the local quadratic
approximation do not go to 0 as the increment h is reduced.

I assume you mean by "error" the size of the second and third term?


In addition, the
value of the action is roughly the same for each h for both the adaptively
refined and uniform meshes.

I don't think I understand this statement.


The only other clue I have is that the error of
the numerical solution against the analytic solution is actually somewhat
worse on the adaptively-refined mesh than for the uniform mesh, but before I
assumed this just had something to do with the linear solver.

How do you measure "worse"? As the error as a function of the number of 
unknowns?

Best
 W.

PS: I do like this approach to testing. It shows great maturity in designing code and testing numerical methods to think this way. Well done!


--
------------------------------------------------------------------------
Wolfgang Bangerth          email:                 bange...@colostate.edu
                           www: http://www.math.colostate.edu/~bangerth/

--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- You received this message because you are subscribed to the Google Groups "deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to