Skip to content
This repository was archived by the owner on Jul 19, 2023. It is now read-only.

Commit 734e5b7

Browse files
committed
Added tests for generic operators to higher order - will need updating after the new derivative operator is finalized
1 parent 31735b7 commit 734e5b7

File tree

3 files changed

+46
-20
lines changed

3 files changed

+46
-20
lines changed

test/generic_operator_check.jl

Lines changed: 0 additions & 19 deletions
This file was deleted.
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
using DiffEqOperators
2+
3+
n = 100
4+
x=0.0:0.01:2π
5+
xprime = x[2:(end-1)]
6+
dx=diff(x)
7+
y = exp.(π*x)
8+
y_im = exp.(π*im*x)
9+
yim_ = y_im[2:(end-1)]
10+
y_ = y[2:(end-1)]
11+
12+
13+
14+
for dor in 1:6, aor in 1:8
15+
16+
D1 = DerivativeOperator{Float64}(dor,aor,dx[1],length(x))
17+
D2 = DiffEqOperators.FiniteDifference{Float64}(dor,aor,dx,length(x))
18+
D = (D1,D2)
19+
@test convert(Array, D1) convert(Array, D2)
20+
21+
#take derivatives
22+
yprime1 = D1*y
23+
yprime2 = D2*y
24+
25+
#test result
26+
@test yprime1 ^dor)*y_ # test operator with known derivative of exp(kx)
27+
@test yprime2 ^dor)*y_ # test operator with known derivative of exp(kx)
28+
29+
#test equivalance
30+
@test yprime1 yprime2
31+
32+
#take derivatives
33+
y_imprime1 = D1*y_im
34+
y_imprime2 = D2*y_im
35+
36+
#test result
37+
@test y_imprime1 ((pi*im)^dor)*yim_ # test operator with known derivative of exp(jkx)
38+
@test y_imprime2 ((pi*im)^dor)*yim_ # test operator with known derivative of exp(jkx)
39+
40+
#test equivalance
41+
@test y_imprime1 y_imprime2
42+
43+
#TODO: implement specific tests for the left and right boundary regions, waiting until after update
44+
end
45+
end

test/runtests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import Base: isapprox
55
@time @safetestset "Robin Boundary Condition Operators" begin include("robin.jl") end
66
@time @safetestset "JacVec Operators Interface" begin include("jacvec_operators.jl") end
77
@time @safetestset "Composite Operators Interface" begin include("composite_operators_interface.jl") end
8-
8+
@time @safetestset "Validate and Compare Generic Operators" begin include("generic_operator_validation.jl") end
99
@time @safetestset "Derivative Operators Interface" begin include("derivative_operators_interface.jl") end
1010
#@time @safetestset "2nd order check" begin include("2nd_order_check.jl") end
1111
#@time @safetestset "Finite Difference Operator" begin include("generic_operator_check.jl") end

0 commit comments

Comments
 (0)