changeset 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 ebd359176b41
children b96858a50e35
files test/BoundaryConditions/boundary_condition_test.jl
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/test/BoundaryConditions/boundary_condition_test.jl	Fri Aug 25 15:41:56 2023 +0200
+++ b/test/BoundaryConditions/boundary_condition_test.jl	Fri Aug 25 16:08:21 2023 +0200
@@ -10,9 +10,12 @@
     (_,_,_,_,id_b,_) = boundary_identifiers(grid_3d)
 
     g = 3.14
-    f(x,y) = x^2+y^2
+    f(x,y,z) = x^2+y^2+z^2
     @test DirichletCondition(g,id_n) isa BoundaryCondition{Float64}
-    @test NeumannCondition(f,id_n) isa BoundaryCondition{<:Function}
+    @test NeumannCondition(f,id_b) isa BoundaryCondition{<:Function}
 
-   @test g*ones(11,1) ≈ discretize_data(grid_2d,DirichletCondition(g,id_n))
+    @test g*ones(11,1) ≈ discretize_data(grid_2d,DirichletCondition(g,id_n))
+    X = repeat(0:1/10:1, inner = (1,15))
+    Y = repeat(0:1/14:1, outer = (1,11))
+    @test map((x,y)->f(x,y,0), X,Y') ≈ discretize_data(grid_3d,NeumannCondition(f,id_b))
 end