Hi all,
I am trying to write a code that doesn't require a linear solver by using the mass lumping technique. My current implementation looks like this:
active_set.clear();
active_set.set_size(dof_handler.n_dofs());
std::vector<types::global_dof_index> local_dof_indices(fe.dofs_per_cell);
typename DoFHandler<dim>::active_cell_iterator cell =
dof_handler.begin_active(), endc = dof_handler.end();
for (; cell != endc; ++cell)
{
if (! cell->is_locally_owned())
continue;
cell->get_dof_indices(local_dof_indices);
for (unsigned int i=0; i<fe.dofs_per_cell; ++i)
{
const types::global_dof_index idx = local_dof_indices[i];
if (active_set.is_element(idx)|| constraints_hanging_nodes.is_constrained(idx))
continue;
newton_update(idx) = rhs_relevant(idx)/diag_total_relevant(idx);
active_set.add_index(idx);
}
}
newton_update.compress(VectorOperation::insert);
constraints_update.distribute(newton_update);
It works well. However, the only issue is that looping over cell in typename DoFHandler::active_cell_iterator degrades the performance greatly, which is slower than solving the linear system by an iterative solver like GMRES. I wish I can write a parallel code like this:
for(int idx=0; idx< newton_update.size(); idx++)
if(diag_total_relevant(idx)>1e-20)
newton_update(idx) = rhs_relevant(idx)/diag_total_relevant(idx);
However, it only works for single core. I really appreciate if anyone has any idea to paralellize the solve part with the mass lumping technique.