From f68f8ecc7a0bc27ba1abffb0f6501bbc7c4ebec4 Mon Sep 17 00:00:00 2001 From: Martin Kronbichler Date: Wed, 10 Jul 2024 14:15:03 +0200 Subject: [PATCH] Fix ghost update for step-66 --- examples/step-66/step-66.cc | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/examples/step-66/step-66.cc b/examples/step-66/step-66.cc index fc250ae1d3..f0840377bf 100644 --- a/examples/step-66/step-66.cc +++ b/examples/step-66/step-66.cc @@ -192,6 +192,16 @@ namespace Step66 // std::exp(newton_step[q]) and store these values in the table. // This skips all evaluations of the nonlinearity in each call of the // vmult() function. + // + // Note that we need to manually call the functions to exchange the ghost + // data here, by calling + // LinearAlgebra::distributed::Vector::update_ghost_values(), to ensure all + // data from neighboring processes is available for evaluating the + // finite-element interpolation on cells. In the other functions of this + // tutorial program, MatrixFree::cell_loop() made sure to call this + // function. Note that we clear the ghost state again at the end of the + // function, in order to avoid mixing ghosted and non-ghosted vectors in + // other parts of the solver. template void JacobianOperator::evaluate_newton_step( const LinearAlgebra::distributed::Vector &newton_step) @@ -199,6 +209,8 @@ namespace Step66 const unsigned int n_cells = this->data->n_cell_batches(); FECellIntegrator phi(*this->data); + newton_step.update_ghost_values(); + nonlinear_values.reinit(n_cells, phi.n_q_points); for (unsigned int cell = 0; cell < n_cells; ++cell) @@ -212,6 +224,7 @@ namespace Step66 nonlinear_values(cell, q) = std::exp(phi.get_value(q)); } } + newton_step.zero_out_ghost_values(); } -- 2.39.5