Mercurial > repos > public > sbplib_julia
comparison diffOp.jl @ 154:3193bac1c086 boundary_conditions
More sketching of how things might work
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Tue, 23 Apr 2019 09:53:34 +0200 |
parents | 754c36796ac8 |
children | 89b63bdf1ea8 |
comparison
equal
deleted
inserted
replaced
153:754c36796ac8 | 154:3193bac1c086 |
---|---|
100 | 100 |
101 struct Laplace{Dim,T<:Real,N,M,K} <: DiffOpCartesian{Dim} | 101 struct Laplace{Dim,T<:Real,N,M,K} <: DiffOpCartesian{Dim} |
102 grid::Grid.EquidistantGrid{Dim,T} | 102 grid::Grid.EquidistantGrid{Dim,T} |
103 a::T | 103 a::T |
104 op::D2{Float64,N,M,K} | 104 op::D2{Float64,N,M,K} |
105 e::BoundaryValue | |
106 d::NormalDerivative | |
105 end | 107 end |
106 | 108 |
107 function apply(L::Laplace{Dim}, v::AbstractArray{T,Dim} where T, I::CartesianIndex{Dim}) where Dim | 109 function apply(L::Laplace{Dim}, v::AbstractArray{T,Dim} where T, I::CartesianIndex{Dim}) where Dim |
108 error("not implemented") | 110 error("not implemented") |
109 end | 111 end |
128 function apply(L::Laplace{2}, v::AbstractArray{T,2} where T, i::CartesianIndex{2}) | 130 function apply(L::Laplace{2}, v::AbstractArray{T,2} where T, i::CartesianIndex{2}) |
129 I = Index{Unknown}.(Tuple(i)) | 131 I = Index{Unknown}.(Tuple(i)) |
130 apply(L, v, I) | 132 apply(L, v, I) |
131 end | 133 end |
132 | 134 |
135 struct BoundaryOperator | |
136 | |
137 end | |
138 | |
139 struct BoundaryValue | |
140 op::D2{Float64,N,M,K} | |
141 end | |
142 | |
143 function apply(e::BoundaryValue) | |
144 | |
145 end | |
146 | |
147 function apply_adjoint(e::BoundaryValue) | |
148 | |
149 end | |
150 | |
151 struct NormalDerivative | |
152 op::D2{Float64,N,M,K} | |
153 end | |
154 | |
155 function apply(e::NormalDerivative) | |
156 | |
157 end | |
158 | |
159 function apply_adjoint(e::NormalDerivative) | |
160 | |
161 end | |
162 | |
163 | |
133 # Boundary operators | 164 # Boundary operators |
134 | 165 |
135 function apply_e(L::Laplace{2}, v::AbstractArray{T,2} where T, ::CartesianBoundary{1,R}, j::Int) where R | 166 function apply_e(L::Laplace{2}, v::AbstractArray{T,2} where T, ::CartesianBoundary{1,R}, j::Int) where R |
136 @inbounds vy = view(v, :, j) | 167 @inbounds vy = view(v, :, j) |
137 return apply_e(L.op,vy, R) | 168 return apply_e(L.op,vy, R) |
183 function sat(L::Laplace{2}, bc::Dirichlet{CartesianBoundary{1,R}}, v::AbstractArray{T,2} where T, g::AbstractVector{T}, i::CartesianIndex{2}) where R | 214 function sat(L::Laplace{2}, bc::Dirichlet{CartesianBoundary{1,R}}, v::AbstractArray{T,2} where T, g::AbstractVector{T}, i::CartesianIndex{2}) where R |
184 # Hi * (tau/h*e + sig*d) * H_gamma * (e'*v - g) | 215 # Hi * (tau/h*e + sig*d) * H_gamma * (e'*v - g) |
185 # e, d, H_gamma applied based on bc.boundaryId | 216 # e, d, H_gamma applied based on bc.boundaryId |
186 end | 217 end |
187 | 218 |
219 function apply(s::MyWaveEq{D}, v::AbstractArray{T,D}, i::CartesianIndex{D}) where D | |
220 return apply(s.L, v, i) + | |
221 sat(s.L, Dirichlet{CartesianBoundary{1,Lower}}(s.tau), v, s.g_w, i) + | |
222 sat(s.L, Dirichlet{CartesianBoundary{1,Upper}}(s.tau), v, s.g_e, i) + | |
223 sat(s.L, Dirichlet{CartesianBoundary{2,Lower}}(s.tau), v, s.g_s, i) + | |
224 sat(s.L, Dirichlet{CartesianBoundary{2,Upper}}(s.tau), v, s.g_n, i) + | |
225 end |