John,
another long unanswered email :-(
> I would like to calculate some error indicators for a problem similar to
> step-21. If I wanted the divergence of the first components of
> BlockVector solution I could do something like (in pseudo code):
>
> std::vector<double> div_u (n_quadrature_points);
> const FEValuesExtractors::Vector velocities (0);
> loop over cells
> fe_values.reinit (cell);
> fe_values[velocities].get_function_divergences (solution, div_u);
> end loop
>
> which gives the divergences at the quadrature points on cell, which is
> good.
>
> However, what I would like is the divergence of D(u)\nabla c, where D(u)
> is a Tensor<2,dim> valued function of the first component u of solution
> and \nabla c is the gradient of the last component of solution, so
> D(u)\nabla c is of type Tensor<1,dim>.
The way to do this sort of thing is to multiply out the derivatives, i.e. to
compute it as
D^2(u) D(c) + D(u)D^2(c)
where you'll have to figure out which indices to contract over. You can
compute the second derivatives of a quantity using a call like
fe_values[velocities].get_function_hessians (solution, div_u);
This way you can save yourself the round trip of computing D(u) grad c,
putting its components into a vector, and taking the divergence of that.
Best
W.
-------------------------------------------------------------------------
Wolfgang Bangerth email: [email protected]
www: http://www.math.tamu.edu/~bangerth/
_______________________________________________
dealii mailing list http://poisson.dealii.org/mailman/listinfo/dealii