-
Notifications
You must be signed in to change notification settings - Fork 172
Open
Labels
Description
Describe the bug
The ksp_initial_guess_nonzero
parameter is ignored by LinearSolver
.
Steps to Reproduce
from firedrake import *
mesh = UnitIntervalMesh(10)
space = FunctionSpace(mesh, "CG", 1)
test, trial = TestFunction(space), TrialFunction(space)
solver = LinearSolver(assemble(inner(trial, test) * dx),
solver_parameters={"ksp_type": "preonly",
"pc_type": "jacobi",
"ksp_max_it": 1,
"ksp_initial_guess_nonzero": False})
b = assemble(inner(Constant(1), test) * dx)
u = Function(space, name="u")
u.assign(0)
solver.solve(u, b)
print(u.dat.data_ro)
u.assign(1)
solver.solve(u, b)
print(u.dat.data_ro)
displays
[1.5 1.5 1.5 1.5 1.5 1.5 1.5 1.5 1.5 1.5 1.5]
[1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1.]
Expected behavior
The non-zero initial value should be ignored in the second case, the linear solver should use a zero initial guess, and the results of the two solves should be the same.