Skip to content
Open
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: 2 additions & 0 deletions lib/BoundaryValueDiffEqMIRK/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ DifferentiationInterface = "a0c0ee7d-e4b9-4e03-894e-1c5f64a51d63"
FastAlmostBandedMatrices = "9d29842c-ecb8-4973-b1e9-a27b1157504e"
FastClosures = "9aa1b823-49e4-5ca5-8b0f-3971ec8bab6a"
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
KernelAbstractions = "63c18a36-062a-441e-b654-da1e3ab1ce7c"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
PreallocationTools = "d236fae5-4411-538c-8e31-a6e3d9e00b46"
PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
Expand All @@ -38,6 +39,7 @@ DifferentiationInterface = "0.7.15"
FastAlmostBandedMatrices = "0.1.4"
FastClosures = "0.3.2"
ForwardDiff = "0.10.38, 1"
KernelAbstractions = "0.9"
LinearAlgebra = "1.10"
LinearSolve = "2.36.2, 3, 4.2"
OptimizationIpopt = "1.2.2"
Expand Down
2 changes: 2 additions & 0 deletions lib/BoundaryValueDiffEqMIRK/src/BoundaryValueDiffEqMIRK.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ using FastAlmostBandedMatrices: AlmostBandedMatrix, fillpart, exclusive_bandpart
finish_part_setindex!
using FastClosures: @closure
using ForwardDiff: ForwardDiff, pickchunksize
using KernelAbstractions: Backend, CPU, @index, @kernel, synchronize
using LinearAlgebra: LinearAlgebra
using RecursiveArrayTools: AbstractVectorOfArray, DiffEqArray, VectorOfArray, recursivecopy,
recursivefill!
Expand Down Expand Up @@ -180,6 +181,7 @@ include("sparse_jacobians.jl")
end

export MIRK2, MIRK3, MIRK4, MIRK5, MIRK6, MIRK6I
export CPU
export BVPJacobianAlgorithm
export maxsol, minsol, integral

Expand Down
14 changes: 10 additions & 4 deletions lib/BoundaryValueDiffEqMIRK/src/algorithms.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ for order in (2, 3, 4, 5, 6)

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

$($order)th order Monotonic Implicit Runge Kutta method.
Expand All @@ -31,6 +31,8 @@ for order in (2, 3, 4, 5, 6)
`nonbc_diffmode` defaults to `AutoSparse(AutoForwardDiff())` if possible else
`AutoSparse(AutoFiniteDiff())`. For `bc_diffmode`, defaults to `AutoForwardDiff` if
possible else `AutoFiniteDiff`.
- `platform`: KernelAbstractions backend used to evaluate the collocation
equations. Defaults to `CPU()`.
- `defect_threshold`: Threshold for defect control.
- `max_num_subintervals`: Number of maximal subintervals, default as 3000.

Expand All @@ -52,10 +54,11 @@ for order in (2, 3, 4, 5, 6)
}
```
"""
@kwdef struct $(alg){N, O, J <: BVPJacobianAlgorithm, T} <: AbstractMIRK
@kwdef struct $(alg){N, O, J <: BVPJacobianAlgorithm, P <: Backend, T} <: AbstractMIRK
nlsolve::N = nothing
optimize::O = nothing
jac_alg::J = BVPJacobianAlgorithm()
platform::P = CPU()
defect_threshold::T = 0.1
max_num_subintervals::Int = 3000
end
Expand All @@ -67,7 +70,7 @@ for order in (6)

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

$($order)th order Monotonic Implicit Runge Kutta method.
Expand All @@ -91,6 +94,8 @@ for order in (6)
`nonbc_diffmode` defaults to `AutoSparse(AutoForwardDiff())` if possible else
`AutoSparse(AutoFiniteDiff())`. For `bc_diffmode`, defaults to `AutoForwardDiff` if
possible else `AutoFiniteDiff`.
- `platform`: KernelAbstractions backend used to evaluate the collocation
equations. Defaults to `CPU()`.
- `defect_threshold`: Threshold for defect control.
- `max_num_subintervals`: Number of maximal subintervals, default as 3000.

Expand All @@ -112,10 +117,11 @@ for order in (6)
}
```
"""
@kwdef struct $(alg){N, O, J <: BVPJacobianAlgorithm, T} <: AbstractMIRK
@kwdef struct $(alg){N, O, J <: BVPJacobianAlgorithm, P <: Backend, T} <: AbstractMIRK
nlsolve::N = nothing
optimize::O = nothing
jac_alg::J = BVPJacobianAlgorithm()
platform::P = CPU()
defect_threshold::T = 0.1
max_num_subintervals::Int = 3000
end
Expand Down
Loading
Loading