Soon Hoe,

Thank you for the info. When I tried "VectorTools::interpolate" instead of
"VectorTools::project", the interpolation of the initial condition is
indeed much better. But somehow I found that the resulting solutions do not
match that of the analytical one... By the way, my test problem is the heat
equation $u_{t} = \kappa (u_{xx} + u_{yy})$ on the domain $[0,30]^{2}$,
where the initial solution at $t=0$ is 1000 in $[20,21]x[20,20.05]$, and
30*y elsewhere. The boundary condition is $u_y = 30$, $u_{x} = 0$.

If I used the "project" function and refine the initial mesh sufficiently
to reduce any numerical spikes, the solution matches the analytical one (up
to first 10,000 terms) to within 1 percent of error. But if I used the
"interpolate" function, there is possibly overshoots of the solution at
t>0, depending on the initial refinement. Also, the solution won't match
that of the analytical one since the analytical solution (an infinite
series) itself does not satisfy the initial condition for some parts in the
domain...

I don't know what exactly you mean by "first 10,000 terms" but in general I would suggest you start verifying the correctness of your code using a simple solution for which you know the analytic solution, e.g. using as initial conditions something like
   sin(pi x/30) * sin(pi y/30)
Then compare the numerical solution you get for both VectorTools::project and VectorTools::interpolate with the analytically known solution. You may also want to use a particular norm to verify correctness (e.g., the L2 norm) since the statement "to within 1 percent of error" is not entirely clear in itself.

In general, I don't think that this is where your problem lies. Both of these functions should generate an approximation of your initial conditions that is "reasonable". If your exact initial conditions are discontinuous, then project() is going to produce an approximation that has oscillations whereas interpolate() will be smooth. But if you run the heat equation on either for a few time steps, and if the solver is correctly implemented, then you should get comparable results.

Best
 W.


--
------------------------------------------------------------------------
Wolfgang Bangerth               email:            [email protected]
                                www: http://www.math.tamu.edu/~bangerth/



_______________________________________________
dealii mailing list http://poisson.dealii.org/mailman/listinfo/dealii

Reply via email to