Mercurial > repos > public > sbplib_julia
comparison DiffOps/test/runtests.jl @ 259:5571d2c5bf0f boundary_conditions
Implement BaoundaryQuadrature for Laplace
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Fri, 28 Jun 2019 14:17:13 +0200 |
parents | a827568fc251 |
children | f1e90a92ad74 |
comparison
equal
deleted
inserted
replaced
258:3ea8c60ccef3 | 259:5571d2c5bf0f |
---|---|
138 @test collect(d_w*g_y) ≈ G_w | 138 @test collect(d_w*g_y) ≈ G_w |
139 @test collect(d_e*g_y) ≈ G_e | 139 @test collect(d_e*g_y) ≈ G_e |
140 @test collect(d_s*g_x) ≈ G_s | 140 @test collect(d_s*g_x) ≈ G_s |
141 @test collect(d_n*g_x) ≈ G_n | 141 @test collect(d_n*g_x) ≈ G_n |
142 end | 142 end |
143 | |
144 @testset "BoundaryQuadrature" begin | |
145 op = readOperator(sbp_operators_path()*"d2_4th.txt",sbp_operators_path()*"h_4th.txt") | |
146 g = EquidistantGrid((10,11), (0.0, 0.0), (1.0,1.0)) | |
147 | |
148 H_w = BoundaryQuadrature(op, g, CartesianBoundary{1,Lower}()) | |
149 H_e = BoundaryQuadrature(op, g, CartesianBoundary{1,Upper}()) | |
150 H_s = BoundaryQuadrature(op, g, CartesianBoundary{2,Lower}()) | |
151 H_n = BoundaryQuadrature(op, g, CartesianBoundary{2,Upper}()) | |
152 | |
153 v = evalOn(g, (x,y)-> x^2 + (y-1)^2 + x*y) | |
154 | |
155 function get_quadrature(N) | |
156 qc = op.quadratureClosure | |
157 q = (qc..., ones(N-2*closuresize(op))..., reverse(qc)...) | |
158 @assert length(q) == N | |
159 return q | |
160 end | |
161 | |
162 v_w = v[1,:] | |
163 v_e = v[10,:] | |
164 v_s = v[:,1] | |
165 v_n = v[:,11] | |
166 | |
167 q_x = spacing(g)[1].*get_quadrature(10) | |
168 q_y = spacing(g)[2].*get_quadrature(11) | |
169 | |
170 @test H_w isa TensorOperator{T,1} where T | |
171 | |
172 @test domain_size(H_w, (3,)) == (3,) | |
173 @test domain_size(H_n, (3,)) == (3,) | |
174 | |
175 @test range_size(H_w, (3,)) == (3,) | |
176 @test range_size(H_n, (3,)) == (3,) | |
177 | |
178 @test size(H_w*v_w) == (11,) | |
179 @test size(H_e*v_e) == (11,) | |
180 @test size(H_s*v_s) == (10,) | |
181 @test size(H_n*v_n) == (10,) | |
182 | |
183 @test collect(H_w*v_w) ≈ q_y.*v_w | |
184 @test collect(H_e*v_e) ≈ q_y.*v_e | |
185 @test collect(H_s*v_s) ≈ q_x.*v_s | |
186 @test collect(H_n*v_n) ≈ q_x.*v_n | |
187 end |