Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions lib/BoundaryValueDiffEqMIRKN/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
PreallocationTools = "d236fae5-4411-538c-8e31-a6e3d9e00b46"
Preferences = "21216c6a-2e73-6563-6e65-726566657250"
RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd"
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462"
Setfield = "efcf1570-3423-57d1-acb7-fd33fddbac46"

Expand All @@ -32,7 +31,6 @@ PreallocationTools = "1.2"
Preferences = "1.4"
Random = "1.10"
RecursiveArrayTools = "3.27.0, 4"
Reexport = "1.2"
SciMLBase = "3.30"
SciMLTesting = "2.4"
Setfield = "1.1.1"
Expand Down
5 changes: 1 addition & 4 deletions lib/BoundaryValueDiffEqMIRKN/src/BoundaryValueDiffEqMIRKN.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module BoundaryValueDiffEqMIRKN

using ADTypes: ADTypes, AutoSparse, AutoForwardDiff
using ADTypes: ADTypes, AutoSparse
using BoundaryValueDiffEqCore: BoundaryValueDiffEqCore,
AbstractBoundaryValueDiffEqAlgorithm,
AbstractBoundaryValueDiffEqCache, BVPJacobianAlgorithm,
Expand Down Expand Up @@ -29,15 +29,12 @@ using LinearAlgebra: LinearAlgebra
using PreallocationTools: PreallocationTools, get_tmp
using Preferences: Preferences
using RecursiveArrayTools: AbstractVectorOfArray, ArrayPartition
using Reexport: @reexport
using SciMLBase: SciMLBase, ReturnCode, SecondOrderBVProblem,
StandardSecondOrderBVProblem, TwoPointSecondOrderBVProblem, isinplace, remake
using Setfield: @set!

const DI = DifferentiationInterface

@reexport using ADTypes, BoundaryValueDiffEqCore, SciMLBase

include("types.jl")
include("algorithms.jl")
include("mirkn.jl")
Expand Down
40 changes: 27 additions & 13 deletions lib/BoundaryValueDiffEqMIRKN/src/algorithms.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,37 +6,51 @@ for order in (4, 6)

@eval begin
"""
$($alg)(; nlsolve = NewtonRaphson(), optimize = nothing, jac_alg = BVPJacobianAlgorithm(),
$($alg)(; nlsolve = nothing, optimize = nothing, jac_alg = BVPJacobianAlgorithm(),
defect_threshold = 0.1, max_num_subintervals = 3000)

$($order)th order Monotonic Implicit Runge Kutta Nyström method.

## Fields

- `nlsolve`: Optional nonlinear solver algorithm. `nothing` selects the package default.
- `optimize`: Optional optimization solver algorithm. `nothing` disables optimization-based
initialization.
- `jac_alg`: Jacobian construction configuration used by the nonlinear solver.
- `defect_threshold`: Defect-control threshold used to refine the mesh.
- `max_num_subintervals`: Maximum number of mesh subintervals permitted during refinement.

## Keyword Arguments

- `nlsolve`: Internal Nonlinear solver. Any solver which conforms to the SciML
`NonlinearProblem` interface can be used. Note that any autodiff argument for
the solver will be ignored and a custom jacobian algorithm will be used.
- `optimize`: Internal Optimization solver. Any solver which conforms to the SciML
`OptimizationProblem` interface can be used. Note that any autodiff argument for
the solver will be ignored and a custom jacobian algorithm will be used. Optimization
solvers should first be loaded to allow this functionality.
- `jac_alg`: Jacobian Algorithm used for the nonlinear solver. Defaults to
`BVPJacobianAlgorithm()`, which automatically decides the best algorithm to
use based on the input types and problem type.
- `nlsolve = nothing`: Internal nonlinear solver. Any solver that conforms to the SciML
`NonlinearProblem` interface can be used. Its autodiff setting is ignored because MIRKN
uses `jac_alg` to construct the Jacobian.
- `optimize = nothing`: Internal optimization solver. Any solver that conforms to the
SciML `OptimizationProblem` interface can be used for initialization. Load the solver
package before constructing the algorithm.
- `jac_alg = BVPJacobianAlgorithm()`: Jacobian algorithm used for the nonlinear solver.
It automatically selects an algorithm from the problem and input types.
- For `TwoPointBVProblem`, only `diffmode` is used (defaults to
`AutoSparse(AutoForwardDiff())` if possible else `AutoSparse(AutoFiniteDiff())`).
- For `BVProblem`, `bc_diffmode` and `nonbc_diffmode` are used. For
`nonbc_diffmode` defaults to `AutoSparse(AutoForwardDiff())` if possible else
`AutoSparse(AutoFiniteDiff())`. For `bc_diffmode`, defaults to `AutoForwardDiff` if
possible else `AutoFiniteDiff`.
- `defect_threshold`: Threshold for defect control.
- `max_num_subintervals`: Number of maximal subintervals, default as 3000.
- `defect_threshold = 0.1`: Threshold for defect control.
- `max_num_subintervals = 3000`: Maximum number of mesh subintervals.

!!! note

For type-stability, the chunksizes for ForwardDiff ADTypes in
`BVPJacobianAlgorithm` must be provided.

## Examples

```jldoctest
julia> MIRKN$($order)().max_num_subintervals
3000
```

## References

```bibtex
Expand Down
6 changes: 3 additions & 3 deletions lib/BoundaryValueDiffEqMIRKN/test/Core/mirkn_basic_tests.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
using BoundaryValueDiffEqMIRKN
using SciMLBase: DynamicalBVPFunction, SecondOrderBVProblem, TwoPointSecondOrderBVProblem,
solve
using Test

using BoundaryValueDiffEqMIRKN
import SciMLBase

for order in (4, 6)
s = Symbol("MIRKN$(order)")
Expand Down Expand Up @@ -85,8 +87,6 @@ end
# JET tests have been moved to the separate QA test group (test/qa/)

@testset "Example problem from paper" begin
using BoundaryValueDiffEqMIRKN

for order in (4, 6)
s = Symbol("MIRKN$(order)")
@eval mirkn_solver(::Val{$order}, args...; kwargs...) = $(s)(args...; kwargs...)
Expand Down
8 changes: 0 additions & 8 deletions lib/BoundaryValueDiffEqMIRKN/test/qa/qa.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ using SciMLTesting
using BoundaryValueDiffEqMIRKN
using Test

const DOCS_SRC = normpath(joinpath(@__DIR__, "..", "..", "..", "..", "docs", "src"))
include(joinpath(@__DIR__, "..", "..", "..", "..", "test", "qa", "reexports.jl"))

run_qa(
BoundaryValueDiffEqMIRKN;
ei_kwargs = (;
Expand All @@ -15,9 +12,4 @@ run_qa(
ignore = (:StandardSecondOrderBVProblem, :pickchunksize),
),
),
reexports_allow = MIRKN_REEXPORTS,
api_docs_kwargs = (;
docs_src = DOCS_SRC, ignore = MIRKN_REEXPORTS,
rendered_ignore = MIRKN_REEXPORTS,
),
)
Loading