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

Implement Part 1 Of Adaptive Radau Method #2450

Merged
merged 87 commits into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
84ef783
rename
Shreyas-Ekanathan Jul 24, 2024
0ba696d
Merge branch 'master' into head
Shreyas-Ekanathan Jul 24, 2024
b9083ff
Merge pull request #3 from Shreyas-Ekanathan/head
Shreyas-Ekanathan Jul 24, 2024
fdc92bb
Delete src/algorithms/explicit_rk_pde.jl
Shreyas-Ekanathan Jul 25, 2024
3a48a6e
Delete src/caches/extrapolation_caches.jl
Shreyas-Ekanathan Jul 25, 2024
5400ec8
Delete src/caches/feagin_caches.jl
Shreyas-Ekanathan Jul 25, 2024
38ad679
Delete src/caches/low_storage_rk_caches.jl
Shreyas-Ekanathan Jul 25, 2024
b011f36
Delete src/caches/rkc_caches.jl
Shreyas-Ekanathan Jul 25, 2024
075885b
Delete src/caches/rkn_caches.jl
Shreyas-Ekanathan Jul 25, 2024
ec9c8b3
Delete src/caches/ssprk_caches.jl
Shreyas-Ekanathan Jul 25, 2024
2222a9c
Delete src/caches/symplectic_caches.jl
Shreyas-Ekanathan Jul 25, 2024
e9421a9
Delete src/caches/verner_caches.jl
Shreyas-Ekanathan Jul 25, 2024
19e524e
Delete src/dense/verner_addsteps.jl
Shreyas-Ekanathan Jul 25, 2024
7f8de0b
Delete src/perform_step/extrapolation_perform_step.jl
Shreyas-Ekanathan Jul 25, 2024
2eb16b6
Delete src/perform_step/feagin_rk_perform_step.jl
Shreyas-Ekanathan Jul 25, 2024
82cc872
Delete src/perform_step/low_storage_rk_perform_step.jl
Shreyas-Ekanathan Jul 25, 2024
7d75164
Delete src/perform_step/rkc_perform_step.jl
Shreyas-Ekanathan Jul 25, 2024
4112f61
Delete src/perform_step/rkn_perform_step.jl
Shreyas-Ekanathan Jul 25, 2024
28759d0
Delete src/perform_step/ssprk_perform_step.jl
Shreyas-Ekanathan Jul 25, 2024
8372fe0
Delete src/perform_step/symplectic_perform_step.jl
Shreyas-Ekanathan Jul 25, 2024
84158ab
Delete src/perform_step/verner_rk_perform_step.jl
Shreyas-Ekanathan Jul 25, 2024
0baa146
Delete src/rkc_utils.jl
Shreyas-Ekanathan Jul 25, 2024
1aafef3
Delete src/tableaus/feagin_tableaus.jl
Shreyas-Ekanathan Jul 25, 2024
2dd0999
Delete src/tableaus/rkc_tableaus.jl
Shreyas-Ekanathan Jul 25, 2024
47ea1ef
Delete src/tableaus/rkn_tableaus.jl
Shreyas-Ekanathan Jul 25, 2024
aa29690
Delete src/tableaus/symplectic_tableaus.jl
Shreyas-Ekanathan Jul 25, 2024
131ea9c
Delete src/tableaus/verner_tableaus.jl
Shreyas-Ekanathan Jul 25, 2024
f6dac89
Delete test/algconvergence/ode_extrapolation_tests.jl
Shreyas-Ekanathan Jul 25, 2024
01688f1
Delete test/algconvergence/ode_feagin_tests.jl
Shreyas-Ekanathan Jul 25, 2024
95a7fd4
Delete test/algconvergence/ode_low_storage_rk_tests.jl
Shreyas-Ekanathan Jul 25, 2024
0a99b48
Delete test/algconvergence/ode_ssprk_tests.jl
Shreyas-Ekanathan Jul 25, 2024
f896f73
Delete test/algconvergence/rkc_tests.jl
Shreyas-Ekanathan Jul 25, 2024
459ccf3
Delete test/algconvergence/symplectic_tests.jl
Shreyas-Ekanathan Jul 25, 2024
798fef8
Update ode_firk_tests.jl
Shreyas-Ekanathan Jul 25, 2024
2020765
Merge pull request #4 from Shreyas-Ekanathan/master
Shreyas-Ekanathan Jul 25, 2024
9378160
Merge pull request #5 from Shreyas-Ekanathan/upstream
Shreyas-Ekanathan Jul 25, 2024
d3c8a52
Merge branch 'master' of https://github.com/Shreyas-Ekanathan/Ordinar…
Shreyas-Ekanathan Jul 27, 2024
cf648e8
Update firk_tableaus.jl
Shreyas-Ekanathan Jul 27, 2024
5b0cbe1
Merge branch 'master' of https://github.com/Shreyas-Ekanathan/Ordinar…
Shreyas-Ekanathan Aug 6, 2024
c887941
add to tableau, create cache, oop method
Shreyas-Ekanathan Aug 6, 2024
1598f04
format
Shreyas-Ekanathan Aug 6, 2024
45641a3
calculate T
Shreyas-Ekanathan Aug 9, 2024
a685028
add in-place
Shreyas-Ekanathan Aug 10, 2024
91cd34b
Update firk_perform_step.jl
Shreyas-Ekanathan Aug 11, 2024
d5beb29
Update integrator_interface.jl
Shreyas-Ekanathan Aug 11, 2024
9fee28b
Update integrator_interface.jl
Shreyas-Ekanathan Aug 11, 2024
67bb0fe
rename, formatting
Shreyas-Ekanathan Aug 13, 2024
30cc947
Merge branch 'upstream' of https://github.com/Shreyas-Ekanathan/Ordin…
Shreyas-Ekanathan Aug 15, 2024
f182b38
Merge pull request #7 from Shreyas-Ekanathan/master
Shreyas-Ekanathan Aug 15, 2024
1125bc1
Merge pull request #9 from Shreyas-Ekanathan/upstream
Shreyas-Ekanathan Aug 15, 2024
d836402
Merge pull request #10 from SciML/master
Shreyas-Ekanathan Aug 15, 2024
3d09fa2
lots of edits
Shreyas-Ekanathan Aug 21, 2024
de394f3
Merge branch 'master' into upstream
Shreyas-Ekanathan Aug 21, 2024
4228c83
Merge pull request #11 from Shreyas-Ekanathan/upstream
Shreyas-Ekanathan Aug 21, 2024
6df8b72
tweaks
Shreyas-Ekanathan Aug 22, 2024
51d2012
Merge pull request #12 from Shreyas-Ekanathan/upstream
Shreyas-Ekanathan Aug 22, 2024
9eb4538
fix collocation on radauIIA9
Shreyas-Ekanathan Aug 23, 2024
1d7a4bd
fix collocation on adaptive radau
Shreyas-Ekanathan Aug 23, 2024
c69f1c1
oop works!
Shreyas-Ekanathan Aug 24, 2024
f1ae02f
Merge pull request #13 from Shreyas-Ekanathan/upstream
Shreyas-Ekanathan Aug 25, 2024
2d6b5f6
fixes
Shreyas-Ekanathan Aug 25, 2024
aaeed16
Merge branch 'master' of https://github.com/Shreyas-Ekanathan/Ordinar…
Shreyas-Ekanathan Aug 25, 2024
064c77d
Update ode_firk_tests.jl
Shreyas-Ekanathan Aug 27, 2024
bff13df
clean up
Shreyas-Ekanathan Aug 30, 2024
55259d5
IN PLACE
Shreyas-Ekanathan Sep 1, 2024
ff10299
Update ode_firk_tests.jl
Shreyas-Ekanathan Sep 1, 2024
df3063f
cached tableaus
Shreyas-Ekanathan Sep 2, 2024
e8ba6c7
fix types
Shreyas-Ekanathan Sep 2, 2024
52613d3
clean up
Shreyas-Ekanathan Sep 2, 2024
d9545fd
tweaks
Shreyas-Ekanathan Sep 3, 2024
2ee7782
Merge branch 'SciML:master' into upstream
Shreyas-Ekanathan Sep 3, 2024
0740aea
Merge pull request #14 from Shreyas-Ekanathan/upstream
Shreyas-Ekanathan Sep 3, 2024
8574f04
edits
Shreyas-Ekanathan Sep 3, 2024
71e13ef
Update firk_perform_step.jl
Shreyas-Ekanathan Sep 3, 2024
f17907a
types
Shreyas-Ekanathan Sep 3, 2024
f52c9e4
fix tableaus
Shreyas-Ekanathan Sep 4, 2024
42f5280
edits
Shreyas-Ekanathan Sep 6, 2024
40baa62
minor fixes
oscardssmith Sep 6, 2024
12630e0
little things
Shreyas-Ekanathan Sep 6, 2024
4252639
fix types
Shreyas-Ekanathan Sep 7, 2024
3318e37
explicitly perform multiplications
Shreyas-Ekanathan Sep 8, 2024
9c15269
caches
Shreyas-Ekanathan Sep 12, 2024
75168c8
small edits
Shreyas-Ekanathan Sep 14, 2024
533f9a8
@..
Shreyas-Ekanathan Sep 15, 2024
fed9fc5
add adaptivity
Shreyas-Ekanathan Sep 18, 2024
c0b5936
Update ode_firk_tests.jl
Shreyas-Ekanathan Sep 18, 2024
bdb0a63
Update ode_firk_tests.jl
Shreyas-Ekanathan Sep 19, 2024
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
10 changes: 8 additions & 2 deletions lib/OrdinaryDiffEqFIRK/src/firk_caches.jl
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,7 @@ mutable struct AdaptiveRadauCache{uType, cuType, uNoUnitsType, rateType, JType,
dw2::Vector{cuType}
cubuff::Vector{cuType}
cont::Vector{uType}
derivatives:: Matrix{uType}
du1::rateType
fsalfirst::rateType
ks::Vector{rateType}
Expand Down Expand Up @@ -594,10 +595,15 @@ function alg_cache(alg::AdaptiveRadau, u, rate_prototype, ::Type{uEltypeNoUnits}
recursivefill!.(cubuff, false)

cont = Vector{typeof(u)}(undef, num_stages)
for i in 1: num_stages
for i in 1 : num_stages
cont[i] = zero(u)
end

derivatives = Matrix{typeof(u)}(undef, num_stages, num_stages)
for i in 1 : num_stages, j in 1 : num_stages
derivatives[i, j] = zero(u)
end

fsalfirst = zero(rate_prototype)
fw = Vector{typeof(rate_prototype)}(undef, num_stages)
ks = Vector{typeof(rate_prototype)}(undef, num_stages)
Expand Down Expand Up @@ -635,7 +641,7 @@ function alg_cache(alg::AdaptiveRadau, u, rate_prototype, ::Type{uEltypeNoUnits}
atol = reltol isa Number ? reltol : zero(reltol)

AdaptiveRadauCache(u, uprev,
z, w, dw1, ubuff, dw2, cubuff, cont,
z, w, dw1, ubuff, dw2, cubuff, cont, derivatives,
du1, fsalfirst, ks, k, fw,
J, W1, W2,
uf, tab, κ, one(uToltype), 10000, tmp,
Expand Down
32 changes: 13 additions & 19 deletions lib/OrdinaryDiffEqFIRK/src/firk_perform_step.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1369,21 +1369,16 @@ end

J = calc_J(integrator, cache)

#if u isa Number
# LU1 = Complex(-γdt * mass_matrix + J)
# LU2 = -(αdt[1] + βdt[1] * im) * mass_matrix + J
#else
LU1 = lu(-γdt * mass_matrix + J)
LU2 = lu(-(αdt[1] + βdt[1] * im) * mass_matrix + J)
#end
LU = [LU2 for _ in 1:(num_stages + 1) ÷ 2]
LU2 = Vector{Complex{typeof(u)}}(undef, (num_stages - 1) ÷ 2)
oscardssmith marked this conversation as resolved.
Show resolved Hide resolved
if u isa Number
for i in 3 :(num_stages + 1) ÷ 2
LU[i] = -(αdt[i - 1] + βdt[i - 1] * im) * mass_matrix + J
LU1 = -γdt * mass_matrix + J
for i in 1 : (num_stages - 1) ÷ 2
LU2[i] = -(αdt[i] + βdt[i] * im) * mass_matrix + J
end
else
for i in 3 :(num_stages + 1) ÷ 2
LU[i] = lu(-(αdt[i - 1] + βdt[i - 1] * im) * mass_matrix + J)
LU1 = lu(-γdt * mass_matrix + J)
for i in 1 : (num_stages - 1) ÷ 2
LU2[i] = lu(-(αdt[i] + βdt[i] * im) * mass_matrix + J)
end
end

Expand Down Expand Up @@ -1453,7 +1448,7 @@ end
dw = Vector{typeof(u)}(undef, num_stages)
dw[1] = _reshape(LU1 \ _vec(rhs[1]), axes(u))
for i in 2 :(num_stages + 1) ÷ 2
tmp = _reshape(LU[i] \ _vec(@.. rhs[2 * i - 2] + rhs[2 * i - 1] * im), axes(u))
tmp = _reshape(LU2[i - 1] \ _vec(@.. rhs[2 * i - 2] + rhs[2 * i - 1] * im), axes(u))
dw[2 * i - 2] = real(tmp)
dw[2 * i - 1] = imag(tmp)
end
Expand Down Expand Up @@ -1555,7 +1550,7 @@ end
@muladd function perform_step!(integrator, cache::AdaptiveRadauCache, repeat_step = false)
@unpack t, dt, uprev, u, f, p, fsallast, fsalfirst = integrator
@unpack T, TI, γ, α, β, c, #=e,=# num_stages = cache.tab
@unpack κ, cont, z, w = cache
@unpack κ, cont, derivatives, z, w = cache
@unpack dw1, ubuff, dw2, cubuff = cache
@unpack ks, k, fw, J, W1, W2 = cache
@unpack tmp, atmp, jac_config, linsolve1, linsolve2, rtol, atol, step_limiter! = cache
Expand Down Expand Up @@ -1763,15 +1758,14 @@ end
if integrator.EEst <= oneunit(integrator.EEst)
cache.dtprev = dt
if alg.extrapolant != :constant
derivatives = Matrix{typeof(u)}(undef, num_stages, num_stages)
derivatives[1, 1] = @.. z[1] / c[1]
@.. derivatives[1, 1] = z[1] / c[1]
for j in 2 : num_stages
derivatives[1, j] = @.. (z[j - 1] - z[j]) / (c[j - 1] - c[j]) #first derivatives
@.. derivatives[1, j] = (z[j - 1] - z[j]) / (c[j - 1] - c[j]) #first derivatives
end
for i in 2 : num_stages
derivatives[i, i] = @.. (derivatives[i - 1, i] - derivatives[i - 1, i - 1]) / c[i]
@.. derivatives[i, i] = (derivatives[i - 1, i] - derivatives[i - 1, i - 1]) / c[i]
for j in i+1 : num_stages
derivatives[i, j] = @.. (derivatives[i - 1, j - 1] - derivatives[i - 1, j]) / (c[j - i] - c[j]) #all others
@.. derivatives[i, j] = (derivatives[i - 1, j - 1] - derivatives[i - 1, j]) / (c[j - i] - c[j]) #all others
end
end
for i in 1 : num_stages
Expand Down
Loading