Mercurial > repos > public > sbplib_julia
comparison test/testSbpOperators.jl @ 382:5c10cd0ed1fe
testSbpOperators.jl: Add a test for Quadrature and mark some tests broken
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Wed, 30 Sep 2020 21:53:52 +0200 |
parents | de4746d6d126 |
children | aaf8e331cb80 |
comparison
equal
deleted
inserted
replaced
381:dacbcba33d7d | 382:5c10cd0ed1fe |
---|---|
141 Ly = 5.2 | 141 Ly = 5.2 |
142 g = EquidistantGrid((77,66), (0.0, 0.0), (Lx,Ly)) | 142 g = EquidistantGrid((77,66), (0.0, 0.0), (Lx,Ly)) |
143 | 143 |
144 Q = Quadrature(g, op.quadratureClosure) | 144 Q = Quadrature(g, op.quadratureClosure) |
145 | 145 |
146 v = ones(Float64, size(g)) | |
147 | |
148 @test Q isa TensorMapping{T,2,2} where T | 146 @test Q isa TensorMapping{T,2,2} where T |
149 @test Q' isa TensorMapping{T,2,2} where T | 147 @test Q' isa TensorMapping{T,2,2} where T |
150 @test sum(collect(Q*v)) ≈ (Lx*Ly) | 148 |
151 @test collect(Q*v) == collect(Q'*v) | 149 v = ones(Float64, size(g)) |
150 @test sum(Q*v) ≈ Lx*Ly | |
151 | |
152 v = 2*ones(Float64, size(g)) | |
153 @test_broken sum(Q*v) ≈ 2*Lx*Ly | |
154 | |
155 @test Q*v == Q'*v | |
152 end | 156 end |
153 | 157 |
154 @testset "InverseDiagonalInnerProduct" begin | 158 @testset "InverseDiagonalInnerProduct" begin |
155 op = readOperator(sbp_operators_path()*"d2_4th.txt",sbp_operators_path()*"h_4th.txt") | 159 op = readOperator(sbp_operators_path()*"d2_4th.txt",sbp_operators_path()*"h_4th.txt") |
156 L = 2.3 | 160 L = 2.3 |
175 Qinv = InverseQuadrature(g, op.quadratureClosure) | 179 Qinv = InverseQuadrature(g, op.quadratureClosure) |
176 v = evalOn(g, (x,y)-> x^2 + (y-1)^2 + x*y) | 180 v = evalOn(g, (x,y)-> x^2 + (y-1)^2 + x*y) |
177 | 181 |
178 @test Qinv isa TensorMapping{T,2,2} where T | 182 @test Qinv isa TensorMapping{T,2,2} where T |
179 @test Qinv' isa TensorMapping{T,2,2} where T | 183 @test Qinv' isa TensorMapping{T,2,2} where T |
180 @test collect(Qinv*(Q*v)) ≈ v | 184 @test_broken collect(Qinv*(Q*v)) ≈ v |
181 @test collect(Qinv*v) == collect(Qinv'*v) | 185 @test collect(Qinv*v) == collect(Qinv'*v) |
182 end | 186 end |
183 # | 187 # |
184 # @testset "BoundaryValue" begin | 188 # @testset "BoundaryValue" begin |
185 # op = readOperator(sbp_operators_path()*"d2_4th.txt",sbp_operators_path()*"h_4th.txt") | 189 # op = readOperator(sbp_operators_path()*"d2_4th.txt",sbp_operators_path()*"h_4th.txt") |