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

Commit cd9201a

Browse files
strop utilities tests
1 parent 32811aa commit cd9201a

File tree

1 file changed

+0
-74
lines changed

1 file changed

+0
-74
lines changed

test/Misc/utils.jl

Lines changed: 0 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,9 @@
11
using Test, LinearAlgebra
22
using DiffEqOperators
3-
using ModelingToolkit
43

54
@testset "utility functions" begin
65
@test DiffEqOperators.unit_indices(2) == (CartesianIndex(1,0), CartesianIndex(0,1))
76
@test DiffEqOperators.add_dims(zeros(2,2), ndims(zeros(2,2)) + 2) == [6. 6.; 0. 0.; 0. 0.]
87
@test DiffEqOperators.perpindex(collect(1:5), 3) == [1, 2, 4, 5]
98
@test DiffEqOperators.perpsize(zeros(2,2,3,2), 3) == (2, 2, 2)
109
end
11-
12-
@testset "count differentials 1D" begin
13-
@parameters t x
14-
@variables u(..)
15-
Dt = Differential(t)
16-
17-
Dx = Differential(x)
18-
eq = Dt(u(t,x)) ~ -Dx(u(t,x))
19-
@test first(DiffEqOperators.differential_order(eq.rhs, x.val)) == 1
20-
@test isempty(DiffEqOperators.differential_order(eq.rhs, t.val))
21-
@test first(DiffEqOperators.differential_order(eq.lhs, t.val)) == 1
22-
@test isempty(DiffEqOperators.differential_order(eq.lhs, x.val))
23-
24-
Dxx = Differential(x)^2
25-
eq = Dt(u(t,x)) ~ Dxx(u(t,x))
26-
@test first(DiffEqOperators.differential_order(eq.rhs, x.val)) == 2
27-
@test isempty(DiffEqOperators.differential_order(eq.rhs, t.val))
28-
@test first(DiffEqOperators.differential_order(eq.lhs, t.val)) == 1
29-
@test isempty(DiffEqOperators.differential_order(eq.lhs, x.val))
30-
31-
Dxxxx = Differential(x)^4
32-
eq = Dt(u(t,x)) ~ -Dxxxx(u(t,x))
33-
@test first(DiffEqOperators.differential_order(eq.rhs, x.val)) == 4
34-
@test isempty(DiffEqOperators.differential_order(eq.rhs, t.val))
35-
@test first(DiffEqOperators.differential_order(eq.lhs, t.val)) == 1
36-
@test isempty(DiffEqOperators.differential_order(eq.lhs, x.val))
37-
end
38-
39-
@testset "count differentials 2D" begin
40-
@parameters t x y
41-
@variables u(..)
42-
Dxx = Differential(x)^2
43-
Dyy = Differential(y)^2
44-
Dt = Differential(t)
45-
46-
eq = Dt(u(t,x,y)) ~ Dxx(u(t,x,y)) + Dyy(u(t,x,y))
47-
@test first(DiffEqOperators.differential_order(eq.rhs, x.val)) == 2
48-
@test first(DiffEqOperators.differential_order(eq.rhs, y.val)) == 2
49-
@test isempty(DiffEqOperators.differential_order(eq.rhs, t.val))
50-
@test first(DiffEqOperators.differential_order(eq.lhs, t.val)) == 1
51-
@test isempty(DiffEqOperators.differential_order(eq.lhs, x.val))
52-
@test isempty(DiffEqOperators.differential_order(eq.lhs, y.val))
53-
end
54-
55-
@testset "count with mixed terms" begin
56-
@parameters t x y
57-
@variables u(..)
58-
Dxx = Differential(x)^2
59-
Dyy = Differential(y)^2
60-
Dx = Differential(x)
61-
Dy = Differential(y)
62-
Dt = Differential(t)
63-
64-
eq = Dt(u(t,x,y)) ~ Dxx(u(t,x,y)) + Dyy(u(t,x,y)) + Dx(Dy(u(t,x,y)))
65-
@test DiffEqOperators.differential_order(eq.rhs, x.val) == Set([2, 1])
66-
@test DiffEqOperators.differential_order(eq.rhs, y.val) == Set([2, 1])
67-
end
68-
69-
@testset "Kuramoto–Sivashinsky equation" begin
70-
@parameters x, t
71-
@variables u(..)
72-
Dt = Differential(t)
73-
Dx = Differential(x)
74-
Dx2 = Differential(x)^2
75-
Dx3 = Differential(x)^3
76-
Dx4 = Differential(x)^4
77-
78-
α = 1
79-
β = 4
80-
γ = 1
81-
eq = Dt(u(x,t)) + u(x,t)*Dx(u(x,t)) + α*Dx2(u(x,t)) + β*Dx3(u(x,t)) + γ*Dx4(u(x,t)) ~ 0
82-
@test DiffEqOperators.differential_order(eq.lhs, x.val) == Set([4, 3, 2, 1])
83-
end

0 commit comments

Comments
 (0)