- edited description
PETScVector ghost values not up-to-date when needed
Plot from MWE #258 shows that ghost values are not correct. To obtain expected behaviour one can put as_backend_type(u.vector()).update_ghost_values()
or u.vector().apply('insert')
to the code.
This is basically a follow-up of #263 which was not resolved robustly. It was originally agreed to "update lately when needed; introduce dirty flag". Garth finally implemented updating early after solve or some PETScVector operations (apply, *=, +=, axpy, ...) without dirty flag.
In a case that we do not regard this as a bug, then as_backend_type(u.vector()).update_ghost_values()
line must be added to demo_petsc4py.py
and moreover user/developer will be everytime responsible to do update whenever needed.
The advantage of late update (when dirty) is that probably only assembler, (maybe also DirichletBC), plotting and IO will do the updates in the library so the vector will be most of the time in arbitrary but known state. Potentially this leaves less space for bugs.
Comments (8)
-
reporter -
@blechta - can you provide a fix for this soon, or change milestone to 1.6
-
reporter - changed milestone to 1.6
-
assigned issue to
I don't think there's an easy fix. This requires that we revisit the discussion how to handle up-to-dateness of ghost values and agree on some consensus. Also new aspects of the problem may appear with the introduction of TPetra backend.
I will kick off discussion on mailing list after release.
-
reporter - changed milestone to 1.7
-
- removed milestone
Removing milestone: 1.7 (automated comment)
-
reporter Seems that a dirty flag is easily available using
PetscObjectStateGet
. -
We can use a PETSc flag. We really shouldn't write our own flag since the vector can be modified by PETSc.
It's still not perfect because a vector change might not touch ghost values.
-
reporter - removed responsible
- Log in to comment