# Residual norm different in parallel and serial

**URL:** <https://fenicsproject.discourse.group/t/residual-norm-different-in-parallel-and-serial/19420>\
**Category:** dolfinx\
**Tags:** mpi\
**Created:** [January 28, 2026, 1:19pm UTC](https://fenicsproject.discourse.group/t/residual-norm-different-in-parallel-and-serial/19420 "2026-01-28T13:19:17Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![dokken](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/dokken/32/1560_2.png) [@dokken](https://fenicsproject.discourse.group/u/dokken)\
**Post date:** [January 29, 2026, 2:24pm UTC](https://fenicsproject.discourse.group/t/residual-norm-different-in-parallel-and-serial/19420/4 "2026-01-29T14:24:49Z")

</div>

PETScVec.scale should be done after ghost updating. I.e. I guess something along the lines of:

```python
        with L.localForm() as loc_L:
            loc_L.set(0)
        A.zeroEntries()
        assemble_matrix(A, J_form, bcs=bcs)
        A.assemble()
        assemble_vector(L, res_form)
        apply_lifting(L, [J_form], [bcs], x0=[u.x.petsc_vec], alpha=-1.0)
        L.ghostUpdate(addv=PETSc.InsertMode.ADD_VALUES, mode=PETSc.ScatterMode.REVERSE)
        set_bc(L, bcs, u.x.petsc_vec, alpha=-1.0)
        L.ghostUpdate(addv=PETSc.InsertMode.INSERT_VALUES, mode=PETSc.ScatterMode.FORWARD)
        L.scale(-1)

```

should do the trick (also for the computation of stress displacement).

---

_[View the full topic](https://fenicsproject.discourse.group/t/residual-norm-different-in-parallel-and-serial/19420)._
