Dear All
i wrote a code to compute the gradient of a functional which is :
gradient = E:grad(u).grad(u) in which E is elasticity tensor and u is the
answer of elastic equation . supposing isotropic material i wrote code as :
FEValuesExtractors::Vector displacement(0);
std::vector<Tensor<2,dim> > solution_grads (n_q_points);
std::vector<SymmetricTensor<2,dim> > strain (n_q_points);
std::vector<SymmetricTensor<2,dim> > stress (n_q_points);
...
for (cell ...) {
...
fe_values.reinit (cell);
fe_values[displacement].get_function_gradients (solution_d,
solution_grads);
for (q_piont ...) {
strain[q] = symmetrize(solution_grads[q]);
stress[q] = (2*d_mu*strain[q] + d_landa*trace(strain[q])*
unit_symmetric_tensor<dim>());
grad += stress[q]*strain[q] ;
}
gradient(icell) = -0.5*grad ;
}
but in contrast of theory that says the gradient
of each cell is a scalar , here in every cell gradient is a
vector (i.e. has 2 component .one in u direction and one in v as you know ) .
i know that the last thing that can be done directly in dealii is double
contraction of two tensor as i do here but i just want to know how to get a
scalar as gradient i.e. how do total inner product .
thanks in advance,
S.M.Mohseni
_______________________________________________
dealii mailing list http://poisson.dealii.org/mailman/listinfo/dealii