Skip to content

BUG: DeflatedSNES not updating snes.its #4923

@abaaba337

Description

@abaaba337

Describe the bug
when using solver = NonlinearVariationalSolver(problem, solver_parameters, appctx={"deflation": deflation}) and call solver.snes.its will always return 0.

Expected behavior
solver.snes.its should return the number of snes iterations.

Additional Info
Can be solved by replacing the solve method in class DeflatedSNES with:

def solve(self, snes, b, x):
    from firedrake import Function
    out = self.inner.solve(b, x)
    snes.reason = self.inner.reason
    snes.its = self.inner.its # update here

    # Record the solution we've just found
    self.deflation.append(Function(self.problem.u))

    return out

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions