template <int dim, int fe_degree, typename number>
void MechanicsOperator<dim, fe_degree, number>::local_compute_diagonal(
const MatrixFree<dim, number> & data,
LinearAlgebra::distributed::Vector<number> &dst,
const unsigned int &,
const std::pair<unsigned int, unsigned int> &cell_range) const
{
FEEvaluation<dim, fe_degree, fe_degree + 1, dim, number> phi(data);
AlignedVector<Tensor<1,dim,VectorizedArray<number>>>
diagonal(phi.dofs_per_component);
for (unsigned int cell = cell_range.first; cell < cell_range.second; ++cell)
{
phi.reinit(cell);
for (unsigned int i = 0; i < phi.dofs_per_component; ++i)
{
for (unsigned int j = 0; j < phi.dofs_per_component; ++j)
{
phi.submit_dof_value(Tensor<1,dim,VectorizedArray<number>>(), j);
}
Tensor<1,dim,VectorizedArray<number>> diagonal_tensor;
for (unsigned int d=0; d<dim; d++)
diagonal_tensor[d] = 1.;
phi.submit_dof_value(diagonal_tensor, i);
phi.evaluate(false, true);
for (unsigned int q = 0; q < phi.n_q_points; ++q)
{
phi.submit_symmetric_gradient(Cmatx*phi.get_symmetric_gradient(q),q); // while Cmatx is the 4-rank elastic tensor
}
phi.integrate(false,true);
diagonal[i] = phi.get_dof_value(i);
}
for (unsigned int i = 0; i < phi.dofs_per_component; ++i)
phi.submit_dof_value(diagonal[i],i);
phi.distribute_local_to_global(dst);
}
}
3) is the Multigrid still work well in vector-valued problem? or in multi-physics couple problem?
I want to use it to solve the couple equations(Allen-Cahn and mechanics equalibrium equations)
because it might be the easy one to be build.
I am still searching others' answers in the mailing list but have not found the answer about this topic( 1) and 2) ) yet(maybe).
Any suggestion or any materials related to this implementation would be appreciated .
best,
m.