comparison test/SbpOperators/volumeops/laplace/laplace_test.jl @ 754:dc38e57ebd1b feature/laplace_opset

Add convenience functions for returning multiple boundary operators from Laplace
author Vidar Stiernström <vidar.stiernstrom@it.uu.se>
date Sun, 21 Mar 2021 13:44:29 +0100
parents fc83d672be36
children 1784b1c0af3e
comparison
equal deleted inserted replaced
753:fc83d672be36 754:dc38e57ebd1b
109 end 109 end
110 110
111 @testset "boundary_restriction" begin 111 @testset "boundary_restriction" begin
112 L = Laplace(g_3D, sbp_operators_path()*"standard_diagonal.toml"; order=4) 112 L = Laplace(g_3D, sbp_operators_path()*"standard_diagonal.toml"; order=4)
113 (id_l, id_r, id_s, id_n, id_b, id_t) = boundary_identifiers(g_3D) 113 (id_l, id_r, id_s, id_n, id_b, id_t) = boundary_identifiers(g_3D)
114 ids = boundary_identifiers(g_3D)
115 @test boundary_restriction(L,id_l) == boundary_restriction(g_3D,op.eClosure,id_l) 114 @test boundary_restriction(L,id_l) == boundary_restriction(g_3D,op.eClosure,id_l)
116 @test boundary_restriction(L,id_r) == boundary_restriction(g_3D,op.eClosure,id_r) 115 @test boundary_restriction(L,id_r) == boundary_restriction(g_3D,op.eClosure,id_r)
117 @test boundary_restriction(L,id_s) == boundary_restriction(g_3D,op.eClosure,id_s) 116 @test boundary_restriction(L,id_s) == boundary_restriction(g_3D,op.eClosure,id_s)
118 @test boundary_restriction(L,id_n) == boundary_restriction(g_3D,op.eClosure,id_n) 117 @test boundary_restriction(L,id_n) == boundary_restriction(g_3D,op.eClosure,id_n)
119 @test boundary_restriction(L,id_b) == boundary_restriction(g_3D,op.eClosure,id_b) 118 @test boundary_restriction(L,id_b) == boundary_restriction(g_3D,op.eClosure,id_b)
120 @test boundary_restriction(L,id_t) == boundary_restriction(g_3D,op.eClosure,id_t) 119 @test boundary_restriction(L,id_t) == boundary_restriction(g_3D,op.eClosure,id_t)
120
121 ids = boundary_identifiers(g_3D)
122 es = boundary_restriction(L,ids)
123 @test es == (boundary_restriction(L,id_l),
124 boundary_restriction(L,id_r),
125 boundary_restriction(L,id_s),
126 boundary_restriction(L,id_n),
127 boundary_restriction(L,id_b),
128 boundary_restriction(L,id_t));
129 @test es == boundary_restriction(L,ids...)
121 end 130 end
122 131
123 @testset "normal_derivative" begin 132 @testset "normal_derivative" begin
124 L = Laplace(g_3D, sbp_operators_path()*"standard_diagonal.toml"; order=4) 133 L = Laplace(g_3D, sbp_operators_path()*"standard_diagonal.toml"; order=4)
125 (id_l, id_r, id_s, id_n, id_b, id_t) = boundary_identifiers(g_3D) 134 (id_l, id_r, id_s, id_n, id_b, id_t) = boundary_identifiers(g_3D)
127 @test normal_derivative(L,id_r) == normal_derivative(g_3D,op.dClosure,id_r) 136 @test normal_derivative(L,id_r) == normal_derivative(g_3D,op.dClosure,id_r)
128 @test normal_derivative(L,id_s) == normal_derivative(g_3D,op.dClosure,id_s) 137 @test normal_derivative(L,id_s) == normal_derivative(g_3D,op.dClosure,id_s)
129 @test normal_derivative(L,id_n) == normal_derivative(g_3D,op.dClosure,id_n) 138 @test normal_derivative(L,id_n) == normal_derivative(g_3D,op.dClosure,id_n)
130 @test normal_derivative(L,id_b) == normal_derivative(g_3D,op.dClosure,id_b) 139 @test normal_derivative(L,id_b) == normal_derivative(g_3D,op.dClosure,id_b)
131 @test normal_derivative(L,id_t) == normal_derivative(g_3D,op.dClosure,id_t) 140 @test normal_derivative(L,id_t) == normal_derivative(g_3D,op.dClosure,id_t)
141
142 ids = boundary_identifiers(g_3D)
143 ds = normal_derivative(L,ids)
144 @test ds == (normal_derivative(L,id_l),
145 normal_derivative(L,id_r),
146 normal_derivative(L,id_s),
147 normal_derivative(L,id_n),
148 normal_derivative(L,id_b),
149 normal_derivative(L,id_t));
150 @test ds == normal_derivative(L,ids...)
132 end 151 end
133 152
134 @testset "boundary_quadrature" begin 153 @testset "boundary_quadrature" begin
135 L = Laplace(g_3D, sbp_operators_path()*"standard_diagonal.toml"; order=4) 154 L = Laplace(g_3D, sbp_operators_path()*"standard_diagonal.toml"; order=4)
136 (id_l, id_r, id_s, id_n, id_b, id_t) = boundary_identifiers(g_3D) 155 (id_l, id_r, id_s, id_n, id_b, id_t) = boundary_identifiers(g_3D)
138 @test boundary_quadrature(L,id_r) == inner_product(boundary_grid(g_3D,id_r),op.quadratureClosure) 157 @test boundary_quadrature(L,id_r) == inner_product(boundary_grid(g_3D,id_r),op.quadratureClosure)
139 @test boundary_quadrature(L,id_s) == inner_product(boundary_grid(g_3D,id_s),op.quadratureClosure) 158 @test boundary_quadrature(L,id_s) == inner_product(boundary_grid(g_3D,id_s),op.quadratureClosure)
140 @test boundary_quadrature(L,id_n) == inner_product(boundary_grid(g_3D,id_n),op.quadratureClosure) 159 @test boundary_quadrature(L,id_n) == inner_product(boundary_grid(g_3D,id_n),op.quadratureClosure)
141 @test boundary_quadrature(L,id_b) == inner_product(boundary_grid(g_3D,id_b),op.quadratureClosure) 160 @test boundary_quadrature(L,id_b) == inner_product(boundary_grid(g_3D,id_b),op.quadratureClosure)
142 @test boundary_quadrature(L,id_t) == inner_product(boundary_grid(g_3D,id_t),op.quadratureClosure) 161 @test boundary_quadrature(L,id_t) == inner_product(boundary_grid(g_3D,id_t),op.quadratureClosure)
162
163 ids = boundary_identifiers(g_3D)
164 H_gammas = boundary_quadrature(L,ids)
165 @test H_gammas == (boundary_quadrature(L,id_l),
166 boundary_quadrature(L,id_r),
167 boundary_quadrature(L,id_s),
168 boundary_quadrature(L,id_n),
169 boundary_quadrature(L,id_b),
170 boundary_quadrature(L,id_t));
171 @test H_gammas == boundary_quadrature(L,ids...)
143 end 172 end
144 173
145 # Exact differentiation is measured point-wise. In other cases 174 # Exact differentiation is measured point-wise. In other cases
146 # the error is measured in the l2-norm. 175 # the error is measured in the l2-norm.
147 @testset "Accuracy" begin 176 @testset "Accuracy" begin