comparison test/testSbpOperators.jl @ 764:d34b515b0ae7 operator_storage_array_of_table

Add functions for reading stencil sets
author Jonatan Werpers <jonatan@werpers.com>
date Sat, 06 Feb 2021 20:45:34 +0100
parents 5ff162f3ed72
children fdd48f6ace1c
comparison
equal deleted inserted replaced
763:5ff162f3ed72 764:d34b515b0ae7
91 91
92 H.closure = ["-1/49", "0", "59/49", "-118/49", "64/49", "-4/49"] 92 H.closure = ["-1/49", "0", "59/49", "-118/49", "64/49", "-4/49"]
93 """ 93 """
94 94
95 parsed_toml = TOML.parse(toml_str) 95 parsed_toml = TOML.parse(toml_str)
96
97 @testset "get_stencil_set" begin
98 @test get_stencil_set(parsed_toml; order = 2) isa Dict
99 @test get_stencil_set(parsed_toml; order = 2) == parsed_toml["stencil_set"][1]
100 @test get_stencil_set(parsed_toml; test = 1) == parsed_toml["stencil_set"][2]
101 @test get_stencil_set(parsed_toml; order = 4, test = 2) == parsed_toml["stencil_set"][3]
102
103 @test_throws ArgumentError get_stencil_set(parsed_toml; test = 2)
104 @test_throws ArgumentError get_stencil_set(parsed_toml; order = 4)
105 end
106
96 @testset "get_stencil" begin 107 @testset "get_stencil" begin
97 @test get_stencil(parsed_toml, "order2", "D1", "inner_stencil") == Stencil((-1/2, 0., 1/2), center=2) 108 @test get_stencil(parsed_toml, "order2", "D1", "inner_stencil") == Stencil((-1/2, 0., 1/2), center=2)
98 @test get_stencil(parsed_toml, "order2", "D1", "inner_stencil", center=1) == Stencil((-1/2, 0., 1/2); center=1) 109 @test get_stencil(parsed_toml, "order2", "D1", "inner_stencil", center=1) == Stencil((-1/2, 0., 1/2); center=1)
99 @test get_stencil(parsed_toml, "order2", "D1", "inner_stencil", center=3) == Stencil((-1/2, 0., 1/2); center=3) 110 @test get_stencil(parsed_toml, "order2", "D1", "inner_stencil", center=3) == Stencil((-1/2, 0., 1/2); center=3)
100 111
315 @test Dₓₓ*monomials[3] ≈ monomials[1] atol = 5e-10 326 @test Dₓₓ*monomials[3] ≈ monomials[1] atol = 5e-10
316 @test Dₓₓ*monomials[4] ≈ monomials[2] atol = 5e-10 327 @test Dₓₓ*monomials[4] ≈ monomials[2] atol = 5e-10
317 @test Dₓₓ*v ≈ vₓₓ rtol = 5e-4 norm = l2 328 @test Dₓₓ*v ≈ vₓₓ rtol = 5e-4 norm = l2
318 end 329 end
319 end 330 end
320 331
321 @testset "2D" begin 332 @testset "2D" begin
322 l2(v) = sqrt(prod(spacing(g_2D))*sum(v.^2)); 333 l2(v) = sqrt(prod(spacing(g_2D))*sum(v.^2));
323 binomials = () 334 binomials = ()
324 maxOrder = 4; 335 maxOrder = 4;
325 for i = 0:maxOrder-1 336 for i = 0:maxOrder-1