comparison src/SbpOperators/boundary_conditions/boundary_condition.jl @ 1616:e41eddc640f3 feature/boundary_conditions

Docs
author Vidar Stiernström <vidar.stiernstrom@gmail.com>
date Sun, 09 Jun 2024 17:51:57 -0700
parents 1388149b54ad
children a00fa58e9fb0
comparison
equal deleted inserted replaced
1615:b74e1a21265f 1616:e41eddc640f3
1 """ 1 """
2 BoundaryCondition{BID} 2 BoundaryCondition{BID}
3 3
4 A type for implementing boundary_data needed in order to impose a boundary condition. 4 A type for implementing data needed in order to impose a boundary condition.
5 Subtypes refer to perticular types of boundary conditions, e.g. Neumann conditions. 5 Subtypes refer to perticular types of boundary conditions, e.g. Neumann conditions.
6 """ 6 """
7 abstract type BoundaryCondition{BID} end 7 abstract type BoundaryCondition{BID} end
8 8
9 """ 9 """
28 """ 28 """
29 function discretize_data(grid, bc::BoundaryCondition) 29 function discretize_data(grid, bc::BoundaryCondition)
30 return eval_on(boundary_grid(grid, boundary(bc)), boundary_data(bc)) 30 return eval_on(boundary_grid(grid, boundary(bc)), boundary_data(bc))
31 end 31 end
32 32
33 """
34 DirichletCondition{DT,BID}
35
36 A Dirichlet condition with `data::DT` on the boundary
37 specified by the boundary identifier `BID`.
38 """
33 struct DirichletCondition{DT,BID} <: BoundaryCondition{BID} 39 struct DirichletCondition{DT,BID} <: BoundaryCondition{BID}
34 data::DT 40 data::DT
35 function DirichletCondition(data, id) 41 function DirichletCondition(data, id)
36 return new{typeof(data),typeof(id)}(data) 42 return new{typeof(data),typeof(id)}(data)
37 end 43 end
38 end 44 end
39 boundary_data(bc::DirichletCondition) = bc.data 45 boundary_data(bc::DirichletCondition) = bc.data
40 46
47 """
48 DirichletCondition{DT,BID}
49
50 A Neumann condition with `data::DT` on the boundary
51 specified by the boundary identifier `BID`.
52 """
41 struct NeumannCondition{DT,BID} <: BoundaryCondition{BID} 53 struct NeumannCondition{DT,BID} <: BoundaryCondition{BID}
42 data::DT 54 data::DT
43 function NeumannCondition(data, id) 55 function NeumannCondition(data, id)
44 return new{typeof(data),typeof(id)}(data) 56 return new{typeof(data),typeof(id)}(data)
45 end 57 end