Skip to content

Commit

Permalink
Merge pull request #89 from ErikQQY/master
Browse files Browse the repository at this point in the history
Add defect control adaptivity
  • Loading branch information
ChrisRackauckas committed Jul 24, 2023
2 parents ec3a956 + 6a4860f commit e697350
Show file tree
Hide file tree
Showing 10 changed files with 600 additions and 177 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
*.jl.*.cov
*.jl.mem
Manifest.toml
.vscode
.vscode/*
32 changes: 27 additions & 5 deletions src/BoundaryValueDiffEq.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,43 @@ import ForwardDiff, BandedMatrices, FiniteDiff

import TruncatedStacktraces: @truncate_stacktrace

struct MIRKTableau{T, cType, vType, bType, xType}
struct MIRKTableau{T, cType, vType, bType, xType, sType, starType, tauType}
c::cType
v::vType
b::bType
x::xType
"""Discrete stages of MIRK formula"""
s::sType
"""Number of stages to form the interpolant"""
s_star::starType
"""Defect sampling point"""
tau::tauType
end

function MIRKTableau(c, v, b, x)
@assert eltype(c) == eltype(v) == eltype(b) == eltype(x)
return MIRKTableau{eltype(c), typeof(c), typeof(v), typeof(b), typeof(x)}(c, v, b, x)
function MIRKTableau(c, v, b, x, s, s_star, tau)
@assert eltype(c) == eltype(v) == eltype(b) == eltype(x) == eltype(tau)
return MIRKTableau{
eltype(c),
typeof(c),
typeof(v),
typeof(b),
typeof(x),
typeof(s),
typeof(s_star),
typeof(tau),
}(c,
v,
b,
x,
s,
s_star,
tau)
end

@truncate_stacktrace MIRKTableau 1

# ODE BVP problem system
struct BVPSystem{T, U <: AbstractArray, P, F, B, S}
mutable struct BVPSystem{T, U <: AbstractArray, P, F, B, S}
order::Int # The order of MIRK method
M::Int # Number of equations in the ODE system
N::Int # Number of nodes in the mesh
Expand All @@ -46,6 +67,7 @@ include("cache.jl")
include("collocation.jl")
include("jacobian.jl")
include("solve.jl")
include("adaptivity.jl")

export Shooting
export GeneralMIRK4, GeneralMIRK5, GeneralMIRK6
Expand Down

0 comments on commit e697350

Please sign in to comment.