Mercurial > repos > public > sbplib_julia
annotate src/BoundaryConditions/boundary_condition.jl @ 1163:c9fdfb1efba8 feature/boundary_conditions
Merge with default
author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
---|---|
date | Wed, 12 Oct 2022 10:45:47 +0200 |
parents | 667e9c588f23 |
children | d26aef8a5987 |
rev | line source |
---|---|
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
|
1 """ |
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
|
2 BoundaryDataType |
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
|
3 |
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
|
4 A type for storing boundary data, e.g. constant, space-dependent, time-dependent etc. |
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
|
5 Subtypes of `BoundaryDataType` should store the boundary data in a field `val`, i.e. |
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
|
6 `struct MyBoundaryDataType{T} <: BoundaryDataType val::T end`. |
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
|
7 """ |
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
|
8 abstract type BoundaryDataType end |
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
|
9 |
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
|
10 struct ConstantBoundaryData{T} <: BoundaryDataType |
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
|
11 val::T |
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
|
12 end |
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 |
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
|
14 struct SpaceDependentBoundaryData{T} <: BoundaryDataType |
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
|
15 val::T |
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
|
16 end |
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
|
17 |
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
|
18 struct TimeDependentBoundaryData{T} <: BoundaryDataType |
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 val::T |
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
|
20 end |
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
|
21 |
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
|
22 struct SpaceTimeDependentBoundaryData{T} <: BoundaryDataType |
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
|
23 val::T |
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
|
24 end |
1106
b4ee47f2aafb
Start implementing functions for boundary conditions associated with Laplace
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
25 |
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
|
26 """ |
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
|
27 BoundaryCondition |
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
|
28 |
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
|
29 A type for implementing data needed in order to impose a boundary condition. |
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
|
30 Subtypes refer to perticular types of boundary conditions, e.g. Neumann conditions. |
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
|
31 """ |
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
|
32 # TODO: Parametrize the boundary id as well? |
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
|
33 abstract type BoundaryCondition{T<:BoundaryDataType} end |
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
|
34 |
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
|
35 data(bc::BoundaryCondition) = bc.data.val |
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
|
36 |
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
|
37 struct NeumannCondition{BDT<:BoundaryDataType} <: BoundaryCondition{BDT} |
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
|
38 id::BoundaryIdentifier |
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
|
39 data::BDT |
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
|
40 end |
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
|
41 |
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
|
42 struct DirichletCondition{BDT<:BoundaryDataType} <: BoundaryCondition{BDT} |
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
|
43 id::BoundaryIdentifier |
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
|
44 data::BDT |
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
|
45 end |
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
|
46 |
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
|
47 struct RobinCondition{BDT<:BoundaryDataType,T<:Real} <: BoundaryCondition{BDT} |
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
|
48 id::BoundaryIdentifier |
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
|
49 data::BDT |
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
|
50 α::T |
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
|
51 β::T |
1106
b4ee47f2aafb
Start implementing functions for boundary conditions associated with Laplace
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
52 end |