Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Newton-Krylov solver #114

Merged
merged 63 commits into from
Oct 21, 2024
Merged

Newton-Krylov solver #114

merged 63 commits into from
Oct 21, 2024

Conversation

Simkern
Copy link
Collaborator

@Simkern Simkern commented Oct 7, 2024

Implementation of a basic Newton-Krylov root-finding algorithm for fixed points and periodic orbits.

Algorithmic features:

  • The solver is fully integrated into the abstract framework accepting any linear solver for the computation of the Newton step. In particular, this allows for user-defined linear solvers that go beyond the solvers of LightKrylov, e.g. implementing an optimal norm-constrained Newton step (a.k.a. a hook step). The development includes a change in the interface for abstract_linear_solver that allows the tolerances chosen in the Newton iteration to be broadcast to the concrete solver used.
  • The solver exposes an abstract interface for a user-defined tolerance scheduler for inexact Newton iteration. Two basic tolerance schedulers are implemented: contant_atol, which always returns the absolute tolerance for the Newton iteration, and dynamic_tol, which instead dynamically adapts the solver tolerances to 10% of the current residual norm which may accelerate computations.
  • Given a new Newton step increment, the solver offers optional step damping if the full Newton step does not lead to a reduction of the residual. This damping procedure performs a fixed number of steps of an optimal golden-ratio based 1D line search along the Newton step direction.

Integration:

  • To support the solver, the new abstract types abstract_dynamical_system and abstract_jacobian are defined. The abstract_dynamical_system contains and instance of abstract_jacobian (derived from abstract_linop), which itself contains an abstract_vector corresponding to the current estimate of the fixed point (or initial point of the periodic orbit) around which the jacobian is evaluated. abstract_dynamical_system also exposes an interface for the user-defined function to evaluate the residual of the function of which we seek a root.
  • The test suite has been updated to include a test for the correctness of the Newton iteration using the fixed points of the Roessler system for sp and dp.
  • The main routines are documented.
  • The pull request also contains a number of cleanups of various routines, including in particular, the removal of verbosity flags in favor of a full adoption of the logger framework throughout the project.
  • All parts of the implementation are compatible with the *.fypp framework.

Roessler example

  • To showcase the capability of the Newton solver to find periodic orbits, an example has been added computing a PO of the Roessler system. This example, which relies on rklib for time integration, includes examples of all the features of the solver.
  • The example also computes the monodromy matrix of the PO as well as its eigenvalues.
  • The OTD framework is also implemented. The example has two parts:
  1. OTD modes applied to a fixed point of the system where the OTD modes converge to the invariant subspace spanning the leading eigenvalues of the Jacobian at the fixed point, which are compared with literature.
  2. OTD modes applied to a periodic orbit where the OTD modes converge to the periodic tangent space following the trajectory. For this case, the leading Lyapunov exponents for the orbit are computed and compared with literature.

Possible extensions:

  • Currently, the tests check for convergence to the two fixed points and include the step bisection. The PO could also be added, it's fast enough for a test. But then the definitions should be placed in a different file to not overload TestUtils.f90.

Simkern and others added 30 commits September 27, 2024 17:32
@Simkern Simkern reopened this Oct 8, 2024
@Simkern
Copy link
Collaborator Author

Simkern commented Oct 15, 2024

I'll try to add the FTLEs in the example before the merge.

@Simkern
Copy link
Collaborator Author

Simkern commented Oct 16, 2024

Ready for merge.

Copy link
Member

@loiseaujc loiseaujc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks pretty good to me overall. Just a set of minor changes (in my opinion, but you may argue otherwise) and it'll be ready to merge into dev.

src/AbstractSystems.fypp Outdated Show resolved Hide resolved
src/AbstractSystems.fypp Outdated Show resolved Hide resolved
src/AbstractSystems.fypp Outdated Show resolved Hide resolved
src/AbstractVectors.fypp Outdated Show resolved Hide resolved
src/IterativeSolvers.fypp Show resolved Hide resolved
src/LightKrylov.fypp Outdated Show resolved Hide resolved
src/NewtonKrylov.fypp Outdated Show resolved Hide resolved
src/NewtonKrylov.fypp Outdated Show resolved Hide resolved
src/NewtonKrylov.fypp Outdated Show resolved Hide resolved
src/NewtonKrylov.fypp Outdated Show resolved Hide resolved
@loiseaujc loiseaujc merged commit 94f0472 into dev Oct 21, 2024
12 checks passed
@Simkern Simkern deleted the newton branch November 5, 2024 23:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants