How to obtain parallel solution with the mass-lumping matrix

14 views
Skip to first unread message

Giang Huynh

unread,
Sep 21, 2025, 4:35:22 PM (2 days ago) Sep 21
to deal.II User Group

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.

Bruno Turcksin

unread,
Sep 22, 2025, 12:54:54 PM (16 hours ago) Sep 22
to deal.II User Group
Hello,

Which type of vector are you using? If you use `dealii::LinearAlgebra::Distributed::vector`, local_element() does what you want.

Best,

Bruno
Reply all
Reply to author
Forward
0 new messages