Mercurial > repos > public > sbplib_julia
comparison diffOp.jl @ 26:d2896e70cd4f
Merge with default
author | Ylva Rydin <ylva.rydin@telia.com> |
---|---|
date | Mon, 17 Dec 2018 16:35:08 +0100 |
parents | 10a5e7c77fb8 |
children | f2842e08d813 |
comparison
equal
deleted
inserted
replaced
25:1e845cd91cd3 | 26:d2896e70cd4f |
---|---|
14 | 14 |
15 function boundaryCondition(D::DiffOp) | 15 function boundaryCondition(D::DiffOp) |
16 error("not implemented") | 16 error("not implemented") |
17 end | 17 end |
18 | 18 |
19 function interface(Du::DiffOp, Dv::DiffOp, b::BoundaryID; type) | 19 function interface(Du::DiffOp, Dv::DiffOp, b::grid.BoundaryId; type) |
20 error("not implemented") | 20 error("not implemented") |
21 end | 21 end |
22 | 22 |
23 | 23 |
24 # Differential operator for a*d^2/dx^2 | 24 # Differential operator for a*d^2/dx^2 |
27 a | 27 a |
28 op | 28 op |
29 end | 29 end |
30 | 30 |
31 # u = L*v | 31 # u = L*v |
32 function apply(L::Laplace1D, u::AbstractVector, v::AbstractVector)::AbstractVector | 32 function apply(L::Laplace1D, u::AbstractVector, v::AbstractVector) |
33 N = closureSize(L.op) | 33 N = closureSize(L.op) |
34 M = length(v) | 34 M = length(v) |
35 | 35 |
36 h = scaling(L.grid) | |
37 | |
36 for i ∈ 1:N | 38 for i ∈ 1:N |
37 u[i] = apply(L.op.closureStencils[i], v, i) | 39 u[i] = apply(L.op.closureStencils[i], v, i)/h^2 |
38 end | 40 end |
39 | 41 |
40 for i ∈ N+1:M-N | 42 for i ∈ N+1:M-N |
41 u[i] = apply(L.op.innerStencil, i); | 43 u[i] = apply(L.op.innerStencil, i)/h^2 |
42 end | 44 end |
43 | 45 |
44 for i ∈ M:-1:M-N+1 | 46 for i ∈ M:-1:M-N+1 |
45 u[i] = apply(flip(L.op.closureStencils[M-i+1]), v, i) | 47 u[i] = apply(flip(L.op.closureStencils[M-i+1]), v, i)/h^2 |
46 end | 48 end |
49 | |
50 return nothing | |
47 end | 51 end |