Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
oscardssmith committed Aug 31, 2024
1 parent 76e47ec commit 5bf3cdf
Show file tree
Hide file tree
Showing 14 changed files with 18 additions and 201 deletions.
3 changes: 1 addition & 2 deletions lib/OrdinaryDiffEqBDF/src/OrdinaryDiffEqBDF.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ import OrdinaryDiffEqCore: alg_order, calculate_residuals!,
OrdinaryDiffEqMutableCache, OrdinaryDiffEqConstantCache,
OrdinaryDiffEqNewtonAdaptiveAlgorithm,
OrdinaryDiffEqNewtonAlgorithm,
AbstractController, DEFAULT_PRECS,
CompiledFloats, uses_uprev,
AbstractController, CompiledFloats, uses_uprev,
alg_cache, _vec, _reshape, @cache,
isfsal, full_cache,
constvalue, isadaptive, error_constant,
Expand Down
44 changes: 4 additions & 40 deletions lib/OrdinaryDiffEqBDF/src/algorithms.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ function BDF_docstring(description::String,
concrete_jac = nothing,
diff_type = Val{:forward},
linsolve = nothing,
precs = DEFAULT_PRECS,
""" * "\n" * extra_keyword_default

keyword_default_description = """
Expand All @@ -34,40 +33,6 @@ function BDF_docstring(description::String,
For example, to use [KLU.jl](https://github.com/JuliaSparse/KLU.jl), specify
`$name(linsolve = KLUFactorization()`).
When `nothing` is passed, uses `DefaultLinearSolver`.
- `precs`: Any [LinearSolve.jl-compatible preconditioner](https://docs.sciml.ai/LinearSolve/stable/basics/Preconditioners/)
can be used as a left or right preconditioner.
Preconditioners are specified by the `Pl,Pr = precs(W,du,u,p,t,newW,Plprev,Prprev,solverdata)`
function where the arguments are defined as:
- `W`: the current Jacobian of the nonlinear system. Specified as either
``I - \\gamma J`` or ``I/\\gamma - J`` depending on the algorithm. This will
commonly be a `WOperator` type defined by OrdinaryDiffEq.jl. It is a lazy
representation of the operator. Users can construct the W-matrix on demand
by calling `convert(AbstractMatrix,W)` to receive an `AbstractMatrix` matching
the `jac_prototype`.
- `du`: the current ODE derivative
- `u`: the current ODE state
- `p`: the ODE parameters
- `t`: the current ODE time
- `newW`: a `Bool` which specifies whether the `W` matrix has been updated since
the last call to `precs`. It is recommended that this is checked to only
update the preconditioner when `newW == true`.
- `Plprev`: the previous `Pl`.
- `Prprev`: the previous `Pr`.
- `solverdata`: Optional extra data the solvers can give to the `precs` function.
Solver-dependent and subject to change.
The return is a tuple `(Pl,Pr)` of the LinearSolve.jl-compatible preconditioners.
To specify one-sided preconditioning, simply return `nothing` for the preconditioner
which is not used. Additionally, `precs` must supply the dispatch:
```julia
Pl, Pr = precs(W, du, u, p, t, ::Nothing, ::Nothing, ::Nothing, solverdata)
```
which is used in the solver setup phase to construct the integrator
type with the preconditioners `(Pl,Pr)`.
The default is `precs=DEFAULT_PRECS` where the default preconditioner function
is defined as:
```julia
DEFAULT_PRECS(W, du, u, p, t, newW, Plprev, Prprev, solverdata) = nothing, nothing
```
""" * "/n" * extra_keyword_description
generic_solver_docstring(
description, name, "Multistep Method.", references,
Expand Down Expand Up @@ -658,17 +623,16 @@ function DABDF2(; chunk_size = Val{0}(), autodiff = Val{true}(), standardtag = V
end

#=
struct DBDF{CS,AD,F,F2,P,FDT,ST,CJ} <: DAEAlgorithm{CS,AD,FDT,ST,CJ}
struct DBDF{CS,AD,F,F2,FDT,ST,CJ} <: DAEAlgorithm{CS,AD,FDT,ST,CJ}
linsolve::F
nlsolve::F2
precs::P
extrapolant::Symbol
end
DBDF(;chunk_size=Val{0}(),autodiff=Val{true}(), standardtag = Val{true}(), concrete_jac = nothing,diff_type=Val{:forward},
linsolve=nothing,precs = DEFAULT_PRECS,nlsolve=NLNewton(),extrapolant=:linear) =
DBDF{_unwrap_val(chunk_size),_unwrap_val(autodiff),typeof(linsolve),typeof(nlsolve),typeof(precs),diff_type,_unwrap_val(standardtag),_unwrap_val(concrete_jac)}(
linsolve,nlsolve,precs,extrapolant)
linsolve=nothing,nlsolve=NLNewton(),extrapolant=:linear) =
DBDF{_unwrap_val(chunk_size),_unwrap_val(autodiff),typeof(linsolve),typeof(nlsolve),diff_type,_unwrap_val(standardtag),_unwrap_val(concrete_jac)}(
linsolve,nlsolve,extrapolant)
=#

@doc BDF_docstring("Fully implicit implementation of FBDF based on Shampine's",
Expand Down
2 changes: 0 additions & 2 deletions lib/OrdinaryDiffEqCore/src/OrdinaryDiffEqCore.jl
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,6 @@ end
Divergence = -2
end
const TryAgain = SlowConvergence

DEFAULT_PRECS(W, p) = nothing, nothing
isdiscretecache(cache) = false

include("doc_utils.jl")
Expand Down
36 changes: 1 addition & 35 deletions lib/OrdinaryDiffEqCore/src/doc_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ function differentiation_rk_docstring(description::String,
concrete_jac = nothing,
diff_type = Val{:forward},
linsolve = nothing,
precs = DEFAULT_PRECS,
""" * extra_keyword_default

keyword_default_description = """
Expand All @@ -111,40 +110,7 @@ function differentiation_rk_docstring(description::String,
For example, to use [KLU.jl](https://github.com/JuliaSparse/KLU.jl), specify
`$name(linsolve = KLUFactorization()`).
When `nothing` is passed, uses `DefaultLinearSolver`.
- `precs`: Any [LinearSolve.jl-compatible preconditioner](https://docs.sciml.ai/LinearSolve/stable/basics/Preconditioners/)
can be used as a left or right preconditioner.
Preconditioners are specified by the `Pl,Pr = precs(W,du,u,p,t,newW,Plprev,Prprev,solverdata)`
function where the arguments are defined as:
- `W`: the current Jacobian of the nonlinear system. Specified as either
``I - \\gamma J`` or ``I/\\gamma - J`` depending on the algorithm. This will
commonly be a `WOperator` type defined by OrdinaryDiffEq.jl. It is a lazy
representation of the operator. Users can construct the W-matrix on demand
by calling `convert(AbstractMatrix,W)` to receive an `AbstractMatrix` matching
the `jac_prototype`.
- `du`: the current ODE derivative
- `u`: the current ODE state
- `p`: the ODE parameters
- `t`: the current ODE time
- `newW`: a `Bool` which specifies whether the `W` matrix has been updated since
the last call to `precs`. It is recommended that this is checked to only
update the preconditioner when `newW == true`.
- `Plprev`: the previous `Pl`.
- `Prprev`: the previous `Pr`.
- `solverdata`: Optional extra data the solvers can give to the `precs` function.
Solver-dependent and subject to change.
The return is a tuple `(Pl,Pr)` of the LinearSolve.jl-compatible preconditioners.
To specify one-sided preconditioning, simply return `nothing` for the preconditioner
which is not used. Additionally, `precs` must supply the dispatch:
```julia
Pl, Pr = precs(W, du, u, p, t, ::Nothing, ::Nothing, ::Nothing, solverdata)
```
which is used in the solver setup phase to construct the integrator
type with the preconditioners `(Pl,Pr)`.
The default is `precs=DEFAULT_PRECS` where the default preconditioner function
is defined as:
```julia
DEFAULT_PRECS(W, du, u, p, t, newW, Plprev, Prprev, solverdata) = nothing, nothing
```
""" * extra_keyword_description

generic_solver_docstring(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import OrdinaryDiffEqCore: alg_order, alg_maximum_order, get_current_adaptive_or
OrdinaryDiffEqAdaptiveAlgorithm,
OrdinaryDiffEqAdaptiveImplicitAlgorithm,
alg_cache, CompiledFloats, @threaded, stepsize_controller!,
DEFAULT_PRECS, full_cache,
full_cache,
constvalue, PolyesterThreads, Sequential, BaseThreads,
_digest_beta1_beta2, timedepentdtmin, _unwrap_val,
_reshape, _vec, get_fsalfirstlast, generic_solver_docstring,
Expand Down
2 changes: 1 addition & 1 deletion lib/OrdinaryDiffEqFIRK/src/OrdinaryDiffEqFIRK.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import OrdinaryDiffEqCore: alg_order, calculate_residuals!,
constvalue, _unwrap_val,
differentiation_rk_docstring, trivial_limiter!,
_ode_interpolant!, _ode_addsteps!, AbstractController,
qmax_default, alg_adaptive_order, DEFAULT_PRECS,
qmax_default, alg_adaptive_order,
stepsize_controller!, step_accept_controller!,
step_reject_controller!,
PredictiveController, alg_can_repeat_jac, NewtonAlgorithm,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
module OrdinaryDiffEqIMEXMultistep

import OrdinaryDiffEqCore: alg_order, issplit, OrdinaryDiffEqNewtonAlgorithm, _unwrap_val,
DEFAULT_PRECS, OrdinaryDiffEqConstantCache,
OrdinaryDiffEqMutableCache,
OrdinaryDiffEqConstantCache, OrdinaryDiffEqMutableCache,
@cache, alg_cache, initialize!, perform_step!, @unpack,
full_cache, get_fsalfirstlast,
generic_solver_docstring
Expand Down
3 changes: 1 addition & 2 deletions lib/OrdinaryDiffEqIMEXMultistep/src/algorithms.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ struct CNAB2{CS, AD, F, F2, FDT, ST, CJ} <:
OrdinaryDiffEqNewtonAlgorithm{CS, AD, FDT, ST, CJ}
linsolve::F
nlsolve::F2
precs::P
extrapolant::Symbol
end

Expand Down Expand Up @@ -58,7 +57,7 @@ end
pages={263--276},
year={2015},
publisher={Elsevier}}", "", "")
struct CNLF2{CS, AD, F, F2, P, FDT, ST, CJ} <:
struct CNLF2{CS, AD, F, F2, FDT, ST, CJ} <:
OrdinaryDiffEqNewtonAlgorithm{CS, AD, FDT, ST, CJ}
linsolve::F
nlsolve::F2
Expand Down
2 changes: 1 addition & 1 deletion lib/OrdinaryDiffEqPDIRK/src/OrdinaryDiffEqPDIRK.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module OrdinaryDiffEqPDIRK
import OrdinaryDiffEqCore: isfsal, alg_order, _unwrap_val,
OrdinaryDiffEqNewtonAlgorithm, OrdinaryDiffEqConstantCache,
OrdinaryDiffEqMutableCache, constvalue, alg_cache,
uses_uprev, @unpack, unwrap_alg, @cache, DEFAULT_PRECS,
uses_uprev, @unpack, unwrap_alg, @cache,
@threaded, initialize!, perform_step!, isthreaded,
full_cache, get_fsalfirstlast, differentiation_rk_docstring
import StaticArrays: SVector
Expand Down
76 changes: 3 additions & 73 deletions lib/OrdinaryDiffEqRosenbrock/src/OrdinaryDiffEqRosenbrock.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module OrdinaryDiffEqRosenbrock

import OrdinaryDiffEqCore: alg_order, alg_adaptive_order, isWmethod, isfsal, _unwrap_val,
DEFAULT_PRECS, OrdinaryDiffEqRosenbrockAlgorithm, @cache,
OrdinaryDiffEqRosenbrockAlgorithm, @cache,
alg_cache, initialize!, @unpack,
calculate_residuals!, OrdinaryDiffEqMutableCache,
OrdinaryDiffEqConstantCache, _ode_interpolant, _ode_interpolant!,
Expand Down Expand Up @@ -54,7 +54,6 @@ function rosenbrock_wanner_docstring(description::String,
concrete_jac = nothing,
diff_type = Val{:central},
linsolve = nothing,
precs = DEFAULT_PRECS,
""" * extra_keyword_default

keyword_default_description = """
Expand All @@ -78,41 +77,7 @@ function rosenbrock_wanner_docstring(description::String,
For example, to use [KLU.jl](https://github.com/JuliaSparse/KLU.jl), specify
`$name(linsolve = KLUFactorization()`).
When `nothing` is passed, uses `DefaultLinearSolver`.
- `precs`: Any [LinearSolve.jl-compatible preconditioner](https://docs.sciml.ai/LinearSolve/stable/basics/Preconditioners/)
can be used as a left or right preconditioner.
Preconditioners are specified by the `Pl,Pr = precs(W,du,u,p,t,newW,Plprev,Prprev,solverdata)`
function where the arguments are defined as:
- `W`: the current Jacobian of the nonlinear system. Specified as either
``I - \\gamma J`` or ``I/\\gamma - J`` depending on the algorithm. This will
commonly be a `WOperator` type defined by OrdinaryDiffEq.jl. It is a lazy
representation of the operator. Users can construct the W-matrix on demand
by calling `convert(AbstractMatrix,W)` to receive an `AbstractMatrix` matching
the `jac_prototype`.
- `du`: the current ODE derivative
- `u`: the current ODE state
- `p`: the ODE parameters
- `t`: the current ODE time
- `newW`: a `Bool` which specifies whether the `W` matrix has been updated since
the last call to `precs`. It is recommended that this is checked to only
update the preconditioner when `newW == true`.
- `Plprev`: the previous `Pl`.
- `Prprev`: the previous `Pr`.
- `solverdata`: Optional extra data the solvers can give to the `precs` function.
Solver-dependent and subject to change.
The return is a tuple `(Pl,Pr)` of the LinearSolve.jl-compatible preconditioners.
To specify one-sided preconditioning, simply return `nothing` for the preconditioner
which is not used. Additionally, `precs` must supply the dispatch:
```julia
Pl, Pr = precs(W, du, u, p, t, ::Nothing, ::Nothing, ::Nothing, solverdata)
```
which is used in the solver setup phase to construct the integrator
type with the preconditioners `(Pl,Pr)`.
The default is `precs=DEFAULT_PRECS` where the default preconditioner function
is defined as:
```julia
DEFAULT_PRECS(W, du, u, p, t, newW, Plprev, Prprev, solverdata) = nothing, nothing
```
""" * extra_keyword_description
""" * extra_keyword_description

if with_step_limiter
keyword_default *= "step_limiter! = OrdinaryDiffEq.trivial_limiter!,\n"
Expand Down Expand Up @@ -152,41 +117,7 @@ function rosenbrock_docstring(description::String,
For example, to use [KLU.jl](https://github.com/JuliaSparse/KLU.jl), specify
`$name(linsolve = KLUFactorization()`).
When `nothing` is passed, uses `DefaultLinearSolver`.
- `precs`: Any [LinearSolve.jl-compatible preconditioner](https://docs.sciml.ai/LinearSolve/stable/basics/Preconditioners/)
can be used as a left or right preconditioner.
Preconditioners are specified by the `Pl,Pr = precs(W,du,u,p,t,newW,Plprev,Prprev,solverdata)`
function where the arguments are defined as:
- `W`: the current Jacobian of the nonlinear system. Specified as either
``I - \\gamma J`` or ``I/\\gamma - J`` depending on the algorithm. This will
commonly be a `WOperator` type defined by OrdinaryDiffEq.jl. It is a lazy
representation of the operator. Users can construct the W-matrix on demand
by calling `convert(AbstractMatrix,W)` to receive an `AbstractMatrix` matching
the `jac_prototype`.
- `du`: the current ODE derivative
- `u`: the current ODE state
- `p`: the ODE parameters
- `t`: the current ODE time
- `newW`: a `Bool` which specifies whether the `W` matrix has been updated since
the last call to `precs`. It is recommended that this is checked to only
update the preconditioner when `newW == true`.
- `Plprev`: the previous `Pl`.
- `Prprev`: the previous `Pr`.
- `solverdata`: Optional extra data the solvers can give to the `precs` function.
Solver-dependent and subject to change.
The return is a tuple `(Pl,Pr)` of the LinearSolve.jl-compatible preconditioners.
To specify one-sided preconditioning, simply return `nothing` for the preconditioner
which is not used. Additionally, `precs` must supply the dispatch:
```julia
Pl, Pr = precs(W, du, u, p, t, ::Nothing, ::Nothing, ::Nothing, solverdata)
```
which is used in the solver setup phase to construct the integrator
type with the preconditioners `(Pl,Pr)`.
The default is `precs=DEFAULT_PRECS` where the default preconditioner function
is defined as:
```julia
DEFAULT_PRECS(W, du, u, p, t, newW, Plprev, Prprev, solverdata) = nothing, nothing
```
""" * extra_keyword_default
""" * extra_keyword_default

keyword_default_description = """
- `chunk_size`: TBD
Expand All @@ -195,7 +126,6 @@ function rosenbrock_docstring(description::String,
- `concrete_jac`: function of the form `jac!(J, u, p, t)`
- `diff_type`: TBD
- `linsolve`: custom solver for the inner linear systems
- `precs`: custom preconditioner for the inner linear solver
""" * extra_keyword_description

if with_step_limiter
Expand Down
1 change: 0 additions & 1 deletion lib/OrdinaryDiffEqSDIRK/src/OrdinaryDiffEqSDIRK.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import OrdinaryDiffEqCore: alg_order, calculate_residuals!,
OrdinaryDiffEqMutableCache, OrdinaryDiffEqConstantCache,
OrdinaryDiffEqNewtonAdaptiveAlgorithm,
OrdinaryDiffEqNewtonAlgorithm,
DEFAULT_PRECS,
OrdinaryDiffEqAdaptiveAlgorithm, CompiledFloats, uses_uprev,
alg_cache, _vec, _reshape, @cache, isfsal, full_cache,
constvalue, _unwrap_val, _ode_interpolant,
Expand Down
37 changes: 1 addition & 36 deletions lib/OrdinaryDiffEqSDIRK/src/algorithms.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ function SDIRK_docstring(description::String,
concrete_jac = nothing,
diff_type = Val{:forward},
linsolve = nothing,
precs = DEFAULT_PRECS,
nlsolve = NLNewton(),
""" * extra_keyword_default

Expand All @@ -35,41 +34,7 @@ function SDIRK_docstring(description::String,
For example, to use [KLU.jl](https://github.com/JuliaSparse/KLU.jl), specify
`$name(linsolve = KLUFactorization()`).
When `nothing` is passed, uses `DefaultLinearSolver`.
- `precs`: Any [LinearSolve.jl-compatible preconditioner](https://docs.sciml.ai/LinearSolve/stable/basics/Preconditioners/)
can be used as a left or right preconditioner.
Preconditioners are specified by the `Pl,Pr = precs(W,du,u,p,t,newW,Plprev,Prprev,solverdata)`
function where the arguments are defined as:
- `W`: the current Jacobian of the nonlinear system. Specified as either
``I - \\gamma J`` or ``I/\\gamma - J`` depending on the algorithm. This will
commonly be a `WOperator` type defined by OrdinaryDiffEq.jl. It is a lazy
representation of the operator. Users can construct the W-matrix on demand
by calling `convert(AbstractMatrix,W)` to receive an `AbstractMatrix` matching
the `jac_prototype`.
- `du`: the current ODE derivative
- `u`: the current ODE state
- `p`: the ODE parameters
- `t`: the current ODE time
- `newW`: a `Bool` which specifies whether the `W` matrix has been updated since
the last call to `precs`. It is recommended that this is checked to only
update the preconditioner when `newW == true`.
- `Plprev`: the previous `Pl`.
- `Prprev`: the previous `Pr`.
- `solverdata`: Optional extra data the solvers can give to the `precs` function.
Solver-dependent and subject to change.
The return is a tuple `(Pl,Pr)` of the LinearSolve.jl-compatible preconditioners.
To specify one-sided preconditioning, simply return `nothing` for the preconditioner
which is not used. Additionally, `precs` must supply the dispatch:
```julia
Pl, Pr = precs(W, du, u, p, t, ::Nothing, ::Nothing, ::Nothing, solverdata)
```
which is used in the solver setup phase to construct the integrator
type with the preconditioners `(Pl,Pr)`.
The default is `precs=DEFAULT_PRECS` where the default preconditioner function
is defined as:
```julia
DEFAULT_PRECS(W, du, u, p, t, newW, Plprev, Prprev, solverdata) = nothing, nothing
```
- `nlsolve`: TBD
- `nlsolve`: TBD
""" * extra_keyword_description

generic_solver_docstring(
Expand Down
Loading

0 comments on commit 5bf3cdf

Please sign in to comment.