Mercurial > repos > public > sbplib_julia
comparison test/BoundaryConditions/boundary_condition_test.jl @ 1478:fefc81a9c155 feature/boundary_conditions
Test spatially variable data
author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
---|---|
date | Fri, 25 Aug 2023 16:08:21 +0200 |
parents | 5f79549f60ae |
children | ee242c3fe4af |
comparison
equal
deleted
inserted
replaced
1477:ebd359176b41 | 1478:fefc81a9c155 |
---|---|
8 grid_3d = equidistant_grid((11,15,13), (0.0, 0.0, 0.0), (1.0,1.0, 1.0)) | 8 grid_3d = equidistant_grid((11,15,13), (0.0, 0.0, 0.0), (1.0,1.0, 1.0)) |
9 (_,_,_,id_n) = boundary_identifiers(grid_2d) | 9 (_,_,_,id_n) = boundary_identifiers(grid_2d) |
10 (_,_,_,_,id_b,_) = boundary_identifiers(grid_3d) | 10 (_,_,_,_,id_b,_) = boundary_identifiers(grid_3d) |
11 | 11 |
12 g = 3.14 | 12 g = 3.14 |
13 f(x,y) = x^2+y^2 | 13 f(x,y,z) = x^2+y^2+z^2 |
14 @test DirichletCondition(g,id_n) isa BoundaryCondition{Float64} | 14 @test DirichletCondition(g,id_n) isa BoundaryCondition{Float64} |
15 @test NeumannCondition(f,id_n) isa BoundaryCondition{<:Function} | 15 @test NeumannCondition(f,id_b) isa BoundaryCondition{<:Function} |
16 | 16 |
17 @test g*ones(11,1) ≈ discretize_data(grid_2d,DirichletCondition(g,id_n)) | 17 @test g*ones(11,1) ≈ discretize_data(grid_2d,DirichletCondition(g,id_n)) |
18 X = repeat(0:1/10:1, inner = (1,15)) | |
19 Y = repeat(0:1/14:1, outer = (1,11)) | |
20 @test map((x,y)->f(x,y,0), X,Y') ≈ discretize_data(grid_3d,NeumannCondition(f,id_b)) | |
18 end | 21 end |