> When I use VectorTools::project(...) the (positive) initial value function
> onto my solution vector, I obtain some negative values.
You need to expect this if the function you are projecting is sufficiently
non-smooth (on length scales of the mesh size). The projection onto a
(continuous) finite element space is really not very different to a truncated
Fourier series: you get Gibbs phenomenon with over and undershoots. There is
nothing you can do if you insist on (linear) projections.
> Then, I used VectorTools::interpolate(...), which did give me non-negative
> projection of the initial condition.
> But the scheme still produces negative values for solution.
Most methods actually do. It is very difficult to construct non-negative (or
monotonous) numerical schemes for the advection equation. That said, even
schemes that are not monotonous typically converge -- i.e., they converge to
the correct solution, but the finite dimensional approximations just don't
satisfy one of the physical constraints you have (that the solution is
non-negative).
Best
W.
--
------------------------------------------------------------------------
Wolfgang Bangerth email:
bang...@math.tamu.edu
www:
http://www.math.tamu.edu/~bangerth/