gridap / gridap/GridapPETSc.jl

PETSc nonlinear solve not producing correct solution for transient problems

Open
#101 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
Julia
Stars
33
Forks
14
PR merge metrics
No merged PRs in 30d

Description

For all transient problems in GridapODEs, the stage operator (linear or non-linear) is recreated at each time step. This causes issues in GridapPETSc when using a non-linear solver as described in [Issue#81](https://github.com/gridap/GridapPETSc.jl/issues/81).
https://github.com/gridap/GridapPETSc.jl/blob/35b678da3505ae691552619747b117054584dff0/src/PETScNonlinearSolvers.jl#L161

The hack to comment out this line or set `cache.op=op` does not work for all problems. @JordiManyer and I found the only solution was to set `sysslvrcache=nothing` prior to solving the `NonlinearStageOperator` within `ode_march!`.

This is not a long term solution as destroying `sysslvrcache` means the residual and jacobian are allocated every time step in https://github.com/gridap/GridapPETSc.jl/blob/35b678da3505ae691552619747b117054584dff0/src/PETScNonlinearSolvers.jl#L168

An alternative is to use the non-linear solvers within GridapSolvers. Additionally, we tested using a PETSc linear solver within a GridapSolvers nonlinear solver and this recovered the correct behaviour. This isolates the problem to PETSc nonlinearsolvers, in particular: https://github.com/gridap/GridapPETSc.jl/blob/35b678da3505ae691552619747b117054584dff0/src/PETScNonlinearSolvers.jl#L156

We believe this function should be changed to pass a new jacobian and residual function rather than cached objects for transient problems requiring a non-linear solver. @JordiManyer will try to create a reproducible example for testing.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.