Mercurial > repos > public > sbplib_julia
comparison test/testSbpOperators.jl @ 395:737e597e0e6d refactor/sbp_operators_tests/collect_and_compare
Rewrite broken tests as testing that the norm is zero
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Sun, 04 Oct 2020 19:36:52 +0200 |
parents | 0433ab553d13 |
children | 9aff09ca0052 |
comparison
equal
deleted
inserted
replaced
389:0433ab553d13 | 395:737e597e0e6d |
---|---|
1 using Test | 1 using Test |
2 using Sbplib.SbpOperators | 2 using Sbplib.SbpOperators |
3 using Sbplib.Grids | 3 using Sbplib.Grids |
4 using Sbplib.RegionIndices | 4 using Sbplib.RegionIndices |
5 using Sbplib.LazyTensors | 5 using Sbplib.LazyTensors |
6 using LinearAlgebra | |
6 | 7 |
7 # TODO: Remove collects for all the tests with TensorApplications | 8 # TODO: Remove collects for all the tests with TensorApplications |
8 | 9 |
9 @testset "SbpOperators" begin | 10 @testset "SbpOperators" begin |
10 | 11 |
58 # differently? | 59 # differently? |
59 # 4th order interior stencil, 2nd order boundary stencil, | 60 # 4th order interior stencil, 2nd order boundary stencil, |
60 # implies that L*v should be exact for v - monomial up to order 3. | 61 # implies that L*v should be exact for v - monomial up to order 3. |
61 # Exact differentiation is measured point-wise. For other grid functions | 62 # Exact differentiation is measured point-wise. For other grid functions |
62 # the error is measured in the l2-norm. | 63 # the error is measured in the l2-norm. |
63 @test_broken Dₓₓ*v0 ≈ 0.0 atol=5e-11 | 64 @test norm(Dₓₓ*v0) ≈ 0.0 atol=5e-10 |
64 @test_broken Dₓₓ*v1 ≈ 0.0 atol=5e-11 | 65 @test norm(Dₓₓ*v1) ≈ 0.0 atol=5e-10 |
65 @test Dₓₓ*v2 ≈ v0 atol=5e-11 | 66 @test Dₓₓ*v2 ≈ v0 atol=5e-11 |
66 @test Dₓₓ*v3 ≈ v1 atol=5e-11 | 67 @test Dₓₓ*v3 ≈ v1 atol=5e-11 |
67 | 68 |
68 h = spacing(g)[1]; | 69 h = spacing(g)[1]; |
69 l2(v) = sqrt(h*sum(v.^2)) | 70 l2(v) = sqrt(h*sum(v.^2)) |
101 | 102 |
102 # 4th order interior stencil, 2nd order boundary stencil, | 103 # 4th order interior stencil, 2nd order boundary stencil, |
103 # implies that L*v should be exact for v - monomial up to order 3. | 104 # implies that L*v should be exact for v - monomial up to order 3. |
104 # Exact differentiation is measured point-wise. For other grid functions | 105 # Exact differentiation is measured point-wise. For other grid functions |
105 # the error is measured in the H-norm. | 106 # the error is measured in the H-norm. |
106 @test_broken L*v0 ≈ 0 atol=5e-11 | 107 @test norm(L*v0) ≈ 0 atol=5e-10 |
107 @test_broken L*v1 ≈ 0 atol=5e-11 | 108 @test norm(L*v1) ≈ 0 atol=5e-10 |
108 @test L*v2 ≈ v0 # Seems to be more accurate | 109 @test L*v2 ≈ v0 # Seems to be more accurate |
109 @test L*v3 ≈ v1 atol=5e-10 | 110 @test L*v3 ≈ v1 atol=5e-10 |
110 | 111 |
111 h = spacing(g) | 112 h = spacing(g) |
112 l2(v) = sqrt(prod(h)*sum(v.^2)) | 113 l2(v) = sqrt(prod(h)*sum(v.^2)) |