Mercurial > repos > public > sbplib_julia
annotate src/SbpOperators/boundary_conditions/boundary_condition.jl @ 1955:627d94d0f333 feature/sbp_operators/laplace_curvilinear
Fix boundary iterator in normal_derivative
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Mon, 10 Feb 2025 15:38:38 +0100 |
parents | 48596b2f7923 |
children |
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:
1134
diff
changeset
|
1 """ |
1620
48596b2f7923
Remove type parameter from BoundaryCondition
Vidar Stiernström <vidar.stiernstrom@gmail.com>
parents:
1617
diff
changeset
|
2 BoundaryCondition |
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:
1134
diff
changeset
|
3 |
1617
a00fa58e9fb0
REVIEW: Suggest changes to doc string in boundary_condition.jl
Jonatan Werpers <jonatan@werpers.com>
parents:
1616
diff
changeset
|
4 Description of a boundary condition. Implementations describe the kind of |
a00fa58e9fb0
REVIEW: Suggest changes to doc string in boundary_condition.jl
Jonatan Werpers <jonatan@werpers.com>
parents:
1616
diff
changeset
|
5 boundary condition, what boundary the condition applies to, and any associated |
a00fa58e9fb0
REVIEW: Suggest changes to doc string in boundary_condition.jl
Jonatan Werpers <jonatan@werpers.com>
parents:
1616
diff
changeset
|
6 data. Should implement [`boundary`](@ref) and may implement |
a00fa58e9fb0
REVIEW: Suggest changes to doc string in boundary_condition.jl
Jonatan Werpers <jonatan@werpers.com>
parents:
1616
diff
changeset
|
7 [`boundary_data`](@ref) if applicable. |
a00fa58e9fb0
REVIEW: Suggest changes to doc string in boundary_condition.jl
Jonatan Werpers <jonatan@werpers.com>
parents:
1616
diff
changeset
|
8 |
a00fa58e9fb0
REVIEW: Suggest changes to doc string in boundary_condition.jl
Jonatan Werpers <jonatan@werpers.com>
parents:
1616
diff
changeset
|
9 For examples see [`DirichletCondition`](@ref) and [`NeumannCondition`](@ref) |
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:
1134
diff
changeset
|
10 """ |
1620
48596b2f7923
Remove type parameter from BoundaryCondition
Vidar Stiernström <vidar.stiernstrom@gmail.com>
parents:
1617
diff
changeset
|
11 abstract type BoundaryCondition end |
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:
1134
diff
changeset
|
12 |
1134
667e9c588f23
Add type for different kind of boundary data and refactor the BoundaryConditions such that they are general w.r.t the boundary data type
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1106
diff
changeset
|
13 """ |
1602
3e7438e2a033
Address review comments (1 left to be discussed)
Vidar Stiernström <vidar.stiernstrom@gmail.com>
parents:
1599
diff
changeset
|
14 boundary(::BoundaryCondition) |
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:
1134
diff
changeset
|
15 |
1396
35840a0681d1
Start drafting new implemenentation of boundary conditions
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1395
diff
changeset
|
16 The boundary identifier of the BoundaryCondition. |
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:
1134
diff
changeset
|
17 """ |
1620
48596b2f7923
Remove type parameter from BoundaryCondition
Vidar Stiernström <vidar.stiernstrom@gmail.com>
parents:
1617
diff
changeset
|
18 function boundary end |
1134
667e9c588f23
Add type for different kind of boundary data and refactor the BoundaryConditions such that they are general w.r.t the boundary data type
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1106
diff
changeset
|
19 |
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:
1134
diff
changeset
|
20 """ |
1602
3e7438e2a033
Address review comments (1 left to be discussed)
Vidar Stiernström <vidar.stiernstrom@gmail.com>
parents:
1599
diff
changeset
|
21 boundary_data(::BoundaryCondition) |
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:
1134
diff
changeset
|
22 |
1617
a00fa58e9fb0
REVIEW: Suggest changes to doc string in boundary_condition.jl
Jonatan Werpers <jonatan@werpers.com>
parents:
1616
diff
changeset
|
23 If implemented, the data associated with the BoundaryCondition. |
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:
1134
diff
changeset
|
24 """ |
1602
3e7438e2a033
Address review comments (1 left to be discussed)
Vidar Stiernström <vidar.stiernstrom@gmail.com>
parents:
1599
diff
changeset
|
25 function boundary_data end |
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:
1134
diff
changeset
|
26 |
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:
1134
diff
changeset
|
27 """ |
1617
a00fa58e9fb0
REVIEW: Suggest changes to doc string in boundary_condition.jl
Jonatan Werpers <jonatan@werpers.com>
parents:
1616
diff
changeset
|
28 discretize_data(grid, bc::BoundaryCondition) |
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:
1134
diff
changeset
|
29 |
1617
a00fa58e9fb0
REVIEW: Suggest changes to doc string in boundary_condition.jl
Jonatan Werpers <jonatan@werpers.com>
parents:
1616
diff
changeset
|
30 The data of `bc` as a lazily evaluated grid function on the boundary grid |
a00fa58e9fb0
REVIEW: Suggest changes to doc string in boundary_condition.jl
Jonatan Werpers <jonatan@werpers.com>
parents:
1616
diff
changeset
|
31 specified by `boundary(bc)`. |
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:
1134
diff
changeset
|
32 """ |
1396
35840a0681d1
Start drafting new implemenentation of boundary conditions
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1395
diff
changeset
|
33 function discretize_data(grid, bc::BoundaryCondition) |
1602
3e7438e2a033
Address review comments (1 left to be discussed)
Vidar Stiernström <vidar.stiernstrom@gmail.com>
parents:
1599
diff
changeset
|
34 return eval_on(boundary_grid(grid, boundary(bc)), boundary_data(bc)) |
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:
1134
diff
changeset
|
35 end |
1404
481960ca366f
Fix type signatures
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1396
diff
changeset
|
36 |
1616 | 37 """ |
38 DirichletCondition{DT,BID} | |
39 | |
40 A Dirichlet condition with `data::DT` on the boundary | |
41 specified by the boundary identifier `BID`. | |
42 """ | |
1620
48596b2f7923
Remove type parameter from BoundaryCondition
Vidar Stiernström <vidar.stiernstrom@gmail.com>
parents:
1617
diff
changeset
|
43 struct DirichletCondition{DT,BID} <: BoundaryCondition |
1605
1388149b54ad
REVIEW: Suggestions for minor fixes
Jonatan Werpers <jonatan@werpers.com>
parents:
1603
diff
changeset
|
44 data::DT |
1620
48596b2f7923
Remove type parameter from BoundaryCondition
Vidar Stiernström <vidar.stiernstrom@gmail.com>
parents:
1617
diff
changeset
|
45 boundary::BID |
1404
481960ca366f
Fix type signatures
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1396
diff
changeset
|
46 end |
1602
3e7438e2a033
Address review comments (1 left to be discussed)
Vidar Stiernström <vidar.stiernstrom@gmail.com>
parents:
1599
diff
changeset
|
47 boundary_data(bc::DirichletCondition) = bc.data |
1620
48596b2f7923
Remove type parameter from BoundaryCondition
Vidar Stiernström <vidar.stiernstrom@gmail.com>
parents:
1617
diff
changeset
|
48 boundary(bc::DirichletCondition) = bc.boundary |
1404
481960ca366f
Fix type signatures
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1396
diff
changeset
|
49 |
1616 | 50 """ |
1617
a00fa58e9fb0
REVIEW: Suggest changes to doc string in boundary_condition.jl
Jonatan Werpers <jonatan@werpers.com>
parents:
1616
diff
changeset
|
51 NeumannCondition{DT,BID} |
1616 | 52 |
53 A Neumann condition with `data::DT` on the boundary | |
54 specified by the boundary identifier `BID`. | |
55 """ | |
1620
48596b2f7923
Remove type parameter from BoundaryCondition
Vidar Stiernström <vidar.stiernstrom@gmail.com>
parents:
1617
diff
changeset
|
56 struct NeumannCondition{DT,BID} <: BoundaryCondition |
1605
1388149b54ad
REVIEW: Suggestions for minor fixes
Jonatan Werpers <jonatan@werpers.com>
parents:
1603
diff
changeset
|
57 data::DT |
1620
48596b2f7923
Remove type parameter from BoundaryCondition
Vidar Stiernström <vidar.stiernstrom@gmail.com>
parents:
1617
diff
changeset
|
58 boundary::BID |
1134
667e9c588f23
Add type for different kind of boundary data and refactor the BoundaryConditions such that they are general w.r.t the boundary data type
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1106
diff
changeset
|
59 end |
1602
3e7438e2a033
Address review comments (1 left to be discussed)
Vidar Stiernström <vidar.stiernstrom@gmail.com>
parents:
1599
diff
changeset
|
60 boundary_data(bc::NeumannCondition) = bc.data |
1620
48596b2f7923
Remove type parameter from BoundaryCondition
Vidar Stiernström <vidar.stiernstrom@gmail.com>
parents:
1617
diff
changeset
|
61 boundary(bc::NeumannCondition) = bc.boundary |
1134
667e9c588f23
Add type for different kind of boundary data and refactor the BoundaryConditions such that they are general w.r.t the boundary data type
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1106
diff
changeset
|
62 |