-
Notifications
You must be signed in to change notification settings - Fork 177
Open
Labels
Description
Describe the bug
Consider a nonlinear problem solved with a fieldsplit PC where blocks might contain more than one component. It appears that the Jacobian is not correctly updated.
Steps to Reproduce
from firedrake import *
mesh = UnitIntervalMesh(1)
V = FunctionSpace(mesh, "DG", 0)
Z = V * V * V
u = Function(Z)
u1, u2, u3 = split(u)
v1, v2, v3 = TestFunctions(Z)
F = inner(u1, v1) * dx
F += inner(0.5*u2**2 + u2, v2) * dx
F += inner(u3, v3) * dx
u2.assign(Constant(1))
sp = {
"mat_type": "nest",
"snes_max_it": 10,
"ksp_type": "fgmres",
"pc_type": "fieldsplit",
"pc_fieldsplit_type": "additive",
"pc_fieldsplit_0_fields": "0",
"pc_fieldsplit_1_fields": "1,2",
"fieldsplit_1_ksp_view_eigenvalues": None,
"fieldsplit": {
"ksp_type": "gmres",
"pc_type": "lu"},
}
solve(F == 0, u, solver_parameters=sp)
prints
0 SNES Function norm 1.500000000000e+00
Iteratively computed eigenvalues
1. + 0.i
1 SNES Function norm 2.812500000000e-01
Iteratively computed eigenvalues
0.625 + 0.i
2 SNES Function norm 2.531250000000e-02
Iteratively computed eigenvalues
0.5125 + 0.i
3 SNES Function norm 3.049245240928e-04
Iteratively computed eigenvalues
0.500152 + 0.i
4 SNES Function norm 4.646114840946e-08
Iteratively computed eigenvalues
0.5 + 0.i
5 SNES Function norm 1.079319060632e-15
Expected behavior
If the Jacobian is correctly updated, the eigenvalue should always equal to 1.
Error message
No error message
Additional Info
The (1, 1)-block of Jacobian for this problem is the 1x1 matrix u2 + 1. The eigenvalues of P^{-1} A indicate that P[1, 1] = 1 + 1 at every Newton step but A[1, 1] = u2 + 1 is correctly updated.