comparison test/SbpOperators/volumeops/laplace/laplace_test.jl @ 1615:b74e1a21265f feature/boundary_conditions

Add todos to test
author Vidar Stiernström <vidar.stiernstrom@gmail.com>
date Sun, 09 Jun 2024 17:04:01 -0700
parents 15488c889a50
children 707fc9761c2b 471a948cd2b2
comparison
equal deleted inserted replaced
1614:13063028d604 1615:b74e1a21265f
87 @test Δ isa LazyTensor{Float64,3,3} 87 @test Δ isa LazyTensor{Float64,3,3}
88 end 88 end
89 end 89 end
90 90
91 @testset "sat_tensors" begin 91 @testset "sat_tensors" begin
92 # TODO: The following tests should be implemented
93 # 1. Symmetry D'H == H'D (test_broken below)
94 # 2. Test eigenvalues of and/or solution to Poisson
95 # 3. Test tuning of Dirichlet conditions
96 #
97 # These tests are likely easiest to implement once
98 # we have support for generating matrices from tensors.
99
92 operator_path = sbp_operators_path()*"standard_diagonal.toml" 100 operator_path = sbp_operators_path()*"standard_diagonal.toml"
93 orders = (2,4) 101 orders = (2,4)
94 tols = (5e-2,5e-4) 102 tols = (5e-2,5e-4)
95 sz = (201,401) 103 sz = (201,401)
96 g = equidistant_grid((0.,0.), (1.,1.), sz...) 104 g = equidistant_grid((0.,0.), (1.,1.), sz...)
97 105
98 # Verify implementation of sat_tesnors by testing accuracy and symmetry (TODO) 106 # Verify implementation of sat_tensors by testing accuracy and symmetry (TODO)
99 # of the operator D = Δ + SAT, where SAT is the tensor composition of the 107 # of the operator D = Δ + SAT, where SAT is the tensor composition of the
100 # operators from sat_tensor. Note that SAT*u should approximate 0 for the 108 # operators from sat_tensor. Note that SAT*u should approximate 0 for the
101 # conditions chosen. 109 # conditions chosen.
102 110
103 @testset "Dirichlet" begin 111 @testset "Dirichlet" begin
113 end 121 end
114 e = D*u .- Δu 122 e = D*u .- Δu
115 # Accuracy 123 # Accuracy
116 @test sqrt(sum(H*e.^2)) ≈ 0 atol = tol 124 @test sqrt(sum(H*e.^2)) ≈ 0 atol = tol
117 # Symmetry 125 # Symmetry
118 # TODO: # Consider generating the matrices to H and D and test D'H == H'D
119 r = randn(size(u)) 126 r = randn(size(u))
120 @test_broken (D'∘H - H∘D)*r .≈ 0 atol = 1e-13 # TODO: Need to implement apply_transpose for D. 127 @test_broken (D'∘H - H∘D)*r .≈ 0 atol = 1e-13 # TODO: Need to implement apply_transpose for D.
121 end 128 end
122 end 129 end
123 130
135 end 142 end
136 e = D*u .- Δu 143 e = D*u .- Δu
137 # Accuracy 144 # Accuracy
138 @test sqrt(sum(H*e.^2)) ≈ 0 atol = tol 145 @test sqrt(sum(H*e.^2)) ≈ 0 atol = tol
139 # Symmetry 146 # Symmetry
140 # TODO: # Consider generating the matrices to H and D and test D'H == H'D
141 r = randn(size(u)) 147 r = randn(size(u))
142 @test_broken (D'∘H - H∘D)*r .≈ 0 atol = 1e-13 # TODO: Need to implement apply_transpose for D. 148 @test_broken (D'∘H - H∘D)*r .≈ 0 atol = 1e-13 # TODO: Need to implement apply_transpose for D.
143 end 149 end
144 end 150 end
145 end 151 end