Mercurial > repos > public > sbplib_julia
annotate src/BoundaryConditions/boundary_condition.jl @ 1167:fd80e9a0ef99 feature/boundary_conditions
Make use of discretize in sat functions
author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
---|---|
date | Wed, 07 Dec 2022 21:56:00 +0100 |
parents | d26aef8a5987 |
children | bdcdbd4ea9cd |
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 # TODO: Should BoundaryData just be used for traits |
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
|
2 # of the BoundaryConditions? Seems like one then could move the |
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 # the boundary data value val directly to BoundaryCondition |
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
|
4 # Not sure how one would do this tho. |
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
|
5 """ |
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
|
6 BoundaryData |
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
|
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 A type for storing boundary data, e.g. constant, space-dependent, time-dependent etc. |
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
|
9 Subtypes of `BoundaryData` should store the boundary data in a field `val`. The exception |
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 to this is ZeroBoundaryData. |
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
|
11 """ |
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 abstract type BoundaryData end |
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
|
13 |
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
|
14 """ |
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 ConstantBoundaryData |
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
|
16 |
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 `val` is a scalar value of type T |
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
|
18 """ |
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
|
19 struct ConstantBoundaryData{T<:Number} <: BoundaryData |
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 val::T |
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
|
21 end |
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 |
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
|
23 """ |
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 SpaceDependentBoundaryData |
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
|
25 |
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 `val` is a function of dimensionality equal to the boundary |
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 """ |
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
|
28 struct SpaceDependentBoundaryData{T<:Function} <: BoundaryData |
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 val::T |
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
|
30 end |
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
|
31 |
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 """ |
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
|
33 TimeDependentBoundaryData |
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
|
34 |
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 `val` is a scalar function val(t) |
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
|
36 """ |
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
|
37 struct TimeDependentBoundaryData{T<:Function} <: BoundaryData |
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
|
38 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
|
39 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
|
40 |
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
|
41 """ |
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
|
42 SpaceTimeDependentBoundaryData |
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
|
43 |
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
|
44 `val` is a timedependent function returning the spacedependent |
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
|
45 boundary data at a specific time. For instance, if f(t,x) |
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
|
46 is the function describing the spacetimedependent boundary data then |
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
|
47 val(t*) returns the function g(x) = f(t*,x...) |
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
|
48 """ |
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
|
49 struct SpaceTimeDependentBoundaryData{T<:Function} <: BoundaryData |
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
|
50 val::T |
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
|
51 |
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
|
52 function SpaceTimeDependentBoundaryData(f::Function) |
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
|
53 val(t) = (args...) -> f(t,args...) |
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
|
54 return new{typeof(val)}(val) |
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
|
55 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
|
56 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
|
57 |
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
|
58 """ |
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
|
59 ZeroBoundaryData |
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
|
60 """ |
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
|
61 struct ZeroBoundaryData <: BoundaryData end |
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
|
62 |
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
|
63 |
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
|
64 """ |
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
|
65 discretize(::BoundaryData, boundary_grid) |
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
|
66 |
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
|
67 Returns an anonymous time-dependent function f, such that f(t) is |
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
|
68 a `LazyArray` holding the `BoundaryData` discretized on `boundary_grid`. |
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
|
69 """ |
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
|
70 # TODO: Is the return type of discretize really a good interface |
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
|
71 # for the boundary data? |
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
|
72 # Moreover, instead of explicitly converting to a LazyArray here |
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
|
73 # should we defer this to evalOn (and extend evalOn for scalars as well)? |
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
|
74 # I.e. if evalOn returns a LazyArray, the boundary data is lazy. Otherwise |
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
|
75 # it is preallocated. |
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
|
76 |
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
|
77 function discretize(bd::ConstantBoundaryData, boundary_grid) |
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
|
78 return t -> LazyTensors.LazyConstantArray(bd.val, size(boundary_grid)) |
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
|
79 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
|
80 |
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
|
81 function discretize(bd::TimeDependentBoundaryData, boundary_grid) |
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
|
82 return t -> LazyTensors.LazyConstantArray(bd.val(t), size(boundary_grid)) |
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
|
83 end |
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
|
84 |
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
|
85 function discretize(bd::SpaceDependentBoundaryData, boundary_grid) |
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
|
86 return t -> evalOn(boundary_grid, bd.val) |
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
|
87 end |
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
|
88 |
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
|
89 function discretize(bd::SpaceTimeDependentBoundaryData, boundary_grid) |
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
|
90 return t -> evalOn(boundary_grid, bd.val(t)) |
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
|
91 end |
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
|
92 |
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
|
93 function discretize(::ZeroBoundaryData, boundary_grid) |
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
|
94 return t -> LazyTensors.LazyConstantArray(zero(eltype(boundary_grid)), size(boundary_grid)) |
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
|
95 end |
1106
b4ee47f2aafb
Start implementing functions for boundary conditions associated with Laplace
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
96 |
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
|
97 """ |
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
|
98 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
|
99 |
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
|
100 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
|
101 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
|
102 """ |
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
|
103 abstract type BoundaryCondition{T<:BoundaryData} end |
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
|
104 |
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
|
105 """ |
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
|
106 data(::BoundaryCondition) |
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
|
107 |
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
|
108 Returns the data stored by the `BoundaryCondition`. |
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
|
109 """ |
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
|
110 data(bc::BoundaryCondition) = bc.data |
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
|
111 |
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
|
112 |
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
|
113 struct NeumannCondition{BD<:BoundaryData} <: BoundaryCondition{BD} |
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
|
114 data::BD |
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
|
115 id::BoundaryIdentifier |
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
|
116 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
|
117 |
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
|
118 struct DirichletCondition{BD<:BoundaryData} <: BoundaryCondition{BD} |
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
|
119 data::BD |
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
|
120 id::BoundaryIdentifier |
1106
b4ee47f2aafb
Start implementing functions for boundary conditions associated with Laplace
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
121 end |