Skip to content

Commit 43c98a5

Browse files
compatible with diffeq operator
1 parent a532c18 commit 43c98a5

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

src/integrators/exponential_rk_integrators.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
@inline function initialize!(integrator,cache::LawsonEulerConstantCache,f=integrator.f)
22
integrator.kshortsize = 2
33
integrator.k = eltype(integrator.sol.k)(integrator.kshortsize)
4-
rtmp = f[2](integrator.t,integrator.uprev)
4+
rtmp = f[2]
55
integrator.fsalfirst = rtmp # Pre-start fsal
66
end
77

88
@inline function perform_step!(integrator,cache::LawsonEulerConstantCache,f=integrator.f)
99
@unpack t,dt,uprev,u,k = integrator
1010
rtmp = integrator.fsalfirst
11-
A = f[1](t,u)
11+
A = f[1]
1212
u = expm(dt*A)*(uprev + dt*rtmp)
1313
rtmp = f[2](t+dt,u)
1414
k = A*u + rtmp # For the interpolation, needs k at the updated point
@@ -26,7 +26,7 @@ end
2626
integrator.k = eltype(integrator.sol.k)(integrator.kshortsize)
2727
integrator.k[1] = fsalfirst # this is wrong, since it's just rtmp. Should fsal this value though
2828
integrator.k[2] = k
29-
A = f[1](integrator.t,integrator.u,rtmp)
29+
A = f[1]
3030
A_mul_B!(cache.k,A,integrator.u)
3131
f[2](integrator.t,integrator.uprev,rtmp) # For the interpolation, needs k at the updated point
3232
integrator.fsalfirst .= cache.k .+ rtmp
@@ -35,7 +35,7 @@ end
3535
@inline function perform_step!(integrator,cache::LawsonEulerCache,f=integrator.f)
3636
@unpack t,dt,uprev,u = integrator
3737
@unpack k,rtmp,tmp = cache
38-
A = f[1](t,u,integrator.fsalfirst)
38+
A = f[1]
3939
M = expm(dt*A)
4040
tmp .= uprev .+ dt.*integrator.fsalfirst
4141
A_mul_B!(u,M,tmp)
@@ -55,7 +55,7 @@ end
5555
@inline function perform_step!(integrator,cache::NorsettEulerConstantCache,f=integrator.f)
5656
@unpack t,dt,uprev,u,k = integrator
5757
rtmp = integrator.fsalfirst
58-
A = f[1](t,u)
58+
A = f[1]
5959
u = uprev + ((expm(dt*A)-I)/A)*(A*uprev + rtmp)
6060
rtmp = f[2](t+dt,u)
6161
k = A*u + rtmp # For the interpolation, needs k at the updated point
@@ -82,7 +82,7 @@ end
8282
@inline function perform_step!(integrator,cache::NorsettEulerCache,f=integrator.f)
8383
@unpack t,dt,uprev,u = integrator
8484
@unpack k,rtmp,tmp = cache
85-
A = f[1](t,u,integrator.fsalfirst)
85+
A = f[1]
8686
M = ((expm(dt*A)-I)/A)
8787
A_mul_B!(tmp,A,uprev)
8888
tmp .+= rtmp

src/integrators/iif_integrators.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ end
3333
@unpack uhold,rhs,nl_rhs = cache
3434

3535
# If adaptive, this should be computed after and cached
36-
A = integrator.f[1](t,u)
36+
A = integrator.f[1]
3737
if typeof(cache) <: IIF1ConstantCache
3838
tmp = expm(A*dt)*(uprev)
3939
elseif typeof(cache) <: IIF2ConstantCache
@@ -91,7 +91,7 @@ end
9191
integrator.fsallast = cache.k
9292
integrator.kshortsize = 2
9393
integrator.k = eltype(integrator.sol.k)(integrator.kshortsize)
94-
A = integrator.f[1](integrator.t,integrator.u,cache.rtmp1)
94+
A = integrator.f[1]
9595
f[2](integrator.t,integrator.uprev,cache.rtmp1)
9696
A_mul_B!(cache.k,A,integrator.uprev)
9797
integrator.fsalfirst .= cache.k .+ cache.rtmp1
@@ -109,7 +109,7 @@ end
109109
@. k += 0.5dt*rtmp1
110110
end
111111

112-
A = integrator.f[1](t,uprev,rtmp1)
112+
A = integrator.f[1]
113113
M = expm(A*dt)
114114
A_mul_B!(tmp,M,k)
115115

test/linear_nonlinear_convergence_tests.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using DiffEqBase, OrdinaryDiffEq, Base.Test, DiffEqDevTools, SpecialMatrices
22
const μ = 1.01
33
f2 = (t,u) -> μ * u
4-
f1 = (t,u) -> μ
4+
f1 = μ
55
(p::typeof(f1))(::Type{Val{:analytic}},t,u0) = u0.*exp.(2μ*t)
66

77
prob = SplitODEProblem((f1,f2),1/2,(0.0,1.0))
@@ -19,7 +19,7 @@ sim = test_convergence(dts,prob,NorsettEuler())
1919

2020
u0 = rand(2)
2121
A = Strang(2)
22-
f1 = (t,u,du) -> A
22+
f1 = A
2323
f2 = (t,u,du) -> du .= μ .* u
2424
function (p::typeof(f1))(::Type{Val{:analytic}},t,u0)
2525
tmp = (A+μ*I)*t

0 commit comments

Comments
 (0)