MCPcopy Create free account
hub / github.com/FEniCS/dolfinx / F

Method F

python/test/unit/nls/test_newton.py:38–49  ·  view source on GitHub ↗

Assemble residual vector.

(self, x, b)

Source from the content-addressed store, hash-verified

36 x.ghostUpdate(addv=PETSc.InsertMode.INSERT, mode=PETSc.ScatterMode.FORWARD)
37
38 def F(self, x, b):
39 """Assemble residual vector."""
40 from petsc4py import PETSc
41
42 from dolfinx.fem.petsc import apply_lifting, assemble_vector, set_bc
43
44 with b.localForm() as b_local:
45 b_local.set(0.0)
46 assemble_vector(b, self.L)
47 apply_lifting(b, [self.a], bcs=[[self.bc]], x0=[x], alpha=-1.0)
48 b.ghostUpdate(addv=PETSc.InsertMode.ADD, mode=PETSc.ScatterMode.REVERSE)
49 set_bc(b, [self.bc], x, -1.0)
50
51 def J(self, x, A):
52 """Assemble Jacobian matrix."""

Callers

nothing calls this directly

Calls 4

assemble_vectorFunction · 0.90
apply_liftingFunction · 0.90
set_bcFunction · 0.90
setMethod · 0.45

Tested by

no test coverage detected