Assemble the residual F into the vector b. Args: x: The vector containing the latest solution b: Vector to assemble the residual into
(self, x: PETSc.Vec, b: PETSc.Vec)
| 1509 | x.ghostUpdate(addv=PETSc.InsertMode.INSERT, mode=PETSc.ScatterMode.FORWARD) # type: ignore[attr-defined] |
| 1510 | |
| 1511 | def F(self, x: PETSc.Vec, b: PETSc.Vec) -> None: # type: ignore[name-defined] |
| 1512 | """Assemble the residual F into the vector b. |
| 1513 | |
| 1514 | Args: |
| 1515 | x: The vector containing the latest solution |
| 1516 | b: Vector to assemble the residual into |
| 1517 | """ |
| 1518 | # Reset the residual vector |
| 1519 | dolfinx.la.petsc._zero_vector(b) |
| 1520 | assemble_vector(b, self._L) |
| 1521 | |
| 1522 | # Apply boundary condition |
| 1523 | if self.bcs is not None: |
| 1524 | apply_lifting(b, [self._a], bcs=[self.bcs], x0=[x], alpha=-1.0) |
| 1525 | b.ghostUpdate(addv=PETSc.InsertMode.ADD, mode=PETSc.ScatterMode.REVERSE) # type: ignore[attr-defined] |
| 1526 | set_bc(b, self.bcs, x, -1.0) |
| 1527 | else: |
| 1528 | b.ghostUpdate(addv=PETSc.InsertMode.ADD, mode=PETSc.ScatterMode.REVERSE) # type: ignore[attr-defined] |
| 1529 | |
| 1530 | def J(self, x: PETSc.Vec, A: PETSc.Mat) -> None: # type: ignore[name-defined] |
| 1531 | """Assemble the Jacobian matrix. |
nothing calls this directly
no test coverage detected