Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add defect control adaptivity #89

Merged
merged 30 commits into from
Jul 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
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 .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
Loading