Sean:
> VectorTools::interpolate(mapping,dof_handler_DG,Functions::ConstantFunction<dim>(1.),alpha_solution);
>
> Obviously changing the final vector for different variables.
>
> Later, when the gradient of these terms are used the gradient calculated by
> deal.ii is not 0. I do get very small values on the order of 10^(-14) and when
> I account for the inverse jacobian factor the unit_gradient returns values
> ranging between +/- .9x10^(-15) & +/- 2x10^(-15).
Right, and this can not be avoided. Your alpha_solution corresponds to a
function of the form
\sum_j c_j phi_j(x)
where the coefficients c_j in your case happen to all be ones. Then if you
compute the gradient of this function, it is computed as
\sum_j c_j [grad phi_j(x)]
which *should* be zero, but because grad phi_j(x) is not zero, you are adding
together things that are subject to round-off errors and so you have to expect
that the terms in the sum do not exactly cancel but are on the order of
round-off. That's of course exactly what you observe.
> These seem very small but due to their values being periodic they quickly grow
> and destroy stability of my simulation. Are there any known fixes for this?
This is the real problem in your program: That cannot tolerate small
perturbations. This will be true of all perturbations, not just those that
come from round-off. In other words, your algorithm is not *stable*: Small
perturbations grow without bounds. No algorithm that is not stable is useful.
You need to figure out what it is that makes your algorithm instable.
Best
W.
--
------------------------------------------------------------------------
Wolfgang Bangerth email:
bang...@colostate.edu
www:
http://www.math.colostate.edu/~bangerth/