# Parallel custom Newton solver

**URL:** <https://fenicsproject.discourse.group/t/parallel-custom-newton-solver/19545>\
**Category:** General\
**Created:** [February 25, 2026, 9:16am UTC](https://fenicsproject.discourse.group/t/parallel-custom-newton-solver/19545 "2026-02-25T09:16:58Z")\
**Posts on this page:** 1\
**Showing post:** 2

<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:** [February 25, 2026, 9:26am UTC](https://fenicsproject.discourse.group/t/parallel-custom-newton-solver/19545/2 "2026-02-25T09:26:09Z")

</div>

> [@federicobetti](#):
>
> ```auto
> apply_lifting(b, [J_form], [bcs], x0=[dvp_["n"].vector], scale=1.0)
> set_bc(b, bcs, dvp_["n"].vector, 1.0)
> b.ghostUpdate(addv=PETSc.InsertMode.INSERT_VALUES, mode=PETSc.ScatterMode.FORWARD
> )
> 
> ```

Ghost updates is not done correctly, as for instance covered in:

> [@Residual norm different in parallel and serial](https://fenicsproject.discourse.group/t/residual-norm-different-in-parallel-and-serial/19420/4):
>
> PETScVec.scale should be done after ghost updating. I.e. I guess something along the lines of: 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) …

I’ll update the tutorial:

> **[bc - Custom Newton solvers — FEniCSx tutorial](https://jsdokken.com/dolfinx-tutorial/chapter4/newton-solver.html#newtons-method-with-dirichletbc)**
>
> Author: Jørgen S. Dokken

to reflect this.

---

_[View the full topic](https://fenicsproject.discourse.group/t/parallel-custom-newton-solver/19545)._
