diff test/testSbpOperators.jl @ 388:5223872485cd refactor/sbp_operators_tests/collect_and_compare

Clean up grid creation
author Jonatan Werpers <jonatan@werpers.com>
date Thu, 01 Oct 2020 08:16:46 +0200
parents 4686c3509b54
children 0433ab553d13
line wrap: on
line diff
--- a/test/testSbpOperators.jl	Thu Oct 01 08:10:14 2020 +0200
+++ b/test/testSbpOperators.jl	Thu Oct 01 08:16:46 2020 +0200
@@ -32,9 +32,7 @@
 @testset "SecondDerivative" begin
     op = readOperator(sbp_operators_path()*"d2_4th.txt",sbp_operators_path()*"h_4th.txt")
     L = 3.5
-    g = EquidistantGrid((101,), (0.0,), (L,))
-    h_inv = inverse_spacing(g)
-    h = 1/h_inv[1];
+    g = EquidistantGrid(101, 0.0, L)
     Dₓₓ = SecondDerivative(g,op.innerStencil,op.closureStencils)
 
     f0(x::Float64) = 1.
@@ -66,8 +64,10 @@
     @test_broken Dₓₓ*v1 ≈ 0.0 atol=5e-11
     @test Dₓₓ*v2 ≈ v0 atol=5e-11
     @test Dₓₓ*v3 ≈ v1 atol=5e-11
+
     e4 = Dₓₓ*v4 - v2
     e5 = Dₓₓ*v5 + v5
+    h = spacing(g)[1];
     @test sqrt(h*sum(e4.^2)) ≈ 0 atol=5e-4
     @test sqrt(h*sum(e5.^2)) ≈ 0 atol=5e-4
 end
@@ -119,7 +119,7 @@
 @testset "DiagonalInnerProduct" begin
     op = readOperator(sbp_operators_path()*"d2_4th.txt",sbp_operators_path()*"h_4th.txt")
     L = 2.3
-    g = EquidistantGrid((77,), (0.0,), (L,))
+    g = EquidistantGrid(77, 0.0, L)
     H = DiagonalInnerProduct(g,op.quadratureClosure)
     v = ones(Float64, size(g))
 
@@ -152,7 +152,7 @@
 @testset "InverseDiagonalInnerProduct" begin
     op = readOperator(sbp_operators_path()*"d2_4th.txt",sbp_operators_path()*"h_4th.txt")
     L = 2.3
-    g = EquidistantGrid((77,), (0.0,), (L,))
+    g = EquidistantGrid(77, 0.0, L)
     H = DiagonalInnerProduct(g, op.quadratureClosure)
     Hi = InverseDiagonalInnerProduct(g,op.quadratureClosure)
     v = evalOn(g, x->sin(x))