comparison src/SbpOperators/boundary_conditions/boundary_condition.jl @ 1649:b02917bcd7d5 feature/grids/curvilinear

Merge default
author Jonatan Werpers <jonatan@werpers.com>
date Wed, 26 Jun 2024 12:41:03 +0200
parents 48596b2f7923
children
comparison
equal deleted inserted replaced
1645:64452a678e7a 1649:b02917bcd7d5
1 """
2 BoundaryCondition
3
4 Description of a boundary condition. Implementations describe the kind of
5 boundary condition, what boundary the condition applies to, and any associated
6 data. Should implement [`boundary`](@ref) and may implement
7 [`boundary_data`](@ref) if applicable.
8
9 For examples see [`DirichletCondition`](@ref) and [`NeumannCondition`](@ref)
10 """
11 abstract type BoundaryCondition end
12
13 """
14 boundary(::BoundaryCondition)
15
16 The boundary identifier of the BoundaryCondition.
17 """
18 function boundary end
19
20 """
21 boundary_data(::BoundaryCondition)
22
23 If implemented, the data associated with the BoundaryCondition.
24 """
25 function boundary_data end
26
27 """
28 discretize_data(grid, bc::BoundaryCondition)
29
30 The data of `bc` as a lazily evaluated grid function on the boundary grid
31 specified by `boundary(bc)`.
32 """
33 function discretize_data(grid, bc::BoundaryCondition)
34 return eval_on(boundary_grid(grid, boundary(bc)), boundary_data(bc))
35 end
36
37 """
38 DirichletCondition{DT,BID}
39
40 A Dirichlet condition with `data::DT` on the boundary
41 specified by the boundary identifier `BID`.
42 """
43 struct DirichletCondition{DT,BID} <: BoundaryCondition
44 data::DT
45 boundary::BID
46 end
47 boundary_data(bc::DirichletCondition) = bc.data
48 boundary(bc::DirichletCondition) = bc.boundary
49
50 """
51 NeumannCondition{DT,BID}
52
53 A Neumann condition with `data::DT` on the boundary
54 specified by the boundary identifier `BID`.
55 """
56 struct NeumannCondition{DT,BID} <: BoundaryCondition
57 data::DT
58 boundary::BID
59 end
60 boundary_data(bc::NeumannCondition) = bc.data
61 boundary(bc::NeumannCondition) = bc.boundary
62