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

Commit a1dcf61

Browse files
#352 more 2D tests
1 parent 7801125 commit a1dcf61

3 files changed

Lines changed: 13 additions & 9 deletions

File tree

test/MOL/MOL_2D_Diffusion.jl

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,15 @@ using ModelingToolkit: Differential
3737

3838
# Method of lines discretization
3939
dx = 0.1; dy = 0.2
40-
discretization = MOLFiniteDifference([x=>dx,y=>dy],t)
41-
prob = ModelingToolkit.discretize(pdesys,discretization)
42-
sol = solve(prob,Tsit5())
43-
44-
# Test against exact solution
45-
# TODO: do this properly when sol[u] with reshape etc works
46-
@test sol.u[1][1] analytic_sol_func(sol.t[1],0.1,0.2)
47-
@test sol.u[1][2] analytic_sol_func(sol.t[1],0.2,0.2)
40+
for order in [2,4,6]
41+
discretization = MOLFiniteDifference([x=>dx,y=>dy],t;centered_order=order)
42+
prob = ModelingToolkit.discretize(pdesys,discretization)
43+
sol = solve(prob,Tsit5())
44+
45+
# Test against exact solution
46+
# TODO: do this properly when sol[u] with reshape etc works
47+
@test sol.u[1][1] analytic_sol_func(sol.t[1],0.1,0.2)
48+
@test sol.u[1][2] analytic_sol_func(sol.t[1],0.2,0.2)
49+
50+
end
4851
end

test/runtests.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ end
3838
if GROUP == "All" || GROUP == "MOLFiniteDifference"
3939
@time @safetestset "MOLFiniteDifference Interface" begin include("MOL/MOLtest.jl") end
4040
#@time @safetestset "MOLFiniteDifference Interface: Linear Convection" begin include("MOL/MOL_1D_Linear_Convection.jl") end
41-
@time @safetestset "MOLFiniteDifference Interface: Linear Diffusion" begin include("MOL/MOL_1D_Linear_Diffusion.jl") end
41+
@time @safetestset "MOLFiniteDifference Interface: 1D Diffusion" begin include("MOL/MOL_1D_Diffusion.jl") end
42+
@time @safetestset "MOLFiniteDifference Interface: 2D Diffusion" begin include("MOL/MOL_2D_Diffusion.jl") end
4243
end
4344

4445
if GROUP == "All" || GROUP == "Misc"

0 commit comments

Comments
 (0)