From: Martin Kronbichler Date: Wed, 10 Jul 2024 12:15:03 +0000 (+0200) Subject: Fix ghost update for step-66 X-Git-Tag: v9.6.0-rc1~107^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F17241%2Fhead;p=dealii.git Fix ghost update for step-66 --- 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(); }