comparison test/Grids/mapped_grid_test.jl @ 1737:a4e1721a7109 feature/grids/curvilinear

Simplify tests of boundary_grid
author Jonatan Werpers <jonatan@werpers.com>
date Tue, 10 Sep 2024 22:17:01 +0200
parents 863385aae454
children 7573c9244e47
comparison
equal deleted inserted replaced
1736:863385aae454 1737:a4e1721a7109
188 J2((ξ, η)) = @SMatrix[ 188 J2((ξ, η)) = @SMatrix[
189 0; 189 0;
190 1+ξ*(ξ-1); 190 1+ξ*(ξ-1);
191 ] 191 ]
192 192
193 function test_boundary_grid(mg, bId, Jb) 193 function expected_bg(mg, bId, Jb)
194 bg = boundary_grid(mg, bId)
195
196 lg = logicalgrid(mg) 194 lg = logicalgrid(mg)
197 expected_bg = MappedGrid( 195 return MappedGrid(
198 boundary_grid(lg, bId), 196 boundary_grid(lg, bId),
199 map(x̄, boundary_grid(lg, bId)), 197 map(x̄, boundary_grid(lg, bId)),
200 map(Jb, boundary_grid(lg, bId)), 198 map(Jb, boundary_grid(lg, bId)),
201 ) 199 )
202 200 end
203 @testset let bId=bId, bg=bg, expected_bg=expected_bg 201
204 @test collect(bg) == collect(expected_bg) 202 let bid = TensorGridBoundary{1, LowerBoundary}()
205 @test logicalgrid(bg) == logicalgrid(expected_bg) 203 @test boundary_grid(mg, bid) == expected_bg(mg, bid, J2)
206 @test jacobian(bg) == jacobian(expected_bg) 204 end
207 # TODO: Implement equality of a curvilinear grid and simlify the above 205
208 end 206 let bid = TensorGridBoundary{1, UpperBoundary}()
209 end 207 @test boundary_grid(mg, bid) == expected_bg(mg, bid, J2)
210 208 end
211 @testset test_boundary_grid(mg, TensorGridBoundary{1, LowerBoundary}(), J2) 209
212 @testset test_boundary_grid(mg, TensorGridBoundary{1, UpperBoundary}(), J2) 210 let bid = TensorGridBoundary{2, LowerBoundary}()
213 @testset test_boundary_grid(mg, TensorGridBoundary{2, LowerBoundary}(), J1) 211 @test boundary_grid(mg, bid) == expected_bg(mg, bid, J1)
214 @testset test_boundary_grid(mg, TensorGridBoundary{2, UpperBoundary}(), J1) 212 end
213
214 let bid = TensorGridBoundary{2, UpperBoundary}()
215 @test boundary_grid(mg, bid) == expected_bg(mg, bid, J1)
216 end
215 end 217 end
216 end 218 end
217 219
218 @testset "mapped_grid" begin 220 @testset "mapped_grid" begin
219 x̄, J = _partially_curved_mapping() 221 x̄, J = _partially_curved_mapping()