From 721ab71ab6cd8c5554d4a5d7c9e057ae84b2955c Mon Sep 17 00:00:00 2001 From: termi-official Date: Mon, 4 Nov 2024 14:03:07 +0100 Subject: [PATCH 1/4] Clarify nlprob docs for ODEFunction --- src/scimlfunctions.jl | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/scimlfunctions.jl b/src/scimlfunctions.jl index b05ffbfd5..0d485e6dc 100644 --- a/src/scimlfunctions.jl +++ b/src/scimlfunctions.jl @@ -256,6 +256,7 @@ ODEFunction{iip,specialize}(f; sparsity = __has_sparsity(f) ? f.sparsity : jac_prototype, paramjac = __has_paramjac(f) ? f.paramjac : nothing, colorvec = __has_colorvec(f) ? f.colorvec : nothing, + nlprob = __has_nlprob(f) ? f.nlprob : nothing, sys = __has_sys(f) ? f.sys : nothing) ``` @@ -289,10 +290,14 @@ the usage of `f`. These include: based on the sparsity pattern. Defaults to `nothing`, which means a color vector will be internally computed on demand when required. The cost of this operation is highly dependent on the sparsity pattern. -- `nlprob`: a `NonlinearProblem` that solves `f(u, t, p) = u_tmp` - where the nonlinear parameters are the tuple `(t, u_tmp, p)`. - This will be used as the nonlinear problem inside an implicit solver by specifying `u, u_tmp` and `t` - such that solving this function produces a solution to the implicit step of your solver. +- `nlprob`: some `AbstractNonlinearProblem` to define custom nonlinear problems to be used for + implicit time discretizations. This allows to use extra structure of the ODE function (e.g. + multi-level structure). The rationale here is essentially that implicit ODE integration algorithms + need do solve the a nonlinear problems, usually of the form `dt⋅f(γ⋅z+inner_tmp,p,t) + outer_tmp = z`, + during time integration, where users want to use extra structure of f during the nonlinear solve. + Here `z` is the stage solution vector, `p` is the parameter vector of the ODE problem, `t` is + the time, `dt` the respective time increment`, `γ` is some scaling factor and the temporary + variables are some compatible vectors set by the specific solver. ## iip: In-Place vs Out-Of-Place From c3009856b899cee8741b26555d4b7fab37ea2190 Mon Sep 17 00:00:00 2001 From: termi-official Date: Mon, 4 Nov 2024 14:07:52 +0100 Subject: [PATCH 2/4] Further clarification --- src/scimlfunctions.jl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/scimlfunctions.jl b/src/scimlfunctions.jl index 0d485e6dc..e2d30effc 100644 --- a/src/scimlfunctions.jl +++ b/src/scimlfunctions.jl @@ -298,6 +298,8 @@ the usage of `f`. These include: Here `z` is the stage solution vector, `p` is the parameter vector of the ODE problem, `t` is the time, `dt` the respective time increment`, `γ` is some scaling factor and the temporary variables are some compatible vectors set by the specific solver. + Note that other implicit techniques, like for example some fully-implicit Runge-Kutta methods, + need to solve different nonlinear systems. ## iip: In-Place vs Out-Of-Place From 6b9ea4a90461029856ae64e6b0503f14fb94c022 Mon Sep 17 00:00:00 2001 From: termi-official Date: Mon, 4 Nov 2024 14:16:53 +0100 Subject: [PATCH 3/4] Add back information about the actual nonlinear function. --- src/scimlfunctions.jl | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/scimlfunctions.jl b/src/scimlfunctions.jl index e2d30effc..02fdfea9e 100644 --- a/src/scimlfunctions.jl +++ b/src/scimlfunctions.jl @@ -300,6 +300,11 @@ the usage of `f`. These include: variables are some compatible vectors set by the specific solver. Note that other implicit techniques, like for example some fully-implicit Runge-Kutta methods, need to solve different nonlinear systems. + Generally the inner nonlinear function of the nonlinear problem is in general of the form `g(z,p') = 0` + where `p'` is a struct with all information about the specific nonlinear problem at hand to solve + for a specific time discretization. For example, for the nonlinear problem stated in the first + paragraph in this docstring, `p'` would hold `(dt, γ, inner_tmp, outer_tmp, t, p)`, such that + `g(z,p') = dt⋅f(γ⋅z+inner_tmp,p,t) + outer_tmp - z = 0`. ## iip: In-Place vs Out-Of-Place From 0d49fa092eee6042d682d86418ed271455f4d927 Mon Sep 17 00:00:00 2001 From: termi-official Date: Mon, 4 Nov 2024 14:17:54 +0100 Subject: [PATCH 4/4] Oopsie. --- src/scimlfunctions.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scimlfunctions.jl b/src/scimlfunctions.jl index 02fdfea9e..3ff10abc9 100644 --- a/src/scimlfunctions.jl +++ b/src/scimlfunctions.jl @@ -300,7 +300,7 @@ the usage of `f`. These include: variables are some compatible vectors set by the specific solver. Note that other implicit techniques, like for example some fully-implicit Runge-Kutta methods, need to solve different nonlinear systems. - Generally the inner nonlinear function of the nonlinear problem is in general of the form `g(z,p') = 0` + The inner nonlinear function of the nonlinear problem is in general of the form `g(z,p') = 0` where `p'` is a struct with all information about the specific nonlinear problem at hand to solve for a specific time discretization. For example, for the nonlinear problem stated in the first paragraph in this docstring, `p'` would hold `(dt, γ, inner_tmp, outer_tmp, t, p)`, such that