From 769d85044bab684753ab736fbeb4829035c23e14 Mon Sep 17 00:00:00 2001 From: Avik Pal Date: Thu, 22 Feb 2024 12:22:34 -0500 Subject: [PATCH 1/4] Default to PolyAlgorithm instead of Newton --- Project.toml | 2 +- src/manifold.jl | 17 ++++++----------- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/Project.toml b/Project.toml index 78b7c16c..5754797e 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "DiffEqCallbacks" uuid = "459566f4-90b8-5000-8ac3-15dfb0a30def" authors = ["Chris Rackauckas "] -version = "3.0.0" +version = "3.0.1" [deps] DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8" diff --git a/src/manifold.jl b/src/manifold.jl index 7559c3c3..891114b7 100644 --- a/src/manifold.jl +++ b/src/manifold.jl @@ -13,9 +13,8 @@ end SciMLBase.isinplace(::NonAutonomousFunction{iip}) where {iip} = iip """ - ManifoldProjection(g; nlsolve = missing, save = true, nlls = Val(true), - isinplace = Val(true), autonomous = nothing, resid_prototype = nothing, - kwargs...) + ManifoldProjection(g; nlsolve = nothing, save = true, nlls = Val(true), + isinplace = Val(true), autonomous = nothing, resid_prototype = nothing, kwargs...) In many cases, you may want to declare a manifold on which a solution lives. Mathematically, a manifold `M` is defined by a function `g` as the set of points where `g(u) = 0`. An @@ -45,7 +44,8 @@ properties. ## Keyword Arguments - `nlsolve`: A nonlinear solver as defined in the - [NonlinearSolve.jl format](https://docs.sciml.ai/NonlinearSolve/stable/basics/solve/) + [NonlinearSolve.jl format](https://docs.sciml.ai/NonlinearSolve/stable/basics/solve/). + Defaults to a PolyAlgorithm. - `save`: Whether to do the standard saving (applied after the callback) - `nlls`: If the problem is a nonlinear least squares problem. `nlls = Val(false)` generates a `NonlinearProblem` which is typically faster than @@ -127,15 +127,10 @@ function Manifold_initialize( u_modified!(integrator, false) end -# Since this is applied to every point, we can reasonably assume that the solution is close -# to the initial guess, so we would want to use NewtonRaphson / RobustMultiNewton instead of -# the default one. -function ManifoldProjection(g; nlsolve = missing, save = true, nlls = Val(true), +function ManifoldProjection(g; nlsolve = nothing, save = true, nlls = Val(true), isinplace = Val(true), autonomous = nothing, resid_prototype = nothing, kwargs...) - # `nothing` is a valid solver, so this need to be `missing` _nlls = SciMLBase._unwrap_val(nlls) - _nlsolve = nlsolve === missing ? (_nlls ? GaussNewton() : NewtonRaphson()) : nlsolve iip = SciMLBase._unwrap_val(isinplace) if autonomous === nothing if iip @@ -145,7 +140,7 @@ function ManifoldProjection(g; nlsolve = missing, save = true, nlls = Val(true), end end affect! = ManifoldProjection{iip, _nlls, SciMLBase._unwrap_val(autonomous)}( - g, _nlsolve, resid_prototype, kwargs) + g, nlsolve, resid_prototype, kwargs) condition = (u, t, integrator) -> true return DiscreteCallback(condition, affect!; initialize = Manifold_initialize, save_positions = (false, save)) From 0615fab653998c0a9bfd3284b2de3dbc55ae0d5c Mon Sep 17 00:00:00 2001 From: Avik Pal Date: Thu, 22 Feb 2024 12:23:59 -0500 Subject: [PATCH 2/4] Temp reduce version number --- Project.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Project.toml b/Project.toml index 5754797e..a176d8b8 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "DiffEqCallbacks" uuid = "459566f4-90b8-5000-8ac3-15dfb0a30def" authors = ["Chris Rackauckas "] -version = "3.0.1" +version = "2.38.0" [deps] DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8" @@ -30,7 +30,7 @@ ForwardDiff = "0.10.36" Functors = "0.4" LinearAlgebra = "1.10" Markdown = "1.10" -NonlinearSolve = "3.6" +NonlinearSolve = "3.7.2" ODEProblemLibrary = "0.1.5" OrdinaryDiffEq = "6.68" Parameters = "0.12" From 5c03cf083597c27ff8b7f0449527cd4bee9c4629 Mon Sep 17 00:00:00 2001 From: Avik Pal Date: Thu, 22 Feb 2024 18:55:47 -0500 Subject: [PATCH 3/4] Update Project.toml --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index a176d8b8..d516e867 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "DiffEqCallbacks" uuid = "459566f4-90b8-5000-8ac3-15dfb0a30def" authors = ["Chris Rackauckas "] -version = "2.38.0" +version = "3.0.1" [deps] DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8" From 7456fbe94d27fb7dbcf788d704b9e9430113dd12 Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Sat, 24 Feb 2024 10:49:51 -0500 Subject: [PATCH 4/4] Update Project.toml --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index d516e867..4137bbe5 100644 --- a/Project.toml +++ b/Project.toml @@ -38,7 +38,7 @@ QuadGK = "2.4" RecipesBase = "1.3.4" RecursiveArrayTools = "3.9" SciMLBase = "2.26" -SciMLSensitivity = "7.49" +SciMLSensitivity = "7.56" StaticArrays = "1.8" StaticArraysCore = "1.4" Sundials = "4.19.2"