Mercurial > repos > public > sbplib_julia
annotate test/BoundaryConditions/boundary_condition_test.jl @ 1417:5f79549f60ae feature/boundary_conditions
Test constant dirichlet data
author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
---|---|
date | Wed, 23 Aug 2023 09:27:32 +0200 |
parents | b4ec84190e6b |
children | fefc81a9c155 |
rev | line source |
---|---|
1164
d26aef8a5987
Add types for different kinds of boundary data functions to discretize the data on the grid. Add tests
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
1 using Test |
d26aef8a5987
Add types for different kinds of boundary data functions to discretize the data on the grid. Add tests
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
2 |
d26aef8a5987
Add types for different kinds of boundary data functions to discretize the data on the grid. Add tests
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
3 using Sbplib.BoundaryConditions |
d26aef8a5987
Add types for different kinds of boundary data functions to discretize the data on the grid. Add tests
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
4 using Sbplib.Grids |
d26aef8a5987
Add types for different kinds of boundary data functions to discretize the data on the grid. Add tests
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
5 |
1406
b4ec84190e6b
Start reimplementing tests
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1395
diff
changeset
|
6 @testset "BoundaryCondition" begin |
b4ec84190e6b
Start reimplementing tests
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1395
diff
changeset
|
7 grid_2d = equidistant_grid((11,15), (0.0, 0.0), (1.0,1.0)) |
b4ec84190e6b
Start reimplementing tests
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1395
diff
changeset
|
8 grid_3d = equidistant_grid((11,15,13), (0.0, 0.0, 0.0), (1.0,1.0, 1.0)) |
b4ec84190e6b
Start reimplementing tests
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1395
diff
changeset
|
9 (_,_,_,id_n) = boundary_identifiers(grid_2d) |
b4ec84190e6b
Start reimplementing tests
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1395
diff
changeset
|
10 (_,_,_,_,id_b,_) = boundary_identifiers(grid_3d) |
1164
d26aef8a5987
Add types for different kinds of boundary data functions to discretize the data on the grid. Add tests
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
11 |
1406
b4ec84190e6b
Start reimplementing tests
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1395
diff
changeset
|
12 g = 3.14 |
b4ec84190e6b
Start reimplementing tests
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1395
diff
changeset
|
13 f(x,y) = x^2+y^2 |
b4ec84190e6b
Start reimplementing tests
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1395
diff
changeset
|
14 @test DirichletCondition(g,id_n) isa BoundaryCondition{Float64} |
b4ec84190e6b
Start reimplementing tests
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1395
diff
changeset
|
15 @test NeumannCondition(f,id_n) isa BoundaryCondition{<:Function} |
1164
d26aef8a5987
Add types for different kinds of boundary data functions to discretize the data on the grid. Add tests
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
16 |
1417
5f79549f60ae
Test constant dirichlet data
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1406
diff
changeset
|
17 @test g*ones(11,1) ≈ discretize_data(grid_2d,DirichletCondition(g,id_n)) |
1406
b4ec84190e6b
Start reimplementing tests
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1395
diff
changeset
|
18 end |